@@ -32,7 +32,7 @@ rc = 0.25 # Reference concentration
32
32
gamma (t), [description = " Reaction speed" ]
33
33
xc (t) = c0, [description = " Concentration" ]
34
34
xT (t) = T0, [description = " Temperature" ]
35
- xT_c (t) = T0 , [description = " Cooling temperature" ]
35
+ xT_c (t), [description = " Cooling temperature" ]
36
36
end
37
37
38
38
@components begin
77
77
end
78
78
79
79
# Create an MTK-compatible constructor
80
- RefFilter (; y0, name) = ODESystem (Fss; name, x0 = init_filter (y0))
80
+ function RefFilter (; name)
81
+ sys = ODESystem (Fss; name)
82
+ delete! (defaults (sys), @nonamespace (sys. x)[1 ])
83
+ return sys
84
+ end
81
85
end
82
86
@mtkmodel InverseControlledTank begin
83
87
begin
97
101
ff_gain = Gain (k = 1 ) # To allow turning ff off
98
102
controller = PI (gainPI. k = 10 , T = 500 )
99
103
tank = MixingTank (xc = c_start, xT = T_start, c0 = c0, T0 = T0)
100
- inverse_tank = MixingTank (xc = c_start , xT = T_start, c0 = c0, T0 = T0)
104
+ inverse_tank = MixingTank (xc = nothing , xT = T_start, c0 = c0, T0 = T0)
101
105
feedback = Feedback ()
102
106
add = Add ()
103
- filter = RefFilter (y0 = c_start) # Initialize filter states to the initial concentration
107
+ filter = RefFilter ()
104
108
noise_filter = FirstOrder (k = 1 , T = 1 , x = T_start)
105
109
# limiter = Gain(k=1)
106
110
limiter = Limiter (y_max = 370 , y_min = 250 ) # Saturate the control input
0 commit comments