For my rechargeble battery model in Simulink,i need a switch that needs to control the voltages across 2 points and according to a certain level it changes its state. To implement this in Simulink i use Voltage-Controlled Switch which belongs to a different library than by cells whose voltages are 12 Volts each. After connecting "Voltage-Current Interface(Ground)" to my circuit to connect these two objects of two different libraries i get an error stating the following. How can i fix this problem. Do you have any suggestions that i can do to accomplish my task. You can find the design and the error message below.
2 Answers
Is there any reason you are mixing SimPowerSystems & SimScape?
With the introduction of SimScape "SimPowerSystems", the legacy method of dealing with electrical simulations has become redundant EXCEPT for some legacy blocks and specialised technologies.
The legacy SimPowerSystems does have a more specialised battery model so I can understand why you would want to use that IF it provides features the simscape battery does not (or that you cannot reproduce...)
you can run with both as long as you provide the needed pre-requisites.
I don't see a SimScape reference block nor a solver block. Do they exist.
The actual problem here is an algebraic loop.
the subsystem highlighted within the 1st post. What EXACTLY is in there? I suspect there is some form of SimPowerSystem voltage sensor to bring a signal into the simulink domain, a Simulink-PS converter block to take it into the SimScape domain. This is where it needs to be solved.
Add a memory block in the simulink domain should break the loop and provided the needed initial condition (if you are running continuous consider adding a TF with a small timeconstant todo the same thing)
Try to avoid using simpowersystem and simscap components in the same simulation file.
To solve the simulation error, you can simply use "ideal switch" block from Simpowersystem>Power electronics library.
On the other hand you can use a DC-DC converter (boost or buck ... etc) with a dc voltage source to charge the battery. I do not see any logic in connecting a current source directly to the battery terminals.
-
\$\begingroup\$ Thank you for your answer. That helps a lot. I try to use the ideal switch but as far as i understand the switch opearates with respect to "0" but in my application it should be "20" Volts. \$\endgroup\$ Commented Aug 24, 2017 at 11:46
-
\$\begingroup\$ This switch works as per the gate (g) signal (for 0 it is opened, 1 it is closed) regardless the circuit voltage. You have other alternatives like (breaker>elements>simpowersystems) in case if you want to use it only for switching on/off for longer period. Ideal swirtch, however, can be used instead of a power electronic switch like a transistor or thyristor (with neglecting all the losses and the delay of these switches). \$\endgroup\$– HazemCommented Aug 24, 2017 at 12:21