I designed a very simple electronic circuit in Simulink (Simscape). It consists of a dc voltage source and two resistors connected in series. When the values of these two resistors are kept constant, then I can build the model with RTW. But I want to sweep the value of one of the resistors. So, when I put the resistor's value equal to R (which I am going to change through the matlab's workspace), then I can't build the model. What should I do?
Thanks!
"joskem joskem" <jos...@pathfinder.gr> wrote in message <hg2u4i$9p9$1...@fred.mathworks.com>...
Hi, code generated by Simscape doesn't support tuneable parameters, which is
why you can't change the value of the resistor, once the model has been
built with RTW. Have a look at the documenation for limitations when
generating code:
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/simscape/ug/bq91pc7.html#bq91pov-1
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/simscape/ug/bqqjdvg-1.html
To work around this, use the variable resistor block instead:
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/simscape/ref/variableresistor.html
If you feed the block with a Simulink block (e.g. constant) through
Simulink-PS interface block, you should be able to tune the resistor value.
Have a look at this video for an example:
http://www.mathworks.com/products/demos/simscape/param_projector/index.html
HTH,
Arnaud
That works perfect! But considering another case where I have an AC voltage source in my circuit, then the controlled voltage source block only lets me to externally choose the amplitude of the sine wave. What could I do to sweep its frequency?
Thanks again!
Hi,
The controlled voltage source block takes whatever signal you feed it with,
so you could use a Sine Wave block from Simulink (again, through a
Simulink-PS Converter block), and sweep the frequency of the Sine Wave
block.
HTH,
Arnaud