ScalarInterpolation ​
Performs interpolation on input values using a specified dataset and interpolation method.
Takes an input value and produces an output by interpolating within a dataset according to the specified interpolation type. The component creates an interpolator object from the dataset and interpolation parameters, then applies this interpolator to map input values to output values through lookup and interpolation.
Usage ​
ScalarInterpolation(interpolation_type, filepath, independent_var, dependent_var)
Parameters: ​
| Name | Description | Units | Default value |
|---|---|---|---|
filepath | Dataset containing the data points to be interpolated | – | |
independent_var | – | ||
dependent_var | – | ||
interpolation_type | – |
Connectors ​
u- This connector represents a real signal as an input to a component (RealInput)y- This connector represents a real signal as an output from a component (RealOutput)
Behavior ​
@example
using BlockComponents #hide
using ModelingToolkit #hide
datapath = joinpath("..", "tests", "data", "interp_square_data.csv")
@named sys = ScalarInterpolation(interpolation_type="LinearInterpolation", filepath=datapath, independent_var="ts", dependent_var="data") #hide
full_equations(sys) #hideSource ​
# Performs interpolation on input values using a specified dataset and interpolation method.
#
# Takes an input value and produces an output by interpolating within a dataset according to the
# specified interpolation type. The component creates an interpolator object from the dataset and
# interpolation parameters, then applies this interpolator to map input values to output values
# through lookup and interpolation.
component ScalarInterpolation
  # Input value to be used for interpolation lookup
  u = RealInput()
  # Interpolated output value
  y = RealOutput()
  # Dataset containing the data points to be interpolated
  structural filepath::String
  structural independent_var::String
  structural dependent_var::String
  structural interpolation_type::String
  final parameter interpolator::Real2RealInterpolator = dataset_interpolation(interpolation_type, filepath, independent_var, dependent_var)
relations
  y = interpolator(u)
endFlattened Source
# Performs interpolation on input values using a specified dataset and interpolation method.
#
# Takes an input value and produces an output by interpolating within a dataset according to the
# specified interpolation type. The component creates an interpolator object from the dataset and
# interpolation parameters, then applies this interpolator to map input values to output values
# through lookup and interpolation.
component ScalarInterpolation
  # Input value to be used for interpolation lookup
  u = RealInput()
  # Interpolated output value
  y = RealOutput()
  # Dataset containing the data points to be interpolated
  structural filepath::String
  structural independent_var::String
  structural dependent_var::String
  structural interpolation_type::String
  final parameter interpolator::Real2RealInterpolator = dataset_interpolation(interpolation_type, filepath, independent_var, dependent_var)
relations
  y = interpolator(u)
metadata {}
endTest Cases ​
No test cases defined.
Related ​
Examples
Experiments
Analyses
Tests