Description
The state estimation example in docs/src/tutorials/disturbance_modeling.md is disabled due to compatibility issues with generate_control_function and analysis points.
Problem
The example showing how to generate functions f and g for state estimation using generate_control_function and build_explicit_observed_function fails when used with models containing analysis points.
Location
docs/src/tutorials/disturbance_modeling.md - lines 206-235
Expected behavior
Should be able to generate control functions from a model with analysis points for use in state estimators like Kalman filters or particle filters.
Related code
inputs = [ssys.u]
disturbance_inputs = [ssys.d1, ssys.d2]
P = ssys.system_model
outputs = [P.inertia1.phi, P.inertia2.phi, P.inertia1.w, P.inertia2.w]
(f_oop, f_ip), x_sym, p_sym, io_sys = ModelingToolkit.generate_control_function(
model_with_disturbance, inputs; known_disturbance_inputs = disturbance_inputs)
g = ModelingToolkit.build_explicit_observed_function(io_sys, outputs; inputs)
op = ModelingToolkit.inputs(io_sys) .=> 0
x0 = ModelingToolkit.get_u0(io_sys, op)
p = MTKParameters(io_sys, op)
u = zeros(1)
w = zeros(length(disturbance_inputs))
@test f_oop(x0, u, p, t, w) == zeros(5)
@test g(x0, u, p, 0.0) == [0, 0, 0, 0]
Context
This is important for users who want to use ModelingToolkit models with state estimation libraries like LowLevelParticleFiltersMTK.jl.
Description
The state estimation example in
docs/src/tutorials/disturbance_modeling.mdis disabled due to compatibility issues withgenerate_control_functionand analysis points.Problem
The example showing how to generate functions
fandgfor state estimation usinggenerate_control_functionandbuild_explicit_observed_functionfails when used with models containing analysis points.Location
docs/src/tutorials/disturbance_modeling.md- lines 206-235Expected behavior
Should be able to generate control functions from a model with analysis points for use in state estimators like Kalman filters or particle filters.
Related code
Context
This is important for users who want to use ModelingToolkit models with state estimation libraries like LowLevelParticleFiltersMTK.jl.