Skip to content

Providing parameter override errors with "Initialization expression currently not supported" #3087

@baggepinnen

Description

@baggepinnen

The following (minimized) example from https://help.juliahub.com/juliasimcontrol/dev/robust_control/ has been broken on some recent release of MTK, the error is

ERROR: Initialization expression sys₊k is currently not supported. If its a higher order derivative expression, then only the dummy derivative expressions are supported.
using ModelingToolkit, MonteCarloMeasurements, OrdinaryDiffEq

T = typeof(1 ± 1)
@parameters t k::T d
@variables x(t)::T v(t)::T
D = Differential(t)
eqs = [D(x) ~ v, D(v) ~ -k*x - d*v - 9.82]
@named sys = ODESystem(eqs, t)
prob = ODEProblem(complete(sys), [x => 0.0 ± 0.1, v => 0.0, k => 10 ± 1, d => 1], (0.0, 10.0))
sol = solve(prob, Tsit5())

T = typeof(-1..1)
@parameters Δ::T=(-1..1) # The uncertain element is between -1 and 1
@variables y(t)=0
connections = [
    y ~ sys.x + Δ
]

@named uncertain_sys = ODESystem(connections, t, systems=[sys])
initial_condition = [sys.x => zero(T), sys.v => 0.0, sys.k => 10, sys.d => 1]
prob = ODEProblem(structural_simplify(uncertain_sys, split=false), initial_condition, (0.0, 10.0)) # This line errors
sol = solve(prob, Tsit5())

here's a failing build log
https://github.com/JuliaComputing/JuliaSimControl.jl/actions/runs/11119591661/job/30899449776#step:6:442

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions