Skip to content

Commit 02fe980

Browse files
committed
Format
1 parent 907060f commit 02fe980

File tree

10 files changed

+126
-126
lines changed

10 files changed

+126
-126
lines changed

src/Blocks/analysis_points.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ end
258258
const SymOrVec = Union{Symbol, Vector{Symbol}}
259259

260260
function get_sensitivity_function(sys, ap_name::SymOrVec; loop_openings = nothing,
261-
kwargs...)
261+
kwargs...)
262262
find = namespaced_ap_match(ap_name, loop_openings)
263263
t = get_iv(sys)
264264
aps = []
@@ -287,7 +287,7 @@ function get_sensitivity_function(sys, ap_name::SymOrVec; loop_openings = nothin
287287
end
288288

289289
function get_comp_sensitivity_function(sys, ap_name::SymOrVec; loop_openings = nothing,
290-
kwargs...)
290+
kwargs...)
291291
find = namespaced_ap_match(ap_name, loop_openings)
292292
t = get_iv(sys)
293293
aps = []
@@ -316,7 +316,7 @@ function get_comp_sensitivity_function(sys, ap_name::SymOrVec; loop_openings = n
316316
end
317317

318318
function get_looptransfer_function(sys, ap_name::SymOrVec; loop_openings = nothing,
319-
kwargs...)
319+
kwargs...)
320320
find = namespaced_ap_match(ap_name, loop_openings)
321321
t = get_iv(sys)
322322
aps = []
@@ -383,9 +383,9 @@ function open_loop(sys, ap_name::Symbol; ground_input = false, kwargs...)
383383
end
384384

385385
function ModelingToolkit.linearization_function(sys::ModelingToolkit.AbstractSystem,
386-
input_name::SymOrVec, output_name;
387-
loop_openings = nothing,
388-
kwargs...)
386+
input_name::SymOrVec, output_name;
387+
loop_openings = nothing,
388+
kwargs...)
389389
t = get_iv(sys)
390390
@variables u(t)=0 [input = true]
391391
names = [input_name;]
@@ -447,19 +447,19 @@ for f in [:get_sensitivity, :get_comp_sensitivity, :get_looptransfer, :open_loop
447447
end
448448

449449
function ModelingToolkit.linearize(sys, input::AnalysisPoint, output::AnalysisPoint;
450-
kwargs...)
450+
kwargs...)
451451
ModelingToolkit.linearize(sys, nameof(input), nameof(output); kwargs...)
452452
end
453453

454454
# Methods above are implemented in terms of linearization_function, the method below creates wrappers for linearize
455455
for f in [:get_sensitivity, :get_comp_sensitivity, :get_looptransfer]
456456
@eval function $f(sys,
457-
ap,
458-
args...;
459-
loop_openings = nothing,
460-
op = Dict(),
461-
p = DiffEqBase.NullParameters(),
462-
kwargs...)
457+
ap,
458+
args...;
459+
loop_openings = nothing,
460+
op = Dict(),
461+
p = DiffEqBase.NullParameters(),
462+
kwargs...)
463463
lin_fun, ssys = $(Symbol(string(f) * "_function"))(sys, ap, args...; op, p,
464464
loop_openings,
465465
kwargs...)
@@ -475,7 +475,7 @@ Linearize a system between two analysis points. To get a loop-transfer function,
475475
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.
476476
"""
477477
function ModelingToolkit.linearize(sys, input_name::SymOrVec, output_name;
478-
loop_openings = nothing, kwargs...)
478+
loop_openings = nothing, kwargs...)
479479
lin_fun, ssys = linearization_function(sys, input_name, output_name; loop_openings,
480480
kwargs...)
481481
ModelingToolkit.linearize(ssys, lin_fun; kwargs...), ssys

src/Blocks/continuous.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Text-book version of a PID-controller without actuator saturation and anti-windu
245245
See also [`LimPID`](@ref)
246246
"""
247247
@component function PID(; name, k = 1, Ti = false, Td = false, Nd = 10, int__x = 0,
248-
der__x = 0)
248+
der__x = 0)
249249
with_I = !isequal(Ti, false)
250250
with_D = !isequal(Td, false)
251251
@named err_input = RealInput() # control error
@@ -386,13 +386,13 @@ where the transfer function for the derivative includes additional filtering, se
386386
- `ctr_output`
387387
"""
388388
@component function LimPID(; name, k = 1, Ti = false, Td = false, wp = 1, wd = 1,
389-
Ni = Ti == 0 ? Inf : (max(Td / Ti, 1e-6)),
390-
Nd = 10,
391-
u_max = Inf,
392-
u_min = u_max > 0 ? -u_max : -Inf,
393-
gains = false,
394-
int__x = 0.0,
395-
der__x = 0.0)
389+
Ni = Ti == 0 ? Inf : (max(Td / Ti, 1e-6)),
390+
Nd = 10,
391+
u_max = Inf,
392+
u_min = u_max > 0 ? -u_max : -Inf,
393+
gains = false,
394+
int__x = 0.0,
395+
der__x = 0.0)
396396
with_I = !isequal(Ti, false)
397397
with_D = !isequal(Td, false)
398398
with_AWM = Ni != Inf
@@ -522,7 +522,7 @@ y &= h(x, u)
522522
linearized around the operating point `x₀, u₀`, we have `y0, u0 = h(x₀, u₀), u₀`.
523523
"""
524524
@component function StateSpace(; A, B, C, D = nothing, x = zeros(size(A, 1)), name,
525-
u0 = zeros(size(B, 2)), y0 = zeros(size(C, 1)))
525+
u0 = zeros(size(B, 2)), y0 = zeros(size(C, 1)))
526526
nx, nu, ny = size(A, 1), size(B, 2), size(C, 1)
527527
size(A, 2) == nx || error("`A` has to be a square matrix.")
528528
size(B, 1) == nx || error("`B` has to be of dimension ($nx x $nu).")

src/Blocks/sources.jl

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,12 @@ Generate sine signal.
130130
- `output`
131131
"""
132132
@component function Sine(; name,
133-
frequency,
134-
amplitude = 1,
135-
phase = 0,
136-
offset = 0,
137-
start_time = 0,
138-
smooth = false)
133+
frequency,
134+
amplitude = 1,
135+
phase = 0,
136+
offset = 0,
137+
start_time = 0,
138+
smooth = false)
139139
@named output = RealOutput()
140140
pars = @parameters offset=offset start_time=start_time amplitude=amplitude frequency=frequency phase=phase
141141
equation = if smooth == false
@@ -173,12 +173,12 @@ Cosine signal.
173173
"""
174174

175175
@component function Cosine(; name,
176-
frequency,
177-
amplitude = 1,
178-
phase = 0,
179-
offset = 0,
180-
start_time = 0,
181-
smooth = false)
176+
frequency,
177+
amplitude = 1,
178+
phase = 0,
179+
offset = 0,
180+
start_time = 0,
181+
smooth = false)
182182
@named output = RealOutput()
183183
pars = @parameters offset=offset start_time=start_time amplitude=amplitude frequency=frequency phase=phase
184184
equation = if smooth == false
@@ -238,11 +238,11 @@ Generate ramp signal.
238238
- `output`
239239
"""
240240
@component function Ramp(; name,
241-
height = 1,
242-
duration = 1,
243-
offset = 0,
244-
start_time = 0,
245-
smooth = false)
241+
height = 1,
242+
duration = 1,
243+
offset = 0,
244+
start_time = 0,
245+
smooth = false)
246246
@named output = RealOutput()
247247
pars = @parameters offset=offset start_time=start_time height=height duration=duration
248248
equation = if smooth == false
@@ -280,7 +280,7 @@ Generate smooth square signal.
280280
- `output`
281281
"""
282282
@component function Square(; name, frequency = 1.0, amplitude = 1.0,
283-
offset = 0.0, start_time = 0.0, smooth = false)
283+
offset = 0.0, start_time = 0.0, smooth = false)
284284
@named output = RealOutput()
285285
pars = @parameters begin
286286
frequency = frequency
@@ -322,7 +322,7 @@ Generate step signal.
322322
- `output`
323323
"""
324324
@component function Step(; name, height = 1, offset = 0, start_time = 0, duration = Inf,
325-
smooth = 1e-5)
325+
smooth = 1e-5)
326326
@named output = RealOutput()
327327
duration_numeric = duration
328328
pars = @parameters offset=offset start_time=start_time height=height duration=duration
@@ -366,13 +366,13 @@ Exponentially damped sine signal.
366366
- `output`
367367
"""
368368
@component function ExpSine(; name,
369-
frequency,
370-
amplitude = 1,
371-
damping = 0.1,
372-
phase = 0,
373-
offset = 0,
374-
start_time = 0,
375-
smooth = false)
369+
frequency,
370+
amplitude = 1,
371+
damping = 0.1,
372+
phase = 0,
373+
offset = 0,
374+
start_time = 0,
375+
smooth = false)
376376
@named output = RealOutput()
377377
pars = @parameters offset=offset start_time=start_time amplitude=amplitude frequency=frequency phase=phase damping=damping
378378

