From 4909f40af133f3bc61a428ec5caae4bb3dfd09c0 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Mon, 25 Mar 2024 15:10:52 +0000 Subject: [PATCH] build based on 211b17e --- dev/.documenter-siteinfo.json | 2 +- dev/API/blocks/index.html | 18 +- dev/API/electrical/index.html | 2 +- dev/API/hydraulic/index.html | 4 +- .../{4beb0d98.svg => 9457f203.svg} | 112 +++++------ .../{01e9a6f3.svg => 9ddbacac.svg} | 72 +++---- dev/API/linear_analysis/index.html | 16 +- dev/API/magnetic/index.html | 2 +- dev/API/mechanical/index.html | 2 +- dev/API/thermal/index.html | 2 +- dev/assets/Manifest.toml | 56 +++--- .../{a9a3019e.svg => 0f98397a.svg} | 128 ++++++------ .../{5ba0ab6b.svg => 2faa71a4.svg} | 128 ++++++------ .../{36d9ec33.svg => 758fda2b.svg} | 68 +++---- .../{e635af09.svg => 918c6aa3.svg} | 188 +++++++++--------- .../{861a5613.svg => c782995b.svg} | 56 +++--- .../{c9ef0a40.svg => cf3f0971.svg} | 84 ++++---- dev/connectors/connections/index.html | 12 +- dev/index.html | 27 +-- dev/tutorials/custom_component/index.html | 2 +- .../{87508734.svg => 5b698c11.svg} | 82 ++++---- .../{d0c422d0.svg => b1322da7.svg} | 128 ++++++------ .../{4778243c.svg => e73752b8.svg} | 72 +++---- dev/tutorials/dc_motor_pi/index.html | 6 +- dev/tutorials/input_component/index.html | 2 +- dev/tutorials/rc_circuit/index.html | 2 +- dev/tutorials/thermal_model/index.html | 2 +- 27 files changed, 641 insertions(+), 634 deletions(-) rename dev/API/linear_analysis/{4beb0d98.svg => 9457f203.svg} (87%) rename dev/API/linear_analysis/{01e9a6f3.svg => 9ddbacac.svg} (84%) rename dev/connectors/connections/{a9a3019e.svg => 0f98397a.svg} (89%) rename dev/connectors/connections/{5ba0ab6b.svg => 2faa71a4.svg} (89%) rename dev/connectors/connections/{36d9ec33.svg => 758fda2b.svg} (92%) rename dev/connectors/connections/{e635af09.svg => 918c6aa3.svg} (89%) rename dev/connectors/connections/{861a5613.svg => c782995b.svg} (85%) rename dev/connectors/connections/{c9ef0a40.svg => cf3f0971.svg} (91%) rename dev/tutorials/dc_motor_pi/{87508734.svg => 5b698c11.svg} (85%) rename dev/tutorials/dc_motor_pi/{d0c422d0.svg => b1322da7.svg} (85%) rename dev/tutorials/dc_motor_pi/{4778243c.svg => e73752b8.svg} (86%) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 22b0f7dfb..906b1551c 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-22T15:13:27","documenter_version":"1.3.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.2","generation_timestamp":"2024-03-25T15:10:46","documenter_version":"1.3.0"}} \ No newline at end of file diff --git a/dev/API/blocks/index.html b/dev/API/blocks/index.html index a45ef9a99..3949d8374 100644 --- a/dev/API/blocks/index.html +++ b/dev/API/blocks/index.html @@ -1,22 +1,22 @@ -Basic Blocks · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Blocks

Index

Utility Blocks

ModelingToolkitStandardLibrary.Blocks.RealOutputFunction
RealOutput(;name, nout, u_start)

Connector with one output signal of type Real.

Parameters:

  • nout=1: Number of outputs
  • u_start=0: Initial value for u

States:

  • u: Value of the connector; if nout=1 this is a scalar
source
ModelingToolkitStandardLibrary.Blocks.SISOConstant
SISO(;name, u_start = 0.0, y_start = 0.0)

Single input single output (SISO) continuous system block.

Parameters:

  • u_start: Initial value for the input
  • y_start: Initial value for the output
source

Math Blocks

ModelingToolkitStandardLibrary.Blocks.Add3Constant
Add(; name, k1 = 1.0, k2 = 1.0, k3 = 1.0)

Output the sum of the three scalar inputs.

Parameters:

  • k1: Gain for first input
  • k2: Gain for second input
  • k3: Gain for third input

Connectors:

  • input1
  • input2
  • input3
  • output
source

Source Blocks

ModelingToolkitStandardLibrary.Blocks.SineFunction
Sine(; name, frequency, amplitude = 1, phase = 0, offset = 0, start_time = 0,
-smooth = false)

Generate sine signal.

Parameters:

  • frequency: [Hz] Frequency of sine wave
  • amplitude: Amplitude of sine wave
  • phase: [rad] Phase of sine wave
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.CosineFunction
Cosine(; name, frequency, amplitude = 1, phase = 0, offset = 0, start_time = 0,
-smooth = false)

Generate cosine signal.

Parameters:

  • frequency: [Hz] Frequency of cosine wave
  • amplitude: Amplitude of cosine wave
  • phase: [rad] Phase of cosine wave
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.RampFunction

Ramp(; name, height = 1, duration = 1, offset = 0, start_time = 0, smooth = false)

Generate ramp signal.

Parameters:

  • height: Height of ramp
  • duration: [s] Duration of ramp (= 0.0 gives a Step)
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.StepFunction
Step(;name, height=1, offset=0, start_time=0, duration=Inf, smooth=true)

Generate step signal.

Parameters:

  • height: Height of step
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time and thereafter offset+height.
  • duration: [s] If duration < Inf is supplied, the output will revert to offset after duration seconds.
  • smooth: If true, returns a smooth wave. Defaults to true It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.ExpSineFunction
ExpSine(; name, frequency, amplitude = 1, damping = 0.1, phase = 0, offset = 0, start_time = 0, smooth = false)

Exponentially damped sine signal.

Parameters:

  • frequency: [Hz] Frequency of sine wave
  • amplitude: Amplitude of sine wave
  • damping: [1/s] Damping coefficient of sine wave
  • phase: [rad] Phase of sine wave
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source

Nonlinear Blocks

ModelingToolkitStandardLibrary.Blocks.DeadZoneConstant
DeadZone(; name, u_max, u_min = -u_max)

The DeadZone block defines a region of zero output. If the input is within u_min ... u_max, the output is zero. Outside of this zone, the output is a linear function of the input with a slope of 1.

       y▲
+Basic Blocks · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Blocks

Index

Utility Blocks

ModelingToolkitStandardLibrary.Blocks.RealOutputFunction
RealOutput(;name, nout, u_start)

Connector with one output signal of type Real.

Parameters:

  • nout=1: Number of outputs
  • u_start=0: Initial value for u

States:

  • u: Value of the connector; if nout=1 this is a scalar
source
ModelingToolkitStandardLibrary.Blocks.SISOConstant
SISO(;name, u_start = 0.0, y_start = 0.0)

Single input single output (SISO) continuous system block.

Parameters:

  • u_start: Initial value for the input
  • y_start: Initial value for the output
source

Math Blocks

ModelingToolkitStandardLibrary.Blocks.Add3Constant
Add(; name, k1 = 1.0, k2 = 1.0, k3 = 1.0)

Output the sum of the three scalar inputs.

Parameters:

  • k1: Gain for first input
  • k2: Gain for second input
  • k3: Gain for third input

Connectors:

  • input1
  • input2
  • input3
  • output
source

Source Blocks

ModelingToolkitStandardLibrary.Blocks.SineFunction
Sine(; name, frequency, amplitude = 1, phase = 0, offset = 0, start_time = 0,
+smooth = false)

Generate sine signal.

Parameters:

  • frequency: [Hz] Frequency of sine wave
  • amplitude: Amplitude of sine wave
  • phase: [rad] Phase of sine wave
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.CosineFunction
Cosine(; name, frequency, amplitude = 1, phase = 0, offset = 0, start_time = 0,
+smooth = false)

Generate cosine signal.

Parameters:

  • frequency: [Hz] Frequency of cosine wave
  • amplitude: Amplitude of cosine wave
  • phase: [rad] Phase of cosine wave
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.RampFunction

Ramp(; name, height = 1, duration = 1, offset = 0, start_time = 0, smooth = false)

Generate ramp signal.

Parameters:

  • height: Height of ramp
  • duration: [s] Duration of ramp (= 0.0 gives a Step)
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.StepFunction
Step(;name, height=1, offset=0, start_time=0, duration=Inf, smooth=true)

Generate step signal.

Parameters:

  • height: Height of step
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time and thereafter offset+height.
  • duration: [s] If duration < Inf is supplied, the output will revert to offset after duration seconds.
  • smooth: If true, returns a smooth wave. Defaults to true It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source
ModelingToolkitStandardLibrary.Blocks.ExpSineFunction
ExpSine(; name, frequency, amplitude = 1, damping = 0.1, phase = 0, offset = 0, start_time = 0, smooth = false)

Exponentially damped sine signal.

Parameters:

  • frequency: [Hz] Frequency of sine wave
  • amplitude: Amplitude of sine wave
  • damping: [1/s] Damping coefficient of sine wave
  • phase: [rad] Phase of sine wave
  • offset: Offset of output signal
  • start_time: [s] Output y = offset for t < start_time
  • smooth: If true, returns a smooth wave. Defaults to false It uses a default smoothing factor of δ=1e-5, but this can be changed by supplying smooth=δ.

Connectors:

  • output
source

Nonlinear Blocks

ModelingToolkitStandardLibrary.Blocks.DeadZoneConstant
DeadZone(; name, u_max, u_min = -u_max)

The DeadZone block defines a region of zero output. If the input is within u_min ... u_max, the output is zero. Outside of this zone, the output is a linear function of the input with a slope of 1.

       y▲
         │     /
         │    /
   u_min │   /
 ─────|──┼──|───────► u
     /   │   u_max
    /    │
-  /     │

Parameters:

  • u_max: Upper limit of dead zone
  • u_min: Lower limit of dead zone

Connectors:

  • input
  • output
source
ModelingToolkitStandardLibrary.Blocks.SlewRateLimiterConstant
SlewRateLimiter(; name, y_start, rising = 1.0, falling = -rising, Td = 0.001)

Limits the slew rate of a signal. Initial value of state Y can be set with int.y

Parameters:

  • rising: Maximum rising slew rate
  • falling: Maximum falling slew rate
  • Td: [s] Derivative time constant
  • y_start: Initial value of y state of SISO

Connectors:

  • input
  • output
source

Continuous Blocks

ModelingToolkitStandardLibrary.Blocks.IntegratorConstant
Integrator(;name, k = 1, x = 0.0)

Outputs y = ∫k*u dt, corresponding to the transfer function $1/s$. Initial value of integrator state $x$ can be set with x

Connectors:

  • input
  • output

Parameters:

  • k: Gain of integrator

Unknowns:

  • x: State of Integrator. Defaults to 0.0.
source
ModelingToolkitStandardLibrary.Blocks.DerivativeConstant
Derivative(; name, k = 1, T, x = 0.0)

Outputs an approximate derivative of the input. The transfer function of this block is

k      k        ks  
+  /     │

Parameters:

  • u_max: Upper limit of dead zone
  • u_min: Lower limit of dead zone

Connectors:

  • input
  • output
source
ModelingToolkitStandardLibrary.Blocks.SlewRateLimiterConstant
SlewRateLimiter(; name, y_start, rising = 1.0, falling = -rising, Td = 0.001)

Limits the slew rate of a signal. Initial value of state Y can be set with int.y

Parameters:

  • rising: Maximum rising slew rate
  • falling: Maximum falling slew rate
  • Td: [s] Derivative time constant
  • y_start: Initial value of y state of SISO

Connectors:

  • input
  • output
source

Continuous Blocks

ModelingToolkitStandardLibrary.Blocks.IntegratorConstant
Integrator(;name, k = 1, x = 0.0)

Outputs y = ∫k*u dt, corresponding to the transfer function $1/s$. Initial value of integrator state $x$ can be set with x

Connectors:

  • input
  • output

Parameters:

  • k: Gain of integrator

Unknowns:

  • x: State of Integrator. Defaults to 0.0.
source
ModelingToolkitStandardLibrary.Blocks.DerivativeConstant
Derivative(; name, k = 1, T, x = 0.0)

Outputs an approximate derivative of the input. The transfer function of this block is

k      k        ks  
 ─ - ─────── = ────── 
-T   sT² + T   sT + 1

and a state-space realization is given by ss(-1/T, 1/T, -k/T, k/T) where T is the time constant of the filter. A smaller T leads to a more ideal approximation of the derivative.

Initial value of the state $x$ can be set with x.

Parameters:

  • k: Gain
  • T: [s] Time constant (T>0 required; T=0 is ideal derivative block)

Unknowns:

  • x: Unknown of Derivative. Defaults to 0.0.

Connectors:

  • input
  • output
source
ModelingToolkitStandardLibrary.Blocks.FirstOrderConstant
FirstOrder(; name, k = 1.0, T, x = 0.0, lowpass = true)

A first-order filter with a single real pole at s = -1/T and gain k. If lowpass=true (default), the transfer function is given by $Y(s)/U(s) =$

   k
+T   sT² + T   sT + 1

and a state-space realization is given by ss(-1/T, 1/T, -k/T, k/T) where T is the time constant of the filter. A smaller T leads to a more ideal approximation of the derivative.

Initial value of the state $x$ can be set with x.

Parameters:

  • k: Gain
  • T: [s] Time constant (T>0 required; T=0 is ideal derivative block)

Unknowns:

  • x: Unknown of Derivative. Defaults to 0.0.

Connectors:

  • input
  • output
source
ModelingToolkitStandardLibrary.Blocks.FirstOrderConstant
FirstOrder(; name, k = 1.0, T, x = 0.0, lowpass = true)

A first-order filter with a single real pole at s = -1/T and gain k. If lowpass=true (default), the transfer function is given by $Y(s)/U(s) =$

   k
 ───────
 sT + 1

and if lowpass=false, by

sT + 1 - k
 ──────────
-  sT + 1

Initial value of the state x can be set with x

Parameters:

  • k: Gain
  • T: [s] Time constant (T>0 required)

Connectors:

  • input
  • output

See also SecondOrder

source
ModelingToolkitStandardLibrary.Blocks.SecondOrderConstant
SecondOrder(; name, k = 1.0, w = 1.0, d = 1.0, x = 0.0, xd = 0.0)

A second-order filter with gain k, a bandwidth of w rad/s and relative damping d. The transfer function is given by Y(s)/U(s) =

      k*w^2
+  sT + 1

Initial value of the state x can be set with x

Parameters:

  • k: Gain
  • T: [s] Time constant (T>0 required)

Connectors:

  • input
  • output

See also SecondOrder

source
ModelingToolkitStandardLibrary.Blocks.SecondOrderConstant
SecondOrder(; name, k = 1.0, w = 1.0, d = 1.0, x = 0.0, xd = 0.0)

A second-order filter with gain k, a bandwidth of w rad/s and relative damping d. The transfer function is given by Y(s)/U(s) =

      k*w^2
 ─────────────────
-s² + 2d*w*s + w^2

Critical damping corresponds to d=1, which yields the fastest step response without overshoot, d < 1 results in an underdamped filter while d > 1 results in an overdamped filter. d = 1/√2 corresponds to a Butterworth filter of order 2 (maximally flat frequency response). Initial value of the state x can be set with x, and of derivative state xd with xd.

Parameters:

  • k: Gain
  • w: [rad/s] Angular frequency
  • d: Damping

Connectors:

  • input
  • output
source
ModelingToolkitStandardLibrary.Blocks.StateSpaceFunction
StateSpace(A, B, C, D = 0; x = zeros(size(A,1)), u0 = zeros(size(B,2)), y0 = zeros(size(C,1)), name)

A linear, time-invariant state-space system on the form.

\[\begin{aligned} +s² + 2d*w*s + w^2

Critical damping corresponds to d=1, which yields the fastest step response without overshoot, d < 1 results in an underdamped filter while d > 1 results in an overdamped filter. d = 1/√2 corresponds to a Butterworth filter of order 2 (maximally flat frequency response). Initial value of the state x can be set with x, and of derivative state xd with xd.

Parameters:

  • k: Gain
  • w: [rad/s] Angular frequency
  • d: Damping

Connectors:

  • input
  • output
source
ModelingToolkitStandardLibrary.Blocks.StateSpaceFunction
StateSpace(A, B, C, D = 0; x = zeros(size(A,1)), u0 = zeros(size(B,2)), y0 = zeros(size(C,1)), name)

A linear, time-invariant state-space system on the form.

\[\begin{aligned} ẋ &= Ax + Bu \\ y &= Cx + Du \end{aligned}\]

Transfer functions can also be simulated by converting them to a StateSpace form.

y0 and u0 can be used to set an operating point, providing them changes the dynamics from an LTI system to the affine system

\[\begin{aligned} @@ -25,7 +25,7 @@ \end{aligned}\]

For a nonlinear system

\[\begin{aligned} ẋ &= f(x, u) \\ y &= h(x, u) -\end{aligned}\]

linearized around the operating point x₀, u₀, we have y0, u0 = h(x₀, u₀), u₀.

source
ModelingToolkitStandardLibrary.Blocks.TransferFunctionFunction
TransferFunction(; b, a, name)

A single input, single output, linear time-invariant system provided as a transfer-function.

Y(s) = b(s) / a(s)  U(s)

where b and a are vectors of coefficients of the numerator and denominator polynomials, respectively, ordered such that the coefficient of the highest power of s is first.

The internal state realization is on controller canonical form, with state variable x, output variable y and input variable u. For numerical robustness, the realization used by the integrator is scaled by the last entry of the a parameter. The internally scaled state variable is available as x_scaled.

To set the initial state, it's recommended to set the initial condition for x, and let that of x_scaled be computed automatically.

Parameters:

  • b: Numerator polynomial coefficients, e.g., 2s + 3 is specified as [2, 3]
  • a: Denominator polynomial coefficients, e.g., s² + 2ωs + ω^2 is specified as [1, 2ω, ω^2]

Connectors:

  • input
  • output

See also StateSpace which handles MIMO systems, as well as ControlSystemsMTK.jl for an interface between ControlSystems.jl and ModelingToolkit.jl for advanced manipulation of transfer functions and linear statespace systems. For linearization, see linearize and Linear Analysis.

source
ModelingToolkitStandardLibrary.Blocks.PIConstant
PI(;name, k = 1.0, T = 1.0, int.x = 0.0)

Textbook version of a PI-controller without actuator saturation and anti-windup measure. The proportional gain can be set with k Initial value of integrator state x can be set with int.x

The PI controller is implemented on standard form:

\[U(s) = k (1 + \dfrac{1}{sT}) E(S)\]

Parameters:

  • k: Proportional gain
  • T: [s] Integrator time constant (T>0 required)

Connectors:

  • err_input
  • ctr_output

See also LimPI

source
ModelingToolkitStandardLibrary.Blocks.LimPIFunction
LimPI(; name, k = 1.0, T, Ta, int__x = 0.0, u_max = 1.0, u_min = -u_max)

Text-book version of a PI-controller with actuator saturation and anti-windup measure.

The PI controller is implemented on standard form

\[u(t) = sat(k (e(t) + ∫\dfrac{1}{T}e(t) dt) )\]

The simplified expression above is given without the anti-windup protection.

Parameters:

  • k: Proportional gain
  • T: [s] Integrator time constant (T>0 required)
  • Ta: [s] Tracking time constant (Ta>0 required)

Connectors:

  • err_input
  • ctr_output
source
ModelingToolkitStandardLibrary.Blocks.PIDFunction
PID(;name, k=1, Ti=false, Td=false, Nd=10, int__x=0, der__x=0)

Text-book version of a PID-controller without actuator saturation and anti-windup measure.

Parameters:

  • k: Gain
  • Ti: [s] Integrator time constant (Ti>0 required). If set to false, no integral action is used.
  • Td: [s] Derivative time constant (Td>0 required). If set to false, no derivative action is used.
  • Nd: [s] Time constant for the derivative approximation (Nd>0 required; Nd=0 is ideal derivative).
  • int__x: Initial value for the integrator.
  • der__x: Initial value for the derivative state.

Connectors:

  • err_input
  • ctr_output

See also LimPID

source
ModelingToolkitStandardLibrary.Blocks.LimPIDFunction
LimPID(; k, Ti=false, Td=false, wp=1, wd=1, Ni, Nd=12, u_max=Inf, u_min=-u_max, gains = false, name)

Proportional-Integral-Derivative (PID) controller with output saturation, set-point weighting and integrator anti-windup.

The equation for the control signal is roughly

k(ep + 1/Ti * ∫e + Td * d/dt(ed))
+\end{aligned}\]

linearized around the operating point x₀, u₀, we have y0, u0 = h(x₀, u₀), u₀.

source
ModelingToolkitStandardLibrary.Blocks.TransferFunctionFunction
TransferFunction(; b, a, name)

A single input, single output, linear time-invariant system provided as a transfer-function.

Y(s) = b(s) / a(s)  U(s)

where b and a are vectors of coefficients of the numerator and denominator polynomials, respectively, ordered such that the coefficient of the highest power of s is first.

The internal state realization is on controller canonical form, with state variable x, output variable y and input variable u. For numerical robustness, the realization used by the integrator is scaled by the last entry of the a parameter. The internally scaled state variable is available as x_scaled.

To set the initial state, it's recommended to set the initial condition for x, and let that of x_scaled be computed automatically.

Parameters:

  • b: Numerator polynomial coefficients, e.g., 2s + 3 is specified as [2, 3]
  • a: Denominator polynomial coefficients, e.g., s² + 2ωs + ω^2 is specified as [1, 2ω, ω^2]

Connectors:

  • input
  • output

See also StateSpace which handles MIMO systems, as well as ControlSystemsMTK.jl for an interface between ControlSystems.jl and ModelingToolkit.jl for advanced manipulation of transfer functions and linear statespace systems. For linearization, see linearize and Linear Analysis.

source
ModelingToolkitStandardLibrary.Blocks.PIConstant
PI(;name, k = 1.0, T = 1.0, int.x = 0.0)

Textbook version of a PI-controller without actuator saturation and anti-windup measure. The proportional gain can be set with k Initial value of integrator state x can be set with int.x

The PI controller is implemented on standard form:

\[U(s) = k (1 + \dfrac{1}{sT}) E(S)\]

Parameters:

  • k: Proportional gain
  • T: [s] Integrator time constant (T>0 required)

Connectors:

  • err_input
  • ctr_output

See also LimPI

source
ModelingToolkitStandardLibrary.Blocks.LimPIFunction
LimPI(; name, k = 1.0, T, Ta, int__x = 0.0, u_max = 1.0, u_min = -u_max)

Text-book version of a PI-controller with actuator saturation and anti-windup measure.

The PI controller is implemented on standard form

\[u(t) = sat(k (e(t) + ∫\dfrac{1}{T}e(t) dt) )\]

The simplified expression above is given without the anti-windup protection.

Parameters:

  • k: Proportional gain
  • T: [s] Integrator time constant (T>0 required)
  • Ta: [s] Tracking time constant (Ta>0 required)

Connectors:

  • err_input
  • ctr_output
source
ModelingToolkitStandardLibrary.Blocks.PIDFunction
PID(;name, k=1, Ti=false, Td=false, Nd=10, int__x=0, der__x=0)

Text-book version of a PID-controller without actuator saturation and anti-windup measure.

Parameters:

  • k: Gain
  • Ti: [s] Integrator time constant (Ti>0 required). If set to false, no integral action is used.
  • Td: [s] Derivative time constant (Td>0 required). If set to false, no derivative action is used.
  • Nd: [s] Time constant for the derivative approximation (Nd>0 required; Nd=0 is ideal derivative).
  • int__x: Initial value for the integrator.
  • der__x: Initial value for the derivative state.

Connectors:

  • err_input
  • ctr_output

See also LimPID

source
ModelingToolkitStandardLibrary.Blocks.LimPIDFunction
LimPID(; k, Ti=false, Td=false, wp=1, wd=1, Ni, Nd=12, u_max=Inf, u_min=-u_max, gains = false, name)

Proportional-Integral-Derivative (PID) controller with output saturation, set-point weighting and integrator anti-windup.

The equation for the control signal is roughly

k(ep + 1/Ti * ∫e + Td * d/dt(ed))
 e = u_r - u_y
 ep = wp*u_r - u_y
-ed = wd*u_r - u_y

where the transfer function for the derivative includes additional filtering, see ? Derivative for more details.

Parameters:

  • k: Proportional gain
  • Ti: [s] Integrator time constant. Set to false to turn off integral action.
  • Td: [s] Derivative time constant. Set to false to turn off derivative action.
  • wp: [0,1] Set-point weighting in the proportional part.
  • wd: [0,1] Set-point weighting in the derivative part.
  • Nd: [1/s] Derivative limit, limits the derivative gain to Nd/Td. Reasonable values are ∈ [8, 20]. A higher value gives a better approximation of an ideal derivative at the expense of higher noise amplification.
  • Ni: Ni*Ti controls the time constant Ta of anti-windup tracking. A common (default) choice is Ta = √(Ti*Td) which is realized by Ni = √(Td / Ti). Anti-windup can be effectively turned off by setting Ni = Inf.
  • gains: If gains = true, Ti and Td will be interpreted as gains with a fundamental PID transfer function on parallel form ki=Ti, kd=Td, k + ki/s + kd*s.

Connectors:

  • reference
  • measurement
  • ctr_output
source
+ed = wd*u_r - u_y

where the transfer function for the derivative includes additional filtering, see ? Derivative for more details.

Parameters:

Connectors:

source diff --git a/dev/API/electrical/index.html b/dev/API/electrical/index.html index c5ef38c26..c1cbbd2f3 100644 --- a/dev/API/electrical/index.html +++ b/dev/API/electrical/index.html @@ -1,2 +1,2 @@ -Electrical Components · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Electrical Components

Index

Electrical Utilities

ModelingToolkitStandardLibrary.Electrical.OnePortConstant
OnePort(; name, v = 0.0, i = 0.0)

Component with two electrical pins p and n and current i flows from p to n.

States:

  • v(t): [V] The voltage across component p.v - n.v
  • i(t): [A] The current passing through positive pin

Connectors:

  • p Positive pin
  • n Negative pin
source
ModelingToolkitStandardLibrary.Electrical.DigitalPinFunction
DigitalPin(; name)

A pin in a digital circuit.

States:

  • v(t): [V] The voltage at this pin
  • i(t): [A] The current passing through this pin
  • val(t): The binary value of the pin at this point. A voltage from 0V to 0.8V is a binary value of 0.

A voltage in the range 2.0V to 5.0V is 1. Any other value is X.

source

Analog Components

ModelingToolkitStandardLibrary.Electrical.IdealOpAmpConstant
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 TwoPort

Connectors:

  • p1 Positive pin (left port)
  • p2 Positive pin (right port)
  • n1 Negative pin (left port)
  • n2 Negative pin (right port)
source

Analog Sensors

ModelingToolkitStandardLibrary.Electrical.VoltageSensorConstant

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 pin p.v - n.v

Connectors:

  • p Positive pin
  • n Negative pin
source
ModelingToolkitStandardLibrary.Electrical.PowerSensorConstant

PowerSensor(; name)

Combines a VoltageSensor and a CurrentSensor to measure the power being consumed by a circuit.

States:

Connectors:

source

Analog Sources

Digital Gates

Missing docstring.

Missing docstring for Not. Check Documenter's build log for details.

Missing docstring.

Missing docstring for And. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Nand. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Or. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Nor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Xor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Xnor. Check Documenter's build log for details.

Digital Components

Missing docstring.

Missing docstring for HalfAdder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for FullAdder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for MUX. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DEMUX. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Encoder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Decoder. Check Documenter's build log for details.

Digital Sources

Missing docstring.

Missing docstring for PulseDiff. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Set. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Reset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Pulse. Check Documenter's build log for details.

+Electrical Components · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Electrical Components

Index

Electrical Utilities

ModelingToolkitStandardLibrary.Electrical.OnePortConstant
OnePort(; name, v = 0.0, i = 0.0)

Component with two electrical pins p and n and current i flows from p to n.

States:

  • v(t): [V] The voltage across component p.v - n.v
  • i(t): [A] The current passing through positive pin

Connectors:

  • p Positive pin
  • n Negative pin
source
ModelingToolkitStandardLibrary.Electrical.DigitalPinFunction
DigitalPin(; name)

A pin in a digital circuit.

States:

  • v(t): [V] The voltage at this pin
  • i(t): [A] The current passing through this pin
  • val(t): The binary value of the pin at this point. A voltage from 0V to 0.8V is a binary value of 0.

A voltage in the range 2.0V to 5.0V is 1. Any other value is X.

source

Analog Components

ModelingToolkitStandardLibrary.Electrical.IdealOpAmpConstant
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 TwoPort

Connectors:

  • p1 Positive pin (left port)
  • p2 Positive pin (right port)
  • n1 Negative pin (left port)
  • n2 Negative pin (right port)
source

Analog Sensors

ModelingToolkitStandardLibrary.Electrical.VoltageSensorConstant

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 pin p.v - n.v

Connectors:

  • p Positive pin
  • n Negative pin
source
ModelingToolkitStandardLibrary.Electrical.PowerSensorConstant

PowerSensor(; name)

Combines a VoltageSensor and a CurrentSensor to measure the power being consumed by a circuit.

States:

Connectors:

source

Analog Sources

Digital Gates

Missing docstring.

Missing docstring for Not. Check Documenter's build log for details.

Missing docstring.

Missing docstring for And. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Nand. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Or. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Nor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Xor. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Xnor. Check Documenter's build log for details.

Digital Components

Missing docstring.

Missing docstring for HalfAdder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for FullAdder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for MUX. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DEMUX. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Encoder. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Decoder. Check Documenter's build log for details.

Digital Sources

Missing docstring.

Missing docstring for PulseDiff. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Set. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Reset. Check Documenter's build log for details.

Missing docstring.

Missing docstring for Pulse. Check Documenter's build log for details.

diff --git a/dev/API/hydraulic/index.html b/dev/API/hydraulic/index.html index 1c41a3401..19136bcee 100644 --- a/dev/API/hydraulic/index.html +++ b/dev/API/hydraulic/index.html @@ -1,5 +1,5 @@ -Hydraulic Components · ModelingToolkitStandardLibrary.jl

ModelingToolkit Standard Library: Hydraulic Components

Index

IsothermalCompressible Components

IsothermalCompressible Utils

ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.HydraulicFluidFunction
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 by density argument)
  • Β: [Pa] fluid bulk modulus describing the compressibility (set by bulk_modulus argument)
  • μ: [Pa*s] or [kg/m-s] fluid dynamic viscosity (set by viscosity argument)
  • n: density exponent
  • let_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 pressure p_gas (set by gas_density argument)
  • p_gas: [Pa] reference pressure (set by gas_pressure argument)
source
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.friction_factorFunction
friction_factor(dm, area, d_h, viscosity, shape_factor)

Calculates the friction factor $f$ for fully developed flow in a tube such that $Δp = f \cdot \rho \frac{u^2}{2} \frac{l}{d_h}$ where

  • $Δp$: [Pa] is the pressure difference over the tube length $l$
  • $\rho$: [kg/m^3] is the average fluid density
  • $u$: [m/s] is the average fluid velocity
  • $l$: [m] is the tube length

The friction factor is calculated for laminar and turbulent flow with a transition region between Reynolds number 2000 to 3000. Turbulent flow equation is for smooth tubes, valid for the Reynolds number range up to 5e6.

Arguments:

  • dm: [kg/s] mass flow
  • area: [m^2] tube cross sectional area
  • d_h: [m] tube hydraulic diameter. For circular tubes d_h is the tube diameter, otherwise it can be found from 4*area/perimeter
  • density: [kg/m^3] fluid density
  • viscosity: [Pa*s] or [kg/m-s] fluid dynamic viscosity
  • shape_factor: the constant defining the laminar fully developed constant f*Re related to the shape of the tube cross section

Reference: Introduction to Fluid Mechanics, Fox & McDonald, 5th Edition, equations 8.19 and 8.21

source

IsothermalCompressible Components

ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.TubeBaseFunction
TubeBase(add_inertia = true; p_int, area, length_int, head_factor = 1, perimeter = 2 * sqrt(area * pi), shape_factor = 64, name)

Variable length internal flow model of the fully developed incompressible flow friction. Includes optional inertia term when add_inertia = true to model wave propagation. Hydraulic ports have equal flow but variable pressure. Density is averaged over the pressures, used to calculated average flow velocity and flow friction.

States:

  • x: [m] length of the pipe
  • ddm: [kg/s^2] Rate of change of mass flow rate in control volume.

Parameters:

  • p_int: [Pa] initial pressure
  • area: [m^2] tube cross sectional area
  • length_int: [m] initial tube length
  • perimeter: [m] perimeter of the pipe cross section (needed only for non-circular pipes)
  • shape_factor: shape factor, see friction_factor function
  • head_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 port
  • port_b: hydraulic port
source
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.TubeFunction
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 pressure
  • area: [m^2] tube cross sectional area
  • length: [m] real length of the tube
  • perimeter: [m] perimeter of the pipe cross section (needed only for non-circular pipes)
  • shape_factor: shape factor, see friction_factor function
  • head_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 port
  • port_b: hydraulic port
source
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.DynamicVolumeFunction

DynamicVolume(N, addinertia=true; pint, area, xint = 0, xmax, xmin = 0, xdamp = xmin, direction = +1, perimeter = 2 * sqrt(area * pi), shapefactor = 64, headfactor = 1, Cd = 1e2, Cdreverse = 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.

     ┌─────────────────┐ ───
+Hydraulic Components · ModelingToolkitStandardLibrary.jl

ModelingToolkit Standard Library: Hydraulic Components

Index

IsothermalCompressible Components

IsothermalCompressible Utils

ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.HydraulicFluidFunction
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 by density argument)
  • Β: [Pa] fluid bulk modulus describing the compressibility (set by bulk_modulus argument)
  • μ: [Pa*s] or [kg/m-s] fluid dynamic viscosity (set by viscosity argument)
  • n: density exponent
  • let_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 pressure p_gas (set by gas_density argument)
  • p_gas: [Pa] reference pressure (set by gas_pressure argument)
source
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.friction_factorFunction
friction_factor(dm, area, d_h, viscosity, shape_factor)

Calculates the friction factor $f$ for fully developed flow in a tube such that $Δp = f \cdot \rho \frac{u^2}{2} \frac{l}{d_h}$ where

  • $Δp$: [Pa] is the pressure difference over the tube length $l$
  • $\rho$: [kg/m^3] is the average fluid density
  • $u$: [m/s] is the average fluid velocity
  • $l$: [m] is the tube length

The friction factor is calculated for laminar and turbulent flow with a transition region between Reynolds number 2000 to 3000. Turbulent flow equation is for smooth tubes, valid for the Reynolds number range up to 5e6.

Arguments:

  • dm: [kg/s] mass flow
  • area: [m^2] tube cross sectional area
  • d_h: [m] tube hydraulic diameter. For circular tubes d_h is the tube diameter, otherwise it can be found from 4*area/perimeter
  • density: [kg/m^3] fluid density
  • viscosity: [Pa*s] or [kg/m-s] fluid dynamic viscosity
  • shape_factor: the constant defining the laminar fully developed constant f*Re related to the shape of the tube cross section

Reference: Introduction to Fluid Mechanics, Fox & McDonald, 5th Edition, equations 8.19 and 8.21

source

IsothermalCompressible Components

ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.TubeBaseFunction
TubeBase(add_inertia = true; p_int, area, length_int, head_factor = 1, perimeter = 2 * sqrt(area * pi), shape_factor = 64, name)

Variable length internal flow model of the fully developed incompressible flow friction. Includes optional inertia term when add_inertia = true to model wave propagation. Hydraulic ports have equal flow but variable pressure. Density is averaged over the pressures, used to calculated average flow velocity and flow friction.

States:

  • x: [m] length of the pipe
  • ddm: [kg/s^2] Rate of change of mass flow rate in control volume.

Parameters:

  • p_int: [Pa] initial pressure
  • area: [m^2] tube cross sectional area
  • length_int: [m] initial tube length
  • perimeter: [m] perimeter of the pipe cross section (needed only for non-circular pipes)
  • shape_factor: shape factor, see friction_factor function
  • head_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 port
  • port_b: hydraulic port
source
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.TubeFunction
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 pressure
  • area: [m^2] tube cross sectional area
  • length: [m] real length of the tube
  • perimeter: [m] perimeter of the pipe cross section (needed only for non-circular pipes)
  • shape_factor: shape factor, see friction_factor function
  • head_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 port
  • port_b: hydraulic port
source
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible.DynamicVolumeFunction

DynamicVolume(N, addinertia=true; pint, area, xint = 0, xmax, xmin = 0, xdamp = xmin, direction = +1, perimeter = 2 * sqrt(area * pi), shapefactor = 64, headfactor = 1, Cd = 1e2, Cdreverse = 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
@@ -7,4 +7,4 @@
      │                 │  ▼
      └─────────────────┤ ───
                        │
-                       └─► x (= ∫ flange.v * direction)

Features:

  • volume discretization with flow resistance and inertia: use N to control number of volume and resistance elements. Set N=0 to turn off volume discretization. See TubeBase for more information about flow resistance.
  • minimum volume flow shutoff with damping and directional resistance. Use reversible=false when problem defines volume position x and solves for dm to prevent numerical instability.

Parameters:

volume

  • p_int: [Pa] initial pressure

  • area: [m^2] moving wall area

  • x_int: [m] initial wall position

  • x_max: [m] max wall position, needed for volume discretization to apply the correct volume sizing as a function of x

  • x_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 the flange to x

flow resistance

  • perimeter: [m] perimeter of the cross section (needed only for non-circular volumes)
  • shape_factor: shape factor, see friction_factor function
  • head_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 port
  • flange: mechanical translational port
source

IsothermalCompressible Sources

+ └─► x (= ∫ flange.v * direction)

Features:

  • volume discretization with flow resistance and inertia: use N to control number of volume and resistance elements. Set N=0 to turn off volume discretization. See TubeBase for more information about flow resistance.
  • minimum volume flow shutoff with damping and directional resistance. Use reversible=false when problem defines volume position x and solves for dm to prevent numerical instability.

Parameters:

volume

  • p_int: [Pa] initial pressure

  • area: [m^2] moving wall area

  • x_int: [m] initial wall position

  • x_max: [m] max wall position, needed for volume discretization to apply the correct volume sizing as a function of x

  • x_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 the flange to x

flow resistance

  • perimeter: [m] perimeter of the cross section (needed only for non-circular volumes)
  • shape_factor: shape factor, see friction_factor function
  • head_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 port
  • flange: mechanical translational port
source

IsothermalCompressible Sources

diff --git a/dev/API/linear_analysis/4beb0d98.svg b/dev/API/linear_analysis/9457f203.svg similarity index 87% rename from dev/API/linear_analysis/4beb0d98.svg rename to dev/API/linear_analysis/9457f203.svg index a167f6001..b2784c1d6 100644 --- a/dev/API/linear_analysis/4beb0d98.svg +++ b/dev/API/linear_analysis/9457f203.svg @@ -1,78 +1,78 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/dev/API/linear_analysis/01e9a6f3.svg b/dev/API/linear_analysis/9ddbacac.svg similarity index 84% rename from dev/API/linear_analysis/01e9a6f3.svg rename to dev/API/linear_analysis/9ddbacac.svg index 09f2524b6..f57bd8351 100644 --- a/dev/API/linear_analysis/01e9a6f3.svg +++ b/dev/API/linear_analysis/9ddbacac.svg @@ -1,50 +1,50 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/API/linear_analysis/index.html b/dev/API/linear_analysis/index.html index 91a1860ce..3366d36cf 100644 --- a/dev/API/linear_analysis/index.html +++ b/dev/API/linear_analysis/index.html @@ -20,7 +20,7 @@ S = ss(matrices_S...) T = ss(matrices_T...) bodeplot([S, T], lab = ["S" "" "T" ""], plot_title = "Bode plot of sensitivity functions", - margin = 5Plots.mm)Example block output

The sensitivity functions obtained this way should be equivalent to the ones obtained with the code below

using ControlSystemsBase
+    margin = 5Plots.mm)
Example block output

The sensitivity functions obtained this way should be equivalent to the ones obtained with the code below

using ControlSystemsBase
 P = tf(1.0, [1, 1]) |> ss
 C = 1                      # Negative feedback assumed in ControlSystems
 S = sensitivity(P, C)      # or feedback(1, P*C)
@@ -70,11 +70,11 @@
 ----------
 1.0s + 2.0
 
-Continuous-time transfer function model

Gain and phase margins

Further linear analysis can be performed using the analysis methods from ControlSystemsBase. For example, calculating the gain and phase margins of a system can be done using

margin(P)
(wgm = [NaN;;], gm = [Inf;;], wpm = [NaN;;], pm = [Inf;;])

(they are infinite for this system). A Nyquist plot can be produced using

nyquistplot(P)
Example block output

Index

ModelingToolkitStandardLibrary.Blocks.get_comp_sensitivityFunction
get_comp_sensitivity(sys, ap::AnalysisPoint; kwargs)
-get_comp_sensitivity(sys, ap_name::Symbol; kwargs)

Compute the complementary sensitivity function in analysis point ap. The complementary sensitivity function is obtained by introducing an infinitesimal perturbation d at the output of ap, linearizing the system and computing the transfer function between d and the input of ap.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_sensitivity, get_looptransfer.

source
ModelingToolkitStandardLibrary.Blocks.get_looptransferFunction
get_looptransfer(sys, ap::AnalysisPoint; kwargs)
-get_looptransfer(sys, ap_name::Symbol; kwargs)

Compute the (linearized) loop-transfer function in analysis point ap, from ap.out to ap.in.

Negative feedback

Feedback loops often use negative feedback, and the computed loop-transfer function will in this case have the negative feedback included. Standard analysis tools often assume a loop-transfer function without the negative gain built in, and the result of this function may thus need negation before use.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_sensitivity, get_comp_sensitivity, open_loop.

source
ModelingToolkitStandardLibrary.Blocks.get_sensitivityFunction
get_sensitivity(sys, ap::AnalysisPoint; kwargs)
-get_sensitivity(sys, ap_name::Symbol; kwargs)

Compute the sensitivity function in analysis point ap. The sensitivity function is obtained by introducing an infinitesimal perturbation d at the input of ap, linearizing the system and computing the transfer function between d and the output of ap.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_comp_sensitivity, get_looptransfer.

source
ModelingToolkitStandardLibrary.Blocks.open_loopMethod
open_sys = open_loop(sys, ap::AnalysisPoint; kwargs)
-open_sys = open_loop(sys, ap_name::Symbol; kwargs)

Open the loop at analysis point ap by breaking the connection through ap.

open_sys will have u ~ ap.out as input and y ~ ap.in as output.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_sensitivity, get_comp_sensitivity, get_looptransfer.

source
ModelingToolkitStandardLibrary.Blocks.AnalysisPointMethod
AnalysisPoint(in, out, name::Symbol)
+Continuous-time transfer function model

Gain and phase margins

Further linear analysis can be performed using the analysis methods from ControlSystemsBase. For example, calculating the gain and phase margins of a system can be done using

margin(P)
(wgm = [NaN;;], gm = [Inf;;], wpm = [NaN;;], pm = [Inf;;])

(they are infinite for this system). A Nyquist plot can be produced using

nyquistplot(P)
Example block output

Index

ModelingToolkitStandardLibrary.Blocks.get_comp_sensitivityFunction
get_comp_sensitivity(sys, ap::AnalysisPoint; kwargs)
+get_comp_sensitivity(sys, ap_name::Symbol; kwargs)

Compute the complementary sensitivity function in analysis point ap. The complementary sensitivity function is obtained by introducing an infinitesimal perturbation d at the output of ap, linearizing the system and computing the transfer function between d and the input of ap.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_sensitivity, get_looptransfer.

source
ModelingToolkitStandardLibrary.Blocks.get_looptransferFunction
get_looptransfer(sys, ap::AnalysisPoint; kwargs)
+get_looptransfer(sys, ap_name::Symbol; kwargs)

Compute the (linearized) loop-transfer function in analysis point ap, from ap.out to ap.in.

Negative feedback

Feedback loops often use negative feedback, and the computed loop-transfer function will in this case have the negative feedback included. Standard analysis tools often assume a loop-transfer function without the negative gain built in, and the result of this function may thus need negation before use.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_sensitivity, get_comp_sensitivity, open_loop.

source
ModelingToolkitStandardLibrary.Blocks.get_sensitivityFunction
get_sensitivity(sys, ap::AnalysisPoint; kwargs)
+get_sensitivity(sys, ap_name::Symbol; kwargs)

Compute the sensitivity function in analysis point ap. The sensitivity function is obtained by introducing an infinitesimal perturbation d at the input of ap, linearizing the system and computing the transfer function between d and the output of ap.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_comp_sensitivity, get_looptransfer.

source
ModelingToolkitStandardLibrary.Blocks.open_loopMethod
open_sys = open_loop(sys, ap::AnalysisPoint; kwargs)
+open_sys = open_loop(sys, ap_name::Symbol; kwargs)

Open the loop at analysis point ap by breaking the connection through ap.

open_sys will have u ~ ap.out as input and y ~ ap.in as output.

Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • kwargs: Are sent to ModelingToolkit.linearize

See also get_sensitivity, get_comp_sensitivity, get_looptransfer.

source
ModelingToolkitStandardLibrary.Blocks.AnalysisPointMethod
AnalysisPoint(in, out, name::Symbol)
 AnalysisPoint(in, out; name::Symbol)
 AnalysisPoint(name::Symbol)

Create an AnalysisPoint for linear analysis. Analysis points can also be created automatically by calling

connect(in, :ap_name, out)
Experimental

The analysis-point interface is currently experimental and at any time subject to breaking changes not respecting semantic versioning.

Arguments:

  • in: A connector of type RealOutput.
  • out: A connector of type RealInput.
  • name: The name of the analysis point.

See also get_sensitivity, get_comp_sensitivity, get_looptransfer, open_loop

Example

using ModelingToolkitStandardLibrary.Blocks
 @named P = FirstOrder(k = 1, T = 1)
@@ -92,7 +92,7 @@
 P = tf(1.0, [1, 1])
 C = 1                      # Negative feedback assumed in ControlSystems
 S = sensitivity(P, C)      # or feedback(1, P*C)
-T = comp_sensitivity(P, C) # or feedback(P*C)
source
ModelingToolkit.linearizeFunction
(; A, B, C, D), simplified_sys = linearize(sys, inputs, outputs;    t=0.0, op = Dict(), allow_input_derivatives = false, zero_dummy_der=false, kwargs...)
+T = comp_sensitivity(P, C) # or feedback(P*C)
source
ModelingToolkit.linearizeFunction
(; A, B, C, D), simplified_sys = linearize(sys, inputs, outputs;    t=0.0, op = Dict(), allow_input_derivatives = false, zero_dummy_der=false, kwargs...)
 (; A, B, C, D)                 = linearize(simplified_sys, lin_fun; t=0.0, op = Dict(), allow_input_derivatives = false, zero_dummy_der=false)

Linearize sys between inputs and outputs, both vectors of variables. Return a NamedTuple with the matrices of a linear statespace representation on the form

\[\begin{aligned} ẋ &= Ax + Bu\\ y &= Cx + Du @@ -154,4 +154,4 @@ ## Symbolic linearization lsys_sym, _ = ModelingToolkit.linearize_symbolic(cl, [f.u], [p.x]) -@assert substitute(lsys_sym.A, ModelingToolkit.defaults(cl)) == lsys.A

source
ModelingToolkit.linearize(sys, input_name::Symbol, output_name; kwargs...)

Linearize a system between two analysis points. To get a loop-transfer function, see get_looptransfer.

The output is allowed to be either an analysis-point name, or a vector of symbolic variables like the standard interface to linearize. The input must be an analysis-point name.

source
+@assert substitute(lsys_sym.A, ModelingToolkit.defaults(cl)) == lsys.Asource
ModelingToolkit.linearize(sys, input_name::Symbol, output_name; kwargs...)

Linearize a system between two analysis points. To get a loop-transfer function, see get_looptransfer.

The output is allowed to be either an analysis-point name, or a vector of symbolic variables like the standard interface to linearize. The input must be an analysis-point name.

source
diff --git a/dev/API/magnetic/index.html b/dev/API/magnetic/index.html index 8d6ece527..36c025aef 100644 --- a/dev/API/magnetic/index.html +++ b/dev/API/magnetic/index.html @@ -1,2 +1,2 @@ -Magnetic Components · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Magnetic Components

Index

Flux Tubes

Flux Tube Utilities

ModelingToolkitStandardLibrary.Magnetic.FluxTubes.TwoPortConstant
TwoPort(; name, V_m = 0.0, Phi = 0.0)

Partial component with magnetic potential difference between two magnetic ports p and n and magnetic flux Phi from p to n.

Parameters:

  • V_m: Initial magnetic potential difference between both ports
  • Phi: Initial magnetic flux from portp to portn
source

Basic Flux Tube Blocks

ModelingToolkitStandardLibrary.Magnetic.FluxTubes.EddyCurrentConstant
EddyCurrent(;name, Phi, rho = 0.098e-6, l = 1, A = 1)

For modelling of eddy current in a conductive magnetic flux tube. Initial magnetic flux flowing into the port_p can be set with Phi ([Wb])

Parameters:

  • rho: [ohm * m] Resistivity of flux tube material (default: Iron at 20degC)
  • l: [m] Average length of eddy current path
  • A: [m^2] Cross sectional area of eddy current path
source

Flux Tube Sources

+Magnetic Components · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Magnetic Components

Index

Flux Tubes

Flux Tube Utilities

ModelingToolkitStandardLibrary.Magnetic.FluxTubes.TwoPortConstant
TwoPort(; name, V_m = 0.0, Phi = 0.0)

Partial component with magnetic potential difference between two magnetic ports p and n and magnetic flux Phi from p to n.

Parameters:

  • V_m: Initial magnetic potential difference between both ports
  • Phi: Initial magnetic flux from portp to portn
source

Basic Flux Tube Blocks

ModelingToolkitStandardLibrary.Magnetic.FluxTubes.EddyCurrentConstant
EddyCurrent(;name, Phi, rho = 0.098e-6, l = 1, A = 1)

For modelling of eddy current in a conductive magnetic flux tube. Initial magnetic flux flowing into the port_p can be set with Phi ([Wb])

Parameters:

  • rho: [ohm * m] Resistivity of flux tube material (default: Iron at 20degC)
  • l: [m] Average length of eddy current path
  • A: [m^2] Cross sectional area of eddy current path
source

Flux Tube Sources

diff --git a/dev/API/mechanical/index.html b/dev/API/mechanical/index.html index e2eec3ed3..c7f77650f 100644 --- a/dev/API/mechanical/index.html +++ b/dev/API/mechanical/index.html @@ -1,2 +1,2 @@ -Mechanical Components · ModelingToolkitStandardLibrary.jl

ModelingToolkit Standard Library: Mechanical Components

Index

Rotational Components

Rotational Utils

ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialCompliantWithRelativeStatesConstant
PartialCompliantWithRelativeStates(; name, phi_rel = 0.0, tau = 0.0)

Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states

States:

  • phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi). It accepts an initial value, which defaults to 0.0.
  • w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel)). It accepts an initial value, which defaults to 0.0.
  • a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel)). It accepts an initial value, which defaults to 0.0.
  • tau(t): [N.m] Torque between flanges (= flange_b.tau). It accepts an initial value, which defaults to 0.0.

Connectors:

source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialElementaryTwoFlangesAndSupport2Function
PartialElementaryTwoFlangesAndSupport2(;name, use_support=false)

Partial model for a component with two rotational 1-dim. shaft flanges and a support used for textual modeling, i.e., for elementary models

States:

  • phi_support(t): [rad] Absolute angle of support flange

Connectors:

Parameters:

  • use_support: If support flange enabled, otherwise implicitly grounded
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialCompliantConstant
PartialCompliant(;  name, phi_rel = 0.0, tau = 0.0)

Partial model for the compliant connection of two rotational 1-dim. shaft flanges.

States:

  • phi_rel(t): [rad] Relative rotation angle (flange_b.phi - flange_a.phi). It accepts an initial value, which defaults to 0.0.
  • tau(t): [N.m] Torque between flanges (flange_b.tau). It accepts an initial value, which defaults to 0.0.

Connectors:

source

Rotational Core Components

ModelingToolkitStandardLibrary.Mechanical.Rotational.InertiaConstant
Inertia(;name, J, phi = 0.0, w = 0.0, a = 0.0)

1D-rotational component with inertia.

States:

  • phi: [rad] Absolute rotation angle of component
  • w: [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
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringConstant
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 constant
  • phi_rel0: [rad] Unstretched spring angle. Defaults to 0.0.
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.DamperConstant
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
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringDamperConstant
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 constant
  • c: [N.m/rad] Spring constant
  • phi_rel0: [rad] Unstretched spring angle. Defaults to 0.0
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.IdealGearConstant
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 support
  • phi_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 is false
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.RotationalFrictionConstant
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 coefficient
  • tau_c: [N⋅m] Coulomb friction torque
  • w_brk: [rad/s] Breakaway friction velocity
  • tau_brk: [N⋅m] Breakaway friction torque
source

Rotational Sources

ModelingToolkitStandardLibrary.Mechanical.Rotational.SpeedFunction
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:

  • flange Flange
  • w_ref RealInput Reference 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 grounded
  • exact: true/false exact treatment/filtering the input signal
  • tau_filt: [rad/s] if exact=false, Time constant of low-pass filter to filter input signal
source

Rotational Sensors

Translational Components

Translational Utils

Translational Core Components

ModelingToolkitStandardLibrary.Mechanical.Translational.MassFunction
Mass(; name, v_0 = 0.0, m, s = nothing, g = nothing)

Sliding mass with inertia

Parameters:

  • m: [kg] mass of sliding body
  • v_0: [m/s] Initial value of absolute linear velocity of sliding mass (default 0 m/s)
  • s: [m] initial value of absolute position of sliding mass (optional)
  • g: [m/s²] gravity field acting on the mass, positive value acts in the positive direction (optional)

States:

  • v: [m/s] absolute linear velocity of sliding mass
  • s: [m] absolute position of sliding mass (optional with parameter s)

Connectors:

  • flange: 1-dim. translational flange
source
ModelingToolkitStandardLibrary.Mechanical.Translational.SpringFunction
Spring(; name, k, delta_s = 0.0,  va=0.0, v_b_0=0.0)

Linear 1D translational spring

Parameters:

  • k: [N/m] Spring constant
  • delta_s: initial spring stretch
  • va: [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 spring
  • flange_b: 1-dim. translational flange on opposite side of spring
source
ModelingToolkitStandardLibrary.Mechanical.Translational.DamperConstant
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 state v is set to 0.0 m/s.
  • flange_b: 1-dim. translational flange on opposite side of damper. Initial value of state v is set to 0.0 m/s.
source

Translational Sources

ModelingToolkitStandardLibrary.Mechanical.Translational.PositionFunction
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 flange
  • s: real input
source
ModelingToolkitStandardLibrary.Mechanical.Translational.VelocityFunction
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 flange
  • v: real input
source
ModelingToolkitStandardLibrary.Mechanical.Translational.AccelerationFunction

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 flange
  • a: real input
source

Translational Sensors

+Mechanical Components · ModelingToolkitStandardLibrary.jl

ModelingToolkit Standard Library: Mechanical Components

Index

Rotational Components

Rotational Utils

ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialCompliantWithRelativeStatesConstant
PartialCompliantWithRelativeStates(; name, phi_rel = 0.0, tau = 0.0)

Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states

States:

  • phi_rel(t): [rad] Relative rotation angle (= flangeb.phi - flangea.phi). It accepts an initial value, which defaults to 0.0.
  • w_rel(t): [rad/s] Relative angular velocity (= D(phi_rel)). It accepts an initial value, which defaults to 0.0.
  • a_rel(t): [rad/s²] Relative angular acceleration (= D(w_rel)). It accepts an initial value, which defaults to 0.0.
  • tau(t): [N.m] Torque between flanges (= flange_b.tau). It accepts an initial value, which defaults to 0.0.

Connectors:

source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialElementaryTwoFlangesAndSupport2Function
PartialElementaryTwoFlangesAndSupport2(;name, use_support=false)

Partial model for a component with two rotational 1-dim. shaft flanges and a support used for textual modeling, i.e., for elementary models

States:

  • phi_support(t): [rad] Absolute angle of support flange

Connectors:

Parameters:

  • use_support: If support flange enabled, otherwise implicitly grounded
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.PartialCompliantConstant
PartialCompliant(;  name, phi_rel = 0.0, tau = 0.0)

Partial model for the compliant connection of two rotational 1-dim. shaft flanges.

States:

  • phi_rel(t): [rad] Relative rotation angle (flange_b.phi - flange_a.phi). It accepts an initial value, which defaults to 0.0.
  • tau(t): [N.m] Torque between flanges (flange_b.tau). It accepts an initial value, which defaults to 0.0.

Connectors:

source

Rotational Core Components

ModelingToolkitStandardLibrary.Mechanical.Rotational.InertiaConstant
Inertia(;name, J, phi = 0.0, w = 0.0, a = 0.0)

1D-rotational component with inertia.

States:

  • phi: [rad] Absolute rotation angle of component
  • w: [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
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringConstant
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 constant
  • phi_rel0: [rad] Unstretched spring angle. Defaults to 0.0.
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.DamperConstant
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
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.SpringDamperConstant
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 constant
  • c: [N.m/rad] Spring constant
  • phi_rel0: [rad] Unstretched spring angle. Defaults to 0.0
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.IdealGearConstant
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 support
  • phi_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 is false
source
ModelingToolkitStandardLibrary.Mechanical.Rotational.RotationalFrictionConstant
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 coefficient
  • tau_c: [N⋅m] Coulomb friction torque
  • w_brk: [rad/s] Breakaway friction velocity
  • tau_brk: [N⋅m] Breakaway friction torque
source

Rotational Sources

ModelingToolkitStandardLibrary.Mechanical.Rotational.SpeedFunction
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:

  • flange Flange
  • w_ref RealInput Reference 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 grounded
  • exact: true/false exact treatment/filtering the input signal
  • tau_filt: [rad/s] if exact=false, Time constant of low-pass filter to filter input signal
source

Rotational Sensors

Translational Components

Translational Utils

Translational Core Components

ModelingToolkitStandardLibrary.Mechanical.Translational.MassFunction
Mass(; name, v_0 = 0.0, m, s = nothing, g = nothing)

Sliding mass with inertia

Parameters:

  • m: [kg] mass of sliding body
  • v_0: [m/s] Initial value of absolute linear velocity of sliding mass (default 0 m/s)
  • s: [m] initial value of absolute position of sliding mass (optional)
  • g: [m/s²] gravity field acting on the mass, positive value acts in the positive direction (optional)

States:

  • v: [m/s] absolute linear velocity of sliding mass
  • s: [m] absolute position of sliding mass (optional with parameter s)

Connectors:

  • flange: 1-dim. translational flange
source
ModelingToolkitStandardLibrary.Mechanical.Translational.SpringFunction
Spring(; name, k, delta_s = 0.0,  va=0.0, v_b_0=0.0)

Linear 1D translational spring

Parameters:

  • k: [N/m] Spring constant
  • delta_s: initial spring stretch
  • va: [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 spring
  • flange_b: 1-dim. translational flange on opposite side of spring
source
ModelingToolkitStandardLibrary.Mechanical.Translational.DamperConstant
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 state v is set to 0.0 m/s.
  • flange_b: 1-dim. translational flange on opposite side of damper. Initial value of state v is set to 0.0 m/s.
source

Translational Sources

ModelingToolkitStandardLibrary.Mechanical.Translational.PositionFunction
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 flange
  • s: real input
source
ModelingToolkitStandardLibrary.Mechanical.Translational.VelocityFunction
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 flange
  • v: real input
source
ModelingToolkitStandardLibrary.Mechanical.Translational.AccelerationFunction

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 flange
  • a: real input
source

Translational Sensors

diff --git a/dev/API/thermal/index.html b/dev/API/thermal/index.html index 88721fc12..cae144e9b 100644 --- a/dev/API/thermal/index.html +++ b/dev/API/thermal/index.html @@ -1,2 +1,2 @@ -Thermal Components · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Thermal Components

Index

Thermal Utilities

ModelingToolkitStandardLibrary.Thermal.HeatPortConstant
HeatPort(; name, T = 273.15 + 20.0, Q_flow = 0.0)

Port for a thermal system.

States:

  • T: [K] Temperature of the port. It accepts an initial value, which defaults to 273.15 + 20.
  • Q_flow: [W] Heat flow rate at the port. It accepts an initial value, which defaults to 0.0.
source
ModelingToolkitStandardLibrary.Thermal.Element1DConstant
Element1D(; name, dT = 0.0, Q_flow = 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. It accepts an initial value, which defaults to 0.0.
  • Q_flow: [W] Heat flow rate from port a -> port b. It accepts an initial value, which defaults to 0.0.

Connectors:

port_a port_b

source

Thermal Components

ModelingToolkitStandardLibrary.Thermal.BodyRadiationConstant
BodyRadiation(; name, G)

Lumped thermal element for radiation heat transfer.

States:

  • dT: [K] Temperature difference across the component a.T - b.T
  • Q_flow: [W] Heat flow rate from port a -> port b

Connectors:

  • port_a
  • port_b

Parameters:

  • G: [m^2] Net radiation conductance between two surfaces # Stefan-Boltzmann constant TODO: extract into physical constants module or use existing one
source
ModelingToolkitStandardLibrary.Thermal.ConvectiveConductorConstant
ConvectiveConductor(; name, G)

Lumped thermal element for heat convection.

States:

  • dT: [K] Temperature difference across the component solid.T - fluid.T
  • Q_flow: [W] Heat flow rate from solid -> fluid

Connectors:

  • solid
  • fluid

Parameters:

  • G: [W/K] Convective thermal conductance
source
ModelingToolkitStandardLibrary.Thermal.ConvectiveResistorConstant
ConvectiveResistor(; name, R)

Lumped thermal element for heat convection.

States:

  • dT: [K] Temperature difference across the component solid.T - fluid.T
  • Q_flow: [W] Heat flow rate from solid -> fluid

Connectors:

  • solid
  • fluid

Parameters:

  • R: [K/W] Constant thermal resistance of material
source
ModelingToolkitStandardLibrary.Thermal.HeatCapacitorConstant
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)
source
ModelingToolkitStandardLibrary.Thermal.ThermalResistorConstant
ThermalResistor(; name, R)

Lumped thermal element transporting heat without storing it.

States:

  • dT: [K] Temperature difference across the component a.T - b.T
  • Q_flow: [W] Heat flow rate from port a -> port b

Connectors:

  • port_a
  • port_b

Parameters:

  • R: [K/W] Constant thermal resistance of material
source
ModelingToolkitStandardLibrary.Thermal.ThermalCollectorFunction
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_a1 to port_am
  • port_b

Parameters:

  • m: Number of heat ports (e.g. m=2: port_a1, port_a2)
source

Thermal Sensors

ModelingToolkitStandardLibrary.Thermal.RelativeTemperatureSensorConstant
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.

States:

  • T(t): [K] Relative temperature a.T - b.T

Connectors:

  • port_a
  • port_b
source
ModelingToolkitStandardLibrary.Thermal.HeatFlowSensorConstant
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.

States:

  • Q_flow(t): [W] Heat flow from port_a to port_b

Connectors:

  • port_a
  • port_b
source
ModelingToolkitStandardLibrary.Thermal.TemperatureSensorConstant
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.

States:

  • T(t): [K] Absolute temperature

Connectors:

  • port
source

Thermal Sources

ModelingToolkitStandardLibrary.Thermal.FixedHeatFlowConstant
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 port
  • T_ref: [K] Reference temperature
  • alpha: [1/K] Temperature coefficient of heat flow rate
source
ModelingToolkitStandardLibrary.Thermal.FixedTemperatureConstant
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
source
ModelingToolkitStandardLibrary.Thermal.PrescribedHeatFlowConstant
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:

  • port
  • RealInput Q_flow Input for the heat flow

Parameters:

  • T_ref: [K] Reference temperature
  • alpha: [1/K] Temperature coefficient of heat flow rate
source
ModelingToolkitStandardLibrary.Thermal.PrescribedTemperatureConstant
PrescribedTemperature(; name)

This model represents a variable temperature boundary condition.

The temperature in kelvin is given as input signal to the RealInput T. 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:

  • port
  • RealInput T input for the temperature
source
+Thermal Components · ModelingToolkitStandardLibrary.jl

ModelingToolkitStandardLibrary: Thermal Components

Index

Thermal Utilities

ModelingToolkitStandardLibrary.Thermal.HeatPortConstant
HeatPort(; name, T = 273.15 + 20.0, Q_flow = 0.0)

Port for a thermal system.

States:

  • T: [K] Temperature of the port. It accepts an initial value, which defaults to 273.15 + 20.
  • Q_flow: [W] Heat flow rate at the port. It accepts an initial value, which defaults to 0.0.
source
ModelingToolkitStandardLibrary.Thermal.Element1DConstant
Element1D(; name, dT = 0.0, Q_flow = 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. It accepts an initial value, which defaults to 0.0.
  • Q_flow: [W] Heat flow rate from port a -> port b. It accepts an initial value, which defaults to 0.0.

Connectors:

port_a port_b

source

Thermal Components

ModelingToolkitStandardLibrary.Thermal.BodyRadiationConstant
BodyRadiation(; name, G)

Lumped thermal element for radiation heat transfer.

States:

  • dT: [K] Temperature difference across the component a.T - b.T
  • Q_flow: [W] Heat flow rate from port a -> port b

Connectors:

  • port_a
  • port_b

Parameters:

  • G: [m^2] Net radiation conductance between two surfaces # Stefan-Boltzmann constant TODO: extract into physical constants module or use existing one
source
ModelingToolkitStandardLibrary.Thermal.ConvectiveConductorConstant
ConvectiveConductor(; name, G)

Lumped thermal element for heat convection.

States:

  • dT: [K] Temperature difference across the component solid.T - fluid.T
  • Q_flow: [W] Heat flow rate from solid -> fluid

Connectors:

  • solid
  • fluid

Parameters:

  • G: [W/K] Convective thermal conductance
source
ModelingToolkitStandardLibrary.Thermal.ConvectiveResistorConstant
ConvectiveResistor(; name, R)

Lumped thermal element for heat convection.

States:

  • dT: [K] Temperature difference across the component solid.T - fluid.T
  • Q_flow: [W] Heat flow rate from solid -> fluid

Connectors:

  • solid
  • fluid

Parameters:

  • R: [K/W] Constant thermal resistance of material
source
ModelingToolkitStandardLibrary.Thermal.HeatCapacitorConstant
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)
source
ModelingToolkitStandardLibrary.Thermal.ThermalResistorConstant
ThermalResistor(; name, R)

Lumped thermal element transporting heat without storing it.

States:

  • dT: [K] Temperature difference across the component a.T - b.T
  • Q_flow: [W] Heat flow rate from port a -> port b

Connectors:

  • port_a
  • port_b

Parameters:

  • R: [K/W] Constant thermal resistance of material
source
ModelingToolkitStandardLibrary.Thermal.ThermalCollectorFunction
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_a1 to port_am
  • port_b

Parameters:

  • m: Number of heat ports (e.g. m=2: port_a1, port_a2)
source

Thermal Sensors

ModelingToolkitStandardLibrary.Thermal.RelativeTemperatureSensorConstant
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.

States:

  • T(t): [K] Relative temperature a.T - b.T

Connectors:

  • port_a
  • port_b
source
ModelingToolkitStandardLibrary.Thermal.HeatFlowSensorConstant
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.

States:

  • Q_flow(t): [W] Heat flow from port_a to port_b

Connectors:

  • port_a
  • port_b
source
ModelingToolkitStandardLibrary.Thermal.TemperatureSensorConstant
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.

States:

  • T(t): [K] Absolute temperature

Connectors:

  • port
source

Thermal Sources

ModelingToolkitStandardLibrary.Thermal.FixedHeatFlowConstant
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 port
  • T_ref: [K] Reference temperature
  • alpha: [1/K] Temperature coefficient of heat flow rate
source
ModelingToolkitStandardLibrary.Thermal.FixedTemperatureConstant
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
source
ModelingToolkitStandardLibrary.Thermal.PrescribedHeatFlowConstant
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:

  • port
  • RealInput Q_flow Input for the heat flow

Parameters:

  • T_ref: [K] Reference temperature
  • alpha: [1/K] Temperature coefficient of heat flow rate
source
ModelingToolkitStandardLibrary.Thermal.PrescribedTemperatureConstant
PrescribedTemperature(; name)

This model represents a variable temperature boundary condition.

The temperature in kelvin is given as input signal to the RealInput T. 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:

  • port
  • RealInput T input for the temperature
source
diff --git a/dev/assets/Manifest.toml b/dev/assets/Manifest.toml index 7087da631..aa1f83aef 100644 --- a/dev/assets/Manifest.toml +++ b/dev/assets/Manifest.toml @@ -78,9 +78,9 @@ version = "7.9.0" [[deps.ArrayLayouts]] deps = ["FillArrays", "LinearAlgebra"] -git-tree-sha1 = "2aeaeaff72cdedaa0b5f30dfb8c1f16aefdac65d" +git-tree-sha1 = "6404a564c24a994814106c374bec893195e19bac" uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" -version = "1.7.0" +version = "1.8.0" weakdeps = ["SparseArrays"] [deps.ArrayLayouts.extensions] @@ -483,9 +483,9 @@ version = "0.5.5" [[deps.DynamicQuantities]] deps = ["Compat", "PackageExtensionCompat", "Tricks"] -git-tree-sha1 = "bd77385a0fc00ca65d69f55e41955b07ff0dd366" +git-tree-sha1 = "bcb4d4a81564700278852b730ced61b66ad338e6" uuid = "06fc5a27-2a28-4c7c-a15d-362465fb6821" -version = "0.12.3" +version = "0.13.1" [deps.DynamicQuantities.extensions] DynamicQuantitiesLinearAlgebraExt = "LinearAlgebra" @@ -568,9 +568,9 @@ version = "3.3.10+0" [[deps.FastAlmostBandedMatrices]] deps = ["ArrayInterface", "ArrayLayouts", "BandedMatrices", "ConcreteStructs", "LazyArrays", "LinearAlgebra", "MatrixFactorizations", "PrecompileTools", "Reexport"] -git-tree-sha1 = "178316d87f883f0702e79d9c83a8049484c9f619" +git-tree-sha1 = "9dc913faf8552fd09b92a0d7fcc25f1d5609d795" uuid = "9d29842c-ecb8-4973-b1e9-a27b1157504e" -version = "0.1.0" +version = "0.1.1" [[deps.FastBroadcast]] deps = ["ArrayInterface", "LinearAlgebra", "Polyester", "Static", "StaticArrayInterface", "StrideArraysCore"] @@ -711,9 +711,9 @@ version = "0.73.3+0" [[deps.GenericSchur]] deps = ["LinearAlgebra", "Printf"] -git-tree-sha1 = "fb69b2a645fa69ba5f474af09221b9308b160ce6" +git-tree-sha1 = "af49a0851f8113fcfae2ef5027c6d49d0acec39b" uuid = "c145ed77-6b09-5dd9-b285-bf645a82121e" -version = "0.5.3" +version = "0.5.4" [[deps.Gettext_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Libiconv_jll", "Pkg", "XML2_jll"] @@ -1072,10 +1072,10 @@ weakdeps = ["ChainRulesCore", "SparseArrays", "Statistics"] LinearMapsStatisticsExt = "Statistics" [[deps.LinearSolve]] -deps = ["ArrayInterface", "ChainRulesCore", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "Libdl", "LinearAlgebra", "MKL_jll", "Markdown", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "StaticArraysCore", "UnPack"] -git-tree-sha1 = "73d8f61f8d27f279edfbafc93faaea93ea447e94" +deps = ["ArrayInterface", "ChainRulesCore", "ConcreteStructs", "DocStringExtensions", "EnumX", "FastLapackInterface", "GPUArraysCore", "InteractiveUtils", "KLU", "Krylov", "LazyArrays", "Libdl", "LinearAlgebra", "MKL_jll", "Markdown", "PrecompileTools", "Preferences", "RecursiveFactorization", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Sparspak", "StaticArraysCore", "UnPack"] +git-tree-sha1 = "775e5e5d9ace42ef8deeb236587abc69e70dc455" uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae" -version = "2.27.0" +version = "2.28.0" [deps.LinearSolve.extensions] LinearSolveBandedMatricesExt = "BandedMatrices" @@ -1225,9 +1225,9 @@ uuid = "a63ad114-7e13-5084-954f-fe012c677804" [[deps.ModelingToolkit]] deps = ["AbstractTrees", "ArrayInterface", "Combinatorics", "Compat", "ConstructionBase", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "DiffRules", "Distributed", "Distributions", "DocStringExtensions", "DomainSets", "DynamicQuantities", "ExprTools", "FindFirstFunctions", "ForwardDiff", "FunctionWrappersWrappers", "Graphs", "InteractiveUtils", "JuliaFormatter", "JumpProcesses", "LabelledArrays", "Latexify", "Libdl", "LinearAlgebra", "MLStyle", "NaNMath", "OrdinaryDiffEq", "PrecompileTools", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLBase", "SciMLStructures", "Serialization", "Setfield", "SimpleNonlinearSolve", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicUtils", "Symbolics", "URIs", "UnPack", "Unitful"] -git-tree-sha1 = "7d14b2163fee826b3d56c3e85c107f90757bbe75" +git-tree-sha1 = "547b014cef60a35657ee5ff1e87a0e1f20d9f11d" uuid = "961ee093-0014-501f-94e3-6117800e7a78" -version = "9.6.1" +version = "9.7.0" [deps.ModelingToolkit.extensions] MTKBifurcationKitExt = "BifurcationKit" @@ -1288,9 +1288,9 @@ version = "1.2.0" [[deps.NonlinearSolve]] deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "LazyArrays", "LineSearches", "LinearAlgebra", "LinearSolve", "MaybeInplace", "PrecompileTools", "Preferences", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArraysCore", "TimerOutputs"] -git-tree-sha1 = "13232c70f50a05f98c7206190ab33dd48fa39c5b" +git-tree-sha1 = "1638addfc31707aea26333ff822afcf9d2e6f7de" uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" -version = "3.8.1" +version = "3.8.3" [deps.NonlinearSolve.extensions] NonlinearSolveBandedMatricesExt = "BandedMatrices" @@ -1675,9 +1675,9 @@ version = "0.6.42" [[deps.SciMLBase]] deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "SciMLStructures", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"] -git-tree-sha1 = "088123999a9a8fa7ff386a82048c6ed24b2b7d07" +git-tree-sha1 = "d15c65e25615272e1b1c5edb1d307484c7942824" uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462" -version = "2.30.2" +version = "2.31.0" [deps.SciMLBase.extensions] SciMLBaseChainRulesCoreExt = "ChainRulesCore" @@ -1926,10 +1926,16 @@ uuid = "fb77eaff-e24c-56d4-86b1-d163f2edb164" version = "5.2.2+0" [[deps.SymbolicIndexingInterface]] -deps = ["MacroTools", "RuntimeGeneratedFunctions"] -git-tree-sha1 = "f7b1fc9fc2bc938436b7684c243be7d317919056" +deps = ["ArrayInterface", "MacroTools", "RuntimeGeneratedFunctions", "StaticArraysCore"] +git-tree-sha1 = "dd94edee1542e9da422cb2f12494ef09ea823e48" uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5" -version = "0.3.11" +version = "0.3.13" + +[[deps.SymbolicLimits]] +deps = ["SymbolicUtils"] +git-tree-sha1 = "89aa6b25a75418c8fffc42073b2e7dce69847394" +uuid = "19f23fe9-fdab-4a78-91af-e7b7767979c3" +version = "0.2.0" [[deps.SymbolicUtils]] deps = ["AbstractTrees", "Bijections", "ChainRulesCore", "Combinatorics", "ConstructionBase", "DataStructures", "DocStringExtensions", "DynamicPolynomials", "IfElse", "LabelledArrays", "LinearAlgebra", "MultivariatePolynomials", "NaNMath", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "TimerOutputs", "Unityper"] @@ -1938,10 +1944,10 @@ uuid = "d1185830-fcd6-423d-90d6-eec64667417b" version = "1.5.1" [[deps.Symbolics]] -deps = ["ArrayInterface", "Bijections", "ConstructionBase", "DataStructures", "DiffRules", "Distributions", "DocStringExtensions", "DomainSets", "DynamicPolynomials", "ForwardDiff", "IfElse", "LaTeXStrings", "LambertW", "Latexify", "Libdl", "LinearAlgebra", "LogExpFunctions", "MacroTools", "Markdown", "NaNMath", "PrecompileTools", "RecipesBase", "Reexport", "Requires", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicUtils"] -git-tree-sha1 = "d8b8dd08b7ec073cc7dc64cfa247fa0c4b5d5297" +deps = ["ArrayInterface", "Bijections", "ConstructionBase", "DataStructures", "DiffRules", "Distributions", "DocStringExtensions", "DomainSets", "DynamicPolynomials", "ForwardDiff", "IfElse", "LaTeXStrings", "LambertW", "Latexify", "Libdl", "LinearAlgebra", "LogExpFunctions", "MacroTools", "Markdown", "NaNMath", "PrecompileTools", "RecipesBase", "Reexport", "Requires", "RuntimeGeneratedFunctions", "SciMLBase", "Setfield", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicLimits", "SymbolicUtils"] +git-tree-sha1 = "d1b0db65977dfc2f942dbf76a0a54c99a9465f71" uuid = "0c5d862f-8b57-4792-8d23-62f2024744c7" -version = "5.25.2" +version = "5.26.0" [deps.Symbolics.extensions] SymbolicsGroebnerExt = "Groebner" @@ -2005,9 +2011,9 @@ uuid = "0796e94c-ce3b-5d07-9a54-7f471281c624" version = "0.5.28" [[deps.TranscodingStreams]] -git-tree-sha1 = "a09c933bebed12501890d8e92946bbab6a1690f1" +git-tree-sha1 = "14389d51751169994b2e1317d5c72f7dc4f21045" uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" -version = "0.10.5" +version = "0.10.6" weakdeps = ["Random", "Test"] [deps.TranscodingStreams.extensions] diff --git a/dev/connectors/connections/a9a3019e.svg b/dev/connectors/connections/0f98397a.svg similarity index 89% rename from dev/connectors/connections/a9a3019e.svg rename to dev/connectors/connections/0f98397a.svg index 6f3dde910..2225a7ace 100644 --- a/dev/connectors/connections/a9a3019e.svg +++ b/dev/connectors/connections/0f98397a.svg @@ -1,82 +1,82 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/connectors/connections/5ba0ab6b.svg b/dev/connectors/connections/2faa71a4.svg similarity index 89% rename from dev/connectors/connections/5ba0ab6b.svg rename to dev/connectors/connections/2faa71a4.svg index 70a3916e5..b8b052656 100644 --- a/dev/connectors/connections/5ba0ab6b.svg +++ b/dev/connectors/connections/2faa71a4.svg @@ -1,82 +1,82 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/connectors/connections/36d9ec33.svg b/dev/connectors/connections/758fda2b.svg similarity index 92% rename from dev/connectors/connections/36d9ec33.svg rename to dev/connectors/connections/758fda2b.svg index cb7d47a62..060d506f3 100644 --- a/dev/connectors/connections/36d9ec33.svg +++ b/dev/connectors/connections/758fda2b.svg @@ -1,48 +1,48 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/connectors/connections/e635af09.svg b/dev/connectors/connections/918c6aa3.svg similarity index 89% rename from dev/connectors/connections/e635af09.svg rename to dev/connectors/connections/918c6aa3.svg index 23dc69ca4..bb8c860ba 100644 --- a/dev/connectors/connections/e635af09.svg +++ b/dev/connectors/connections/918c6aa3.svg @@ -1,116 +1,116 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/connectors/connections/861a5613.svg b/dev/connectors/connections/c782995b.svg similarity index 85% rename from dev/connectors/connections/861a5613.svg rename to dev/connectors/connections/c782995b.svg index 36c8225b7..c5539fd7c 100644 --- a/dev/connectors/connections/861a5613.svg +++ b/dev/connectors/connections/c782995b.svg @@ -1,43 +1,43 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/connectors/connections/c9ef0a40.svg b/dev/connectors/connections/cf3f0971.svg similarity index 91% rename from dev/connectors/connections/c9ef0a40.svg rename to dev/connectors/connections/cf3f0971.svg index 2eb400aeb..db410d2ab 100644 --- a/dev/connectors/connections/c9ef0a40.svg +++ b/dev/connectors/connections/cf3f0971.svg @@ -1,56 +1,56 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/connectors/connections/index.html b/dev/connectors/connections/index.html index 1d23bedb5..80fffdec8 100644 --- a/dev/connectors/connections/index.html +++ b/dev/connectors/connections/index.html @@ -22,7 +22,7 @@ p1 = plot(sol, idxs = [capacitor.v]) p2 = plot(sol, idxs = [resistor.i]) -plot(p1, p2)Example block output

Mechanical Translational Domain

Across Variable = velocity

Now using the Translational library based on velocity, we can see the same relationship with a system reduced to a single equation, using the components:

  • Body (i.e. moving mass): for kinetic energy storage with an initial velocity = 1m/s
  • Damper: for energy flow
  • Fixed: for energy sink
using ModelingToolkitStandardLibrary
+plot(p1, p2)
Example block output

Mechanical Translational Domain

Across Variable = velocity

Now using the Translational library based on velocity, we can see the same relationship with a system reduced to a single equation, using the components:

  • Body (i.e. moving mass): for kinetic energy storage with an initial velocity = 1m/s
  • Damper: for energy flow
  • Fixed: for energy sink
using ModelingToolkitStandardLibrary
 const TV = ModelingToolkitStandardLibrary.Mechanical.Translational
 
 @named damping = TV.Damper(d = 1, flange_a.v = 1)
@@ -41,7 +41,7 @@
 
 p1 = plot(sol_v, idxs = [body.v])
 p2 = plot(sol_v, idxs = [damping.f])
-plot(p1, p2)
Example block output

Across Variable = position

Now, let's consider the position-based approach. We can build the same model with the same components. As can be seen, we now end of up with 2 equations, because we need to relate the lower derivative (position) to force (with acceleration).

const TP = ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition
+plot(p1, p2)
Example block output

Across Variable = position

Now, let's consider the position-based approach. We can build the same model with the same components. As can be seen, we now end of up with 2 equations, because we need to relate the lower derivative (position) to force (with acceleration).

const TP = ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition
 
 @named damping = TP.Damper(d = 1, va = 1, vb = 0.0)
 @named body = TP.Mass(m = 1, v = 1)
@@ -62,7 +62,7 @@
 p2 = plot(sol_p, idxs = [damping.f])
 p3 = plot(sol_p, idxs = [body.s])
 
-plot(p1, p2, p3)
Example block output

The question then arises, can the position be plotted when using the Mechanical Translational Domain based on the Velocity Across variable? Yes, we can! There are 2 solutions:

  1. the Mass component will add the position variable when the s parameter is used to set an initial position. Otherwise, the component does not track the position.
@named body = TV.Mass(m = 1, v = 1, s = 0)
  1. implement a PositionSensor TODO: Implement Translation Sensors

Either option will produce the same result regardless of which across variable is used. If the same result is given, why are both options included in the Standard Library, what are the differences? These differences will be discussed next so that an informed decision can be made about which domain is best for your model.

Mechanical/Translational Library Differences (Velocity vs. Position Connectors)

Initialization

The main difference between ModelingToolkitStandardLibrary.Mechanical.Translational and ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition is how they are initialized. In the ModelingToolkitStandardLibrary initialization, parameters are defined at the component level, so we simply need to be careful to set the correct initial conditions for the domain that it used. Let's use the following example problem to explain the differences.

Example Mechanical Model

In this problem, we have a mass, spring, and damper which are connected to a fixed point. Let's see how each component is defined.

Damper

The damper will connect the flange/flange 1 (flange_a) to the mass, and flange/flange 2 (flange_b) to the fixed point. For both position- and velocity-based domains, we set the damping constant d=1 and va=1 and leave the default for v_b_0 at 0. For the position domain, we also need to set the initial positions for flange_a and flange_b.

@named dv = TV.Damper(d = 1, flange_a.v = 1)
+plot(p1, p2, p3)
Example block output

The question then arises, can the position be plotted when using the Mechanical Translational Domain based on the Velocity Across variable? Yes, we can! There are 2 solutions:

  1. the Mass component will add the position variable when the s parameter is used to set an initial position. Otherwise, the component does not track the position.
@named body = TV.Mass(m = 1, v = 1, s = 0)
  1. implement a PositionSensor TODO: Implement Translation Sensors

Either option will produce the same result regardless of which across variable is used. If the same result is given, why are both options included in the Standard Library, what are the differences? These differences will be discussed next so that an informed decision can be made about which domain is best for your model.

Mechanical/Translational Library Differences (Velocity vs. Position Connectors)

Initialization

The main difference between ModelingToolkitStandardLibrary.Mechanical.Translational and ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition is how they are initialized. In the ModelingToolkitStandardLibrary initialization, parameters are defined at the component level, so we simply need to be careful to set the correct initial conditions for the domain that it used. Let's use the following example problem to explain the differences.

Example Mechanical Model

In this problem, we have a mass, spring, and damper which are connected to a fixed point. Let's see how each component is defined.

Damper

The damper will connect the flange/flange 1 (flange_a) to the mass, and flange/flange 2 (flange_b) to the fixed point. For both position- and velocity-based domains, we set the damping constant d=1 and va=1 and leave the default for v_b_0 at 0. For the position domain, we also need to set the initial positions for flange_a and flange_b.

@named dv = TV.Damper(d = 1, flange_a.v = 1)
 @named dp = TP.Damper(d = 1, va = 1, vb = 0.0, flange_a__s = 3, flange_b__s = 1)

Spring

The spring will connect the flange/flange 1 (flange_a) to the mass, and flange/flange 2 (flange_b) to the fixed point. For both position- and velocity-based domains, we set the spring constant k=1. The velocity domain then requires the initial velocity va and initial spring stretch delta_s. The position domain instead needs the initial positions for flange_a and flange_b and the natural spring length l.

@named sv = TV.Spring(k = 1, flange_a__v = 1, delta_s = 1)
 @named sp = TP.Spring(k = 1, flange_a__s = 3, flange_b__s = 1, l = 1)

Mass

For both position- and velocity-based domains, we set the mass m=1 and initial velocity v=1. Like the damper, the position domain requires the position initial conditions set as well.

@named bv = TV.Mass(m = 1, v = 1)
 @named bp = TP.Mass(m = 1, v = 1, s = 3)

Fixed

Here the velocity domain requires no initial condition, but for our model to work as defined we must set the position domain component to the correct initial position.

@named gv = TV.Fixed()
@@ -84,9 +84,9 @@
 Differential(t)(sv₊delta_s(t)) ~ bv₊v(t)

And the position domain model

solp = simplify_and_solve(dp, sp, bp, gp);
Differential(t)(bp₊s(t)) ~ bp₊v(t)
 Differential(t)(bp₊v(t)) ~ (-dp₊d*bp₊v(t) - (-gp₊s_0 - sp₊l + bp₊s(t))*sp₊k) / bp₊m

Now we can plot the comparison of the 2 models and see they give the same result.

plot(ylabel = "mass velocity [m/s]")
 plot!(solv, idxs = [bv.v])
-plot!(solp, idxs = [bp.v])
Example block output

But, what if we wanted to plot the mass position? This is easy for the position-based domain, we have the state bp₊s(t), but for the velocity-based domain we have sv₊delta_s(t) which is the spring stretch. To get the absolute position, we add the spring natural length (1m) and the fixed position (1m). As can be seen, we then get the same result.

plot(ylabel = "mass position [m]")
+plot!(solp, idxs = [bp.v])
Example block output

But, what if we wanted to plot the mass position? This is easy for the position-based domain, we have the state bp₊s(t), but for the velocity-based domain we have sv₊delta_s(t) which is the spring stretch. To get the absolute position, we add the spring natural length (1m) and the fixed position (1m). As can be seen, we then get the same result.

plot(ylabel = "mass position [m]")
 plot!(solv, idxs = [sv.delta_s + 1 + 1])
-plot!(solp, idxs = [bp.s])
Example block output

So in conclusion, the position based domain gives easier access to absolute position information, but requires more initial condition information.

Accuracy

One may then ask, what the trade-off in terms of numerical accuracy is. When we look at the simplified equations, we can see that actually both systems solve the same equations. The differential equations of the velocity domain are

\[\begin{aligned} +plot!(solp, idxs = [bp.s])Example block output

So in conclusion, the position based domain gives easier access to absolute position information, but requires more initial condition information.

Accuracy

One may then ask, what the trade-off in terms of numerical accuracy is. When we look at the simplified equations, we can see that actually both systems solve the same equations. The differential equations of the velocity domain are

\[\begin{aligned} m \cdot \dot{v} + d \cdot v + k \cdot \Delta s = 0 \\ \dot{\Delta s} = v \end{aligned}\]

And for the position domain are

\[\begin{aligned} @@ -96,4 +96,4 @@ ylabel = "solv[bv.v] .- solp[bp.v]") time = 0:0.1:10 plot!(time, (solv(time)[bv.v] .- solp(time)[bp.v]), label = "") -Plots.ylims!(-1e-15, 1e-15)Example block output

+Plots.ylims!(-1e-15, 1e-15)Example block output diff --git a/dev/index.html b/dev/index.html index 8a2c2d6b0..5017fa8d2 100644 --- a/dev/index.html +++ b/dev/index.html @@ -5,7 +5,7 @@ [0c46a032] DifferentialEquations v7.13.0 [e30172f5] Documenter v1.3.0 [615f187c] IfElse v0.1.1 - [961ee093] ModelingToolkit v9.6.1 + [961ee093] ModelingToolkit v9.7.0 [16a59e39] ModelingToolkitStandardLibrary v2.6.0 `~/work/ModelingToolkitStandardLibrary.jl/ModelingToolkitStandardLibrary.jl` [1dea7af3] OrdinaryDiffEq v6.74.1 [91a5bcdd] Plots v1.40.2
and using this machine and Julia version.
Julia Version 1.10.2
@@ -26,7 +26,7 @@
   [79e6a3ab] Adapt v4.0.4
 ⌅ [ec485272] ArnoldiMethod v0.2.0
   [4fba245c] ArrayInterface v7.9.0
-  [4c555306] ArrayLayouts v1.7.0
+  [4c555306] ArrayLayouts v1.8.0
   [aae01518] BandedMatrices v1.6.1
   [e2ed5e7c] Bijections v0.1.6
   [d1d4a3ce] BitFlags v0.1.8
@@ -75,7 +75,7 @@
   [5b8099bc] DomainSets v0.7.10
   [fa6b7ba4] DualNumbers v0.6.8
   [7c1d4256] DynamicPolynomials v0.5.5
-⌅ [06fc5a27] DynamicQuantities v0.12.3
+  [06fc5a27] DynamicQuantities v0.13.1
   [4e289a0a] EnumX v1.0.4
 ⌃ [f151be2c] EnzymeCore v0.6.5
   [460bff9d] ExceptionUnwrapping v0.1.10
@@ -83,7 +83,7 @@
   [e2ba6199] ExprTools v0.1.10
   [c87230d0] FFMPEG v0.4.1
   [7a1cc6ca] FFTW v1.8.0
-  [9d29842c] FastAlmostBandedMatrices v0.1.0
+  [9d29842c] FastAlmostBandedMatrices v0.1.1
   [7034ab61] FastBroadcast v0.2.8
   [9aa1b823] FastClosures v0.3.2
   [29a986be] FastLapackInterface v2.0.2
@@ -98,7 +98,7 @@
   [d9f16b24] Functors v0.4.8
   [46192b85] GPUArraysCore v0.1.6
   [28b8d3ca] GR v0.73.3
-  [c145ed77] GenericSchur v0.5.3
+  [c145ed77] GenericSchur v0.5.4
   [d7ba0133] Git v1.3.1
   [c27321d9] Glob v1.3.1
   [86223c79] Graphs v1.9.0
@@ -130,7 +130,7 @@
   [2d8b4e74] LevyArea v1.0.0
   [d3d80556] LineSearches v7.2.0
   [7a12625a] LinearMaps v3.11.2
-  [7ed4a6bd] LinearSolve v2.27.0
+  [7ed4a6bd] LinearSolve v2.28.0
   [2ab3a3ac] LogExpFunctions v0.3.27
   [e6f89c97] LoggingExtras v1.0.3
   [bdcacae8] LoopVectorization v0.12.166
@@ -145,7 +145,7 @@
   [739be429] MbedTLS v1.1.9
   [442fdcdd] Measures v0.3.2
   [e1d29d7a] Missings v1.1.0
-  [961ee093] ModelingToolkit v9.6.1
+  [961ee093] ModelingToolkit v9.7.0
   [16a59e39] ModelingToolkitStandardLibrary v2.6.0 `~/work/ModelingToolkitStandardLibrary.jl/ModelingToolkitStandardLibrary.jl`
   [46d2c3a1] MuladdMacro v0.2.4
   [102ac46a] MultivariatePolynomials v0.5.4
@@ -153,7 +153,7 @@
   [d41bc354] NLSolversBase v7.8.3
   [2774e3e8] NLsolve v4.5.1
   [77ba4419] NaNMath v1.0.2
-  [8913a72c] NonlinearSolve v3.8.1
+  [8913a72c] NonlinearSolve v3.8.3
   [6fe1bfb0] OffsetArrays v1.13.0
   [4d8831e6] OpenSSL v1.4.2
   [429524aa] Optim v1.9.3
@@ -191,7 +191,7 @@
   [7e49a35a] RuntimeGeneratedFunctions v0.5.12
   [94e857df] SIMDTypes v0.1.0
   [476501e8] SLEEFPirates v0.6.42
-  [0bca4576] SciMLBase v2.30.2
+  [0bca4576] SciMLBase v2.31.0
   [c0aeaf25] SciMLOperators v0.3.8
   [53ae85a6] SciMLStructures v1.1.0
   [6c6a2e73] Scratch v1.2.1
@@ -216,16 +216,17 @@
   [789caeaf] StochasticDiffEq v6.65.1
   [7792a7ef] StrideArraysCore v0.5.2
   [c3572dad] Sundials v4.24.0
-  [2efcf032] SymbolicIndexingInterface v0.3.11
+  [2efcf032] SymbolicIndexingInterface v0.3.13
+  [19f23fe9] SymbolicLimits v0.2.0
   [d1185830] SymbolicUtils v1.5.1
-  [0c5d862f] Symbolics v5.25.2
+  [0c5d862f] Symbolics v5.26.0
   [3783bdb8] TableTraits v1.0.1
   [bd369af6] Tables v1.11.1
   [62fd8b95] TensorCore v0.1.1
   [8290d209] ThreadingUtilities v0.5.2
   [a759f4b9] TimerOutputs v0.5.23
   [0796e94c] Tokenize v0.5.28
-  [3bb67fe8] TranscodingStreams v0.10.5
+  [3bb67fe8] TranscodingStreams v0.10.6
   [d5829a12] TriangularSolve v0.1.20
   [410a4b4d] Tricks v0.1.8
   [781d530d] TruncatedStacktraces v1.4.0
@@ -370,4 +371,4 @@
   [8e850b90] libblastrampoline_jll v5.8.0+1
   [8e850ede] nghttp2_jll v1.52.0+1
   [3f19e933] p7zip_jll v17.4.0+2
-Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`

You can also download the manifest file and the project file.

+Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`

You can also download the manifest file and the project file.

diff --git a/dev/tutorials/custom_component/index.html b/dev/tutorials/custom_component/index.html index 0bba9d1c9..ef3d3fed4 100644 --- a/dev/tutorials/custom_component/index.html +++ b/dev/tutorials/custom_component/index.html @@ -55,4 +55,4 @@ Plots.plot(sol; idxs = [C1.v, C2.v, L.i], labels = ["C1 Voltage in V" "C2 Voltage in V" "Inductor Current in A"]) -Plots.savefig("chua.png")

Time series plot of C1.v, C2.v and L.i

Phase plane plot of C1.v and C2.v

+Plots.savefig("chua.png")

Time series plot of C1.v, C2.v and L.i

Phase plane plot of C1.v and C2.v

diff --git a/dev/tutorials/dc_motor_pi/87508734.svg b/dev/tutorials/dc_motor_pi/5b698c11.svg similarity index 85% rename from dev/tutorials/dc_motor_pi/87508734.svg rename to dev/tutorials/dc_motor_pi/5b698c11.svg index dbbf366ff..ba46f3a60 100644 --- a/dev/tutorials/dc_motor_pi/87508734.svg +++ b/dev/tutorials/dc_motor_pi/5b698c11.svg @@ -1,55 +1,55 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/dc_motor_pi/d0c422d0.svg b/dev/tutorials/dc_motor_pi/b1322da7.svg similarity index 85% rename from dev/tutorials/dc_motor_pi/d0c422d0.svg rename to dev/tutorials/dc_motor_pi/b1322da7.svg index 93ba6bfa7..91c314a8e 100644 --- a/dev/tutorials/dc_motor_pi/d0c422d0.svg +++ b/dev/tutorials/dc_motor_pi/b1322da7.svg @@ -1,83 +1,83 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/tutorials/dc_motor_pi/4778243c.svg b/dev/tutorials/dc_motor_pi/e73752b8.svg similarity index 86% rename from dev/tutorials/dc_motor_pi/4778243c.svg rename to dev/tutorials/dc_motor_pi/e73752b8.svg index cd6ee430c..743542663 100644 --- a/dev/tutorials/dc_motor_pi/4778243c.svg +++ b/dev/tutorials/dc_motor_pi/e73752b8.svg @@ -1,54 +1,54 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/dev/tutorials/dc_motor_pi/index.html b/dev/tutorials/dc_motor_pi/index.html index 4409ad75a..8e6fb3775 100644 --- a/dev/tutorials/dc_motor_pi/index.html +++ b/dev/tutorials/dc_motor_pi/index.html @@ -65,7 +65,7 @@ label = "Measurement", title = "DC Motor with Speed Controller") Plots.plot!(sol.t, sol[ref.output.u], label = "Reference") p2 = Plots.plot(sol.t, sol[load.tau.u], ylabel = "Disturbance in Nm", label = "") -Plots.plot(p1, p2, layout = (2, 1))Example block output

Closed-loop analysis

When implementing and tuning a control system in simulation, it is a good practice to analyze the closed-loop properties and verify robustness of the closed-loop with respect to, e.g., modeling errors. To facilitate this, we added two analysis points to the set of connections above, more specifically, we added the analysis points named :y and :u to the connections (for more details on analysis points, see Linear Analysis)

connect(speed_sensor.w, :y, feedback.input2)
+Plots.plot(p1, p2, layout = (2, 1))
Example block output

Closed-loop analysis

When implementing and tuning a control system in simulation, it is a good practice to analyze the closed-loop properties and verify robustness of the closed-loop with respect to, e.g., modeling errors. To facilitate this, we added two analysis points to the set of connections above, more specifically, we added the analysis points named :y and :u to the connections (for more details on analysis points, see Linear Analysis)

connect(speed_sensor.w, :y, feedback.input2)
 connect(pi_controller.ctr_output, :u, source.V)

one at the plant output (:y) and one at the plant input (:u). We may use these analysis points to calculate, e.g., sensitivity functions, illustrated below. Here, we calculate the sensitivity function $S(s)$ and the complimentary sensitivity function $T(s) = I - S(s)$, defined as

\[\begin{aligned} S(s) &= \dfrac{1}{I + P(s)C(s)} \\ T(s) &= \dfrac{P(s)C(s)}{I + P(s)C(s)} @@ -77,9 +77,9 @@ model, :y, op = Dict(inertia.phi => 0.0, inertia.w => 0.0)) To = ss(matrices_T...)# The output complementary sensitivity function as a StateSpace system bodeplot([So, To], label = ["S" "T"], plot_title = "Sensitivity functions", - plotphase = false)Example block output

Similarly, we may compute the loop-transfer function and plot its Nyquist curve

matrices_L, simplified_sys = Blocks.get_looptransfer(
+    plotphase = false)
Example block output

Similarly, we may compute the loop-transfer function and plot its Nyquist curve

matrices_L, simplified_sys = Blocks.get_looptransfer(
     model, :y, op = Dict(unknowns(sys) .=> 0.0))
 L = -ss(matrices_L...) # The loop-transfer function as a StateSpace system. The negative sign is to negate the built-in negative feedback
 Ms, ωMs = hinfnorm(So) # Compute the peak of the sensitivity function to draw a circle in the Nyquist plot
 nyquistplot(L, label = "\$L(s)\$", ylims = (-2.5, 0.5), xlims = (-1.2, 0.1),
-    Ms_circles = Ms)
Example block output + Ms_circles = Ms)Example block output diff --git a/dev/tutorials/input_component/index.html b/dev/tutorials/input_component/index.html index 250f5e926..fb53ca109 100644 --- a/dev/tutorials/input_component/index.html +++ b/dev/tutorials/input_component/index.html @@ -101,4 +101,4 @@ @sync begin @async sol1[] = solve(prob1, ImplicitEuler()) @async sol2[] = solve(prob2, ImplicitEuler()) -end

Note, in the above example, we can build the system with an empty SampledData component, only setting the expected data type: @named src = SampledData(Float64). It's also possible to initialize the component with real sampled data: @named src = SampledData(data, dt). Additionally note that before running an ODEProblem using the SampledData component, one must be careful about the parameter vector Type. The SampledData component contains a buffer parameter of type Parameter, therefore we must generate the problem using tofloat=false. This will initially give a parameter vector of type Vector{Any} with a mix of numbers and Parameter type. We can convert the vector to a uniform Parameter type by running p = Parameter.(p). This will wrap all the single values in a Parameter which will be mathematically equivalent to a Number.

+end

Note, in the above example, we can build the system with an empty SampledData component, only setting the expected data type: @named src = SampledData(Float64). It's also possible to initialize the component with real sampled data: @named src = SampledData(data, dt). Additionally note that before running an ODEProblem using the SampledData component, one must be careful about the parameter vector Type. The SampledData component contains a buffer parameter of type Parameter, therefore we must generate the problem using tofloat=false. This will initially give a parameter vector of type Vector{Any} with a mix of numbers and Parameter type. We can convert the vector to a uniform Parameter type by running p = Parameter.(p). This will wrap all the single values in a Parameter which will be mathematically equivalent to a Number.

diff --git a/dev/tutorials/rc_circuit/index.html b/dev/tutorials/rc_circuit/index.html index 48e7a4637..e14a8ee86 100644 --- a/dev/tutorials/rc_circuit/index.html +++ b/dev/tutorials/rc_circuit/index.html @@ -26,4 +26,4 @@ plot(sol, idxs = [capacitor.v, resistor.i], title = "RC Circuit Demonstration", labels = ["Capacitor Voltage" "Resistor Current"]) -savefig("plot.png");

+savefig("plot.png");

diff --git a/dev/tutorials/thermal_model/index.html b/dev/tutorials/thermal_model/index.html index bd961b785..823844575 100644 --- a/dev/tutorials/thermal_model/index.html +++ b/dev/tutorials/thermal_model/index.html @@ -28,4 +28,4 @@ plot(title = "Thermal Conduction Demonstration") plot!(sol, idxs = [mass1.T, mass2.T], labels = ["Mass 1 Temperature" "Mass 2 Temperature"]) plot!(sol.t, T_final_K, label = "Steady-State Temperature") -savefig("thermal_plot.png");

Plot of Temperatures

+savefig("thermal_plot.png");

Plot of Temperatures