Cant create a variable capacitor in simulink

조회 수: 4 (최근 30일)
Saurabh Sakpal
Saurabh Sakpal 2015년 2월 2일
편집: Sebastian Castro 2015년 2월 3일
Hey,
I am trying to create a model of the cardiovascular system and in this i am using a circuit to model the circulatory system. I have to create a capacitor which is the 'heart' and the circuit it is attached to eg. resistors are the blood vessels etc.
I have to create a variable capacitor so that stimulus depends on time and is not constant.
Now the problem i am having is when i attach the variable capacitor to the circuit and measure the voltage which is the 'flow' i keep getting 0. like almost as if there is no reading. Whats wrong with my circuit.
I have attached my circuit below. Please any help would be appreciated thanks.

채택된 답변

Sebastian Castro
Sebastian Castro 2015년 2월 2일
Hi Saurabh,
What version of Simulink are you using? Starting with R2014a, the initial conditions specification changed in Simscape..
Things I would check (assuming you're in R2014a and onwards):
  1. Since you don't have a power source, you need non-zero initial voltages on at least one of the capacitors. Look at the individual initial conditions of each block. If you want to explore the initial conditions, you could also use the Variable Viewer.
  2. Double-click the Solver Configuration block and make sure the "Start simulation from steady-state" box is unchecked.
  3. Try zooming in the time scale (X-axis). Your simulation runs for 10 seconds, but capacitors generally charge and discharge much more quickly.
By the way, you only need the "powergui" block if you have SimPowerSystems blocks in your model. If the screenshot you showed is your entire model, then the blocks are strictly Simscape/SimElectronics, so you can get rid of it unless you're using some of its analysis tools.
- Sebastian
  댓글 수: 3
Saurabh Sakpal
Saurabh Sakpal 2015년 2월 3일
Saurabh Sakpal
Saurabh Sakpal 2015년 2월 3일
error: algebraic loop is infinite or Nan

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Saurabh Sakpal
Saurabh Sakpal 2015년 2월 3일
Thanks again for your help sebastian

Saurabh Sakpal
Saurabh Sakpal 2015년 2월 3일
편집: Saurabh Sakpal 2015년 2월 3일
Another thing i noticed is that in this sample case of inductor which is the design i based my variable capacitor on the positive current terminal of the controlled current source connects to the ground, and the negative connects to the positive (see right image). shouldnt it be the other way around?
Sorry if my reply is long :s
  댓글 수: 1
Sebastian Castro
Sebastian Castro 2015년 2월 3일
편집: Sebastian Castro 2015년 2월 3일
Saurabh,
For the algebraic loop situation, you are seeing this because you're taking an output from the Simscape network and feeding it back as an input without any delays/other ways to break the loop.
If you're building a custom capacitor (i.e., the equations are part of your physical system), I would make the following recommendations:
  1. Instead of using Simulink blocks, try using the Simscape > Foundation Library > Physical Systems library. If you build the same equations using these blocks, you will not get algebraic loops.
  2. Use the Simscape Language to build your own custom Simscape block. You can even start with the equations from the built-in Simscape Capacitor block by double-clicking it and selecting "View source code", then making modifications from there.
Sort of unrelated, but the Simulink derivative block is typically not recommended. If possible, try build your equations "backwards" and use an Integrator block instead. Integrator blocks actually hold a state in memory and play nicer with the Simulink solver because of this.
For the second issue, it's not too big a deal. Component equations for "symmetric" components like springs, inductors, resistors, etc. will not affect the behavior of your system. All this means is that, when you flip the block around, the measured current/voltage values will be negative of what they were before. It's just sign convention.
If you flip something like a diode now... that's when you start changing the behavior of the overall system.
- Sebastian

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Nonlinear Operators에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by