Skip to content
ParameterizedInterpolation.md

ParameterizedInterpolation

Performs interpolation of values based on an input signal using externally defined parameters.

Implements a flexible interpolation function that maps the input value to an output value based on predefined interpolation parameters. The exact interpolation algorithm and parameters are defined externally to this component. This is commonly used for lookup tables, curve fitting, and approximating complex nonlinear relationships between variables.

Usage

ParameterizedInterpolation()

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
@named sys = ParameterizedInterpolation() #hide
full_equations(sys) #hide

Source

dyad
# Performs interpolation of values based on an input signal using externally defined parameters.
#
# Implements a flexible interpolation function that maps the input value to an output value based
# on predefined interpolation parameters. The exact interpolation algorithm and parameters are
# defined externally to this component. This is commonly used for lookup tables, curve fitting,
# and approximating complex nonlinear relationships between variables.
external component ParameterizedInterpolation
  # Input value to be interpolated
  u = RealInput() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "input", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
    }
  }]
  # Interpolated output value
  y = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }]
end
Flattened Source
dyad
# Performs interpolation of values based on an input signal using externally defined parameters.
#
# Implements a flexible interpolation function that maps the input value to an output value based
# on predefined interpolation parameters. The exact interpolation algorithm and parameters are
# defined externally to this component. This is commonly used for lookup tables, curve fitting,
# and approximating complex nonlinear relationships between variables.
external component ParameterizedInterpolation
  # Input value to be interpolated
  u = RealInput() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "input", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
    }
  }]
  # Interpolated output value
  y = RealOutput() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }]
metadata {}
end


Test Cases

This is setup code, that must be run before each test case.

julia
using BlockComponents
using ModelingToolkit, OrdinaryDiffEqDefault
using Plots
using CSV, DataFrames

snapshotsdir = joinpath(dirname(dirname(pathof(BlockComponents))), "test", "snapshots")
"/home/actions-runner-10/.julia/packages/BlockComponents/77kIK/test/snapshots"
  • Examples

  • Experiments

  • Analyses