Domain API Reference
ModelingToolkitStandardLibrary.Mechanical.Rotational — Module
Library to model 1-dimensional, rotational mechanical systems
ModelingToolkitStandardLibrary.Mechanical.Rotational.AngleSensor — Method
AngleSensor(; name)Ideal sensor to measure the absolute flange angle
Connectors:
flange:FlangeFlange of shaft from which sensor information shall be measuredphi:RealOutputAbsolute angle of flange
ModelingToolkitStandardLibrary.Mechanical.Rotational.ConstantTorque — Method
ConstantTorque(; name, tau_constant, use_support = false)Constant torque source
State variables:
phi_support(t): [rad] Absolute angle of support flange, only available ifuse_support = truetau: Accelerating torque acting at flange (= -flange.tau)w: Angular velocity of flange with respect to support (= der(phi))
Connectors:
flangeFlange
Arguments:
tau_constant: The constant torque applied by the sourceuse_support: Whether or not an internal support flange is added. By default, it isfalse
ModelingToolkitStandardLibrary.Mechanical.Rotational.Damper — Method
Damper(; name, d)Linear 1D rotational damper
States:
phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi)w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel))a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel))tau(t): [N.m] Torque between flanges (= flange_b.tau)
Connectors:
Parameters:
d: [N.m.s/rad] Damping constant
ModelingToolkitStandardLibrary.Mechanical.Rotational.Fixed — Method
Fixed(;name, phi0 = 0.0)Flange fixed in housing at a given angle.
Connectors:
flangeFlange
Parameters:
phi0: [rad] Fixed offset angle of housing
ModelingToolkitStandardLibrary.Mechanical.Rotational.Flange — Method
Flange(; name)One-dimensional rotational flange of a shaft.
States
phi(t): [rad] Absolute rotation angle of the flange.tau(t): [N.m] Cut torque in the flange.
ModelingToolkitStandardLibrary.Mechanical.Rotational.IdealGear — Method
IdealGear(; name, ratio, use_support = false)Ideal gear without inertia.
This element characterizes any type of gear box which is fixed in the ground and which has one driving shaft and one driven shaft.
States:
phi_a(t): [rad] Relative angle between shaft a and the supportphi_b(t): [rad] Relative angle between shaft b and the support
Connectors:
Parameters:
ratio: Transmission ratio (flangea.phi/flangeb.phi)use_support: If support flange enabled, otherwise implicitly grounded. By default it isfalse
ModelingToolkitStandardLibrary.Mechanical.Rotational.Inertia — Method
Inertia(;name, J, phi = nothing, w = nothing, a = nothing)1D-rotational component with inertia.
States:
phi: [rad] Absolute rotation angle of componentw: [rad/s] Absolute angular velocity of component (= D(phi))a: [rad/s²] Absolute angular acceleration of component (= D(w))
Connectors:
Parameters:
J: [kg·m²] Moment of inertia
ModelingToolkitStandardLibrary.Mechanical.Rotational.Position — Method
Position(; name, exact = false, f_crit = 50, use_support = false)Forced movement of a flange according to a reference angle signal.
The input signal phi_ref defines the reference angle in [rad]. Flange is forced to move according to this reference motion relative to flange support. According to parameter exact (default = false), this is done in the following way:
exact=true: The reference angle is treated exactly. This is only possible if the input signal is defined by an analytical function that can be differentiated at least twice in order to compute the acceleration.exact=false: The reference angle is filtered and the second derivative of the filtered curve is used to compute the reference acceleration of the flange. This second derivative is not computed by numerical differentiation but by an appropriate realization of the filter. For filtering, a second-order Bessel filter is used. The critical frequency (also called cut-off frequency) of the filter is defined via parameterf_critin [Hz]. This value should be selected in such a way that it is higher than the essential low frequencies in the signal.
Connectors
flange::Flange: Flange to be movedphi_ref::RealInput: Reference angle of flange with respect to support
Variables
phi(t): Rotation angle of flange with respect to supportw(t): Ifexact=false, Angular velocity of flange with respect to supporta(t): Ifexact=false, Angular acceleration of flange with respect to support
Parameters
exact: (structural) true/false exact treatment/filtering the input signalf_crit: [Hz] ifexact=false, Critical frequency of filter to filter input signal
ModelingToolkitStandardLibrary.Mechanical.Rotational.RelSpeedSensor — Method
RelSpeedSensor(; name)Ideal sensor to measure the relative angular velocity
Connectors:
flange_a:FlangeFlange of shaft from which sensor information shall be measuredflange_b:FlangeFlange of shaft from which sensor information shall be measuredw:RealOutputAbsolute angular velocity of flange
ModelingToolkitStandardLibrary.Mechanical.Rotational.RotationalFriction — Method
RotationalFriction(; name, f, tau_c, w_brk, tau_brk)Models rotational friction with Stribeck effect, Coulomb friction and viscous friction between the two flanges. The friction torque is a function of the relative angular velocity between flange_a and flange_b.
Friction model: "Armstrong, B. and C.C. de Wit, Friction Modeling and Compensation, The Control Handbook, CRC Press, 1995."
States:
phi_rel(t): [rad] Relative rotation angle(= flange_b.phi - flange_a.phi)w_rel(t): [rad/s] Relative angular velocity(= D(phi_rel))a_rel(t): [rad/s²] Relative angular acceleration(= D(w_rel))tau(t): [N.m] Torque between flanges(= flange_b.tau)
Connectors:
Parameters:
f: [N⋅m/(rad/s)] Viscous friction coefficienttau_c: [N⋅m] Coulomb friction torquew_brk: [rad/s] Breakaway friction velocitytau_brk: [N⋅m] Breakaway friction torque
ModelingToolkitStandardLibrary.Mechanical.Rotational.Speed — Method
Speed(; name, use_support = false, exact = false, f_crit = 50)Forced movement of a flange according to a reference angular velocity signal
States:
phi_support(t): [rad] Absolute angle of support flange"
Connectors:
flangeFlangew_refRealInputReference angular velocity of flange with respect to support as input signal needs to be continuously differential
Parameters:
use_support: If support flange enabled, otherwise implicitly groundedexact: true/false exact treatment/filtering the input signaltau_filt: [rad/s] if exact=false, Time constant of low-pass filter to filter input signal
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpeedSensor — Method
SpeedSensor(; name)Ideal sensor to measure the absolute flange angular velocity
Connectors:
flange:FlangeFlange of shaft from which sensor information shall be measuredw:RealOutputAbsolute angular velocity of flange
ModelingToolkitStandardLibrary.Mechanical.Rotational.Spring — Method
Spring(; name, c, phi_rel0 = 0.0)Linear 1D rotational spring
States:
phi_rel(t): [rad] Relative rotation angle (flange_b.phi - flange_a.phi)tau(t): [N.m] Torque between flanges (flange_b.tau)
Connectors:
Parameters:
c: [N.m/rad] Spring constantphi_rel0: [rad] Unstretched spring angle. Defaults to 0.0.
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringDamper — Method
SpringDamper(; name, d)Linear 1D rotational spring and damper
States:
phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi)w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel))a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel))tau(t): [N.m] Torque between flanges (= flange_b.tau)
Connectors:
Parameters:
d: [N.m.s/rad] Damping constantc: [N.m/rad] Spring constantphi_rel0: [rad] Unstretched spring angle. Defaults to 0.0
ModelingToolkitStandardLibrary.Mechanical.Rotational.Support — Method
Support(; name)Support or housing of a one-dimensional rotational shaft.
States
phi(t): [rad] Absolute rotation angle of the support or housing.tau(t): [N.m] Cut torque in the support or housing.
ModelingToolkitStandardLibrary.Mechanical.Rotational.Torque — Method
Torque(; name, use_support = false)Input signal acting as external torque on a flange
States:
phi_support(t): [rad] Absolute angle of support flange
Connectors:
Parameters:
use_support
ModelingToolkitStandardLibrary.Mechanical.Rotational.TorqueSensor — Method
TorqueSensor(;name)Ideal sensor to measure the torque between two flanges (= flange_a.tau)
Connectors:
flange_a:FlangeLeft flange of shaftflange_b:FlangeLeft flange of shafttau:RealOutputTorque in flange flangea and flangeb (tau = flange_a.tau = -flange_b.tau)
ModelingToolkitStandardLibrary.Mechanical.Translational — Module
Library to model 1-dimensional, translational mechanical systems
ModelingToolkitStandardLibrary.Mechanical.Translational.Acceleration — Function
Acceleration(solves_force = true; name)
Linear 1D position input source. Set solves_force=false to force input force to 0 (i.e. only the acceleration is given, the respective force needed is already provided elsewhere in the model).
Connectors:
flange: 1-dim. translational flangea: real input
ModelingToolkitStandardLibrary.Mechanical.Translational.AccelerationSensor — Method
AccelerationSensor(; name)Linear 1D acceleration sensor.
States:
a: [m/s^2] measured acceleration
Connectors:
flange: 1-dim. translational flangeoutput: real output
ModelingToolkitStandardLibrary.Mechanical.Translational.Damper — Method
Damper(; name, d, flange_a.v = 0.0, flange_b.v = 0.0)Linear 1D translational damper
Parameters:
d: [N.s/m] Damping constant
Connectors:
flange_a: 1-dim. translational flange on one side of damper. Initial value of statevis set to 0.0 m/s.flange_b: 1-dim. translational flange on opposite side of damper. Initial value of statevis set to 0.0 m/s.
ModelingToolkitStandardLibrary.Mechanical.Translational.Fixed — Method
Fixed(; name)Fixes a flange position (velocity = 0)
Connectors:
flange: 1-dim. translational flange
ModelingToolkitStandardLibrary.Mechanical.Translational.Force — Method
Force(; name)Linear 1D force input source
Connectors:
flange: 1-dim. translational flangef: real input
ModelingToolkitStandardLibrary.Mechanical.Translational.ForceSensor — Method
ForceSensor(; name)Linear 1D force sensor, measures the force between two flanges.
Connectors:
flange: 1-dim. translational flangeoutput: real output
ModelingToolkitStandardLibrary.Mechanical.Translational.Mass — Method
Mass(; name, m, g = 0)Sliding mass with inertia
Parameters:
m: [kg] mass of sliding bodyg = 0: [m/s^2] [m/s²] gravity field acting on the mass, positive value acts in the positive direction
States:
v: [m/s] absolute linear velocity of sliding masss: [m] absolute position of sliding mass (optional with parameter s)
Connectors:
flange: 1-dim. translational flange
ModelingToolkitStandardLibrary.Mechanical.Translational.MechanicalPort — Method
MechanicalPort(; name)One-dimensional translational mechanical port.
States
v(t): [m/s] Velocity of the node.f(t): [N] Force entering the node.
ModelingToolkitStandardLibrary.Mechanical.Translational.Position — Function
Position(solves_force = true; name)Linear 1D position input source. Set solves_force=false to force input force to 0 (i.e. only the position is given, the respective force needed is already provided elsewhere in the model).
Connectors:
flange: 1-dim. translational flanges: real input
ModelingToolkitStandardLibrary.Mechanical.Translational.PositionSensor — Method
PositionSensor(; s = 0, name)Linear 1D position sensor.
States:
s: [m] absolute position (with initial value of 0.0)
Connectors:
flange: 1-dim. translational flangeoutput: real output
ModelingToolkitStandardLibrary.Mechanical.Translational.Spring — Method
Spring(; name, k, delta_s = 0.0, va=0.0, v_b_0=0.0)Linear 1D translational spring
Parameters:
k: [N/m] Spring constantdelta_s: initial spring stretchva: [m/s] Initial value of absolute linear velocity at flange_a (default 0 m/s)v_b_0: [m/s] Initial value of absolute linear velocity at flange_b (default 0 m/s)
Connectors:
flange_a: 1-dim. translational flange on one side of springflange_b: 1-dim. translational flange on opposite side of spring
ModelingToolkitStandardLibrary.Mechanical.Translational.Velocity — Function
Velocity(solves_force = true; name)Linear 1D position input source. Set solves_force=false to force input force to 0 (i.e. only the velocity is given, the respective force needed is already provided elsewhere in the model).
Connectors:
flange: 1-dim. translational flangev: real input
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica — Module
Library to model 1-dimensional, translational mechanical components.
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Damper — Method
Damper(; name, d = 0.0)Linear 1D translational damper
Parameters:
d: [N.s/m] Damping constant
Connectors:
flange_a: 1-dim. translational flange on one side of damperflange_b: 1-dim. translational flange on opposite side of damper
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Fixed — Method
Fixed(; name, s0 = 0.0)Flange fixed in housing at a given position.
Parameters:
s0: [m] Fixed offset position of housing
Connectors:
flange: 1-dim. translational flange
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Flange — Method
Flange(; name)One-dimensional translational flange.
States
s(t): [m] Absolute position of the flange.f(t): [N] Cut force into the flange.
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Force — Method
Force(; name, use_support = false)Input signal acting as external force on a flange
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Mass — Method
Mass(; name, m, s, v = 0.0)Sliding mass with inertia
Parameters:
m: [kg] Mass of sliding mass
States:
s: [m] Absolute position of sliding mass. It accepts an initial value, which defaults to 0.0.v: [m/s] Absolute linear velocity of sliding mass (= D(s)). It accepts an initial value, which defaults to 0.0.
Connectors:
flange: 1-dim. translational flange of mass
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Position — Method
Position(; name, exact = false, f_crit = 50)Forced movement of a flange according to a reference position
The input signal s_ref defines the reference position in [m]. Flange flange is forced to move relative to the support connector according to this reference motion. According to parameter exact, this is done in the following way:
exact=true: The reference position is treated exactly. This is only possible, if the input signal is defined by an analytical function which can be differentiated at least twice. If this prerequisite is fulfilled, the Modelica translator will differentiate the input signal twice in order to compute the reference acceleration of the flange.exact=false: The reference position is filtered and the second derivative of the filtered curve is used to compute the reference acceleration of the flange. This second derivative is not computed by numerical differentiation but by an appropriate realization of the filter. For filtering, a second order Bessel filter is used. The critical frequency (also called cut-off frequency) of the filter is defined via parameterf_critin [Hz]. This value should be selected in such a way that it is higher as the essential low frequencies in the signal.
The input signal can be provided from one of the signal generator blocks of the block library Blocks.Sources.
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.Spring — Method
Spring(; c= 0.0, name, s_rel0 = 0)Linear 1D translational spring
Parameters:
c: [N/m] Spring constants_rel0: Unstretched spring length
Connectors:
flange_a: 1-dim. translational flange on one side of springflange_b: 1-dim. translational flange on opposite side of spring#default function
ModelingToolkitStandardLibrary.Mechanical.TranslationalModelica.SpringDamper — Method
SpringDamper(; name, c = 0.0, d = 0.0, s_rel0 = 0.0)Linear 1D translational spring and damper in parallel
Parameters:
c: [N/m] Spring constantd: [N.s/m] Damping constants_rel0: Unstretched spring length
Connectors:
flange_a: 1-dim. translational flange on one side of springflange_b: 1-dim. translational flange on opposite side of spring
Variables:
lossPower: [W] Power dissipated by the damperf: [N] Total force
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition — Module
Library to model 1-dimensional, translational mechanical components.
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.AccelerationSensor — Method
AccelerationSensor(; name)Linear 1D acceleration sensor.
States:
a: [m/s^2] measured acceleration
Connectors:
flange: 1-dim. translational flangeoutput: real output
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.Damper — Method
Damper(; name, d, va =0.0, vb = 0.0, flange_a.s = 0, flange_b.s = 0)Linear 1D translational damper
Parameters:
d: [N.s/m] Damping constantflange_a__s: [m] Initial value of absolute position of flange_aflange_b__s: [m] Initial value of absolute position of flange_b
Connectors:
flange_a: 1-dim. translational flange on one side of damperflange_b: 1-dim. translational flange on opposite side of damper
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.Fixed — Method
Fixed(;name, s_0=0.0)Flange fixed in housing at a given position.
Parameters:
s_0: [m] Fixed offset position of housing
Connectors:
flange: 1-dim. translational flange
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.Flange — Method
Flange(; name)One-dimensional translational flange.
States
s(t): [m] Absolute position of the flange.f(t): [N] Cut force into the flange.
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.Force — Method
Force(; name, use_support = false)Input signal acting as external force on a flange
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.ForceSensor — Method
ForceSensor(; name)Linear 1D force sensor, measures the force between two flanges.
Connectors:
flange_a: 1-dim. translational flangeflange_b: 1-dim. translational flangeoutput: real output
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.Mass — Method
Mass(; name, m, s = 0.0, v = 0.0)Sliding mass with inertia
Parameters:
m: [kg] Mass of sliding masss_0: [m] Initial value of absolute position of sliding massv_0: [m/s] Initial value of absolute linear velocity of sliding mass
States:
s: [m] Absolute position of sliding massv: [m/s] Absolute linear velocity of sliding mass (= der(s))
Connectors:
flange: 1-dim. translational flange of mass
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.PositionSensor — Method
PositionSensor(; s = 0, name)Linear 1D position sensor.
States:
s: [m] absolute position (with initial value of 0.0)
Connectors:
flange: 1-dim. translational flangeoutput: real output
ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition.Spring — Method
Spring(; name, k, l=0)Linear 1D translational spring
Parameters:
k: [N/m] Spring constantl: Unstretched spring length
Connectors:
flange_a: 1-dim. translational flange on one side of springflange_b: 1-dim. translational flange on opposite side of spring#default function
ModelingToolkitStandardLibrary.Thermal — Module
Library of thermal system components to model heat transfer.
ModelingToolkitStandardLibrary.Thermal.BodyRadiation — Method
BodyRadiation(; name, G)Lumped thermal element for radiation heat transfer.
States:
dT: [K] Temperature difference across the component a.T - b.TQ_flow: [W] Heat flow rate from port a -> port b
Connectors:
port_aport_b
Parameters:
G: [m^2] Net radiation conductance between two surfaces # Stefan-Boltzmann constant TODO: extract into physical constants module or use existing one
ModelingToolkitStandardLibrary.Thermal.ConvectiveConductor — Method
ConvectiveConductor(; name, G)Lumped thermal element for heat convection.
States:
dT: [K] Temperature difference across the componentsolid.T-fluid.TQ_flow: [W] Heat flow rate fromsolid->fluid
Connectors:
solidfluid
Parameters:
G: [W/K] Convective thermal conductance
ModelingToolkitStandardLibrary.Thermal.ConvectiveResistor — Method
ConvectiveResistor(; name, R)Lumped thermal element for heat convection.
States:
dT: [K] Temperature difference across the componentsolid.T-fluid.TQ_flow: [W] Heat flow rate fromsolid->fluid
Connectors:
solidfluid
Parameters:
R: [K/W] Constant thermal resistance of material
ModelingToolkitStandardLibrary.Thermal.Element1D — Method
Element1D(; name, dT_guess = 0.0, Q_flow_guess = 0.0)This partial model contains the basic connectors and variables to allow heat transfer models to be created that do not store energy. This model defines and includes equations for the temperature drop across the element, dT, and the heat flow rate through the element from port_a to port_b, Q_flow.
States:
dT: [K] Temperature difference across the component a.T - b.T (algebraically constrained).Q_flow: [W] Heat flow rate from port a -> port b (algebraically constrained).
Connectors:
port_aport_b
ModelingToolkitStandardLibrary.Thermal.FixedHeatFlow — Method
FixedHeatFlow(; name, Q_flow = 1.0, T_ref = 293.15, alpha = 0.0)Fixed heat flow boundary condition.
This model allows a specified amount of heat flow rate to be "injected" into a thermal system at a given port. The constant amount of heat flow rate Q_flow is given as a parameter. The heat flows into the component to which the component FixedHeatFlow is connected, if parameter Q_flow is positive.
Connectors:
port
Parameters:
Q_flow: [W] Fixed heat flow rate at portT_ref: [K] Reference temperaturealpha: [1/K] Temperature coefficient of heat flow rate
ModelingToolkitStandardLibrary.Thermal.FixedTemperature — Method
FixedTemperature(; name, T)Fixed temperature boundary condition in kelvin.
This model defines a fixed temperature T at its port in kelvin, i.e., it defines a fixed temperature as a boundary condition.
Connectors:
port
Parameters:
T: [K] Fixed temperature boundary condition
ModelingToolkitStandardLibrary.Thermal.HeatCapacitor — Method
HeatCapacitor(; name, C, T = 273.15 + 20)Lumped thermal element storing heat
States:
T: [K] Temperature of element. It accepts an initial value, which defaults to 273.15 + 20.der_T: [K/s] Time derivative of temperature
Connectors:
port
Parameters:
C: [J/K] Heat capacity of element (= cp*m)
ModelingToolkitStandardLibrary.Thermal.HeatFlowSensor — Method
HeatFlowSensor(; name)Heat flow rate sensor.
This model is capable of monitoring the heat flow rate flowing through this component. The sensed value of heat flow rate is the amount that passes through this sensor while keeping the temperature drop across the sensor zero. This is an ideal model, so it does not absorb any energy, and it has no direct effect on the thermal response of a system it is included in. The output signal is positive, if the heat flows from port_a to port_b.
Connectors:
port_a:HeatPortThermal port from which sensor information shall be measuredport_b:HeatPortThermal port from which sensor information shall be measuredQ_flow:RealOutput[W] Heat flow fromport_atoport_b
ModelingToolkitStandardLibrary.Thermal.HeatPort — Method
HeatPort(; name, T = nothing, T_guess = 293.15, Q_flow = nothing, Q_flow_guess = 0.0)Port for a thermal system.
Keyword Arguments
T_guess: [K] Initial temperature guess.Q_flow_guess: [W] Initial heat-flow guess.T: Default value for the temperature state.Q_flow: Default value for the heat-flow state.
ModelingToolkitStandardLibrary.Thermal.PrescribedHeatFlow — Method
PrescribedHeatFlow(; name, T_ref = 293.15, alpha = 0.0)Prescribed heat flow boundary condition.
This model allows a specified amount of heat flow rate to be "injected" into a thermal system at a given port. The amount of heat is given by the input signal Q_flow into the model. The heat flows into the component to which the component PrescribedHeatFlow is connected, if the input signal is positive. If parameter alpha is > 0, the heat flow is multiplied by 1 + alpha*(port.T - T_ref) in order to simulate temperature dependent losses (which are given a reference temperature T_ref).
Connectors:
portRealInputQ_flowInput for the heat flow
Parameters:
T_ref: [K] Reference temperaturealpha: [1/K] Temperature coefficient of heat flow rate
ModelingToolkitStandardLibrary.Thermal.PrescribedTemperature — Method
PrescribedTemperature(; name)This model represents a variable temperature boundary condition.
The temperature in kelvin is given as input signal to the RealInputT. The effect is that an instance of this model acts as an infinite reservoir, able to absorb or generate as much energy as required to keep the temperature at the specified value.
Connectors:
portRealInputTinput for the temperature
ModelingToolkitStandardLibrary.Thermal.RelativeTemperatureSensor — Method
RelativeTemperatureSensor(; name)Relative Temperature sensor.
The relative temperature port_a.T - port_b.T is determined between the two ports of this component and is provided as output signal in kelvin.
Connectors:
port_a:HeatPortThermal port from which sensor information shall be measuredport_b:HeatPortThermal port from which sensor information shall be measuredT:RealOutput[K] Relative temperaturea.T - b.T
ModelingToolkitStandardLibrary.Thermal.TemperatureSensor — Method
TemperatureSensor(; name)Absolute temperature sensor in kelvin.
This is an ideal absolute temperature sensor which returns the temperature of the connected port in kelvin as an output signal. The sensor itself has no thermal interaction with whatever it is connected to. Furthermore, no thermocouple-like lags are associated with this sensor model.
Connectors:
port:HeatPortThermal port from which sensor information shall be measuredT:RealOutput[K] Absolute temperature of port
ModelingToolkitStandardLibrary.Thermal.ThermalCollector — Method
ThermalCollector(; name, m = 1)Collects m heat flows
This is a model to collect the heat flows from m heatports to one single heatport.
States:
Connectors:
port_a1toport_amport_b
Parameters:
m: Number of heat ports (e.g. m=2:port_a1,port_a2)
ModelingToolkitStandardLibrary.Thermal.ThermalConductor — Method
ThermalConductor(; name, G)Lumped thermal element transporting heat without storing it.
States:
see Element1D
Connectors:
port_aport_b
Parameters:
G: [W/K] Constant thermal conductance of material
ModelingToolkitStandardLibrary.Thermal.ThermalResistor — Method
ThermalResistor(; name, R)Lumped thermal element transporting heat without storing it.
States:
dT: [K] Temperature difference across the component a.T - b.TQ_flow: [W] Heat flow rate from port a -> port b
Connectors:
port_aport_b
Parameters:
R: [K/W] Constant thermal resistance of material
ModelingToolkitStandardLibrary.Electrical — Module
Library of electrical models. This library contains electrical components to build up analog circuits.
ModelingToolkitStandardLibrary.Electrical.Capacitor — Method
Capacitor(; name, C, v)Creates an ideal capacitor. Initial voltage of capacitor can be set with v ([V])
States:
See OnePort
Connectors:
pPositive pinnNegative pin
Parameters:
C: [F] Capacitance
ModelingToolkitStandardLibrary.Electrical.Conductor — Method
Conductor(; name, G)Creates an ideal conductor.
States:
See OnePort
Connectors:
pPositive pinnNegative pin
Parameters:
G: [S] Conductance
ModelingToolkitStandardLibrary.Electrical.Current — Method
Current(; name)Acts as an ideal current source with no internal resistance.
States:
See OnePort
Connectors:
pPositive pinnNegative pinIRealInputInput for the current control signal, i.e. `I ~ p.i
ModelingToolkitStandardLibrary.Electrical.CurrentSensor — Method
CurrentSensor(; name)Creates a circuit component that measures the current flowing through it. Analogous to an ideal ammeter.
States:
i(t): [A] Current through the sensor
Connectors:
pPositive pinnNegative pin
ModelingToolkitStandardLibrary.Electrical.Diode — Method
Diode(; name, Is = 1e-6, n = 1, T = 300.15, T_dep = false)Generic diode with optional temperature dependency.
States
- See [`OnePort`](@ref)Connectors
- `p` Positive pin
- `n` Negative pin
- `port` [`HeatPort`](@ref) (only if `T_dep = true`) Heat port to model variable temperature dependencyParameters:
- `Is`: [`A`] Saturation current
- `n`: Ideality factor
- `T`: [K] Constant ambient temperature - only used if T_dep=false
- `T_dep`: [bool] Temperature dependencyModelingToolkitStandardLibrary.Electrical.EMF — Method
EMF(; name, k)Electromotoric force (electric/mechanic transformer)
States
v(t): [V] The voltage across componentp.v - n.vi(t): [A] The current passing through positive pinphi: [rad] Rotation angle (=flange.phi - support.phi)w: [rad/s] Angular velocity (= der(phi))
Connectors
pPinPositive pinnPinNegative pinflangeFlangeShaft of EMF shaftsupportSupportSupport/housing of emf shaft
Parameters:
k: [N⋅m/A] Transformation coefficient
ModelingToolkitStandardLibrary.Electrical.Ground — Method
Ground(; name)Ground node with the potential of zero and connector g. Every circuit must have one ground node.
Connectors:
g
ModelingToolkitStandardLibrary.Electrical.IdealOpAmp — Method
IdealOpAmp(; name)Ideal operational amplifier (norator-nullator pair). The ideal OpAmp is a two-port. The left port is fixed to v1 = 0 and i1 = 0 (nullator). At the right port both any voltage v2 and any current i2 are possible (norator).
States:
See ModelingToolkitStandardLibrary.Magnetic.FluxTubes.TwoPort.
Connectors:
p1Positive pin (left port)p2Positive pin (right port)n1Negative pin (left port)n2Negative pin (right port)
ModelingToolkitStandardLibrary.Electrical.Inductor — Method
Inductor(; name, L, i)Creates an ideal Inductor. Initial current through inductor can be set with i ([A]).
States:
See OnePort
Connectors:
pPositive pinnNegative pin
Parameters:
L: [H] Inductance
ModelingToolkitStandardLibrary.Electrical.MultiSensor — Method
MultiSensor(; name)
Combines a VoltageSensor and a CurrentSensor.
States:
v(t): [V] The voltage across theVoltageSensor. Defaults to 1.0.i(t): [A] The current across theCurrentSensor. Defaults to 1.0.
Connectors:
pcCorresponds to theppin of theCurrentSensorncCorresponds to thenpin of theCurrentSensorpvCorresponds to theppin of theVoltageSensornvCorresponds to thenpin of theVoltageSensor
ModelingToolkitStandardLibrary.Electrical.NMOS — Method
NMOS(;name, V_tn, R_DS, lambda)Creates an N-type MOSFET transistor
# Structural Parameters
- `use_transconductance`: If `true` the parameter `k_n` needs to be provided, and is used in the calculation of the current
through the transistor. Otherwise, `mu_n`, `C_ox`, `W`, and `L` need to be provided and are used to calculate the transconductance.
- `use_channel_length_modulation`: If `true` the channel length modulation effect is taken in to account. In essence this gives
the drain-source current has a small dependency on the drains-source voltage in the saturation region of operation.
# Connectors
- `d` Drain Pin
- `g` Gate Pin
- `s` Source Pin
# Parameters
- `mu_n`: Electron mobility
- `C_ox`: Oxide capacitance (F/m^2)
- `W`: Channel width (m)
- `L`: Channel length
- `k_n`: MOSFET transconductance parameterBased on the MOSFET models in (Sedra, A. S., Smith, K. C., Carusone, T. C., & Gaudet, V. C. (2021). Microelectronic circuits (8th ed.). Oxford University Press.)
ModelingToolkitStandardLibrary.Electrical.NPN — Method
NPN(;name, B_F, B_R, Is, V_T, V_A, phi_C, phi_E, Z_C, Z_E, Tau_f, Tau_r, C_jC0, C_jE0, C_CS, gamma_C, gamma_E, NF, NR)Creates an NPN Bipolar Junction Transistor following a modified Ebers-Moll model. Includes an optional substrate pin and optional Early voltage effect.
# Structural Parameters
- `use_substrate`: If `true`, a substrate pin connector is available. If `false` it is
assumed the substrate is connected to the collector pin.
- `use_Early`: If `true`, the Early effect is modeled, which takes in to account the effect
collector-base voltage variations have on the collector-base depletion region. In many cases this
effectively means that the collector current has a dependency on the collector-emitter voltage.
- `use_advanced_continuation`: When false, the `C_jC` and `C_jE` non-linear capacitance curves use
a simplified linear continuation starting when `V_BC` and `V_BE` are 0, respectively. If `true`, the `Z_C` and `Z_E` parameters
are used to start the linear continuation at `Phi_C - Z_C` and `Phi_E - Z_E`.
# Connectors
- `b` Base Pin
- `c` Collector Pin
- `e` Emitter Pin
- `s` Substrate Pin, only available when `use_substrate = true`
# Parameters
- `B_F`: Forward beta
- `B_R`: Reverse beta
- `Is`: Saturation current
- `V_T`: Thermal voltage at 300K
- `V_A`: Inverse Early voltage
- `phi_C`: Collector junction exponent
- `phi_E`: Emitter junction exponent
- `Z_C`: Collector junction offset
- `Z_E`: Emitter junction offset
- `Tau_f`: Forward transit time
- `Tau_r`: Reverse transit time
- `C_jC0`: Collector junction capacitance coefficient
- `C_jE0`: Emitter junction capacitance coefficient
- `C_CS`: Collector-substrate capacitance
- `gamma_C`: Collector junction exponent
- `gamma_E`: Emitter junction exponent
- `NF`: Forward emission coefficient
- `NR`: Reverse emission coefficientModelingToolkitStandardLibrary.Electrical.OnePort — Method
OnePort(; name, v = nothing, i = nothing)Component with two electrical pins p and n and current i flows from p to n.
States:
v(t): [V] The voltage across componentp.v - n.vi(t): [A] The current passing through positive pin
Connectors:
pPositive pinnNegative pin
ModelingToolkitStandardLibrary.Electrical.PMOS — Method
PMOS(;name, V_tp, R_DS, lambda)Creates an N-type MOSFET transistor
# Structural Parameters
- `use_transconductance`: If `true` the parameter `k_p` needs to be provided, and is used in the calculation of the current
through the transistor. Otherwise, `mu_n`, `C_ox`, `W`, and `L` need to be provided and are used to calculate the transconductance.
- `use_channel_length_modulation`: If `true` the channel length modulation effect is taken in to account. In essence this gives
the drain-source current has a small dependency on the drains-source voltage in the saturation region of operation.
# Connectors
- `d` Drain Pin
- `g` Gate Pin
- `s` Source Pin
# Parameters
- `mu_p`: Electron mobility
- `C_ox`: Oxide capacitance (F/m^2)
- `W`: Channel width (m)
- `L`: Channel length
- `k_p`: MOSFET transconductance parameterBased on the MOSFET models in (Sedra, A. S., Smith, K. C., Carusone, T. C., & Gaudet, V. C. (2021). Microelectronic circuits (8th ed.). Oxford University Press.)
ModelingToolkitStandardLibrary.Electrical.PNP — Method
PNP(;name, B_F, B_R, Is, V_T, V_A, phi_C, phi_E, Z_C, Z_E, Tau_f, Tau_r, C_jC0, C_jE0, C_CS, gamma_C, gamma_E, NF, NR)Creates a PNP Bipolar Junction Transistor following a modified Ebers-Moll model. Includes an optional substrate pin and optional Early voltage effect.
# Structural Parameters
- `use_substrate`: If `true`, a substrate pin connector is available. If `false` it is
assumed the substrate is connected to the collector pin.
- `use_Early`: If `true`, the Early effect is modeled, which takes in to account the effect
collector-base voltage variations have on the collector-base depletion region. In many cases this
effectively means that the collector current has a dependency on the collector-emitter voltage.
- `use_advanced_continuation`: When false, the `C_jC` and `C_jE` non-linear capacitance curves use
a simplified linear continuation starting when `V_CB` and `V_EB` are 0, respectively. If `true`, the `Z_C` and `Z_E` parameters
are used to start the linear continuation at `Phi_C - Z_C` and `Phi_E - Z_E`.
# Connectors
- `b` Base Pin
- `c` Collector Pin
- `e` Emitter Pin
- `s` Substrate Pin, only available when `use_substrate = true`
# Parameters
- `B_F`: Forward beta
- `B_R`: Reverse beta
- `Is`: Saturation current
- `V_T`: Thermal voltage at 300K
- `V_A`: Inverse Early voltage
- `phi_C`: Collector junction exponent
- `phi_E`: Emitter junction exponent
- `Z_C`: Collector junction offset
- `Z_E`: Emitter junction offset
- `Tau_f`: Forward transit time
- `Tau_r`: Reverse transit time
- `C_jC0`: Collector junction capacitance coefficient
- `C_jE0`: Emitter junction capacitance coefficient
- `C_CS`: Collector-substrate capacitance
- `gamma_C`: Collector junction exponent
- `gamma_E`: Emitter junction exponent
- `NF`: Forward emission coefficient
- `NR`: Reverse emission coefficientModelingToolkitStandardLibrary.Electrical.Pin — Method
Pin(; name)A pin in an analog circuit.
States:
v(t): [V] The voltage at this pini(t): [A] The current passing through this pin
ModelingToolkitStandardLibrary.Electrical.PotentialSensor — Method
PotentialSensor(; name)
Creates a circuit component which measures the potential at a pin.
States:
phi(t): [V] The measured potential at this point
Connectors:
pPin at which potential is to be measured
ModelingToolkitStandardLibrary.Electrical.PowerSensor — Method
PowerSensor(; name)
Combines a VoltageSensor and a CurrentSensor to measure the power being consumed by a circuit.
States:
power(t): [W] The power being consumed, given by the product of voltage and current- See
VoltageSensor - See
CurrentSensor
Connectors:
pcCorresponds to theppin of theCurrentSensorncCorresponds to thenpin of theCurrentSensorpvCorresponds to theppin of theVoltageSensornvCorresponds to thenpin of theVoltageSensor
ModelingToolkitStandardLibrary.Electrical.Resistor — Method
Resistor(; name, R = 1.0, T_ref = 300.15, alpha = 0, T_dep = false)Generic resistor with optional temperature dependency.
States:
- See
OnePort R(t): [Ω] Resistance (temperature dependent ifT_dep = true)
Connectors:
pPositive pinnNegative pinheat_portHeatPort(only ifT_dep = true) Heat port to model the temperature dependency
Parameters:
R: [Ω] Reference resistanceT_ref: [K] Reference temperaturealpha: [K⁻¹] Temperature coefficient of resistanceT_dep: [bool] Temperature dependency
ModelingToolkitStandardLibrary.Electrical.Short — Method
Short(; name)Short is a simple short cut branch. That means the voltage drop between both pins is zero.
States:
See OnePort
Connectors:
pPositive pinnNegative pin
ModelingToolkitStandardLibrary.Electrical.VariableResistor — Method
VariableResistor(; name, R_ref = 1.0, T_ref = 300.15, R_const = 1e-3, T_dep = false)Variable resistor with optional temperature dependency.
The total resistance R ∈ [Rconst, Rconst + Rref], where pos is the position of the wiper and Rref is the variable resistance between p and n. The total resistance is then:
R = Rconst + pos * Rref
If T_dep is true, then R also depends on the temperature of the heat port with temperature coefficient alpha. The total resistance is then:
R = Rconst + pos * Rref * (1 + alpha * (port.T - T_ref))
States
- See [`OnePort`](@ref)
- `pos(t)`: Position of the wiper (normally 0-1)
- `R(t)`: ResistanceConnectors
- `p` Positive pin
- `n` Negative pin
- `position` RealInput to set the position of the wiper
- `port` [`HeatPort`](@ref) Heat port to model the temperature dependencyParameters
- `R_ref`: [`Ω`] Resistance at temperature T_ref when fully closed (pos=1.0)
- `T_ref`: [K] Reference temperature
- `R_const`: [`Ω`] Constant resistance between p and n
- `T_dep`: Temperature dependency
- `alpha`: [K⁻¹] Temperature coefficient of resistance
- `enforce_bounds`: Enforce bounds for the position of the wiper (0-1)ModelingToolkitStandardLibrary.Electrical.Voltage — Method
Voltage(; name)Acts as an ideal voltage source with no internal resistance.
States:
See OnePort
Connectors:
pPositive pinnNegative pinVRealInputInput for the voltage control signal, i.e.V ~ p.v - n.v
ModelingToolkitStandardLibrary.Electrical.VoltageSensor — Method
VoltageSensor(; name)
Creates a circuit component that measures the voltage across it. Analogous to an ideal voltmeter.
States:
v(t): [V] The voltage difference from positive to negative pinp.v - n.v
Connectors:
pPositive pinnNegative pin
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible — Module
Library to model iso-thermal compressible liquid fluid flow
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Actuator — Function
Actuator(N, add_inertia = true, reversible = false;
p_a_int,
p_b_int,
area_a,
area_b,
perimeter_a = 2 * sqrt(area_a * pi),
perimeter_b = 2 * sqrt(area_b * pi),
length_a_int,
length_b_int,
shape_factor_a = 64,
shape_factor_b = 64,
head_factor_a = 1,
head_factor_b = 1,
m,
g,
x_int = 0,
minimum_volume_a = 0,
minimum_volume_b = 0,
damping_volume_a = minimum_volume_a,
damping_volume_b = minimum_volume_b,
Cd = 1e4,
Cd_reverse = Cd,
p_a_int,
p_b_int,
name)Actuator made of two DynamicVolumes connected in opposite direction with body mass attached.
Features:
- volume discretization with flow resistance and inertia: use
Nto control number of volume and resistance elements. SetN=0to turn off volume discretization. SeeTubeBasefor more information about flow resistance. - minimum volume flow shutoff with damping and directional resistance. Use
reversible=falsewhen problem defines volume positionxand solves fordmto prevent numerical instability.
Parameters:
volume
p_a_int: [Pa] initial pressure forport_ap_b_int: [Pa] initial pressure forport_barea_a: [m^2] moving wall area of volumeAarea_b: [m^2] moving wall area of volumeBlength_a_int: [m] initial wall position forAlength_b_int: [m] initial wall position forb
mass
m: [kg] mass of the bodyg: [m/s²] gravity field acting on the mass, positive value acts in the positive directionx_int: [m] initial flange position
flow resistance
perimeter_a: [m] perimeter of the cross sectionA(needed only for non-circular volumes)perimeter_b: [m] perimeter of the cross sectionB(needed only for non-circular volumes)shape_factor_a: shape factor ofA, seefriction_factorfunctionshape_factor_b: shape factor ofB, seefriction_factorfunctionhead_factor_a: effective length multiplier forA, used to account for addition friction from flow development and additional friction such as pipe bends, entrance/exit lossses, etc.head_factor_b: effective length multiplier forB, used to account for addition friction from flow development and additional friction such as pipe bends, entrance/exit lossses, etc.
flow shut off and damping
minimum_volume_a: [m^3] minimum volumeAthat shuts off flow and prevents negative volume.minimum_volume_b: [m^3] minimum volumeBthat shuts off flow and prevents negative volume.damping_volume_a: [m^3] volume ofAthat initiates a linear damping region before reaching full flow shut off. Helps provide a smooth end stop.damping_volume_b: [m^3] volume ofBthat initiates a linear damping region before reaching full flow shut off. Helps provide a smooth end stop.Cd: discharge coefficient for flow out of the volume. Note: area is 1m² when valve is fully open. Ensure this does not induce unwanted flow resistance.Cd_reverse: discharge coefficient for flow into the volume. Use a lower value to allow easy wall release, in some cases the wall can "stick".
Connectors:
port_a: hydraulic portport_b: hydraulic portflange: mechanical translational port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Cap — Method
Cap(; name)Caps a hydraulic port to prevent mass flow in or out.
Connectors:
port: hydraulic port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.DynamicVolume — Function
DynamicVolume(reversible = false; p_int, area, x_int = 0, x_max, x_min = 0, x_damp = x_min, direction = +1, perimeter = 2 * sqrt(area * pi), shape_factor = 64, head_factor = 1, Cd = 1e2, Cd_reverse = Cd, name)Volume with moving wall with flange connector for converting hydraulic energy to 1D mechanical. The direction argument aligns the mechanical port with the hydraulic port, useful when connecting two dynamic volumes together in oppsing directions to create an actuator.
┌─────────────────┐ ───
│ │ ▲
│ │
dm ────► │ │ area
│ │
│ │ ▼
└─────────────────┤ ───
│
└─► x (= ∫ flange.v * direction)Features:
- minimum volume flow shutoff with damping and directional resistance. Use
reversible=falsewhen problem defines volume positionxand solves fordmto prevent numerical instability.
Parameters:
volume
p_int: [Pa] initial pressurearea: [m^2] moving wall areax_max: [m] max wall position, needed for volume discretization to apply the correct volume sizing as a function ofxx_min: [m] wall position that shuts off flow and prevents negative volume.x_damp: [m] wall position that initiates a linear damping region before reaching full flow shut off. Helps provide a smooth end stop.direction: [+/-1] applies the direction conversion from theflangetox
flow resistance
perimeter: [m] perimeter of the cross section (needed only for non-circular volumes)shape_factor: shape factor, seefriction_factorfunctionhead_factor: effective length multiplier, used to account for addition friction from flow development and additional friction such as pipe bends, entrance/exit lossses, etc.
flow shut off and damping
Cd: discharge coefficient for flow out of the volume. Note: area is 1m² when valve is fully open. Ensure this does not induce unwanted flow resistance.Cd_reverse: discharge coefficient for flow into the volume. Use a lower value to allow easy wall release, in some cases the wall can "stick".
Connectors:
port: hydraulic portflange: mechanical translational port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.FixedPressure — Method
FixedPressure(; p, name)Fixed pressure source
Parameters:
p: [Pa] set pressure (set bypargument)
Connectors:
port: hydraulic port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.FixedVolume — Method
FixedVolume(; p_int, vol, name)Fixed fluid volume.
Parameters:
p_int: [Pa] initial pressurevol: [m^3] fixed volume
Connectors:
port: hydraulic port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.FlowDivider — Method
FlowDivider(; n, name)Reduces the flow from port_a to port_b by n. Useful for modeling parallel tubes efficiently by placing a FlowDivider on each end of a tube.
Parameters:
n: divide flow fromport_atoport_bbyn
Connectors:
port_a: full flow hydraulic portport_b: part flow hydraulic port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.HydraulicFluid — Method
HydraulicFluid(; density = 997, bulk_modulus = 2.09e9, viscosity = 0.0010016, gas_density = 0.0073955, gas_pressure = -1000, n = 1, let_gas = 1, name)Fluid parameter setter for isothermal compressible fluid domain. Defaults given for water at 20°C and 0Pa gage (1atm absolute) reference pressure. Density is modeled using the Tait equation of state. For pressures below the reference pressure, density is linearly interpolated to the gas state (when let_gas is set to 1), this helps prevent pressures from going below the reference pressure.
Parameters:
ρ: [kg/m^3] fluid density at 0Pa reference gage pressure (set bydensityargument)Β: [Pa] fluid bulk modulus describing the compressibility (set bybulk_modulusargument)μ: [Pa*s] or [kg/m-s] fluid dynamic viscosity (set byviscosityargument)n: density exponentlet_gas: set to 1 to allow fluid to transition from liquid to gas (for density calculation only)ρ_gas: [kg/m^3] density of fluid in gas state at reference gage pressurep_gas(set bygas_densityargument)p_gas: [Pa] reference pressure (set bygas_pressureargument)
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.HydraulicPort — Method
HydraulicPort(; name)Connector port for hydraulic components.
States:
p: [Pa] gauge total pressuredm: [kg/s] mass flow
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.MassFlow — Method
MassFlow(; name)Hydraulic mass flow input source
Connectors:
port: hydraulic portdm: real input
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Open — Method
Open(; name)Provides an "open" boundary condition for a hydraulic port such that mass flow dm is non-zero. This is opposite from an un-connected hydraulic port or the Cap boundary component which sets the mass flow dm to zero.
Connectors:
port: hydraulic port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Pressure — Method
Pressure(; name)input pressure source
Connectors:
port: hydraulic portp: real input
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.SpoolValve — Function
SpoolValve(reversible = false; x_int, Cd, d, name)Spool valve with x valve opening input as mechanical flange port and d diameter of orifice. See Valve for more information.
Parameters:
x_int: [m] initial valve openingd: [m] orifice diameterCd: discharge coefficient flowing froma → b
Connectors:
port_a: hydraulic portport_b: hydraulic portflange: mechanical translational port
See Valve for more information.
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.SpoolValve2Way — Function
SpoolValve2Way(reversible = false; m, g, x_int, Cd, d, name)2-ways spool valve with 4 ports and spool mass. Fluid flow direction S → A and B → R when x is positive and S → B and A → R when x is negative.
Parameters:
m: [kg] mass of the spoolg: [m/s²] gravity field acting on the spool, positive value acts in the positive directionx_int: [m] initial valve openingd: [m] orifice diameterCd: discharge coefficient flowing froms → aandb → r
Connectors:
port_s: hydraulic portport_a: hydraulic portport_b: hydraulic portport_r: hydraulic portflange: mechanical translational port
See SpoolValve for more information.
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Tube — Function
Tube(N, add_inertia=true; p_int, area, length, head_factor=1, perimeter = 2 * sqrt(area * pi), shape_factor = 64, name)Constant length internal flow model discretized by N (FixedVolume: N, TubeBase:N-1) which models the fully developed flow friction, compressibility (when N>1), and inertia effects when add_inertia = true. See TubeBase and FixedVolume for more information.
Parameters:
p_int: [Pa] initial pressurearea: [m^2] tube cross sectional arealength: [m] real length of the tubeperimeter: [m] perimeter of the pipe cross section (needed only for non-circular pipes)shape_factor: shape factor, seefriction_factorfunctionhead_factor: effective length multiplier, used to account for addition friction from flow development and additional friction such as pipe bends, entrance/exit lossses, etc.
Connectors:
port_a: hydraulic portport_b: hydraulic port
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Valve — Function
Valve(reversible = false; p_a_int, p_b_int, area_int, Cd, Cd_reverse = Cd, minimum_area = 0, name)Valve with area input and discharge coefficient Cd defined by https://en.wikipedia.org/wiki/Dischargecoefficient. The `Cdreverse` parameter allows for directional flow restriction, making it possible to define a check valve.
Parameters:
p_a_int: [Pa] initial pressure forport_ap_b_int: [Pa] initial pressure forport_barea_int: [m^2] initial valve openingCd: discharge coefficient flowing froma → bCd_reverse: discharge coefficient flowing fromb → aminimum_area: whenreversible = falseapplies a forced minimum area
Connectors:
port_a: hydraulic portport_b: hydraulic portarea: real input setting the valvearea. Whenreversible = true, negative input reverses flow direction, otherwise a floor ofminimum_areais enforced.
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.Volume — Method
Volume(; x, dx=0, p, drho=0, dm=0, area, direction = 1, name)Volume with moving wall with flange connector for converting hydraulic energy to 1D mechanical. The direction argument aligns the mechanical port with the hydraulic port, useful when connecting two dynamic volumes together in oppsing directions to create an actuator.
┌─────────────────┐ ───
│ │ ▲
│ │
dm ────► │ │ area
│ │
│ │ ▼
└─────────────────┤ ───
│
└─► x (= ∫ flange.v * direction)Features:
- volume discretization with flow resistance and inertia: use
Nto control number of volume and resistance elements. SetN=0to turn off volume discretization. SeeTubeBasefor more information about flow resistance. - minimum volume flow shutoff with damping and directional resistance. Use
reversible=falsewhen problem defines volume positionxand solves fordmto prevent numerical instability.
Parameters:
volume
p: [Pa] initial pressurearea: [m^2] moving wall areax: [m] initial wall positiondx=0: [m/s] initial wall velocitydrho=0: [kg/m^3/s] initial density derivativedm=0: [kg/s] initial flowdirection: [+/-1] applies the direction conversion from theflangetox
Connectors:
port: hydraulic portflange: mechanical translational port
See also FixedVolume, DynamicVolume