Assume I create a ModelingToolkit “instantiator”, say:
@mtkmodel Tank begin
@structural_parameters
case = :std
@parameters begin
...
end
@variables begin
...
end
@equations begin
...
end
end
Questions:
- Is it permissible to have more than one “block” of each type, e.g., can I split parameters into two
@parameters
blocks, e.g.,
@parameters begin
a = 2
end
@parameters begin
b = 2
end
Would this be the same as?
@parameters
a = 1
b = 2
end
- If yes, can I do the same for other “blocks”, e.g.,
@variables
, etc.? - Can I mix the order?, e.g.,
@parameters begin
a = 1
end
@variables begin
x(t)=5
end
@parameters begin
b = 2
end
@variables begin
y(t) = 3
end
- Can I have several tests of parameters/structural parameters in the equation block? E.g.
@equations begin
if case == :std
x ~ 2y
else
x ~ -2y
end
y ~z
if case == :std
w ~z
else
w ~ -z
end
end
or do I need to collect cases in a single block?
[I’m getting very strange results when instantiating the model… goes from working to giving warning/error message if I put an equation into an if-test, even if the if test is true…]