@@ -752,24 +752,25 @@ such as `LinearInterpolation`, `ConstantInterpolation` or `CubicSpline`.
752752
753753# Parameters:
754754 - `interpolator`: the symbolic
755- - `t`: the parameter used for interpolation
756755
757756# Connectors:
757+ - `input`: a [`RealInput`](@ref) connector corresponding to the independent variable
758758 - `output`: a [`RealOutput`](@ref) connector corresponding to the interpolated value
759759"""
760760function Interpolation (interp_type, u, x, args... ; name)
761761 itp = interp_type (u, x, args... )
762- InterpolationBlock (itp; name, t )
762+ Interpolation (itp; name)
763763end
764764
765765function Interpolation (itp; name)
766766 @parameters (interpolator:: typeof (itp))(.. ) = itp
767-
767+ @named input = RealInput ()
768768 @named output = RealOutput ()
769769
770- eqs = [output. u ~ interpolator (t )]
770+ eqs = [output. u ~ interpolator (input . u )]
771771
772- ODESystem (eqs, ModelingToolkit. t_nounits, [], [interpolator, t]; name, systems = [output])
772+ ODESystem (
773+ eqs, t, [], [interpolator]; name, systems = [input, output])
773774end
774775
775776struct CachedInterpolation{T,I,U,X,C}
@@ -840,36 +841,35 @@ such as `LinearInterpolation`, `ConstantInterpolation` or `CubicSpline`.
840841 - `args`: any other arguments beeded to build the interpolation
841842# Keyword arguments:
842843 - `name`: the name of the component
843- - `t`: the interpolation parameter, this is the time (`ModelingToolkit.t_nounits`) by default
844844
845845# Parameters:
846846 - `data`: the symbolic representation of the data passed at construction time via `u`.
847847 - `ts`: the symbolic representation of times corresponding to the data passed at construction time via `x`.
848- - `t`: the parameter used for interpolation
849848
850849# Connectors:
850+ - `input`: a [`RealInput`](@ref) connector corresponding to the independent variable
851851 - `output`: a [`RealOutput`](@ref) connector corresponding to the interpolated value
852852"""
853853function ParametrizedInterpolation (
854854 interp_type:: T , u:: AbstractVector , x:: AbstractVector , args... ;
855- name, t = ModelingToolkit. t_nounits) where {T}
856-
855+ name) where {T}
857856 build_interpolation = CachedInterpolation (interp_type, u, x, args)
858857
859858 @parameters data[1 : length (x)] = u
860859 @parameters ts[1 : length (x)] = x
861860 @parameters interpolation_type:: T = interp_type [tunable = false ]
862861 @parameters (interpolator:: interp_type )(.. ):: eltype (u)
863862
863+ @named input = RealInput ()
864864 @named output = RealOutput ()
865865
866- eqs = [output. u ~ interpolator (t )]
866+ eqs = [output. u ~ interpolator (input . u )]
867867
868868 ODESystem (eqs, ModelingToolkit. t_nounits, [],
869- [data, ts, interpolation_type, interpolator, t ];
869+ [data, ts, interpolation_type, interpolator];
870870 parameter_dependencies = [
871871 interpolator ~ build_interpolation (data, ts, args)
872872 ],
873- systems = [output],
873+ systems = [input, output],
874874 name)
875875end
0 commit comments