Feedback
Computes the difference between a reference input and a feedback input.
This block calculates the error signal in a feedback control system by subtracting the feedback input (u2
) from the reference input (u1
). The component is typically used at the beginning of a control system to determine the difference between a desired setpoint and the measured output being fed back.
This component extends from SI2SO
Usage
Feedback()
Connectors
u1
- This connector represents a real signal as an input to a component (RealInput
)u2
- 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
Source
# Computes the difference between a reference input and a feedback input.
#
# This block calculates the error signal in a feedback control system by subtracting the feedback
# input (`u2`) from the reference input (`u1`). The component is typically used at the beginning of a
# control system to determine the difference between a desired setpoint and the measured output
# being fed back.
component Feedback
extends SI2SO
relations
# Calculates output as the difference between the reference input and feedback input
y = u1-u2
metadata {"Dyad": {"icons": {"default": "dyad://BlockComponents/Feedback.svg"}}}
end
Flattened Source
# Computes the difference between a reference input and a feedback input.
#
# This block calculates the error signal in a feedback control system by subtracting the feedback
# input (`u2`) from the reference input (`u1`). The component is typically used at the beginning of a
# control system to determine the difference between a desired setpoint and the measured output
# being fed back.
component Feedback
# First real-valued input signal
u1 = RealInput() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 150, "x2": 50, "y2": 250}}}}]
# Second real-valued input signal
u2 = RealInput() [{"Dyad": {"placement": {"icon": {"x1": -50, "y1": 750, "x2": 50, "y2": 850}}}}]
# Real-valued output signal
y = RealOutput() [{"Dyad": {"placement": {"icon": {"x1": 950, "y1": 450, "x2": 1050, "y2": 550}}}}]
relations
# Calculates output as the difference between the reference input and feedback input
y = u1-u2
metadata {"Dyad": {"icons": {"default": "dyad://BlockComponents/Feedback.svg"}}}
end
Test Cases
This is setup code, that must be run before each test case.
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"
Related
Examples
Experiments
Analyses
Tests