Skip to content

Commit fba3324

Browse files
authored
Merge branch 'main' into bgc/sign_convention
2 parents 92f354b + e6ffefa commit fba3324

Some content is hidden

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

74 files changed

+1298
-1091
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ updates:
77
interval: "weekly"
88
ignore:
99
- dependency-name: "crate-ci/typos"
10-
update-types: ["version-update:semver-patch"]
10+
update-types: ["version-update:semver-patch", "version-update:semver-minor"]

.github/workflows/CI.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- '1'
2222
steps:
2323
- uses: actions/checkout@v4
24-
- uses: julia-actions/setup-julia@v1
24+
- uses: julia-actions/setup-julia@v2
2525
with:
2626
version: ${{ matrix.version }}
27-
- uses: actions/cache@v3
27+
- uses: actions/cache@v4
2828
env:
2929
cache-name: cache-artifacts
3030
with:
@@ -37,6 +37,8 @@ jobs:
3737
- uses: julia-actions/julia-buildpkg@v1
3838
- uses: julia-actions/julia-runtest@v1
3939
- uses: julia-actions/julia-processcoverage@v1
40-
- uses: codecov/codecov-action@v3
40+
- uses: codecov/codecov-action@v4
4141
with:
4242
file: lcov.info
43+
token: ${{ secrets.CODECOV_TOKEN }}
44+
fail_ci_if_error: true

.github/workflows/Documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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@v3
26+
- uses: codecov/codecov-action@v4
2727
with:
2828
file: lcov.info

.github/workflows/Downgrade.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
version: ['1']
1919
steps:
2020
- uses: actions/checkout@v4
21-
- uses: julia-actions/setup-julia@v1
21+
- uses: julia-actions/setup-julia@v2
2222
with:
2323
version: ${{ matrix.version }}
24-
- uses: cjdoris/julia-downgrade-compat-action@v1
24+
- uses: julia-actions/julia-downgrade-compat@v1
2525
# if: ${{ matrix.version == '1.6' }}
2626
with:
2727
skip: Pkg,TOML
2828
- uses: julia-actions/julia-buildpkg@v1
29-
- uses: julia-actions/julia-runtest@v1
29+
- uses: julia-actions/julia-runtest@v1

.github/workflows/Downstream.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- {user: SciML, repo: ModelingToolkit.jl}
2121
steps:
2222
- uses: actions/checkout@v4
23-
- uses: julia-actions/setup-julia@v1
23+
- uses: julia-actions/setup-julia@v2
2424
with:
2525
version: ${{ matrix.julia-version }}
2626
arch: x64
@@ -48,6 +48,8 @@ jobs:
4848
exit(0) # Exit immediately, as a success
4949
end
5050
- uses: julia-actions/julia-processcoverage@v1
51-
- uses: codecov/codecov-action@v3
51+
- uses: codecov/codecov-action@v4
5252
with:
5353
file: lcov.info
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
fail_ci_if_error: true

.github/workflows/Invalidations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
if: github.base_ref == github.event.repository.default_branch
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: julia-actions/setup-julia@v1
19+
- uses: julia-actions/setup-julia@v2
2020
with:
2121
version: '1'
2222
- uses: actions/checkout@v4

.github/workflows/SpellCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ jobs:
1010
- name: Checkout Actions Repository
1111
uses: actions/checkout@v4
1212
- name: Check spelling
13-
uses: crate-ci/typos@v1.17.0
13+
uses: crate-ci/typos@v1.18.0

.typos.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[default.extend-words]
22
Nd = "Nd"
33
nin = "nin"
4-
coul = "coul"
4+
coul = "coul"
5+
isconnection = "isconnection"

Project.toml

Lines changed: 8 additions & 8 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 = "2.3.4"
4+
version = "2.7.1"
55

66
[deps]
77
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
@@ -13,16 +13,16 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"
1313

1414
[compat]
1515
Aqua = "0.8"
16-
ChainRulesCore = "1"
17-
ControlSystemsBase = "1"
18-
DataInterpolations = "4"
19-
DiffEqBase = "6.103"
16+
ChainRulesCore = "1.18"
17+
ControlSystemsBase = "1.4"
18+
DataInterpolations = "4.6"
19+
DiffEqBase = "6.147"
2020
IfElse = "0.1"
2121
LinearAlgebra = "1.10"
22-
ModelingToolkit = "8.69"
23-
OrdinaryDiffEq = "6.33"
22+
ModelingToolkit = "9.2"
23+
OrdinaryDiffEq = "6.72"
2424
SafeTestsets = "0.1"
25-
Symbolics = "5.2"
25+
Symbolics = "5.20"
2626
Test = "1"
2727
julia = "1.10"
2828

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ V = 1.0
6060
@named ground = Ground()
6161

6262
rc_eqs = [connect(constant.output, source.V)
63-
connect(source.p, resistor.p)
64-
connect(resistor.n, capacitor.p)
65-
connect(capacitor.n, source.n, ground.g)]
63+
connect(source.p, resistor.p)
64+
connect(resistor.n, capacitor.p)
65+
connect(capacitor.n, source.n, ground.g)]
6666

6767
@named rc_model = ODESystem(rc_eqs, t,
6868
systems = [resistor, capacitor, constant, source, ground])

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ ControlSystemsBase = "1.1"
1313
DifferentialEquations = "7.6"
1414
Documenter = "1"
1515
IfElse = "0.1"
16-
ModelingToolkit = "8.67"
16+
ModelingToolkit = "9"
1717
OrdinaryDiffEq = "6.31"
1818
Plots = "1.36"

docs/pages.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pages = [
55
"Custom Components" => "tutorials/custom_component.md",
66
"Thermal Conduction Model" => "tutorials/thermal_model.md",
77
"DC Motor with Speed Controller" => "tutorials/dc_motor_pi.md",
8-
"SampledData Component" => "tutorials/input_component.md",
8+
"SampledData Component" => "tutorials/input_component.md"
99
],
1010
"About Acausal Connections" => [
1111
"Theory" => "connectors/connections.md",
@@ -18,6 +18,6 @@ pages = [
1818
"Mechanical Components" => "API/mechanical.md",
1919
"Thermal Components" => "API/thermal.md",
2020
"Hydraulic Components" => "API/hydraulic.md",
21-
"Linear Analysis" => "API/linear_analysis.md",
22-
],
21+
"Linear Analysis" => "API/linear_analysis.md"
22+
]
2323
]

docs/src/API/linear_analysis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ using ModelingToolkitStandardLibrary.Blocks, ModelingToolkit
6060
@named C = Gain(-1) # A P controller
6161
t = ModelingToolkit.get_iv(P)
6262
eqs = [connect(P.output, :plant_output, C.input) # Connect with an automatically created analysis point called :plant_output
63-
connect(C.output, :plant_input, P.input)]
63+
connect(C.output, :plant_input, P.input)]
6464
sys = ODESystem(eqs, t, systems = [P, C], name = :feedback_system)
6565
6666
matrices_S = get_sensitivity(sys, :plant_input)[1] # Compute the matrices of a state-space representation of the (input)sensitivity function.

docs/src/API/mechanical.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,41 @@ SpeedSensor
5555
TorqueSensor
5656
RelSpeedSensor
5757
```
58+
59+
## Translational Components
60+
61+
```@meta
62+
CurrentModule = ModelingToolkitStandardLibrary.Mechanical.Translational
63+
```
64+
65+
### Translational Utils
66+
67+
```@docs
68+
MechanicalPort
69+
```
70+
71+
### Translational Core Components
72+
73+
```@docs
74+
Mass
75+
Spring
76+
Damper
77+
Fixed
78+
```
79+
80+
### Translational Sources
81+
82+
```@docs
83+
Force
84+
Position
85+
Velocity
86+
Acceleration
87+
```
88+
89+
### Translational Sensors
90+
91+
```@docs
92+
ForceSensor
93+
PositionSensor
94+
AccelerationSensor
95+
```

docs/src/connectors/connections.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,15 @@ As can be seen, this will give a 1 equation model matching our energy dissipatio
9090

9191
```@example connections
9292
using ModelingToolkitStandardLibrary.Electrical, ModelingToolkit, DifferentialEquations
93+
using ModelingToolkit: t_nounits as t
9394
using Plots
9495
95-
@parameters t
96-
9796
@named resistor = Resistor(R = 1)
9897
@named capacitor = Capacitor(C = 1)
9998
@named ground = Ground()
10099
101100
eqs = [connect(capacitor.p, resistor.p)
102-
connect(resistor.n, ground.g, capacitor.n)]
101+
connect(resistor.n, ground.g, capacitor.n)]
103102
104103
@named model = ODESystem(eqs, t; systems = [resistor, capacitor, ground])
105104
@@ -139,7 +138,7 @@ const TV = ModelingToolkitStandardLibrary.Mechanical.Translational
139138
@named ground = TV.Fixed()
140139
141140
eqs = [connect(damping.flange_a, body.flange)
142-
connect(ground.flange, damping.flange_b)]
141+
connect(ground.flange, damping.flange_b)]
143142
144143
@named model = ODESystem(eqs, t; systems = [damping, body, ground])
145144
@@ -172,7 +171,7 @@ const TP = ModelingToolkitStandardLibrary.Mechanical.TranslationalPosition
172171
@named ground = TP.Fixed(s_0 = 0)
173172
174173
eqs = [connect(damping.flange_a, body.flange)
175-
connect(ground.flange, damping.flange_b)]
174+
connect(ground.flange, damping.flange_b)]
176175
177176
@named model = ODESystem(eqs, t; systems = [damping, body, ground])
178177
@@ -267,7 +266,7 @@ Let's define a quick function to simplify and solve the 2 different systems. Not
267266
```@example connections
268267
function simplify_and_solve(damping, spring, body, ground)
269268
eqs = [connect(spring.flange_a, body.flange, damping.flange_a)
270-
connect(spring.flange_b, damping.flange_b, ground.flange)]
269+
connect(spring.flange_b, damping.flange_b, ground.flange)]
271270
272271
@named model = ODESystem(eqs, t; systems = [ground, body, spring, damping])
273272

docs/src/tutorials/custom_component.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ First, we need to make some imports.
88

99
```@example components
1010
using ModelingToolkit
11+
using ModelingToolkit: t_nounits as t
1112
using ModelingToolkitStandardLibrary.Electrical
1213
using ModelingToolkitStandardLibrary.Electrical: OnePort
1314
using OrdinaryDiffEq
@@ -35,18 +36,16 @@ end NonlinearResistor;
3536
this can almost be directly translated to the syntax of `ModelingToolkit`.
3637

3738
```@example components
38-
@parameters t
39-
4039
function NonlinearResistor(; name, Ga, Gb, Ve)
4140
@named oneport = OnePort()
4241
@unpack v, i = oneport
4342
pars = @parameters Ga=Ga Gb=Gb Ve=Ve
4443
eqs = [
4544
i ~ ifelse(v < -Ve,
46-
Gb * (v + Ve) - Ga * Ve,
47-
ifelse(v > Ve,
48-
Gb * (v - Ve) + Ga * Ve,
49-
Ga * v)),
45+
Gb * (v + Ve) - Ga * Ve,
46+
ifelse(v > Ve,
47+
Gb * (v - Ve) + Ga * Ve,
48+
Ga * v))
5049
]
5150
extend(ODESystem(eqs, t, [], pars; name = name), oneport)
5251
end
@@ -102,14 +101,14 @@ The final model can now be created with the components from the library and the
102101
@named Gnd = Ground()
103102
104103
connections = [connect(L.p, G.p)
105-
connect(G.n, Nr.p)
106-
connect(Nr.n, Gnd.g)
107-
connect(C1.p, G.n)
108-
connect(L.n, Ro.p)
109-
connect(G.p, C2.p)
110-
connect(C1.n, Gnd.g)
111-
connect(C2.n, Gnd.g)
112-
connect(Ro.n, Gnd.g)]
104+
connect(G.n, Nr.p)
105+
connect(Nr.n, Gnd.g)
106+
connect(C1.p, G.n)
107+
connect(L.n, Ro.p)
108+
connect(G.p, C2.p)
109+
connect(C1.n, Gnd.g)
110+
connect(C2.n, Gnd.g)
111+
connect(Ro.n, Gnd.g)]
113112
114113
@named model = ODESystem(connections, t, systems = [L, Ro, G, C1, C2, Nr, Gnd])
115114
nothing # hide
@@ -132,7 +131,7 @@ Plots.savefig("chua_phase_plane.png")
132131
nothing # hide
133132
134133
Plots.plot(sol; idxs = [C1.v, C2.v, L.i],
135-
labels = ["C1 Voltage in V" "C1 Voltage in V" "Inductor Current in A"])
134+
labels = ["C1 Voltage in V" "C2 Voltage in V" "Inductor Current in A"])
136135
Plots.savefig("chua.png")
137136
nothing # hide
138137
```

0 commit comments

Comments
 (0)