Skip to content

parameter as a function of other parameters #3309

Closed
@tpdsantos

Description

@tpdsantos

Question❓

I have a model of a continuously stirred tank (CST):

@mtkmodel CST begin
    @structural_parameters begin
        NC = 1
    end
    @parameters begin
        Q = 1.0
        V
    end
    @variables begin
        cin(t)[1:NC] = nothing
        cout(t)[1:NC] = 0.0
    end
    @equations begin
        D(cout) ~ Q/V * (cin - cout)
    end
end

I also have a model of a Plugflow Device (PF) but it's a bit large and is not that relevant for the question. The important part is that also has a parameter V
I wanted to simulate the hydrodynamic behaviour of a fluid in the tubes of an equipment by assuming that behaviour is a mix of CST and PF, in the sense that a part of the equipment volume behaves as CST and the rest as PF, so I did the following:

@mtkmodel CST_ED begin
    @structural_parameters begin
        NC = 1 # number of components
    end
    @parameters begin
        α  = 0.25
        Ve = 2.77
        Q  = 1.0
        cin[1:NC] = [0.5i for i in 1:NC]
    end
    @components begin
        T = CST(NC = NC)
        C = PF(NC = NC)
    end
    @equations begin
        T.V ~ α * Ve
        C.V ~ (1-α) * Ve
        T.cin ~ cin
        C.cin ~ T.cout
        C.Q ~ Q
    end
end

This approach does not work because the equations involving the parameters do not go to the observed section, which leaves me with $N$ variables and $N+2$ equations. How would I solve this without changing C.V and T.V to variables?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions