Issue
When instantiating an enumeration type with a choices annotation as below, the choices annotation is not parsed and templates.json is populated with all the elements from the enumeration, yielding an incorrect list in the parameter dialog.
parameter Buildings.Templates.Plants.HeatPumps.Types.Distribution typDis_select1(
start=Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Variable2)=
Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Variable2
"Type of distribution system"
annotation (Evaluate=true,
Dialog(group="Configuration",
enable=typ==Buildings.Templates.Components.Types.HeatPump.AirToWater),
choices(
choice=Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1Only
"Variable primary-only",
choice=Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Variable2
"Constant primary - Variable secondary centralized"));
is parsed as follows.
Root Cause
In Component.getInputs(), when a non-replaceable parameter has a choices annotation, the annotation is parsed and stored in this.annotation, but it's never used when building childInputs. Instead, all enumeration values from the type's definition are used.
Issue
When instantiating an enumeration type with a choices annotation as below, the choices annotation is not parsed and
templates.jsonis populated with all the elements from the enumeration, yielding an incorrect list in the parameter dialog.is parsed as follows.
{ "modelicaPath": "Buildings.Templates.Plants.HeatPumps.Interfaces.PartialHeatPumpPlant.typDis_select1", "type": "Buildings.Templates.Plants.HeatPumps.Types.Distribution", "options": [ // Options should be limited to the ones specified by the choices annotation "Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Only", "Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1Only", "Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Variable2", "Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1And2" ], //... }Root Cause
In
Component.getInputs(), when a non-replaceable parameter has achoicesannotation, the annotation is parsed and stored inthis.annotation, but it's never used when buildingchildInputs. Instead, all enumeration values from the type's definition are used.