Skip to content

Commit 2431138

Browse files
refactor: use default t and D from MTKv9
1 parent d27d372 commit 2431138

File tree

33 files changed

+38
-90
lines changed

33 files changed

+38
-90
lines changed

docs/src/connectors/connections.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,9 @@ 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, D
9394
using Plots
9495
95-
@parameters t
96-
9796
@named resistor = Resistor(R = 1)
9897
@named capacitor = Capacitor(C = 1)
9998
@named ground = Ground()

docs/src/tutorials/custom_component.md

Lines changed: 1 addition & 2 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,8 +36,6 @@ 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

docs/src/tutorials/dc_motor_pi.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ First, the needed packages are imported and the parameters of the model defined.
1414

1515
```@example dc_motor_pi
1616
using ModelingToolkit
17+
using ModelingToolkit: t
1718
using ModelingToolkitStandardLibrary.Electrical
1819
using ModelingToolkitStandardLibrary.Mechanical.Rotational
1920
using ModelingToolkitStandardLibrary.Blocks
2021
using OrdinaryDiffEq
2122
using Plots
2223
23-
@parameters t
24-
2524
R = 0.5 # [Ohm] armature resistance
2625
L = 4.5e-3 # [H] armature inductance
2726
k = 0.5 # [N.m/A] motor constant

docs/src/tutorials/input_component.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,11 @@ The `ModelingToolkitStandardLibrary.Blocks.TimeVaryingFunction` component is eas
1414

1515
```julia
1616
using ModelingToolkit
17+
using ModelingToolkit: t, D
1718
using ModelingToolkitStandardLibrary.Blocks
1819
using DataInterpolations
1920
using OrdinaryDiffEq
2021

21-
@parameters t
22-
D = Differential(t)
23-
2422
function System(f; name)
2523
src = TimeVaryingFunction(f)
2624

docs/src/tutorials/thermal_model.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ from dividing the total initial energy in the system by the sum of the heat capa
88

99
```@example
1010
using ModelingToolkitStandardLibrary.Thermal, ModelingToolkit, OrdinaryDiffEq, Plots
11-
12-
@parameters t
11+
using ModelingToolkit: t
1312
1413
C1 = 15
1514
C2 = 15

src/Blocks/Blocks.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ module Blocks
55
using ModelingToolkit, Symbolics
66
import IfElse: ifelse
77
import ..@symcheck
8-
using ModelingToolkit: getdefault
9-
10-
@parameters t
11-
D = Differential(t)
8+
using ModelingToolkit: getdefault, t, D
129

1310
export RealInput, RealOutput, SISO
1411
include("utils.jl")

src/Blocks/continuous.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ linearized around the operating point `x₀, u₀`, we have `y0, u0 = h(x₀, u
542542
]
543543
# pars = @parameters A=A B=B C=C D=D # This is buggy
544544
eqs = [ # FIXME: if array equations work
545-
[Differential(t)(x[i]) ~ sum(A[i, k] * x[k] for k in 1:nx) +
545+
[D(x[i]) ~ sum(A[i, k] * x[k] for k in 1:nx) +
546546
sum(B[i, j] * (input.u[j] - u0[j]) for j in 1:nu)
547547
for i in 1:nx]..., # cannot use D here
548548
[output.u[j] ~ sum(C[j, i] * x[i] for i in 1:nx) +

src/Electrical/Electrical.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ This library contains electrical components to build up analog circuits.
55
module Electrical
66

77
using ModelingToolkit, Symbolics, IfElse
8+
using ModelingToolkit: t, D
89
using ..Thermal: HeatPort
910
using ..Mechanical.Rotational: Flange, Support
1011
using ..Blocks: RealInput, RealOutput
1112

12-
@parameters t
13-
D = Differential(t)
14-
1513
export Pin, OnePort
1614
include("utils.jl")
1715

src/Hydraulic/IsothermalCompressible/IsothermalCompressible.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ Library to model iso-thermal compressible liquid fluid flow
44
module IsothermalCompressible
55

66
using ModelingToolkit, Symbolics
7+
using ModelingToolkit: t, D
78

89
using ...Blocks: RealInput, RealOutput
910
using ...Mechanical.Translational: MechanicalPort, Mass
1011

1112
using IfElse: ifelse
1213

13-
@parameters t
14-
D = Differential(t)
15-
1614
export HydraulicPort, HydraulicFluid
1715
include("utils.jl")
1816

src/Magnetic/FluxTubes/FluxTubes.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
module FluxTubes
22
using ModelingToolkit
3+
using ModelingToolkit: t, D
34
using ...Electrical: Pin
45

5-
@parameters t
6-
D = Differential(t)
7-
86
export PositiveMagneticPort, NegativeMagneticPort, TwoPort
97
include("utils.jl")
108

0 commit comments

Comments
 (0)