Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Input/output connectors, for loop, equation count

Input/output connectors, for loop, equation count

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

Re: Input/output connectors, for loop, equation count

Section 9.4 of the Modelica 3.2 spec?

There are 0 guests and 0 other users also viewing this topic
You are here: