Use ControlSystemIdentification.jl for a ModelingToolkit.jl model

langestefan
Wed, 03 Jul 2024 13:58:38 +0000
Modelling & Simulations

Hi,

I have an LTI model defined in ModelingToolkit.jl:

@named T_a_out = TimeVaryingFunction(input_funcs[:T_a])
@named Φ_hp_out = TimeVaryingFunction(input_funcs[:Φ_hp])
@named Φ_cv_out = TimeVaryingFunction(input_funcs[:Φ_cv])
@named Φ_s_out = TimeVaryingFunction(input_funcs[:Φ_s])

vars = @variables T_i(t) T_e(t) T_h(t) T_a(t) Φ_hp(t) Φ_cv(t) Φ_s(t)
pars = @parameters C_i = params[:C_i] C_e = params[:C_e] C_h = params[:C_h] R_ie = params[:R_ie] R_ea = params[:R_ea] R_ih = params[:R_ih] A_w = params[:A_w] A_e = params[:A_e]

eqs = [
    # inputs
    T_a ~ T_a_out.output.u
    Φ_hp ~ Φ_hp_out.output.u
    Φ_cv ~ Φ_cv_out.output.u
    Φ_s ~ Φ_s_out.output.u

    # dynamics
    C_i * D(T_i) ~ A_w * Φ_s + (T_h - T_i) * R_ih + (T_e - T_i) * R_ie
    C_e * D(T_e) ~ A_e * Φ_s + (T_a - T_e) * R_ea + (T_i - T_e) * R_ie
    C_h * D(T_h) ~ Φ_cv + Φ_hp + (T_i - T_h) * R_ih
]

ODESystem(eqs, t, vars, pars; systems=[T_a_out, Φ_hp_out, Φ_cv_out, Φ_s_out], name)

Now I’m trying to estimate the parameters of this model using ControlSystemIdentification.jl.

Is there a guide on how to do this? I assume I need some glue code from ControlSystemsMTK.jl, but has anyone worked this out?

8 posts - 2 participants