Open anandkp92 opened 3 years ago
@anandkp92 , @JayHuLBL : I don't understand the change below.
'models': pubModels,
'blockInputs': pubBlockInputs, // NEW
'blockOutputs': pubBlockOutputs, // NEW
'inputs': pubInputs, // UPDATED
'outputs': pubOutputs, // UPDATED
'subClasses': pubSubClasses // NEW
a) what is the difference between a blockInput
and an input
? Modelica has only inputs of the type input "Type"
where "Type" is for example Real
or Integer
.
b) what is a subClass
? Is this a class definition within a class, such as used in
model A
protected
model B
end B;
end A;
c) Assuming this is for the Modelica mode, does it make sense to use models
? Shouldn't we either use a class
and then its restrictions (e.g., package
, model
, block
, record
, function
, ...) or directly use the restricted type?
@mwetter I want to begin by stating that this issue and the updated model that I posted is just to start having this conversation. It is not a final one yet.
To answer your questions:
a) Currently, we are extracting inputs and outputs only based on the CDL interfaces RealInput
and RealOutput
and not handling variables of type input
or output
. This is why I added blockInputs
(referring to CDL interfaces) and inputs
(referring to input
variables).
b) Yes - in that case model B would be a subclass.
c) Currently there exists a models
variable and it contains anything that has been instantiated in a model that isn't a parameter or RealInput
or a RealOutput
(or boolean
). So while it makes sense to rename subclasses
as models
, it might require renaming the models
as it exists now to something else.
Thanks Anand
@anandkp92 : So a blockInput
is a connector
in Modelica (https://specification.modelica.org/master/connectors-and-connections.html)? Maybe it would be clearer to call is connector
because what is now called a blockInput
can also be used as an input to a model
. We could make a connector
, and then specify its class, e.g., Buildings.Controls.OBC...RealInput
. This way, connector
can also be used for Modelica mode, in which case its class may be ...HeatPort_a
or ....FluidPort_a
.
I think renaming models
to class
would be clearer because the way it is now, a Modelica block
is a jsonmodel
, but in Modelica, a block
and a model
are not the same. (A model
can have acausal connectors, while a block
can only have inputs and outputs.)
Updated data model:
{
'modelicaFile': modelicaFile,
'within': within,
'topClassName': className,
'comment': commentText,
'defaultName': defaultName,
'public': {
'parameters': pubParameters,
'discretes': pubDiscretes, // NEW
'constants': pubConstants, // NEW
'classes': pubClasses, // UPDATED
'connectors': pubConnectors, // NEW
'connectorOutputs': pubConnectorOutputs, // NEW
'inputs': pubInputs, // UPDATED
'outputs': pubOutputs, // UPDATED
'subModels': pubSubModels // NEW
},
'protected': {
'parameters': proParameters,
'discretes': proDiscretes, // NEW
'constants': proConstants, // NEW
'classes': proClasses, // UPDATED
'connectors': proConnectors, // NEW
'inputs': proInputs, // UPDATED
'outputs': proOutputs, // UPDATED
'subModels': pubSubModels // NEW
},
'extends': extModels,
'annotations': { //NEW
'vendorAnnotation': 'vendorAnnotation', //UPDATED
'experimentAnnotation': experimentAnnotation, //NEW
'otherAnnotation': otherAnnotation //NEW
}
'info': info,
'icon': icon,
'diagram': diagram,
'initial_equations': { // NEW
'equations': equations, // NEW
'connections': connections, // NEW
},
'equations': { // UPDATED
'equations': equations, // UPDATED
'connections': connections, // UPDATED
},
'initial_algorithms': initial_algorithms // NEW
'algorithms': algorithms // NEW
}
@mwetter @JayHuLBL @AntoineGautier: requesting your feedback
One issue I still see is the confusion with classes
v/s subModels
. If there is a block
defined within a model, would that be a subModel
or a classs
or a separate subBlock
?
@anandkp92 : That would be a class definition. Block, model, record, package, function are all a class, each with certain restrictions. There is no formal notion of a subclass in Modelica. What we often have is
protected
block ...
which is simply a block, but it is only visible in the class that declares it because it is protected.
current model:
updated model: