Tagged: ideal switch block
9 December, 2014 at 6:02 am #562
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.9 December, 2014 at 9:59 am #563
Can you post a screenshot and attach the mdl/slx file.9 December, 2014 at 10:17 am #564
I haave attached the MD file and the screenshot. Thanks.
Attachments:You must be logged in to view attached files.9 December, 2014 at 10:45 am #567
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.9 December, 2014 at 10:53 am #568
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?9 December, 2014 at 1:47 pm #569
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.9 December, 2014 at 7:50 pm #572
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.9 December, 2014 at 9:30 pm #573
The arguments apply for both.10 December, 2014 at 9:09 am #574
Ok Thanks. Please apart from the Ideal switch block, which other switch block is compatible with simulink?
You must be logged in to reply to this topic.