Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#4697 closed defect (fixed)

OMEdit does not accept parameter with brackets

Reported by: Andrea Bartolini Owned by: Adrian Pop
Priority: blocker Milestone: 1.13.0
Component: OMEdit Version: v1.13.0-dev-nightly
Keywords: Cc:

Description

Consider the following model (also attached):

package test
  model A
    parameter Modelica.SIunit.Time T "time";
  end A;

  model B
    parameter Modelica.SIunit.Time T1 "time1";
    parameter Modelica.SIunit.Time T2 "time2";
    
    test.A a1 annotation(
      Placement(visible = true, transformation(origin = {-90, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    annotation(
      Icon(coordinateSystem(grid = {0.1, 0.1})),
      Diagram(coordinateSystem(extent = {{-200, -100}, {200, 100}})));
  end B;
end test;
  • open the model B
  • open parameters window of model a1 and type (T1+T2)/T2 as value of T

The following error is rised in messages browser:

[1] 18:35:19 Scripting Error
Unable to set the component modifier value using command setComponentModifierValue(test.B, a1.T, $Code((T1+T2)/T2))

[2] 18:35:19 Translation Error
Class setComponentModifierValue not found in scope <global scope> (looking for a function or record).

And the typed value of parameter is lost.

OMEdit 1.13.0~dev-77-ga63f2df
Connected to OpenModelica 1.13.0~dev-489-g623259e
sysop: Linux Ubuntu 16.04 - 64 bit

Attachments (1)

test.mo (484 bytes ) - added by Andrea Bartolini 7 years ago.

Download all attachments as: .zip

Change History (6)

by Andrea Bartolini, 7 years ago

Attachment: test.mo added

comment:1 by Adeel Asghar, 7 years ago

Component: OMEditInteractive Environment
Owner: changed from Adeel Asghar to Adrian Pop
Status: newassigned

comment:2 by Adrian Pop, 7 years ago

Seems OMEdit doesn't use setComponentModifierValue correctly in this case, is missing an = which is: $Code(=(T1+T2)/T2). This works perfectly fine:

loadModel(Modelica); getErrorString();
loadFile("t.mo"); getErrorString();
setComponentModifierValue(test.B, a1.T, $Code(=(T1+T2)/T2)); getErrorString();
list(test); getErrorString();

giving:

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/OMTesting/bugs/4697
$ ~/dev/OpenModelica/build/bin/omc t.mos
true
""
true
""
Ok
""
"package test
  model A
    parameter Modelica.SIunit.Time T \"time\";
  end A;

  model B
    parameter Modelica.SIunit.Time T1 \"time1\";
    parameter Modelica.SIunit.Time T2 \"time2\";
    test.A a1(T = (T1 + T2) / T2) annotation(
      Placement(visible = true, transformation(origin = {-90, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
    annotation(
      Icon(coordinateSystem(grid = {0.1, 0.1})),
      Diagram(coordinateSystem(extent = {{-200, -100}, {200, 100}})));
  end B;
end test;"
""

comment:3 by Adeel Asghar, 7 years ago

Resolution: fixed
Status: assignedclosed

Fixed in e46cb6/OMEdit.

comment:4 by Adeel Asghar, 7 years ago

Component: Interactive EnvironmentOMEdit

comment:5 by Jan Kokert, 7 years ago

It is great that this is fixed! I think ticket #4651 is related. Could you please check?

Note: See TracTickets for help on using tickets.