Opened 12 years ago
Closed 11 years ago
#2002 closed defect (fixed)
Parameterbinding is lost
Reported by: | Christian Schubert | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | blocker | Milestone: | 1.9.0 |
Component: | Frontend | Version: | trunk |
Keywords: | lost parameter redeclare | Cc: | Jens Frenkel, Per Östlund |
Description
Hi,
while looking into the division by zero problems, I came across the
Modelica.Fluid.Examples.InverseParameterization
model which fails with
stdout | warning | division by zero in partial equation: (pipe2.flowModel.m_flows[1] * pipe2.flowModel.dp_nominal) / pipe2.flowModel.m_flow_nominal because pipe2.flowModel.m_flow_nominal == 0: File: /var/lib/hudson/jobs/OpenModelica_MSL_COVERAGE/workspace/OpenModelica/build/lib/omlibrary/Modelica 3.2.1/Fluid/Pipes.mo Line: 2048 stdout | warning | at Time=0.000000 stdout | warning | [line] 2505 | [file] Modelica.Fluid.Examples.InverseParameterization.c assert | assert | division by zero
The parameter pipe2.flowModel.m_flow_nominal should not be zero, however, since
Modelica.Fluid.Pipes.StaticPipe pipe2( [...] redeclare model FlowModel = Modelica.Fluid.Pipes.BaseClasses.FlowModels.NominalLaminarFlow ( [...] m_flow_nominal=1))
when running instantiateModel I get
parameter Real pipe1.flowModel.m_flow_nominal(quantity = \"MassFlowRate\", unit = \"kg/s\") \"Mass flow rate for dp_nominal (for nominal models)\";
So it seems that the (new) binding equation is lost somewhere in the FrontEnd. I ran the model exactly as in the msl32 mos-file so with +d=scodeInstShortcut.
So far I was not able to replicate the problem with a simple test model.
Attachments (2)
Change History (7)
by , 12 years ago
Attachment: | ParameterBug.mo added |
---|
by , 12 years ago
Attachment: | ParameterBug.mos added |
---|
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Cc: | added |
---|
comment:3 by , 12 years ago
I just noted, that this seems only occurs with
+d=scodeInstShortcut
(Unfortunately the fluid models (where this problem occurs) cannot be simulated without scodeInstShortcut.)
comment:4 by , 12 years ago
I've debug this a bit and I know why this happens. I'll see if I can fix it this week (as I'm in holidays).
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This works fine without the +d=scodeInstShortcut flag which should be deprecated soon.
Now, I was able to reproduce the problem with a simple testmodel:
The problem is that instantiateModel(Test) gives
instead of
Although the parameter has been modified in the redeclare in the Test model.