Ports of the Engee Physical Modeling Language
In the Engee physics modeling language, ports are interfaces through which the physical component interacts with other blocks of the model. The following data can be transmitted through the port:
-
Physical quantities (voltage, pressure, temperature);
-
Control signals (for example, numerical coefficients).
Ports of physical components (as well as the entire library Physical Modeling) can only be connected to other blocks of physical modeling of the same domain (for example, a port of translational mechanics with a port of translational mechanics of another block).
Types of ports
There are two types of ports in the Engee physical modeling language:
-
Non-directional ports (
@nodes) — are used to describe physical connections. They do not have a strict division into "entrance" and "exit": the flow can flow in any direction. They are used to model real physical domains, for example:-
Electricity (voltage and current);
-
Translational mechanics (speed and force);
-
Heat (temperature and heat flow).
-
-
Directional ports (
@inputs,@outputs) — are used to transmit signals. They always have a set direction: entrance (@inputs) or exit (`@outputs`Such ports are most often used in control units where control or calculated values need to be transmitted.
Non-directional ports
Inside the component, such ports are declared via the construct @nodes.
@engeemodel Resistor begin
@parameters begin
R = 1.0, [unit = "Ohm"]
end
@nodes begin
p = EngeePhysicalFoundation.Electrical.Pin
n = EngeePhysicalFoundation.Electrical.Pin
end
@variables begin
v = 0.0, [unit = "V"]
i = 0.0, [unit = "A"]
end
@branches begin
i:(p.i, n.i)
end
@equations begin
v ~ p.v - n.v
v ~ R * i
end
end
Here:
-
@nodes— adds two electrical portspandn; -
@branches— formulates the rule of current conservation in the branch; -
@equations— sets Ohm’s law: the voltage across the resistor is equal to the product of resistance and current.
The following are the built-in Engee types of non-directional ports. Use these ports to connect your component to blocks from the Engee library.
| Physical domain | Type of port |
|---|---|
Single-phase electricity |
|
Three-phase electricity |
|
Magnetism |
|
Heat |
|
Translational mechanics |
|
Rotational mechanics |
|
Isothermal liquid |
|
Heat-conducting liquid |
|
Gas |
|
Humid air |
|
Source of humidity and impurity gases |
|
Directional ports
Signal inputs and outputs are announced through constructions @inputs and @outputs.
@engeemodel GainBlock begin
@parameters begin
k = 2.0
end
@inputs begin
x = 0
end
@outputs begin
y = 0
end
@equations begin
y.u ~ k * x.u
end
end
Here:
-
The directed ports contain a variable
u, which represents the value of the signal; -
In the equations, you do not need to use the port itself, but a variable.
uInside it:x.ufor the input signal,y.ufor the weekend; -
The input signal
x.umultiplied by the coefficientk; -
The result is transmitted to the output signal
y.u.
Such ports are convenient for mixed models, where some elements work with physical quantities, and some with control signals.
Potential and streaming variables in non-directional ports
Each non-directional port has two types of associated variables:
-
Potential — values that are equated when connecting ports (potential, temperature, pressure, velocity, angular velocity). They do not require any special marking.
-
Streaming (
connect = Flow) — the transfer values between the components (current, heat flow, flow rate, force, moment), the sum of which is zero for all connected ports.
Example of declaring an electrical port:
@engeeconnector Pin2 begin
@variables begin
v = 2.0 # потенциал (потенциальная переменная)
i = 0.0, [connect = Flow] # ток (потоковая переменная)
end
end
Here:
-
v— potential value (voltage); -
i— the flow value (current).