OpenModelica


Forgot password? | Forgot username? | Register

Compilation of flat model

Compilation of flat model

Hi every one,

First, thank you for the attention and help you'll give to this post.

Quickly :
-----------
- I'm using OMC 1.9.1.beta.1 compiler
- I want to generate C files from *.mo files
To do this :
- I generate a flattened model *.mof from *.mo files
- I try to generate some C files from the *.mof, but i have a compiling error.
  This error occurs in the first line of the *.mof declaring a parameter :
  parameter Real someModel.param1(fixed = false);
  OMC compiler rejects the dot (".")

More precisely :
----------------------
- I have a master model (in "master_model.mo") declaring submodels :
    model master_model
      subModel1 instance1() ;
      subModel2 instance2() ;
      ....
    equation
      <Some equations...>
    end master_model;

- I generate a "master_model.mof" with the command :
  /some_path/omc +showErrorMessages +d=failtrace +d=disableSingleFlowEq master_model.mo subModel1.mo subModel2.mo ....
  No problem to get this "master_model.mof"
 
- I try to generate C file from "master_model.mof" with the command :
  /some_path/omc +simCodeTarget=C +showErrorMessages +g=Modelica +d=initialization +d=failtrace master_model.mof
  and i get a compiling error :
  {"[/a_path.../master_model.mof:2:26-2:26:writable] Error: Missing token: SEMICOLON", "SYNTAX", "Error", "2"}
  When i look at master_model.mof, here is what i see :
 
    class master_model
      parameter Real subModel1.param1(fixed = false); // Error on this first line because of the dot
      parameter Real subModel1.param2(fixed = false);
      
        <some other declarations....>
      
      equations
      
        <some equations....>
       
    end master_model;
   
  The dot on line 2 is rejected.
  What did i do wrong ?
  The presence of this dot at this place in this file seems illogical
  since a declaration should be done with a variable or paramater name without dot,
  as in most language.
  Besides, since OMC compiler created the *.mof, this file should have the right
  syntax and be usable to create C files with the same OMC compiler.

Edited by: guil_pierre - Jun-13-14 12:14:13
Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

The .mof file is not intended to be usable for re-compilation. It is only for diagnostics.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

You probably want to use the +s flag to generate simulation code.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

some of my simulation failed and I have this error :

[:0:0-0:0] Error: [b]Failed to open simulation result /tmp/OpenModelica_maryam/OMEdit/BuildingEnergySystems.CaseStudies.TemperatureControl.Thermal_equivalent.Rooms.RoomsThermalSimplifiedWithAppliances_res.mat: Too few rows in data_2 matrix


and my output is :

/tmp/OpenModelica_maryam/OMEdit/BuildingEnergySystems.CaseStudies.TemperatureControl.Thermal_equivalent.Rooms.RoomsThermalSimplifiedWithAppliances -port=51282 -logFormat=xml -w -lv=LOG_STATS
assert        | debug     | division by zero at time 0, (a=0) / (b=0), where divisor b expression is: heatPump_ConstantCOPheat1.W Debug more
Warning: Variable stove.airSource_fixed_pTX.air.Twb out of [min, max] interval: stove.airSource_fixed_pTX.air.Twb >= 0.0 has value: -226.176
Warning: Variable airSource_fixed_wTX1.air.Twb out of [min, max] interval: airSource_fixed_wTX1.air.Twb >= 0.0 has value: -160.919
Warning: Variable airSource_fixed_wTX.air.Twb out of [min, max] interval: airSource_fixed_wTX.air.Twb >= 0.0 has value: -160.919
Simulation process exited with code 255

Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

Here is the actual error,

Code:

assert        | debug     | division by zero at time 0, (a=0) / (b=0), where divisor b expression is: heatPump_ConstantCOPheat1.W Debug more

Clicking on Debug more should take you to the equation causing the error. Fix division by zero error in your model.

Adeel.

Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

hi
can I ask a question

Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

Thank you.
I use the libraries that they wrote with Dymola.
do you think these error caused because of this

Administrator has disabled public posting. Please login or register in order to proceed.

Re: Compilation of flat model

Hello All,

I am using Dymola software 2017 and I have a concern regarding a question about reading the differential equations (nonlinear and linear) of a model using the dsmodel.mof file.

I have a Thermal power plant (with 104 continuons time states), which I cannot read its complete system of equations through its dsmodel.mof file. I am finding it complex to interpret and figure out these equations from the script in the file specially the non-linear system of equations.

Can someone please guide me to properly read them specially the nonlinear part ?
Pls. find attached mof-file for your review.

Thank you all for your help in advance

dsmodel.mof

Edited by: firasomran - Sep-22-17 09:47:17
Attachments:
Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic
You are here: