Ideal switch block in SimPowersystems

Home Forums Simulink Ideal switch block in SimPowersystems

This topic contains 8 replies, has 2 voices, and was last updated by  obicarl 5 years ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #562

    obicarl
    Participant

    Hello, I tried using the “ideal Switch” block in Simpowersystems.The unique thing about this block is that it has a Simulink control/gate input and a Simulink measurement output… I conneceted it to a battery I coded a matlab function block with if commands to give instructions to the switch via the gate(which is a simulink in put signal) to toggle between off and on. But it does not work.
    so see what I did.
    in the matlab function block
    i did if command as follows,
    if u==1 y=0; else y=1; end
    but when i pass “1″ through it still outputs the voltage in the battery. I have the voltage measurement between the switch and the negative port of the battery. so I have a display attached to the voltage measurement.
    Please assist me with this issue.
    thanks.

    #563

    cK
    Keymaster

    Can you post a screenshot and attach the mdl/slx file.

    #564

    obicarl
    Participant

    I haave attached the MD file and the screenshot. Thanks.

    Attachments:
    You must be logged in to view attached files.
    #567

    cK
    Keymaster

    If you see the ideal switch, it’s perhaps not as ideal as you might have wanted it to be. In off state, it has a very large snubber resistance. It can be arbitrarily large but not infinite. That means even in open state, your circuit is connected to the source which is why the full voltage is seen. However you can complete the circuit with a resistor in the loop and measure current flowing through it in open and closed state. When the switch is open you will see some very small non-zero current due to snubber resistance.

    • This reply was modified 5 years ago by  cK.
    • This reply was modified 5 years ago by  cK.
    #568

    obicarl
    Participant

    Ok I see..so if I add a resistor will that resolve the issue of voltage still passing through or will it just alter the current flowing through it?

    Also is there a better switch that can be used?

    #569

    cK
    Keymaster

    Adding a resistor and monitoring current flow will show that your logic and switch are working as expected. It doesn’t change working of the switch. Apparently I was wrong about INF value for snubber resistance (now corrected in earlier reply). The reason for error is that the circuit breaker cannot be left in open circuit as its modelled as a current source. Note that you are just connecting a voltmeter (inf internal resistance) across the battery terminals. Complete the circuit to see working of switch.

    On another note, consider replacing MatlabFunction block with if block as you are just using if logic. Even better, here you can just use a NOT block.

    #572

    obicarl
    Participant

    Did you say circuit breaker or switch because thereis no circuit breaker in the set up.

    Also the puroose of this is to enable me input the current voltage from the battery to the MATLAB function block and based on the if condition, it will toggle the switch on or off. Now I wanted to build something wimple to first test the working of the switch before I can implement it..so by adding resistance and load…will that resolve this issue..thanks for the idea of using an if or NOT block..I will do that.

    #573

    cK
    Keymaster

    The arguments apply for both.

    #574

    obicarl
    Participant

    Ok Thanks. Please apart from the Ideal switch block, which other switch block is compatible with simulink?

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.