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

Posts

Posts

Feb-28-13 11:55:47
Why does it have the option "(" output_expression_list ")" ?
Category: Programming

Thanks, it is all starting to make sense now!

This example shows why the output_expression_list is actually useful:

Code:


model Test

function func
  input Real a;
  input Real b;
  output Real c;
  output Real d;
algorithm
  c := a*a;
  d := b+b;
end func;

  parameter Real e = 3;
  parameter Real f = 5;
  Real g;
equation
  (,g) = func(e,f);
end Test;

I'll comment this also to the bug report.

Feb-28-13 11:28:18
Why does it have the option "(" output_expression_list ")" ?
Category: Programming

Modelica specification has a separate definition for that case:

Code:


statement :
( component_reference ( ":=" expression | function_call_args )
| "(" output_expression_list ")" ":=" component_reference function_call_args
| ...

Now when thinking of this, replacing output_expression_list with expression_list would allow (1,2,3)^(4,5,6,7,) which would not make much sense either.. Maybe that is just a forgotten legacy line for the function call case? I'll add that ticket and wait for smart people to resolve it current/smile

Feb-28-13 11:02:49
Why does it have the option "(" output_expression_list ")" ?
Category: Programming

Is there anyone who could explain why Modelica syntax allows "(" output_expression_list ")" for primary?

Here is a clip from Modelica 3.3 spec (https://www.modelica.org/documents/ModelicaSpec33.pdf)

Code:


primary :
UNSIGNED_NUMBER
| STRING
| false
| true
| ( name | der | initial) function_call_args
| component_reference
| "(" output_expression_list ")"
| "[" expression_list { ";" expression_list } "]"
| "{" function_arguments "}"
| end

The problem is that output_expression_list allows expressions like (,,,,,,)^(,,,,,). They go unnoticed to compiler which obviously cannot process them. Should it be expression_list instead? Just wondering current/smile

So I was a little ahead of myself. Too bad, I was so excited about this current/smile

What kind of plans there are to support FMI 2.0? I suppose FMI 2.0 will be released pretty soon, since it was planned for March 2012.

Hello all!

I have modified FMU SDK http://www.qtronic.de/en/fmusdk.html and use it to run models exported as .fmu using OpenModelica. During my testing, I ran into a problem, which is more of a philosophical problem than a software problem. Let's say I have the following model:

Code:


model FMITest
    Real stock(start=0.0, fixed=true);
    parameter Real par = 4;   
    parameter Real valve = par;
equation
    der(stock) = valve;
end FMITest;

The export produces model description containing:

Code:


  <ScalarVariable
    name="par"
    valueReference="2"
    variability="parameter"
    causality="internal"
    alias="noAlias">
    <Real start="4.0" fixed="true"  />
  </ScalarVariable>
  <ScalarVariable
    name="valve"
    valueReference="3"
    variability="parameter"
    causality="internal"
    alias="noAlias">
    <Real start="4.0" fixed="true"  />

All good in there. But let's say that during simulation, I change the value of "par" to 2. In my case, I would like that the value of "valve" is also changed. Currently this does not happen and there is no alias reference between"par" and "valve", which I could follow in my software. Is there a specification that says this is the way the software should work or could it be changed? I know that leaving the "parameter" keyword out from "valve" and specifying "valve = par" in equation block would probably fix this, but I would like to leave my model as it is for other reasons.

-Teemu

Apr-27-11 10:49:55
The error appeared after installing 1.7.0

Thanks for the fast and good reply! I got rid of +showErrorMessages, since I clearly don't need it.

-Teemu

Apr-27-11 10:35:54
The error appeared after installing 1.7.0

Hi!

After installing OpenModelica 1.7.0 RC1 I get following errors when using simulate or buildModel in .mos -files in windows command prompt:

{"Error: Class OpenModelica.Scripting.simulate not found in scope <global scope> (looking for a function or record).", "TRANSLATION", "Error", "3"}

Example .mos -file:
loadFile("testi2.mo");
simulate(Model1, startTime=0,stopTime=1, numberOfIntervals=10, method="euler", outputFormat="plt");
getErrorString();

The model is simulated even though the error is shown, but I would like to get rid of the error message. What could be the reason for the errors?

Thanks!

-Teemu

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