How to make R, C, etc. parameters in Acausal Component-Based Model (ModelingToolkit example)

You need to import varmap_to_vars explicitly, it is not an exported function, then you could do this:

using ModelingToolkit
using ModelingToolkit: varmap_to_vars

function reparameterize(sys, prob, parameter_map)
    params = varmap_to_vars(parameter_map, parameters(sys))
    remake(prob; p=params)
end

Looking at the implementation of remake it seems like a version that accepted maps and only updated the mapped variables wouldn’t be too hard to implement.

1 Like