Skip to content

Commit 6a97072

Browse files
refactor: revert renaming for the interpolation components
Co-authored-by: Fredrik Bagge Carlson <[email protected]>
1 parent 223826f commit 6a97072

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/Blocks/Blocks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include("math.jl")
1717

1818
export Constant, TimeVaryingFunction, Sine, Cosine, ContinuousClock, Ramp, Step, ExpSine,
1919
Square, Triangular, Parameter, SampledData,
20-
InterpolationBlock, ParametrizedInterpolationBlock
20+
Interpolation, ParametrizedInterpolation
2121
include("sources.jl")
2222

2323
export Limiter, DeadZone, SlewRateLimiter

src/Blocks/sources.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ function SampledData(; name, buffer, sample_time, circular_buffer)
733733
end
734734

735735
"""
736-
InterpolationBlock(interp_type, u, x, args...; name, t = ModelingToolkit.t_nounits)
736+
Interpolation(interp_type, u, x, args...; name)
737737
738738
Represent function interpolation symbolically as a block component.
739739
By default interpolation types from [`DataInterpolations.jl`](https://github.com/SciML/DataInterpolations.jl) are supported,
@@ -749,7 +749,6 @@ such as `LinearInterpolation`, `ConstantInterpolation` or `CubicSpline`.
749749
- `args`: any other arguments beeded to build the interpolation
750750
# Keyword arguments:
751751
- `name`: the name of the component
752-
- `t`: the interpolation parameter, this is the time (`ModelingToolkit.t_nounits`) by default
753752
754753
# Parameters:
755754
- `interpolator`: the symbolic
@@ -758,12 +757,12 @@ such as `LinearInterpolation`, `ConstantInterpolation` or `CubicSpline`.
758757
# Connectors:
759758
- `output`: a [`RealOutput`](@ref) connector corresponding to the interpolated value
760759
"""
761-
function InterpolationBlock(interp_type, u, x, args...; name, t = ModelingToolkit.t_nounits)
760+
function Interpolation(interp_type, u, x, args...; name)
762761
itp = interp_type(u, x, args...)
763762
InterpolationBlock(itp; name, t)
764763
end
765764

766-
function InterpolationBlock(itp; name, t = ModelingToolkit.t_nounits)
765+
function Interpolation(itp; name)
767766
@parameters (interpolator::typeof(itp))(..) = itp
768767

769768
@named output = RealOutput()
@@ -825,7 +824,7 @@ Base.nameof(::CachedInterpolation) = :CachedInterpolation
825824
@register_symbolic (f::CachedInterpolation)(u::AbstractArray, x::AbstractArray, args::Tuple)
826825

827826
"""
828-
ParametrizedInterpolationBlock(interp_type, u, x, args...; name, t = ModelingToolkit.t_nounits)
827+
ParametrizedInterpolation(interp_type, u, x, args...; name, t = ModelingToolkit.t_nounits)
829828
830829
Represent function interpolation symbolically as a block component, with the interpolation data represented parametrically.
831830
By default interpolation types from [`DataInterpolations.jl`](https://github.com/SciML/DataInterpolations.jl) are supported,
@@ -851,7 +850,7 @@ such as `LinearInterpolation`, `ConstantInterpolation` or `CubicSpline`.
851850
# Connectors:
852851
- `output`: a [`RealOutput`](@ref) connector corresponding to the interpolated value
853852
"""
854-
function ParametrizedInterpolationBlock(
853+
function ParametrizedInterpolation(
855854
interp_type::T, u::AbstractVector, x::AbstractVector, args...;
856855
name, t = ModelingToolkit.t_nounits) where {T}
857856

test/Blocks/sources.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,12 @@ end
482482
end
483483
end
484484

485-
@testset "InterpolationBlock" begin
485+
@testset "Interpolation" begin
486486
@variables y(t) = 0
487487
u = rand(15)
488488
x = 0:14.0
489489

490-
@named i = InterpolationBlock(LinearInterpolation, u, x)
490+
@named i = Interpolation(LinearInterpolation, u, x)
491491
eqs = [D(y) ~ i.output.u]
492492

493493
@named model = ODESystem(eqs, t, systems = [i])
@@ -499,13 +499,13 @@ end
499499
@test SciMLBase.successful_retcode(sol)
500500
end
501501

502-
@testset "ParametrizedInterpolationBlock" begin
502+
@testset "ParametrizedInterpolation" begin
503503
@variables y(t) = 0
504504
u = rand(15)
505505
x = 0:14.0
506506

507507
@testset "LinearInterpolation" begin
508-
@named i = ParametrizedInterpolationBlock(LinearInterpolation, u, x)
508+
@named i = ParametrizedInterpolation(LinearInterpolation, u, x)
509509
eqs = [D(y) ~ i.output.u]
510510

511511
@named model = ODESystem(eqs, t, systems = [i])

0 commit comments

Comments
 (0)