Hi
I am trying to use the TableCurrent block in SystemModeler with WSMLink. The idea is to define a current profine in Mathematica and then use it to trigger the simulation in SystemModeler. Has anyone done this successfully? I cannot assign the table of values inside Mathematica.
The drawback here is that you need to allocate the correct size of the table in the model before calling WSMSimulate. WSMParameterValues can only set values that already exist, i.e. it doesn’t automatically expand the table matrix.
Thus, a better alternative would be to use the SignalCurrent component. Like this:
model Model1
Modelica.Electrical.Analog.Basic.Ground ground;
Modelica.Electrical.Analog.Basic.Resistor resistor;
Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent;
Modelica.Blocks.Interfaces.RealInput u;
equation
connect(signalCurrent.i,u);
connect(signalCurrent.p,ground.p);
connect(signalCurrent.n,resistor.p);
connect(resistor.n,ground.p) ;
end Model1;
WSMInputFunctions takes rules where the targets are functions. If you have measured current data you can create a function with e.g. the Interpolation function in Mathematica.
Also, make sure that you name the input u in your model, the error message indicates that it is not found.