Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

observed function broken on latest #3183

Open
baggepinnen opened this issue Nov 5, 2024 · 0 comments · May be fixed by #3184
Open

observed function broken on latest #3183

baggepinnen opened this issue Nov 5, 2024 · 0 comments · May be fixed by #3184
Assignees
Labels
bug Something isn't working

Comments

@baggepinnen
Copy link
Contributor

This exampel works on ModelingToolkit v9.46.1 but fails on latest

using ModelingToolkit
using ModelingToolkitStandardLibrary: Blocks, Mechanical.Rotational

@mtkmodel ControlledMSD begin
    @parameters begin
        J = 1.0
        c = 100
        d = 0.1
    end
    @components begin
        inertia1 = Rotational.Inertia(; J, phi=0, w=0)
        inertia2 = Rotational.Inertia(; J, phi=0, w=0)
        spring = Rotational.Spring(; c)
        damper = Rotational.Damper(; d)
        input = Rotational.Torque()
    end
    @equations begin
        connect(input.flange, inertia1.flange_a)
        connect(inertia1.flange_b, spring.flange_a, damper.flange_a)
        connect(spring.flange_b, damper.flange_b, inertia2.flange_a)
    end
end

@named model = ControlledMSD()
model = complete(model)
inputs = [model.input.tau.u]
outputs = [model.inertia1.phi]
(f_oop, f_ip), x_sym, p_sym, io_sys = ModelingToolkit.generate_control_function(model, inputs, split=false)
y_fun = ModelingToolkit.build_explicit_observed_function(io_sys, outputs)

_, p = ModelingToolkit.get_u0_p(io_sys, [model.input.tau.u => 0], [])
y_fun(zeros(4), p, t)
@baggepinnen baggepinnen added the bug Something isn't working label Nov 5, 2024
@AayushSabharwal AayushSabharwal linked a pull request Nov 5, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants