- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » array definition
array definition
array definition
the purpose of this model is to provide the indexed elements of the "vector" array the values of the array "tester", which are increasing numbers from 1 to 12.
This shall happen every time the BooleanPulse is true. The arrays are indexed by the Integer "counter", which increases by 1 every boolean pulse.
the model simulates but gives every "vector" element the value 0. also the warning message is "Failed to solve linear system of equations (no. 21) at time 0.000000. Residual norm is 0.5."
model Array_Test_simple
Real vector[12];
Integer counter;
Real tester[12]=1:1:12;
Modelica.Blocks.Sources.BooleanPulse booleanPulse(period = 0.1) annotation(
Placement(visible = true, transformation(origin = {-62, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
initial algorithm
counter:=1;
algorithm
when booleanPulse.y then
vector[counter]:=tester[counter];
counter:=pre(counter)+1;
end when;
equation
annotation(
uses(Modelica(version = "4.0.0")));
end Array_Test_simple;
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » array definition