Opened 7 years ago
Closed 7 years ago
#4921 closed defect (fixed)
Issue with NF involving bindings of arrays of components having a binding declared in the base type
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description
Please check Modelica.Media.Examples.TestOnly.FlueGas.err. The following error is reported:
[Modelica 3.2.2/Media/package.mo:2994:36-2994:46:writable] Error: Type mismatch in binding fixed = true, expected subtype of Boolean[4], got type Boolean.
Change History (4)
follow-up: 3 comment:1 by , 7 years ago
Summary: | More issues with array subscripts in binding with the NF → Issue with NF involving bindings of arrays of components having a binding declared in the base type |
---|
comment:2 by , 7 years ago
Or maybe hstart is not an array and it should be fill(hstart,N) for it to work.
Maybe the frontend should convert hstart in an array?
comment:3 by , 7 years ago
Replying to casella:
The ThermoPower model instantiates an array of variables of this type
Medium.SpecificEnthalpy h[N](start=hstart) "Fluid specific enthalpy at the nodes";and apparently the fact that an array is involved is lost by the NF, that expects the original type of
Medium.SpecificEnthalpy
for the binding.
That's actually not the source of the error, but I see how it can be confusing when the error message only references the line where the binding was declared. I've changed the error message so that it now also prints out where the binding was applied, so that you now get an error like this instead:
[Modelica 3.2.2/Media/Water/package.mo:126:22-126:33:writable] Notification: From here: [ThermoPower 3.1/Water.mo:5349:7-5353:50:writable] Error: Type mismatch in binding start = 100000.0, expected subtype of Real[11], got type Real.
Of course, you shouldn't get any error at all in this case. The actual issue is that the NF doesn't handle type bindings quite correct yet, and in this case somehow misses that it should take the component's dimensions into account when determining the type of the start binding.
comment:4 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The issues with OpenLoopSimulatorHtc is now fixed with aa6c8aa5, which greatly improves the handling of class modifiers.
The FlueGas model reported in the description still gives the same error, but that's because the error is correct and the model is missing an each
in the modifier. It has already been fixed in never versions of the MSL, so I'm not planning on implementing any workaround for it since it's only an example model (and if necessary we could probably just patch the MSL we distribute instead).
Another probably related case is ThermoPower.Examples.HRB.Simulators.OpenLoopSimulatorHtc:
The reported error line
defines the default start value for the medium-specific SpecificEnthalpy type. The ThermoPower model instantiates an array of variables of this type
and apparently the fact that an array is involved is lost by the NF, that expects the original type of
Medium.SpecificEnthalpy
for the binding.