Skip to content

Breaking changes from ModelingToolkit 11 compatibility update (PR #100) #102

@ChrisRackauckas-Claude

Description

@ChrisRackauckas-Claude

Summary

PR #100 updates the compat entry for ModelingToolkit to include version 11 for NeuralLyapunovProblemLibrary. This introduces several breaking changes that need to be addressed before the PR can be merged.

Breaking Changes Encountered

1. Symbolics Version Requirement

  • Issue: ModelingToolkit 11 requires Symbolics v7.x, but NeuralLyapunovProblemLibrary restricted Symbolics to v6.37.
  • Status: ✅ Fixed by updating compat to Symbolics = "6.37, 7"

2. structural_simplify Return Type Change

  • Issue: In MTK 9, structural_simplify(sys, (inputs, outputs)) returned a tuple (simplified_sys, input_functions). In MTK 11, it returns just the System directly.
  • Affected Files:
    • test/pendulum_test.jl (line 35-41)
    • test/double_pendulum_test.jl (lines 89-95, 179-185)
    • test/planar_quadrotor_test.jl (lines 25-31, 122-128)
    • test/quadrotor_test.jl (lines 34-40, 154-160)
  • Status: ✅ Fixed by removing tuple unpacking (sys, _ = structural_simplify(...)sys = structural_simplify(...))

3. linearize Namespacing Changes (Remaining Issue)

  • Issue: MTK 11 has stricter namespacing requirements. When accessing variables via getproperty (e.g., sys.input_var), the variables become namespaced (e.g., sys₊input_var), but linearize/mtkcompile expects non-namespaced names.
  • Error Message:
    The following inputs provided to `mtkcompile` were not found in the system:
      quadrotor_3d₊T(t)
      quadrotor_3d₊τφ(t)
      ...
    
  • Affected Files:
    • test/quadrotor_test.jl (LQR controller test using linearize)
  • Fix Required: Use toggle_namespacing(sys, false) before accessing variables that will be passed to linearize:
    sys_nns = toggle_namespacing(sys, false)
    inputs = [sys_nns.input_var]
    mtkcompile(sys; inputs)

Test Results After Partial Fix

Test Suite Status
Simple pendulum ✅ Pass (5/5)
Double pendulum ✅ Pass (11/11)
Planar Quadrotor ✅ Pass (14/14)
Quadrotor (3D) ❌ Partial (12/13 pass, 1 error in LQR test)
Quality Assurance ✅ Pass (18/18)

Suggested Next Steps

  1. Update the quadrotor LQR test to use toggle_namespacing when accessing variables for linearize
  2. Verify the fix doesn't break backward compatibility with MTK 9.x
  3. Consider adding version-conditional code if the API differs significantly between MTK 9 and 11

Reference

cc @ChrisRackauckas

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions