Skip to content

Commit d07044d

Browse files
refactor: format with v2
1 parent c3ae7f6 commit d07044d

File tree

86 files changed

+607
-349
lines changed

Some content is hidden

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

86 files changed

+607
-349
lines changed

docs/src/API/variables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ For systems that contain parameters with metadata like described above, have som
293293
In the example below, we define a system with tunable parameters and extract bounds vectors
294294

295295
```@example metadata
296-
@variables x(t)=0 u(t)=0 [input = true] y(t)=0 [output = true]
296+
@variables x(t)=0 u(t)=0 [input=true] y(t)=0 [output=true]
297297
@parameters T [tunable = true, bounds = (0, Inf)]
298298
@parameters k [tunable = true, bounds = (0, Inf)]
299299
eqs = [D(x) ~ (-x + k * u) / T # A first-order system with time constant T and gain k

docs/src/basics/Events.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ The basic purely symbolic continuous event interface to encode *one* continuous
9292
event is
9393

9494
```julia
95-
AbstractSystem(eqs, ...; continuous_events::Vector{Equation})
96-
AbstractSystem(eqs, ...; continuous_events::Pair{Vector{Equation}, Vector{Equation}})
95+
AbstractSystem(eqs, _...; continuous_events::Vector{Equation})
96+
AbstractSystem(eqs, _...; continuous_events::Pair{Vector{Equation}, Vector{Equation}})
9797
```
9898

9999
In the former, equations that evaluate to 0 will represent conditions that should
@@ -272,7 +272,7 @@ In addition to continuous events, discrete events are also supported. The
272272
general interface to represent a collection of discrete events is
273273

274274
```julia
275-
AbstractSystem(eqs, ...; discrete_events = [condition1 => affect1, condition2 => affect2])
275+
AbstractSystem(eqs, _...; discrete_events = [condition1 => affect1, condition2 => affect2])
276276
```
277277

278278
where conditions are symbolic expressions that should evaluate to `true` when an
@@ -497,7 +497,8 @@ so far we aren't using anything that's not possible with the implicit interface.
497497
You can also write
498498

499499
```julia
500-
[temp ~ furnace_off_threshold] => ModelingToolkit.ImperativeAffect(modified = (;
500+
[temp ~
501+
furnace_off_threshold] => ModelingToolkit.ImperativeAffect(modified = (;
501502
furnace_on)) do x, o, i, c
502503
@set! x.furnace_on = false
503504
end

docs/src/basics/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The same principle applies to any parameter type that is not `Float64`.
6363
@parameters p1::Int # integer-valued
6464
@parameters p2::Bool # boolean-valued
6565
@parameters p3::MyCustomStructType # non-numeric
66-
@parameters p4::ComponentArray{...} # non-standard array
66+
@parameters p4::ComponentArray{_...} # non-standard array
6767
```
6868

6969
## Getting the index for a symbol

docs/src/basics/MTKLanguage.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ Refer the following example for different ways to define symbolic arrays.
381381
@parameters begin
382382
p1[1:4]
383383
p2[1:N]
384-
p3[1:N, 1:M] = 10,
384+
p3[1:N,
385+
1:M] = 10,
385386
[description = "A multi-dimensional array of arbitrary length with description"]
386387
(p4[1:N, 1:M] = 10),
387388
[description = "An alternate syntax for p3 to match the syntax of vanilla parameters macro"]

docs/src/basics/Validation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function ModelingToolkit.get_unit(op::typeof(dummycomplex), args)
108108
end
109109
110110
sts = @variables a(t)=0 [unit = u"cm"]
111-
ps = @parameters s=-1 [unit = u"cm"] c=c [unit = u"cm"]
111+
ps = @parameters s=-1 [unit=u"cm"] c=c [unit=u"cm"]
112112
eqs = [D(a) ~ dummycomplex(c, s);]
113113
sys = System(
114114
eqs, t, [sts...;], [ps...;], name = :sys, checks = ~ModelingToolkit.CheckUnits)

docs/src/examples/sparse_jacobians.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@ function brusselator_2d_loop(du, u, p, t)
2323
@inbounds for I in CartesianIndices((N, N))
2424
i, j = Tuple(I)
2525
x, y = xyd_brusselator[I[1]], xyd_brusselator[I[2]]
26-
ip1, im1, jp1, jm1 = limit(i + 1, N), limit(i - 1, N), limit(j + 1, N),
26+
ip1, im1, jp1,
27+
jm1 = limit(i + 1, N), limit(i - 1, N), limit(j + 1, N),
2728
limit(j - 1, N)
28-
du[i, j, 1] = alpha * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] -
29-
4u[i, j, 1]) +
30-
B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] +
31-
brusselator_f(x, y, t)
32-
du[i, j, 2] = alpha * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] -
33-
4u[i, j, 2]) +
34-
A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
29+
du[i,
30+
j,
31+
1] = alpha * (u[im1, j, 1] + u[ip1, j, 1] + u[i, jp1, 1] + u[i, jm1, 1] -
32+
4u[i, j, 1]) +
33+
B + u[i, j, 1]^2 * u[i, j, 2] - (A + 1) * u[i, j, 1] +
34+
brusselator_f(x, y, t)
35+
du[i,
36+
j,
37+
2] = alpha * (u[im1, j, 2] + u[ip1, j, 2] + u[i, jp1, 2] + u[i, jm1, 2] -
38+
4u[i, j, 2]) +
39+
A * u[i, j, 1] - u[i, j, 1]^2 * u[i, j, 2]
3540
end
3641
end
3742
p = (3.4, 1.0, 10.0, step(xyd_brusselator))

docs/src/examples/tearing_parallelism.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
1515
1616
# Basic electric components
1717
@connector function Pin(; name)
18-
@variables v(t)=1.0 i(t)=1.0 [connect = Flow]
18+
@variables v(t)=1.0 i(t)=1.0 [connect=Flow]
1919
System(Equation[], t, [v, i], [], name = name)
2020
end
2121
@@ -36,7 +36,7 @@ function ConstantVoltage(; name, V = 1.0)
3636
end
3737
3838
@connector function HeatPort(; name)
39-
@variables T(t)=293.15 Q_flow(t)=0.0 [connect = Flow]
39+
@variables T(t)=293.15 Q_flow(t)=0.0 [connect=Flow]
4040
System(Equation[], t, [T, Q_flow], [], name = name)
4141
end
4242

docs/src/tutorials/disturbance_modeling.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ disturbance_inputs = [ssys.d1, ssys.d2]
188188
P = ssys.system_model
189189
outputs = [P.inertia1.phi, P.inertia2.phi, P.inertia1.w, P.inertia2.w]
190190
191-
(f_oop, f_ip), x_sym, p_sym, io_sys = ModelingToolkit.generate_control_function(
191+
(f_oop, f_ip), x_sym,
192+
p_sym,
193+
io_sys = ModelingToolkit.generate_control_function(
192194
model_with_disturbance, inputs, disturbance_inputs; disturbance_argument = true)
193195
194196
g = ModelingToolkit.build_explicit_observed_function(

docs/src/tutorials/linear_analysis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ This is signified by the name being the middle argument to `connect`.
3939
Of the above mentioned functions, all except for [`open_loop`](@ref) return the output of [`ModelingToolkit.linearize`](@ref), which is
4040

4141
```julia
42-
matrices, simplified_sys = linearize(...)
42+
matrices, simplified_sys = linearize(_...)
4343
# matrices = (; A, B, C, D)
4444
```
4545

ext/MTKCasADiDynamicOptExt.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ function MTK.CasADiDynamicOptProblem(sys::System, op, tspan;
6767
dt = nothing,
6868
steps = nothing,
6969
guesses = Dict(), kwargs...)
70-
prob, _ = MTK.process_DynamicOptProblem(
70+
prob,
71+
_ = MTK.process_DynamicOptProblem(
7172
CasADiDynamicOptProblem, CasADiModel, sys, op, tspan; dt, steps, guesses, kwargs...)
7273
prob
7374
end

0 commit comments

Comments
 (0)