Metadata of the Engee Physical Modeling Language
|
Page in progress. |
Metadata in the Engee physical modeling language is used to describe the properties of parameters, variables, nodes, and other entities within physical component.
They do not directly affect mathematical equations, but they determine:
-
Units of measurement;
-
Text descriptions;
-
Display rules in the interface;
-
Grouping in the block settings window;
-
Priorities;
-
Access.
Therefore, metadata helps to make the component understandable and user-friendly in Engee.
Metadata syntax
Metadata is specified in square brackets after the name of a parameter, variable, or other construct. You can specify multiple fields at the same time.
@parameters [group = "Parameters"] begin
R = 1.0, [unit = "Ohm", description = "Resistance"]
v = 5.0, [unit = "V", description = "Voltage"]
end
In this example:
-
[group = "Parameters"]— metadata for the entire structure@parameters. They define that all the parameters inside this construct will be grouped in an interface called Parameters. -
[unit = "Ohm", description = "Resistance"]— metadata for a specific parameterR. The unit of measurement is indicated here (Ohm) and the description (Resistance). -
[unit = "V", description = "Voltage"]— metadata for a specific parameterv. The unit of measurement is indicated here (V) and the description (Voltage).
Thus, metadata can be set both at the level of the entire structure and for individual elements.
Units of measurement
Units of measurement are set as metadata unit and apply equally to @parameters and @variables.
@parameters begin
R = 1.0, [unit = "Ohm"]
end
@variables begin
i = 0.0, [unit = "A"]
v = 0.0, [unit = "V"]
end
Here:
-
Rset in ohms; -
v— in volts; -
i— in amperes.
Metadata keys and their purpose
The table below provides a list of supported metadata keys, their purpose, acceptable values, and usage examples.
| Key | Appointment | Acceptable values | Example |
|---|---|---|---|
|
Units of measurement. Supported designs:
|
A string indicating the unit of measurement (for example, |
|
|
The text description of the element. Supported designs:
|
Line. |
|
|
Grouping parameters/variables in the interface. Supported designs:
|
Line. By default:
|
|
|
Placing the item on a separate tab in the interface. Supported designs:
|
Line. By default |
|
|
The priority of the variable used during initialization. Supported designs:
|
|
|
|
Manage visibility and editing in the interface. Supported designs:
|
For |
|
|
Access level (determines whether a variable is accessible from the outside). Supported designs:
|
If the construction is declared inside the conditions |
|
|
Marking a variable as discrete event-driven. Supported designs:
|
|
|
|
Defines the role of a variable in port connections. Supported designs:
|
|
|
|
The appearance of the port. Supported designs:
|
By default You can also set the visual representation of the port in more detail.:
|
|
Features of working with metadata
-
Metadata can be set for the entire structure, as well as for individual elements. Individual metadata takes precedence. For example:
@parameters [group = "Main", gui = Modify] begin R = 1.0, [unit = "Ohm", group = "Electrical"] debug_param = 0.0, [gui = Observe] endHere for the parameter
Rthe group will be used"Electrical"instead of inherited"Main", and fordebug_param— display modeObserveinstead of inheritedModify. -
Metadata
priorityandunitcan be passed when creating a sub-component:@components begin custom = CustomComponent(a = (value = 10, unit = "kg/s", priority = "high"), c = 20) end -
If the metadata is not explicitly specified, the default values specified in the component are applied.
-
Metadata
guiyou can change it conditionally using the construction@annotations:@parameters begin a::Bool = true b = 1, [gui = None] end if a @annotations begin b, [gui = Modify] end endIn this example, the metadata behavior depends on the parameter value.
a:-
If
a = false, then the parameterbhidden in the interface (gui = None), -
If
a = true, then the parameterbdisplayed (gui = Modify).
-