@@ -413,7 +413,7 @@ Generate smooth triangular signal for frequencies less than or equal to 25 Hz
413413
- `output`
414414
"""
415415
@component function Triangular(; name, amplitude = 1.0, frequency = 1.0,
416-
offset = 0.0, start_time = 0.0, smooth = false)
416+
offset = 0.0, start_time = 0.0, smooth = false)
417417
@named output = RealOutput()
418418
pars = @parameters begin
419419
amplitude = amplitude
@@ -559,9 +559,9 @@ function first_order_backwards_difference(t, buffer, Δt, circular_buffer)
559559
end
560560

561561
function get_sampled_data(t,
562-
buffer::Vector{T},
563-
dt::T,
564-
circular_buffer = true) where {T <: Real}
562+
buffer::Vector{T},
563+
dt::T,
564+
circular_buffer = true) where {T <: Real}
565565
if t < 0
566566
t = zero(t)
567567
end
@@ -623,11 +623,11 @@ function Symbolics.derivative(::typeof(get_sampled_data), args::NTuple{4, Any},
623623
first_order_backwards_difference(t, buffer, sample_time, circular_buffer)
624624
end
625625
function ChainRulesCore.frule((_, ẋ, _),
626-
::typeof(get_sampled_data),
627-
t,
628-
buffer,
629-
sample_time,
630-
circular_buffer)
626+
::typeof(get_sampled_data),
627+
t,
628+
buffer,
629+
sample_time,
630+
circular_buffer)
631631
first_order_backwards_difference(t, buffer, sample_time, circular_buffer) *
632632
end
633633

@@ -651,10 +651,10 @@ data input component.
651651
- `output`
652652
"""
653653
@component function SampledData(::Val{SampledDataType.vector_based};
654-
name,
655-
buffer,
656-
sample_time,
657-
circular_buffer = true)
654+
name,
655+
buffer,
656+
sample_time,
657+
circular_buffer = true)
658658
pars = @parameters begin
659659
buffer = buffer #::Vector{Real}
660660
sample_time = sample_time #::Real
@@ -717,9 +717,9 @@ function SampledData(sample_time::T, circular_buffer = true; name) where {T <: R
717717
circular_buffer)
718718
end
719719
function SampledData(buffer::Vector{<:Real},
720-
sample_time::Real,
721-
circular_buffer = true;
722-
name)
720+
sample_time::Real,
721+
circular_buffer = true;
722+
name)
723723
SampledData(SampledDataType.vector_based; name, buffer, sample_time, circular_buffer)
724724
end
725725
function SampledData(; name, buffer, sample_time, circular_buffer)

src/Blocks/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Base class for a multiple input multiple output (MIMO) continuous system block.
9696
- `y_start`: Initial value for the output
9797
"""
9898
@component function MIMO(; name, nin = 1, nout = 1, u_start = zeros(nin),
99-
y_start = zeros(nout))
99+
y_start = zeros(nout))
100100
@named input = RealInput(nin = nin, u_start = u_start)
101101
@named output = RealOutput(nout = nout, u_start = y_start)
102102
@variables(u(t)[1:nin]=u_start, [description = "Input of MIMO system $name"],

src/Electrical/Digital/logic_vectors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ axes(l::LogicVector) = axes(l.logic)
2424

2525
getindex(s::LogicVector, i::Int) = getindex(s.logic, i)
2626
function Base.getindex(s::LogicVector, i1::Int, i2::Int,
27-
I::Int...)
27+
I::Int...)
2828
getindex(s.logic, i1, i2, I...)
2929
end
3030

src/Electrical/Digital/tables.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function Base.getindex(s::LogicTable, i1::Logic, i2::Logic)
1717
getindex(s.logic, get_logic_level(i1), get_logic_level(i2))
1818
end
1919
function Base.getindex(s::LogicTable, i1::Logic, i2::Logic,
20-
I::Logic...)
20+
I::Logic...)
2121
getindex(s.logic, get_logic_level(i1), get_logic_level(i2), get_logic_level(I...)...)
2222
end
2323

0 commit comments

Comments
 (0)