Trying to utlized MTK on a larger simulation and having trouble with functions that return tuples that are a function of state. For example:
function foo(x)
return 1.0,2.0
end
@register_symbolic foo(x)
function plant(; name)
@variables x(t)=1 u(t)=0 y(t)=0
D = Differential(t)
k1,k2 = foo(x);
eqs = [D(x) ~ -x*k1 + u;
y ~ x*k2]
ODESystem(eqs, t; name = name)
end
@named p = plant()
and receiving the error:
ERROR: BoundsError: attempt to access Num at index [2]
I realize this is a trivial example but demonstrates the point. In my actual implementation, the functions that rely on states are complex and have external dependencies (external c-library). I’ve tried writing simple wrappers but at a loss. How do we handle such cases?