The Sims standard library
These components are available with Sims.Lib.
Normal usage is:
using Sims
using Sims.Lib
# modeling...Library components include models for:
Electrical circuits
Power system circuits
Heat transfer
Rotational mechanics
Most of the components mimic those in the Modelica Standard Library.
The main types for Unknowns and signals defined in Sims.Lib include:
| | Flow/through variable | Node/across variable | Node helper type | | –––––––––- | ––––––––––- | –––––––––– | –––––––– | | Electrical systems | Current | Voltage | ElectricalNode | | Heat transfer | HeatFlow | Temperature | HeatPort | | Mechanical rotation | Torque | Angle | Flange |
Each of the node-type variables have a helper type for quantities that can be Unknowns or objects. For example, the type ElectricalNode is a Union type that can be a Voltage or a number. ElectricalNode is often used as the type for arguments to model functions to allow passing a Voltage node or a real value (like 0.0 for ground).
The type Signal is also often used for a quantity that can be an Unknown or a concrete value.
Most of the types and functions support Unknowns holding array values, and some support complex values.
Basic types
NumberOrUnknown
Sims.Lib.NumberOrUnknown — Constant.NumberOrUnknown{T,C} is a typealias for Union{AbstractArray, Number, MExpr, RefUnknown{T}, Unknown{T,C}}.
Can be an Unknown, an AbstractArray, a Number, or an MExpr. Useful where an object can be either an Unknown of a particular type or a real value, especially for use as a type in a model argument. It may be parameterized by an UnknownCategory, like NumberOrUnknown{UVoltage} (the definition of an ElectricalNode).
Signal
Sims.Lib.Signal — Constant.Signal is a typealias for NumberOrUnknown{DefaultUnknown}.
Can be an Unknown, an AbstractArray, a Number, or an MExpr.
Electrical types
UVoltage
Sims.Lib.UVoltage — Type.An UnknownCategory for electrical potential in volts.
UCurrent
Sims.Lib.UCurrent — Type.An UnknownCategory for electrical current in amperes.
ElectricalNode
Sims.Lib.ElectricalNode — Constant.ElectricalNode is a typealias for NumberOrUnknown{UVoltage,Normal}.
An electrical node, either a Voltage (an Unknown) or a real value. Can include arrays or complex values. Used commonly as a model arguments for nodes. This allows nodes to be Unknowns or fixed values (like a ground that's zero volts).
Voltage
Sims.Lib.Voltage — Type.Voltage is a typealias for Unknown{UVoltage,Normal}.
Electrical potential with units of volts. Used as nodes and potential differences between nodes.
Often used with ElectricalNode as a model argument.
Current
Sims.Lib.Current — Type.Current is a typealias for Unknown{UCurrent,Normal}.
Electrical current with units of amperes. A flow variable.
Thermal types
UHeatPort
Sims.Lib.UHeatPort — Type.An UnknownCategory for temperature in kelvin.
UTemperature
Sims.Lib.UTemperature — Type.An UnknownCategory for temperature in kelvin.
UHeatFlow
Sims.Lib.UHeatFlow — Type.An UnknownCategory for heat flow rate in watts.
HeatPort
Sims.Lib.HeatPort — Constant.HeatPort is a typealias for NumberOrUnknown{UHeatPort,Normal}.
A thermal node, either a Temperature (an Unknown) or a real value. Can include arrays. Used commonly as a model arguments for nodes. This allows nodes to be Unknowns or fixed values.
HeatFlow
Sims.Lib.HeatFlow — Type.HeatFlow is a typealias for Unknown{UHeatFlow,Normal}.
Heat flow rate in units of watts.
Temperature
Sims.Lib.Temperature — Type.Temperature is a typealias for Unknown{UHeatPort,Normal}.
A thermal potential, a Temperature (an Unknown) in units of kelvin.
Rotational types
UAngle
Sims.Lib.UAngle — Type.An UnknownCategory for rotational angle in radians.
UTorque
Sims.Lib.UTorque — Type.An UnknownCategory for torque in newton-meters.
Angle
Sims.Lib.Angle — Type.Angle is a typealias for Unknown{UAngle,Normal}.
The angle in radians.
Torque
Sims.Lib.Torque — Type.Torque is a typealias for Unknown{UTorque,Normal}.
The torque in newton-meters.
UAngularVelocity
Sims.Lib.UAngularVelocity — Type.An UnknownCategory for angular velocity in radians/sec.
AngularVelocity
Sims.Lib.AngularVelocity — Type.AngularVelocity is a typealias for Unknown{UAngularVelocity,Normal}.
The angular velocity in radians/sec.
UAngularAcceleration
Sims.Lib.UAngularAcceleration — Type.An UnknownCategory for angular acceleration in radians/sec^2.
AngularAcceleration
Sims.Lib.AngularAcceleration — Type.AngularAcceleration is a typealias for Unknown{UAngularAcceleration,Normal}.
The angular acceleration in radians/sec^2.
Flange
Sims.Lib.Flange — Constant.Flange is a typealias for NumberOrUnknown{UAngle,Normal}.
A rotational node, either an Angle (an Unknown) or a real value in radians. Can include arrays. Used commonly as a model argument for nodes. This allows nodes to be Unknowns or fixed values.