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
  • Index
  • » Users
  • » rafd
  • » Profile

Posts

Posts

I'm trying to loop through a vector of models, but I am getting a UNKNOWN_SUBSCRIPT error.

Here is some of the related code:

Code:


House houses[10];

algorithm
    fixed_cost := 0;
   
    for k in 1:10 loop
      fixed_cost := fixed_cost + houses[k].economic_out.fixed_cost; 
    end for;

omc gives the following error:

Code:

EnergySimTest.cpp:1852: error: ‘$Phouses$lBUNKNOWN_SUBSCRIPT$rB$Peconomic_out$Pfixed_cost’ was not declared in this scope

I have checked to see that replacing [k] with [1], [2], etc. works.

Is modelica unable to dynamically generate iterators for a vector of models? (I know it works for a vector of Reals)

  • Index
  • » Users
  • » rafd
  • » Profile
You are here: