Opened 14 years ago

Last modified 14 years ago

#1311 closed defect (fixed)

Better error messages for packages that contain equations are needed!

Reported by: Adrian Pop Owned by: Adrian Pop
Priority: high Milestone:
Component: Instantiation Version:
Keywords: Cc: Adrian Pop, Adrian Pop, Per Östlund

Description

Instantiating this package (thanks to Eric Van Gelder for sending it):

package steve
  annotation(Diagram(coordinateSystem(extent = {{ -100, -100},{100,100}})));
  Modelica.Electrical.Analog.Sources.SineVoltage blob(V = 10, freqHz = 60) annotation(Placement(transformation(origin = { -5.0, -33.0}, extent = {{ -26.0, -54.0},{16.0, -12.0}}, rotation =  -7.016709e-15), iconTransformation(origin = { -4.0, -33.0}, extent = {{ -25.0, -54.0},{17.0, -12.0}})));
  Modelica.Electrical.Analog.Basic.Inductor glob(L = 10) annotation(Placement(transformation(origin = { -5.0,26.0}, extent = {{ -26.0,5.0},{16.0,47.0}}), iconTransformation(origin = { -5.0,26.0}, extent = {{ -26.0,5.0},{16.0,47.0}})));
  Modelica.Electrical.Analog.Sensors.CurrentSensor slob annotation(Placement(transformation(origin = { -68.0, -2.0}, extent = {{ -89.0, -23.0},{ -47.0,19.0}}, rotation = 90.0), iconTransformation(origin = { -76.0,0.0}, extent = {{ -97.0, -21.0},{ -55.0,21.0}})));
equation 
  connect(glob.n,blob.n) annotation(Line(points = {{16.0,26.0},{42.0,26.0},{42.0, -33.0},{16.0, -33.0}}));
  connect(slob.n,glob.p) annotation(Line(points = {{ -68.0,19.0},{ -67.0,19.0},{ -67.0,25.0},{ -26.0,25.0},{ -26.0,26.0}}));
  connect(blob.p,slob.p) annotation(Line(points = {{ -26.0, -33.0},{ -67.0, -33.0},{ -68.0, -33.0},{ -68.0, -24.0}}));
end steve;

using this script:

loadModel(Modelica); getErrorString();
loadFile("steve.mo"); getErrorString();
instantiateModel(steve); getErrorString();
checkModel(steve); getErrorString();

gets you this weird error:

true
""
true
""
""
"[steve.mo:7:3-7:106:writable] Error: Failed to instantiate equation connect(glob.n, blob.n);
Error: Error occured while flattening model steve
[steve.mo:7:3-7:106:writable] Error: Failed to instantiate equation connect(glob.n, blob.n);
Error: Error occured while flattening model steve
"
"[steve.mo:7:3-7:106:writable] Error: Failed to instantiate equation connect(glob.n, blob.n);
Error: Error occured while flattening model steve
"
""

We should tell the user (both):

  • that a package cannot be instantiated
  • that a package cannot contain equations

Change History (1)

comment:1 by Martin Sjölund, 14 years ago

This is fixed in trunk

Note: See TracTickets for help on using tickets.