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
  • » SQX
  • » Profile

Posts

Posts

Mar-29-16 22:46:24
Error message when trying to load the ExternalLibraries.mo example

When I try to load the External Libraries example with OMEedit, I get the following error message:
 

        Error has ocurred while loading the fie/library
        C:/OpenModelica1.9.3/......./ExternalLibraries.mo
        Unable to load the file/library
     
        Only single nonstructured entity is allowed to be stored in the file.   
        C:/OpenM.........mo
        contains following classes ExternalFunc1, ExternalFunc2,External Libraries

Hello,

I am trying to build a library with counters for the component instances. The naive code would be something of the following style:

class Pipe
    Integer ipipe;        //actual number of the instance
    outer Integer npipe; //global counter for the total number of pipes
  initial algorithm
    npipe := npipe + 1;
    ipipe := npipe;
end Pipe;

model hydro_circuit;
  inner Integer npipe(start=0,fixed=false);  //global counter for the normal number of pipes
  Pipe pa, pb, pc, pd;
end hydro_circuit;

I have been unable to achieve my goal: after initialization I want
     npipe=4
     pa.ipipe=1
     pb.ipipe=2
     pc.ipipe=3
     pd.ipipe = 4.

Apparentely, the initial algorithm blocks are considered as multiple equations assigning the same variable npipe.

Thanks in advance for any help

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