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

add input signals to build_explicit_observed_function #2199

Merged
merged 6 commits into from
Jun 27, 2023

Conversation

baggepinnen
Copy link
Contributor

The PR adds the possibility to specify input signals when building an observed function, this is useful for control systems. The resulting function signature will be

$$y = h(x, u, p, t)$$

where $u$ are the inputs.

If this looks reasonable, I can add a few tests.

@ChrisRackauckas
Copy link
Member

Looks reasonable. Add a few tests.

@baggepinnen
Copy link
Contributor Author

The tests are failing on v1.6 due to RGF emitting an opaque closure. I deactivated the added tests on 1.6

LoadError: The function body AST defined by this @generated function is not pure. This likely means it contains a closure or comprehension.
  Stacktrace:
    [1] (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##arg#15198614511220004104"), Symbol("##arg#9481781105307072587"), Symbol("##arg#1087180715767745052"), :t), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0x01a3dfe2, 0xf37029e8, 0xc2df25d1, 0xb0e6e8c4, 0x919d8e05), Expr})(::Vector{Float64}, ::Vector{Float64}, ::Vector{Real}, ::Int64)
      @ RuntimeGeneratedFunctions ~/.julia/packages/RuntimeGeneratedFunctions/b1u1T/src/RuntimeGeneratedFunctions.jl:128
    [2] top-level scope
      @ ~/work/ModelingToolkit.jl/ModelingToolkit.jl/test/input_output_handling.jl:148

@YingboMa
Copy link
Member

Why would it generate a closure at all?

@baggepinnen
Copy link
Contributor Author

No idea, but it did generate a closure that accessed the input. The generated code is working correctly though.

@YingboMa YingboMa merged commit bf3551e into master Jun 27, 2023
32 of 33 checks passed
@YingboMa YingboMa deleted the fb/beefy_observed branch June 27, 2023 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants