@@ -559,3 +559,49 @@ function get_parameter_map(x::Basis)
559559 end
560560 end
561561end
562+
563+ # # ModelingToolkit interface methods
564+
565+ # These methods implement the AbstractSystem interface from ModelingToolkit
566+ # to allow Basis to be used with ODEProblem
567+
568+ function ModelingToolkit. equations (b:: AbstractBasis )
569+ return getfield (b, :eqs )
570+ end
571+
572+ function ModelingToolkit. unknowns (b:: AbstractBasis )
573+ return states (b)
574+ end
575+
576+ function ModelingToolkit. parameters (b:: AbstractBasis )
577+ return getfield (b, :ps )
578+ end
579+
580+ function ModelingToolkit. get_observed (b:: AbstractBasis )
581+ return getfield (b, :observed )
582+ end
583+
584+ function ModelingToolkit. get_iv (b:: AbstractBasis )
585+ return getfield (b, :iv )
586+ end
587+
588+ function ModelingToolkit. nameof (b:: AbstractBasis )
589+ return getfield (b, :name )
590+ end
591+
592+ # Override getproperty to handle :observed field access properly
593+ # This is needed because ModelingToolkit's getproperty for AbstractSystem
594+ # tries to use getvar which doesn't work for Basis
595+ function Base. getproperty (b:: AbstractBasis , name:: Symbol )
596+ if name === :observed
597+ return get_observed (b)
598+ else
599+ # Fall back to getfield for direct field access
600+ return getfield (b, name)
601+ end
602+ end
603+
604+ # Override show to avoid ModelingToolkit's display method that needs namespacing
605+ function Base. show (io:: IO , :: MIME"text/plain" , b:: AbstractBasis )
606+ Base. print (io, b)
607+ end
0 commit comments