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

Posts

Posts

Feb-23-16 15:19:03
Can OpenModelica perform type upgrade from Real to Complex ?

Ok thank you !

Feb-23-16 14:39:53
Can OpenModelica perform type upgrade from Real to Complex ?

Hello,

I tried to write the following very simple model using OpenModelica 1.9.3

model testComplex
  Complex i;
equation
  i = 0.0;
end testComplex;

This model does not compile, whereas the Complex numbers class does have a constructor based on real numbers, so shouldn't the real number be automatically upgraded to Complex (0.0) ?

Also, the model with 0 (int) instead of 0.0 (real) should probably work.

What do you think ?

Besides, why is the "<>" operator not defined for complex numbers ?

Thank you,
François

Jan-11-16 11:36:39
How to retrieve all logs coming from a given .mos file run, how to write flat model

Hello,

I am trying to translate or instantiate models using a .mos file.

The file is the following
loadModel(Modelica);

translateModel(DM_CIVAU7CIVAU1_NGU_SM); getErrorString();

I would like to retrieve all logs messages generated during this process as a string. I tried getMessagesString() but did not get any message. How could I do this ?

Besides, I would like to save the instantied model as a .mo file. The instantiateModel function generates a string, is there a way to generate a native .mo file ?

Thank you,

Jan-06-16 11:49:45
Issue with protected variables
Category: Developer

Hello,

I am currently trying to restrict access to some model variables by relying on public and protected keywords

I designed two models

class AccessRights
  Real publ;
protected
  Real protec;
end AccessRights;

class Glob
  AccessRights A;
equation
  A.publ = 10;
  A.protec = 1;
end Glob;

The Glob model is successfully compiled and a simulation is conducted (using OpenModelica v1.9.3). Only publ can be displayed in output (not A.protec). When I comment out the A.protec = 1 equation, I get an error (not enough equations).
The Modelica language specification (3.3, section 4.1) says that "Protected elements in classes cannot be accessed via dot notation. They may not be modified or redeclared in a class modification."

As a result, shouldn't the A.protec = 1 equation be deemed illegal ?

Thank you in advance

Dec-07-15 16:24:01
Is it possible to avoid having to manually set the order in which the Modelica compiler will...

Thank you for your quick answer

Could you please give me an example mos file to load the two packages, one model model1 located in modelsRoot/subModel1/model1.mo (and within the subModel1 package), and run the compilerModelicaOMC command ?

Thank you very much

Dec-07-15 16:02:19
Is it possible to avoid having to manually set the order in which the Modelica compiler will...

I am trying to use the Modelica compiler in batch mode in order to compile multiple Modelica models (I currently use OpenModelica v1.9.1).
I use two packages : modelsRoot and modelsRoot.subModel1 (in two package.mo files).
When I run the following command line,

compilerModelicaOMC modelsRoot/subModel1/package.mo modelsRoot/package.mo

I get an error "Error: Failed to insert class subModel1 within modelsRoot;
Failed to parse file: modelsRoot/subModel1/package.mo"
Whereas when I run the following command line

compilerModelicaOMC modelsRoot/package.mo modelsRoot/subModel1/package.mo

it works fine. Is there a way to let the compiler know that the model files are not sorted ? Is there a way to avoid having to manually sort Modelica files according to package dependencies ?

Thank you in advance

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