Opened 7 years ago

Last modified 12 months ago

#5051 closed defect

OM accepts in a model a parameter with no value — at Version 1

Reported by: massimo ceraolo Owned by: somebody
Priority: blocker Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc: Adrian Pop

Description (last modified by massimo ceraolo)

Consider this package:

package TestParam
  model ResistorSimple
    parameter Real R;
    extends Modelica.Electrical.Analog.Interfaces.OnePort;
  equation
    v = R*i;
  end ResistorSimple;

  model Circuit
    Modelica.Electrical.Analog.Basic.Ground ground;
    Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=1);
    ResistorSimple res;
  equation
    connect(ground.p, constantVoltage.n);
    connect(constantVoltage.n, res.p);
    connect(res.n, ground.p);
  end Circuit;
end TestParam;

I think Circuit should not run because parameter R has no value defined. Instead OM just issues the following message:

[1] 22:53:00 Translation Warning
[TestParam: 5:5-5:21]: Parameter res.R has no value, and is fixed during initialization (fixed=true), using available start value (start=0.0) as default value.

and runs.

This can be very tricky in larger models (for instance models using MSL models with default values for parameters) where there may exist many parameters having just start values. In these cases it can be very difficult to understand that one or some of them are indeed undefined.

Change History (1)

comment:1 by massimo ceraolo, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.