Opened 4 years ago

Closed 4 years ago

#6133 closed defect (fixed)

OMEdit doesn't load a library if just the version is different; no error, no warning

Reported by: Rüdiger Franke Owned by: Adeel Asghar
Priority: high Milestone: 1.16.0
Component: OMEdit Version: v1.16.0-dev
Keywords: Cc:

Description

The below model is a duplicate of PowerSystems.Examples.Introductory.Units. It states uses(PowerSystems(version = "0.9.0")). OMEdit raises a notification:

[1] 11:22:07 Skripting Meldung
Skipped loading package PowerSystems (0.9.0) using MODELICAPATH C:/Program Files (x86)/OpenModelica1.16.0-dev-32bit/lib/omlibrary (uses-annotation may be wrong).

This should at least be a warning, if not an error as the model will not work.
Better: OMEdit should load the bundled PowerSystems 1.0.0 and raise a warning about the version discrepancy.
Btw: once PowerSystems has been loaded, the model checks successfully but it raises a strange error when attempting to simulate it !?

model LoadLibrary "Duplicate from PowerSystems.Examples.Introductory.Units"

  inner PowerSystems.System system(refType=PowerSystems.Types.ReferenceFrame.Inertial)
    annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
  PowerSystems.AC3ph.Sources.Voltage voltage_SI(
    v0=408)
         annotation (Placement(transformation(extent={{-60,20},{-40,40}})));
  PowerSystems.AC3ph.Nodes.GroundOne grdV1
                              annotation (Placement(transformation(extent={{
            -70,20},{-90,40}})));
  PowerSystems.AC3ph.Sources.Voltage voltage_pu(
    V_nom=400,
    v0=1.02)
         annotation (Placement(transformation(extent={{-60,-40},{-40,-20}})));
  PowerSystems.AC3ph.Nodes.GroundOne grdV2
                              annotation (Placement(transformation(extent={{
            -70,-40},{-90,-20}})));
  PowerSystems.AC3ph.Sensors.PVImeter meter_SI
  annotation (Placement(transformation(extent={{-20,20},{0,40}})));
  PowerSystems.AC3ph.Sensors.PVImeter meter_pu(
    V_nom=400,
    S_nom=10e3)
  annotation (Placement(transformation(extent={{-20,-40},{0,-20}})));
  PowerSystems.AC3ph.Impedances.Resistor load_SI(
    r=20)
    annotation (Placement(transformation(extent={{20,20},{40,40}})));
  PowerSystems.AC3ph.Impedances.Resistor load_pu(
    V_nom=400,
    S_nom=10e3,
    r=1.25)
   annotation (Placement(transformation(extent={{20,-40},{40,-20}})));
  PowerSystems.AC3ph.Nodes.Ground grd1           annotation (Placement(
        transformation(extent={{50,20},{70,40}})));
  PowerSystems.AC3ph.Nodes.Ground grd2           annotation (Placement(
        transformation(extent={{50,-40},{70,-20}})));
equation
  connect(voltage_SI.term, meter_SI.term_p) annotation (Line(points={{-40,30},
          {-20,30}}, color={0,130,175}));
  connect(meter_SI.term_n, load_SI.term_p) annotation (Line(points={{0,30},{
          20,30}}, color={0,130,175}));
  connect(load_SI.term_n, grd1.term) annotation (Line(points={{40,30},{50,30}},
        color={0,130,175}));
  connect(voltage_pu.term, meter_pu.term_p) annotation (Line(points={{-40,-30},
          {-20,-30}}, color={0,130,175}));
  connect(meter_pu.term_n, load_pu.term_p) annotation (Line(points={{0,-30},{
          20,-30}}, color={0,130,175}));
  connect(load_pu.term_n, grd2.term) annotation (Line(points={{40,-30},{50,
          -30}}, color={0,130,175}));
  connect(grdV1.term, voltage_SI.neutral)
    annotation (Line(points={{-70,30},{-60,30}}, color={0,0,255}));
  connect(grdV2.term, voltage_pu.neutral) annotation (Line(points={{-70,-30},
          {-60,-30}}, color={0,0,255}));
annotation(
    experiment(StopTime = 0.1),
    uses(PowerSystems(version = "0.9.0")));
end LoadLibrary;

Change History (9)

comment:1 by Per Östlund, 4 years ago

When I instantiate the model using omc on the command line it just says:

Notification: Automatically loaded package PowerSystems 1.0.0 due to uses annotation.

So it loads 1.0.0 without even indicating that it was actually 0.9.0 that was requested by the model. I don't know what OMEdit does though, it's not building for me at the moment and I haven't bothered to figure out why yet.

Btw: once PowerSystems has been loaded, the model checks successfully but it raises a strange error when attempting to simulate it !?

I get these errors:

Internal error: BackendDAEEXT.getAssignment failed because n=43>arrayLength(ass1)=43 or m=67>arrayLength(ass2)=43
Error: Internal error It is not possible to select continuous time states because Number of Equations 1 greater than number of States 0 to select from.
Error: Internal error - IndexReduction.dynamicStateSelectionWork failed!

Is this the same error that you get? It's a good idea to always write down the error you get in the ticket to make sure everyone's talking about the same issue.

comment:2 by Rüdiger Franke, 4 years ago

No error from OMEdit. Just the notification:

[1] 13:24:04 Skripting Meldung
errorLevelToValue failed 
Version 0, edited 4 years ago by Rüdiger Franke (next)

in reply to:  2 ; comment:3 by Per Östlund, 4 years ago

Replying to rfranke:

No error from OMEdit. Just the notification:

[1] 13:24:04 Skripting Meldung
errorLevelToValue failed 

(besides a dialog offering the old frontend that doesn't work either though)

Ok, seems like the scripting API can't handle internal errors. I will fix it.

in reply to:  3 comment:4 by Per Östlund, 4 years ago

Replying to perost:

Ok, seems like the scripting API can't handle internal errors. I will fix it.

Fixed in 07705543. Internal errors shouldn't happen at all ideally, but at least it's better to display them than just failing when they do happen.

comment:5 by Francesco Casella, 4 years ago

@rfranke, please check and close the ticket at your earlier convenience.

in reply to:  5 comment:6 by Per Östlund, 4 years ago

Replying to casella:

@rfranke, please check and close the ticket at your earlier convenience.

It's not fixed. I only fixed the issue that OMEdit couldn't display the error that occurred when trying to simulate the model, which isn't really what the ticket is about.

comment:7 by Adeel Asghar, 4 years ago

PR#6784 fixes the problem.

The question is should we have notification of loaded libraries on by default or not? Right now in the PR I kept it off and only enabled it for OMEdit. Not sure what is the best way to go forward? Just load uses libraries without notifying the user or show the notifications to user about the loaded libraries due to uses annotation.

comment:8 by Francesco Casella, 4 years ago

I'm in favour of notifications for all loaded libraries on by default, including the path they were actually loaded from. This is critical information, it shouldn't be hidden in the deep recesses of the system.

comment:9 by Adeel Asghar, 4 years ago

Resolution: fixed
Status: newclosed

Fixed with 094bb66/OpenModelica.

OMEdit loads the PowerSystems 1.0.0 when the model is loaded.

Note: See TracTickets for help on using tickets.