@@ -214,7 +214,7 @@ See also [`LimPI`](@ref)
214
214
end
215
215
216
216
"""
217
- PID(;name, k=1, Ti=false, Td=false, Nd=10, xi_start =0, xd_start =0)
217
+ PID(;name, k=1, Ti=false, Td=false, Nd=10, int__x =0, der__x =0)
218
218
219
219
Text-book version of a PID-controller without actuator saturation and anti-windup measure.
220
220
@@ -224,8 +224,8 @@ Text-book version of a PID-controller without actuator saturation and anti-windu
224
224
- `Ti`: [s] Integrator time constant (Ti>0 required). If set to false, no integral action is used.
225
225
- `Td`: [s] Derivative time constant (Td>0 required). If set to false, no derivative action is used.
226
226
- `Nd`: [s] Time constant for the derivative approximation (Nd>0 required; Nd=0 is ideal derivative).
227
- - `x_start `: Initial value for the integrator.
228
- - `xd_start `: Initial value for the derivative state.
227
+ - `int__x `: Initial value for the integrator.
228
+ - `der__x `: Initial value for the derivative state.
229
229
230
230
# Connectors:
231
231
@@ -234,8 +234,8 @@ Text-book version of a PID-controller without actuator saturation and anti-windu
234
234
235
235
See also [`LimPID`](@ref)
236
236
"""
237
- @component function PID (; name, k = 1 , Ti = false , Td = false , Nd = 10 , xi_start = 0 ,
238
- xd_start = 0 )
237
+ @component function PID (; name, k = 1 , Ti = false , Td = false , Nd = 10 , int__x = 0 ,
238
+ der__x = 0 )
239
239
with_I = ! isequal (Ti, false )
240
240
with_D = ! isequal (Td, false )
241
241
@named err_input = RealInput () # control error
@@ -249,12 +249,12 @@ See also [`LimPID`](@ref)
249
249
@named gainPID = Gain (k)
250
250
@named addPID = Add3 ()
251
251
if with_I
252
- @named int = Integrator (k = 1 / Ti, x = xi_start )
252
+ @named int = Integrator (k = 1 / Ti, x = int__x )
253
253
else
254
254
@named Izero = Constant (k = 0 )
255
255
end
256
256
if with_D
257
- @named der = Derivative (k = Td, T = 1 / Nd, x = xd_start )
257
+ @named der = Derivative (k = Td, T = 1 / Nd, x = der__x )
258
258
else
259
259
@named Dzero = Constant (k = 0 )
260
260
end
@@ -290,11 +290,9 @@ See also [`LimPID`](@ref)
290
290
end
291
291
292
292
"""
293
- LimPI(; name, T, Ta, k = 1.0, x_start = 0.0, u_max = 1.0, u_min = -u_max)
293
+ LimPI(; name, T, Ta, k = 1.0, int__x = 0.0, u_max = 1.0, u_min = -u_max)
294
294
295
295
Text-book version of a PI-controller with actuator saturation and anti-windup measure.
296
- Initial value of gain can be set with `gainPI.k`
297
- Initial value of integrator state `x` can be set with `int.x`
298
296
299
297
# Parameters:
300
298
@@ -306,7 +304,7 @@ Initial value of integrator state `x` can be set with `int.x`
306
304
- `err_input`
307
305
- `ctr_output`
308
306
"""
309
- @component function LimPI (; name, k = 1 , T, u_max, u_min = - u_max, Ta, x_start = 0.0 )
307
+ @component function LimPI (; name, k = 1 , T, u_max, u_min = - u_max, Ta, int__x = 0.0 )
310
308
@symcheck Ta > 0 ||
311
309
throw (ArgumentError (" Time constant `Ta` has to be strictly positive" ))
312
310
@symcheck T > 0 || throw (ArgumentError (" Time constant `T` has to be strictly positive" ))
@@ -316,7 +314,7 @@ Initial value of integrator state `x` can be set with `int.x`
316
314
@named gainPI = Gain (k)
317
315
@named addPI = Add ()
318
316
@named addTrack = Add ()
319
- @named int = Integrator (k = 1 / T, x = x_start )
317
+ @named int = Integrator (k = 1 / T, x = int__x )
320
318
@named limiter = Limiter (y_max = u_max, y_min = u_min)
321
319
@named addSat = Add (k1 = 1 , k2 = - 1 )
322
320
@named gainTrack = Gain (1 / Ta)
@@ -376,8 +374,8 @@ where the transfer function for the derivative includes additional filtering, se
376
374
u_max = Inf ,
377
375
u_min = u_max > 0 ? - u_max : - Inf ,
378
376
gains = false ,
379
- xi_start = 0.0 ,
380
- xd_start = 0.0 )
377
+ int__x = 0.0 ,
378
+ der__x = 0.0 )
381
379
with_I = ! isequal (Ti, false )
382
380
with_D = ! isequal (Td, false )
383
381
with_AWM = Ni != Inf
@@ -412,12 +410,12 @@ where the transfer function for the derivative includes additional filtering, se
412
410
else
413
411
@named addI = Add (k1 = 1 , k2 = - 1 )
414
412
end
415
- @named int = Integrator (k = 1 / Ti, x = xi_start )
413
+ @named int = Integrator (k = 1 / Ti, x = int__x )
416
414
else
417
415
@named Izero = Constant (k = 0 )
418
416
end
419
417
if with_D
420
- @named der = Derivative (k = Td, T = 1 / Nd, x = xd_start )
418
+ @named der = Derivative (k = Td, T = 1 / Nd, x = der__x )
421
419
@named addD = Add (k1 = wd, k2 = - 1 )
422
420
else
423
421
@named Dzero = Constant (k = 0 )
@@ -473,7 +471,7 @@ where the transfer function for the derivative includes additional filtering, se
473
471
end
474
472
475
473
"""
476
- StateSpace(A, B, C, D= 0; x_start= zeros(size(A,1)), u0= zeros(size(B,2)), y0= zeros(size(C,1)), name)
474
+ StateSpace(A, B, C, D = 0; x = zeros(size(A,1)), u0 = zeros(size(B,2)), y0 = zeros(size(C,1)), name)
477
475
478
476
A linear, time-invariant state-space system on the form.
479
477
@@ -506,7 +504,7 @@ y &= h(x, u)
506
504
507
505
linearized around the operating point `x₀, u₀`, we have `y0, u0 = h(x₀, u₀), u₀`.
508
506
"""
509
- @component function StateSpace (; A, B, C, D = nothing , x_start = zeros (size (A, 1 )), name,
507
+ @component function StateSpace (; A, B, C, D = nothing , x = zeros (size (A, 1 )), name,
510
508
u0 = zeros (size (B, 2 )), y0 = zeros (size (C, 1 )))
511
509
nx, nu, ny = size (A, 1 ), size (B, 2 ), size (C, 1 )
512
510
size (A, 2 ) == nx || error (" `A` has to be a square matrix." )
@@ -522,7 +520,7 @@ linearized around the operating point `x₀, u₀`, we have `y0, u0 = h(x₀, u
522
520
end
523
521
@named input = RealInput (nin = nu)
524
522
@named output = RealOutput (nout = ny)
525
- @variables x (t)[1 : nx]= x_start [
523
+ @variables x (t)[1 : nx]= x [
526
524
description = " State variables of StateSpace system $name " ,
527
525
]
528
526
# pars = @parameters A=A B=B C=C D=D # This is buggy
0 commit comments