Opened 5 years ago

Closed 4 years ago

#5750 closed defect (worksforme)

buildModel fails when model is extended from

Reported by: olivleno Owned by: somebody
Priority: normal Milestone:
Component: Frontend Version:
Keywords: OMC Cc:

Description

A mos script with the code:

buildModel(EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport.PIDController); getErrorString();

works fine.

The same mos script with

buildModel(EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous); getErrorString();

fails with error message:

Error: Cannot instantiate EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport.PIDController due to class specialization PACKAGE.

even though the second model is as simple as:

within EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport;
model PIDController
  extends EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous;
end PIDController;

Change History (4)

comment:1 Changed 5 years ago by adrpo

I had a look in the EMPHYSIS_TestCases.M03_DCMotorSpeedControl but there are no ModelsToExport.
How is ModelsToExport defined?

Can you send me an email with the actual code so I can debug?

comment:2 Changed 5 years ago by olivleno

The svn is outdated. The latest version of the test cases is on gitlab:
https://gitlab.ida.liu.se/emphysis/efmi-test-cases.git

comment:3 Changed 5 years ago by adrpo

I cannot reproduce your bug. Running script:

loadModel(Modelica); getErrorString();
loadFile("../EMPHYSIS_TestCases/package.mo"); getErrorString();
buildModel(EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport.PIDController); getErrorString();
buildModel(EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous); getErrorString();

Gets me this with the old front-end:

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/repos/efmi-test-cases/Modelica/test
$ ~/dev/OpenModelica/build/bin/omc script.mos
true
""
true
"Notification: Skipped loading package Modelica_Synchronous (0.92.2) using MODELICAPATH C:/home/adrpo33/dev/repos/efmi-test-cases/Modelica/;c:/home/adrpo33/dev/OpenModelica/build/lib/omlibrary (uses-annotation may be wrong).
"
{"C:/home/adrpo33/dev/repos/efmi-test-cases/Modelica/test/EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport.PIDController","EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport.PIDController_init.xml"}
"Notification: Automatically loaded package Modelica_Synchronous 0.93.0 due to uses annotation.
"
{"C:/home/adrpo33/dev/repos/efmi-test-cases/Modelica/test/EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous","EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous_init.xml"}
"Warning: Requested package Modelica_Synchronous of version 0.92.2, but this package was already loaded with version 0.93.0. You might experience problems if these versions are incompatible.
"

And this with the new front-end:

adrpo33@ida-0030 MINGW64 /c/home/adrpo33/dev/repos/efmi-test-cases/Modelica/test
$ ~/dev/OpenModelica/build/bin/omc +d=newInst script.mos
true
""
true
"Notification: Skipped loading package Modelica_Synchronous (0.92.2) using MODELICAPATH C:/home/adrpo33/dev/repos/efmi-test-cases/Modelica/;c:/home/adrpo3                                                           3/dev/OpenModelica/build/lib/omlibrary (uses-annotation may be wrong).
"
{"C:/home/adrpo33/dev/repos/efmi-test-cases/Modelica/test/EMPHYSIS_TestCases.M03_DCMotorSpeedControl.ModelsToExport.PIDController","EMPHYSIS_TestCases.M03                                                           _DCMotorSpeedControl.ModelsToExport.PIDController_init.xml"}
"Notification: Automatically loaded package Modelica_Synchronous 0.93.0 due to uses annotation.
"
{"C:/home/adrpo33/dev/repos/efmi-test-cases/Modelica/test/EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous","EMPHYSIS_TestCases.M03_DCMotorSpeedControl.Controller.PID.SpeedController_continuous_init.xml"}
"Warning: Requested package Modelica_Synchronous of version 0.92.2, but this package was already loaded with version 0.93.0. You might experience problems if these versions are incompatible.
"

Everything seems to work fine.

comment:4 Changed 4 years ago by sjoelund.se

  • Component changed from *unknown* to Frontend
  • Milestone 1.15.0 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Please reopen this if you have additional input.

Note: See TracTickets for help on using tickets.