Opened 5 years ago

Closed 5 years ago

#5750 closed defect (worksforme)

buildModel fails when model is extended from

Reported by: Oliver Lenord 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 by Adrian Pop, 5 years ago

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 by Oliver Lenord, 5 years ago

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 by Adrian Pop, 5 years ago

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 by Martin Sjölund, 5 years ago

Component: *unknown*Frontend
Milestone: 1.15.0
Resolution: worksforme
Status: newclosed

Please reopen this if you have additional input.

Note: See TracTickets for help on using tickets.