- Index
- » Programming
- » Modelica Language
- » Input/output connectors, for loop,...
Page Start Prev 1 Next End
Input/output connectors, for loop, equation count
Input/output connectors, for loop, equation count
Jul-23-12 14:10:12
Hey,
I try to assign values to an array in a connector. What happens is, that the simulation fails without a compiler error message.
If I change the equation section to an algorithm section (with the necessary syntax changes) I suddenly have too many equations (42 eqs for 22 vars).
Code:
class Test
iElement ie;
Module m;
equation
connect(m.oe, ie);
end Test;
class Module
oElement oe;
Integer pos(start=1);
equation
when sample(0,1) then
for i in 1:10 loop
if i==pos then
oe.r[i]=2.2;
oe.int[i]=3;
else
oe.r[i]=pre(oe.r[i]);
oe.int[i]=pre(oe.int[i]);
end if;
end for;
pos=pre(pos)+1;
end when;
end Module;
connector oElement
output Real r[10];
output Integer int[10];
end oElement;
connector iElement
input Real r[10];
input Integer int[10];
end iElement;
Can anyone give any hints as to how to solve the issue? Thanks in advance!
jcm
Edited by: jcm - Jul-23-12 14:17:50
Page Start Prev 1 Next End
- Index
- » Programming
- » Modelica Language
- » Input/output connectors, for loop,...
There are 0 guests and 0 other users also viewing this topic