Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5735 closed defect (fixed)

Potential bug HeatingSystem

Reported by: Victor Owned by: Adeel Asghar
Priority: high Milestone: 1.16.0
Component: OMEdit Version: v1.14.0-dev.beta2
Keywords: standardwater, heatflow, heating Cc: Francesco Casella

Description

I’m new to openmodelica so it might be me, but I think I’ve found a bug. This started when I attempted to build a heat flow model. I am not able to use StandardWater without getting an error. See https://www.openmodelica.org/forum/default-topic/2832-heat-flow for details.

Turns out running Modelica.Fluid.Examples.HeatingSystem also produces a lot of errors causing it to not run.

I have not included the errors since this is easily reproducible by running the HeatingSystem example.

Change History (7)

comment:1 by Karim Adbdelhak, 5 years ago

Oh, i think i actually had a fix for that and forgot to push it.

If it is what i think, i can push it into the latest version until monday!

comment:2 by Victor, 5 years ago

Thanks, tell me if you need help testing

comment:3 by Christoph Buchner <buchner@…>, 5 years ago

Potentially related (it's also about compilation issues with HeatingSystem)? https://github.com/modelica/ModelicaStandardLibrary/issues/3236

comment:4 by Karim Adbdelhak, 5 years ago

Cc: Francesco Casella added

From what i can see the original model Modelica.Fluid.Examples.HeatingSystem runs with the release version (1.14), as well as the latest version (1.16 dev).

We have some issues with variants of this model (e.g. steady state initialization) where i don't really know the issue. Did you change the base model in such a way? It would be helpful if you could post the error messages and additional output from the compiler.

The compiler does a very sensible substitution:

Original equations:
pump.dp_pump = pump.p_b_nominal - tank.ports[2].p
pump.dp_pump = pump.medium.p - tank.ports[2].p

######################################################
 LinearIntegerJacobian sparsity pattern: Original
######################################################
(scal_idx|arr_idx|changed) [var_index, value] || RHS_EXPRESSION
(49|49|false):             [150|-1] [185|-1]  || RHS: -pump.p_b_nominal
(43|43|false):             [150|-1] [185|-1]  || RHS: -pump.medium.p

######################################################
 LinearIntegerJacobian sparsity pattern: Solved
######################################################
(scal_idx|arr_idx|changed) [var_index, value] || RHS_EXPRESSION
(49|49|false):             [150|-1] [185|-1]  || RHS: -pump.p_b_nominal
(43|43|true):              EMPTY ROW          || RHS: pump.medium.p - pump.p_b_nominal

[ASSC] The equation: pump.dp_pump = pump.medium.p - tank.ports[2].p
[ASSC] Gets replaced by equation: 0.0 = pump.medium.p - pump.p_b_nominal

The module that does this transformation got replaced recently by a more stable an faster one, but it still performs these replacements. If you are on the latest version you can switch that of by using --noASSC, for older versions you have to use --preOptModules-=resolveLoops. The models seems to run fine with this changes. Unfortunately this transformation is mandatory for some models so it might not work for every model.

I added @casella to the issue, maybe he can give additional intel on this issue.

in reply to:  3 comment:5 by Francesco Casella, 5 years ago

Milestone: Future1.16.0
Resolution: fixed
Status: newclosed

See the discussion in MSL issue 3236.

We have now improved the pump model in MSL by fixing unnecessary (and in fact misleading) StateSelect.prefer attributes in the pump, as well as by using a simpler medium model. The combination of the two actions makes the model a lot more numerically robust. Regarding the medium, you may do the same if your model operates within a narrow range of operating conditions close to ambient conditions.

These changes have already been merged in to MSL 4.0.0 and should be back-ported to MSL 3.2.3 maintenance, which will be shipped with new releases of OpenModelica, for sure in 1.16.0, but possibly also with earlier versions.

comment:6 by victor, 5 years ago

Thanks, so you don't need more information from me?

comment:7 by Francesco Casella, 5 years ago

@victor, the fix has now been back-ported to MSL 3.2.3 maintenance as well, see MSL PR 3260.

You may re-try this out when we ship a new version of OMC with the updated MSL.

Thanks!

Note: See TracTickets for help on using tickets.