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

Eclipse MDT Console Simulate Fails

Eclipse MDT Console Simulate Fails

I have created the simple DC Motor model referred to in the OM Users Guide. When I run it from the OMShell it simulates fine and produces the results which can be plotted. But if I enter the same commands in the Eclipse MDT Console, simulate fails with the message below.
Please can anyone explain what I should do to be able to use the Eclipse Console? (or should I not be using it?)

Fail message:

Code:

omc> simulate(DCMotor,startTime=0.0,stopTime=10.0)

record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 10.0, numberOfIntervals = 500, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'DCMotor', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
    messages = "Simulation failed for model: DCMotor
Error: Error building simulator. Buildlog: perl /opt/modelica/build//share/omc/scripts/convert_lines.pl DCMotor.c DCMotor.conv.c.tmp
perl /opt/modelica/build//share/omc/scripts/convert_lines.pl DCMotor_functions.c DCMotor.conv.c.tmp
gcc  -O0 -g -falign-functions -march=native -mfpmath=sse -fPIC   -I\"/opt/modelica/build//include/omc\" -I. -L\"Motor\"   -c -o DCMotor.conv.o DCMotor.conv.c
DCMotor.c: In function ‘eqFunction_18’:
DCMotor.c:297:7: error: ‘tmpMeta’ undeclared (first use in this function)
DCMotor.c:297:7: note: each undeclared identifier is reported only once for each function it appears in
DCMotor.c:297:7: warning: passing argument 2 of ‘stringAppend’ discards ‘const’ qualifier from pointer target type [enabled by default]
In file included from /opt/modelica/build//include/omc/modelica.h:99:0,
                 from /opt/modelica/build//include/omc/mmc_gc.h:63,
                 from /opt/modelica/build//include/omc/meta_modelica.h:46,
                 from DCMotor_functions.h:4,
                 from DCMotor.c:13:
/opt/modelica/build//include/omc/meta_modelica_builtin.h:67:34: note: expected ‘metamodelica_string_const’ but argument is of type ‘modelica_string’

And sure enough the C code is different. From OMShell:

Code:

void eqFunction_18(DATA *data)

{
  modelica_boolean tmp0;
  modelica_boolean tmp1;
  static int tmp2 = 0;
  modelica_string tmp3;
  modelica_string tmp4;
  if (!tmp2) {
    tmp0 = GreaterEq($Presistor1$PT_ref,1.0);
    tmp1 = LessEq($Presistor1$PT_ref,6000.0);
    if (!(tmp0 && tmp1)) {
      tmp3 = modelica_real_to_modelica_string_format($Presistor1$PT_ref, "g");
      tmp4 = cat_modelica_string("Variable resistor1.T_ref out of [min, max] interval: resistor1.T_ref >= 1.0 and resistor1.T_ref <= 6000.0 has value: ",tmp3);
      FILE_INFO info = {"/opt/modelica/build//lib/omlibrary/Modelica 3.2.1/Electrical/Analog/Basic.mo",66,3,66,78,0};
      omc_assert_warning(tmp4, info);
      tmp2 = 1;
    }
  }
}

From Eclipse Console:

Code:

void eqFunction_18(DATA *data)

{
  modelica_boolean tmp0;
  modelica_boolean tmp1;
  static int tmp2 = 0;
  modelica_string tmp3;
  /*#modelicaLine [/opt/modelica/build//lib/omlibrary/Modelica 3.2.1/Electrical/Analog/Interfaces.mo:312:5-313:99]*/
  if (!tmp2) {
    tmp0 = GreaterEq($Presistor1$PT,1.0);
    tmp1 = LessEq($Presistor1$PT,6000.0);
    if (!(tmp0 && tmp1)) {
      tmp3 = modelica_real_to_modelica_string_format($Presistor1$PT, "g");
      tmpMeta[12] = stringAppend("Variable resistor1.T out of [min, max] interval: resistor1.T >= 1.0 and resistor1.T <= 6000.0 has value: ",tmp3);
      FILE_INFO info = {"/opt/modelica/build//lib/omlibrary/Modelica 3.2.1/Electrical/Analog/Interfaces.mo",312,5,313,99,0};
      omc_assert_warning(MMC_STRINGDATA(tmpMeta[12]), info);
      tmp2 = 1;
    }
  }
  /*#endModelicaLine*/
}

Re: Eclipse MDT Console Simulate Fails

The omc ran by MDT is run with +g=MetaModelica (mainly used for our compiler developing).
Just disable that (remove +g=MetaModelica)  in Window->Preferences->Modelica.

Cheers,
Adrian Pop/

Re: Eclipse MDT Console Simulate Fails

Wow, that was a quick response - thanks.
But...
I have removed the +g=MetaModelica line and restarted Eclipse but now in the console I get no responses in the console whatever I type; it doesn't seem to do anything at all. e.g.:

Code:

Welcome to Modelica Development Tooling (MTD) Console

You can send commands to OMC from here.
Type !help for help.
omc> cd("/mnt/MikeyT/Project/Modelica/workspace/DCMotor")

omc> cd()

omc>

There are 0 guests and 0 other users also viewing this topic
You are here: