Skip to content

Commit 8c6e16a

Browse files
authored
Merge branch 'main' into fb/msl_translational
2 parents 2aa9d7d + a8428c8 commit 8c6e16a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+895
-214
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Location of package manifests
6+
schedule:
7+
interval: "weekly"

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
- '1'
1818
- '1.6'
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- uses: julia-actions/setup-julia@v1
2222
with:
2323
version: ${{ matrix.version }}
24-
- uses: actions/cache@v1
24+
- uses: actions/cache@v3
2525
env:
2626
cache-name: cache-artifacts
2727
with:
@@ -34,6 +34,6 @@ jobs:
3434
- uses: julia-actions/julia-buildpkg@v1
3535
- uses: julia-actions/julia-runtest@v1
3636
- uses: julia-actions/julia-processcoverage@v1
37-
- uses: codecov/codecov-action@v1
37+
- uses: codecov/codecov-action@v3
3838
with:
3939
file: lcov.info

.github/workflows/Documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
- uses: julia-actions/setup-julia@latest
1616
with:
1717
version: '1'
@@ -23,6 +23,6 @@ jobs:
2323
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
2424
run: julia --project=docs/ --code-coverage=user docs/make.jl
2525
- uses: julia-actions/julia-processcoverage@v1
26-
- uses: codecov/codecov-action@v1
26+
- uses: codecov/codecov-action@v3
2727
with:
2828
file: lcov.info

.github/workflows/FormatCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
version: ${{ matrix.julia-version }}
2323

24-
- uses: actions/checkout@v1
24+
- uses: actions/checkout@v3
2525
- name: Install JuliaFormatter and format
2626
# This will use the latest version by default but you can set the version like so:
2727
#

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkitStandardLibrary"
22
uuid = "16a59e39-deab-5bd0-87e4-056b12336739"
33
authors = ["Chris Rackauckas and Julia Computing"]
4-
version = "1.11.0"
4+
version = "1.13.0"
55

66
[deps]
77
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
@@ -11,7 +11,7 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1111

1212
[compat]
1313
IfElse = "0.1"
14-
ModelingToolkit = "8.26"
14+
ModelingToolkit = "8.50"
1515
Symbolics = "4.9, 5"
1616
julia = "1.6"
1717

src/Blocks/Blocks.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export Abs, Sign, Sqrt, Sin, Cos, Tan, Asin, Acos, Atan, Atan2, Sinh, Cosh, Tanh
1616
export Log, Log10
1717
include("math.jl")
1818

19-
export Constant, Sine, Cosine, ContinuousClock, Ramp, Step, ExpSine, Square, Triangular
19+
export Constant, TimeVaryingFunction, Sine, Cosine, ContinuousClock, Ramp, Step, ExpSine,
20+
Square, Triangular
2021
include("sources.jl")
2122

2223
export Limiter, DeadZone, SlewRateLimiter

src/Blocks/continuous.jl

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Outputs `y = ∫k*u dt`, corresponding to the transfer function `1/s`.
1313
- `k`: Gain of integrator
1414
- `x_start`: Initial value of integrator
1515
"""
16-
function Integrator(; name, k = 1, x_start = 0.0)
16+
@component function Integrator(; name, k = 1, x_start = 0.0)
1717
@named siso = SISO()
1818
@unpack u, y = siso
1919
sts = @variables x(t)=x_start [description = "State of Integrator $name"]
@@ -51,7 +51,7 @@ A smaller `T` leads to a more ideal approximation of the derivative.
5151
- `input`
5252
- `output`
5353
"""
54-
function Derivative(; name, k = 1, T, x_start = 0.0)
54+
@component function Derivative(; name, k = 1, T, x_start = 0.0)
5555
T > 0 || throw(ArgumentError("Time constant `T` has to be strictly positive"))
5656
@named siso = SISO()
5757
@unpack u, y = siso
@@ -97,7 +97,7 @@ sT + 1 - k
9797
9898
See also [`SecondOrder`](@ref)
9999
"""
100-
function FirstOrder(; name, k = 1, T, x_start = 0.0, lowpass = true)
100+
@component function FirstOrder(; name, k = 1, T, x_start = 0.0, lowpass = true)
101101
T > 0 || throw(ArgumentError("Time constant `T` has to be strictly positive"))
102102
@named siso = SISO()
103103
@unpack u, y = siso
@@ -138,7 +138,7 @@ Critical damping corresponds to `d=1`, which yields the fastest step response wi
138138
- `input`
139139
- `output`
140140
"""
141-
function SecondOrder(; name, k = 1, w, d, x_start = 0.0, xd_start = 0.0)
141+
@component function SecondOrder(; name, k = 1, w, d, x_start = 0.0, xd_start = 0.0)
142142
@named siso = SISO()
143143
@unpack u, y = siso
144144
@variables x(t)=x_start [description = "State of SecondOrder filter $name"]
@@ -170,7 +170,7 @@ Textbook version of a PI-controller without actuator saturation and anti-windup
170170
171171
See also [`LimPI`](@ref)
172172
"""
173-
function PI(; name, k = 1, T, x_start = 0.0)
173+
@component function PI(; name, k = 1, T, x_start = 0.0)
174174
T > 0 || throw(ArgumentError("Time constant `T` has to be strictly positive"))
175175
@named err_input = RealInput() # control error
176176
@named ctr_output = RealOutput() # control signal
@@ -209,7 +209,8 @@ Text-book version of a PID-controller without actuator saturation and anti-windu
209209
210210
See also [`LimPID`](@ref)
211211
"""
212-
function PID(; name, k = 1, Ti = false, Td = false, Nd = 10, xi_start = 0, xd_start = 0)
212+
@component function PID(; name, k = 1, Ti = false, Td = false, Nd = 10, xi_start = 0,
213+
xd_start = 0)
213214
with_I = !isequal(Ti, false)
214215
with_D = !isequal(Td, false)
215216
@named err_input = RealInput() # control error
@@ -228,7 +229,7 @@ function PID(; name, k = 1, Ti = false, Td = false, Nd = 10, xi_start = 0, xd_st
228229
@named Izero = Constant(k = 0)
229230
end
230231
if with_D
231-
@named der = Derivative(k = 1 / Td, T = 1 / Nd, x_start = xd_start)
232+
@named der = Derivative(k = Td, T = 1 / Nd, x_start = xd_start)
232233
else
233234
@named Dzero = Constant(k = 0)
234235
end
@@ -280,7 +281,7 @@ Text-book version of a PI-controller with actuator saturation and anti-windup me
280281
- `err_input`
281282
- `ctr_output`
282283
"""
283-
function LimPI(; name, k = 1, T, u_max, u_min = -u_max, Ta, x_start = 0.0)
284+
@component function LimPI(; name, k = 1, T, u_max, u_min = -u_max, Ta, x_start = 0.0)
284285
Ta > 0 || throw(ArgumentError("Time constant `Ta` has to be strictly positive"))
285286
T > 0 || throw(ArgumentError("Time constant `T` has to be strictly positive"))
286287
u_max u_min || throw(ArgumentError("u_min must be smaller than u_max"))
@@ -318,7 +319,7 @@ Proportional-Integral-Derivative (PID) controller with output saturation, set-po
318319
The equation for the control signal is roughly
319320
320321
```
321-
k(ep + 1/Ti * ∫e + 1/Td * d/dt(ed))
322+
k(ep + 1/Ti * ∫e + Td * d/dt(ed))
322323
e = u_r - u_y
323324
ep = wp*u_r - u_y
324325
ed = wd*u_r - u_y
@@ -343,14 +344,14 @@ where the transfer function for the derivative includes additional filtering, se
343344
- `measurement`
344345
- `ctr_output`
345346
"""
346-
function LimPID(; name, k = 1, Ti = false, Td = false, wp = 1, wd = 1,
347-
Ni = Ti == 0 ? Inf : (max(Td / Ti, 1e-6)),
348-
Nd = 10,
349-
u_max = Inf,
350-
u_min = u_max > 0 ? -u_max : -Inf,
351-
gains = false,
352-
xi_start = 0.0,
353-
xd_start = 0.0)
347+
@component function LimPID(; name, k = 1, Ti = false, Td = false, wp = 1, wd = 1,
348+
Ni = Ti == 0 ? Inf : (max(Td / Ti, 1e-6)),
349+
Nd = 10,
350+
u_max = Inf,
351+
u_min = u_max > 0 ? -u_max : -Inf,
352+
gains = false,
353+
xi_start = 0.0,
354+
xd_start = 0.0)
354355
with_I = !isequal(Ti, false)
355356
with_D = !isequal(Td, false)
356357
with_AWM = Ni != Inf
@@ -389,7 +390,7 @@ function LimPID(; name, k = 1, Ti = false, Td = false, wp = 1, wd = 1,
389390
@named Izero = Constant(k = 0)
390391
end
391392
if with_D
392-
@named der = Derivative(k = 1 / Td, T = 1 / Nd, x_start = xd_start)
393+
@named der = Derivative(k = Td, T = 1 / Nd, x_start = xd_start)
393394
@named addD = Add(k1 = wd, k2 = -1)
394395
else
395396
@named Dzero = Constant(k = 0)
@@ -478,8 +479,8 @@ y &= h(x, u)
478479
479480
linearized around the operating point `x₀, u₀`, we have `y0, u0 = h(x₀, u₀), u₀`.
480481
"""
481-
function StateSpace(; A, B, C, D = nothing, x_start = zeros(size(A, 1)), name,
482-
u0 = zeros(size(B, 2)), y0 = zeros(size(C, 1)))
482+
@component function StateSpace(; A, B, C, D = nothing, x_start = zeros(size(A, 1)), name,
483+
u0 = zeros(size(B, 2)), y0 = zeros(size(C, 1)))
483484
nx, nu, ny = size(A, 1), size(B, 2), size(C, 1)
484485
size(A, 2) == nx || error("`A` has to be a square matrix.")
485486
size(B, 1) == nx || error("`B` has to be of dimension ($nx x $nu).")

0 commit comments

Comments
 (0)