As I see it, the basic problem is how to model a bidirectional
component with only input and output ports. For instance, if a
resistor model had 2 inputs corresponding to the voltage at each end
of the resistor, one could define a current output = the input
difference divided by the R value. There is no way I can see of
concatenating this model with others to form a resistor network for
simulation.
MatLab/Simulink Tech Support said they have no information on how to
do this and couldn't help me. The Simpower toolbox didn't look very
useful either.
As far as writing an S-function, I don't know how to structure the
code soas to produce a bidirectional model that concatenates. Any
suggestions?
http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/powersys/simple_4.shtml
"Cy Todd" <cyt...@technimation.com> wrote in message
news:eec4f...@WebX.raydaftYaTP...
So the problem remains how to construct a model of resistors, caps
and inductors from the basic Simulink toolbox.
Cy Todd
Stuart McGarrity wrote:
>
>
> SimPowerSystems lets you model Rs, Ls and Cs and it provides
> nondirectional
> ports.
>
> <http://www.mathworks.com/access/helpdesk/help/toolbox/physmod/powersys/simple_4.shtml>
>
> "Cy Todd" <cyt...@technimation.com> wrote in message
> news:eec4f...@WebX.raydaftYaTP...
> Thanks for the reply Stuart. Having played with the Simulink demo for
> awhile, I was aware of this toolset, but it seemed aimed at electric
> power generation and transmission. Anyway, my management elected not
> to get it [...]
For simulating electrical circuits with Simulink, you may also want to
evaluate the add-on PLECS which has a graphical schematic editor. A limited
student is available for free and can be downloaded from
http://www.plexim.com/downloads/
In this version, the number of inductors and capacitors is limited to a
total of four, however. (The number of resistors is unlimited.)
And there's yet another possibility: If your circuit consists only of linear
elements (i.e. RLC, sources and meters) and if you are not afraid of
netlists, you can also try the tool 'netlist2ss' available for free from
the same web-site. This Matlab function calculates the state-space matrices
for a linear electrical circuit. You can then use these matrices in the
'State-Space' block in Simulink.
> So the problem remains how to construct a model of resistors, caps
> and inductors from the basic Simulink toolbox.
There's no easy way to do this. The time you'll spend on trying it is
definitely going to be more expensive than the license for the appropriate
toolbox (unless you just want to model one circuit and never change it ...)
Regards,
Wolfgang
Take the advice of experts: Simulink is not the type of simulation environment that
naturally lends itself to what you want to do. To get around this, the SimPower Systems
tool largely bypasses the Simulink GUI interpreter and does not use the native Simulink
solvers. Instead it uses its own network analyser to interpret structures built from its
own blocks, and then passes that information to its own network solver. The development
team are listed at
<http://www.mathworks.com/access/helpdesk_r12p1/help/toolbox/powersys/preface4.shtml>
Do you really want to re-invent all that technology?
An equation-oriented imulation environment would lend itself naturally to your task; but if
you must use Simulink then I can't see how you could hope to develop what you want for less
than the cost of a SimPower Systems license. On the other hand, you could be less ambitious
and try to do what you can with Simulink's native capabilities.
You could also have a look at PLECS which has a graphical schematic editor:
<http://www.plexim.com/downloads>
Kelvin B. Hales
Kelvin Hales Associates Limited
Consulting Control Engineers
E-mail: kha...@khace.com
Web: www.khace.com
This is an Octave (not Matlab/Simulink) example showing one way of
calculating network impedance which might be distantly related to what
you need. It assumes that the network can be reduced to an equivalent
complex impedance between two terminals.
%impedance of a simple network of RLC components
f=(10.^(0:.01:7)); % frequency range 1Hz to 10 MHz
jw=(2*pi*i).*f; % rad/sec
%component values
r1=10000; % ohm
r2=1000;
r3=5000;
l1=1e-4; % henry
c1=1e-7; % farad
%component impedances
zr1=r1; % resistor: Z = R
zr2=r2;
zr3=r3;
zl1=jw .* l1; % inductor: Z = jw .* L
zc1=1 ./ (jw .* c1); % capacitor: Z = 1 ./ (jw .* C)
function z=ser(z1,z2)
%impedances in series
z=z1.+z2;
end
function z=par(z1,z2)
%impedances in parallel
z=(z1.*z2)./(z1.+z2);
end
%network impedance
z=ser(par(zr1,ser(zr2,zl1)),par(zr3,zc1));
loglog(w,abs(z))
Hope this helps
--
Alan Linton
to reply change "alan@..." to "alan.linton@..."