Gain
Multiplies input signal by a constant gain factor.
Multiplies the input signal by a constant parameter k. The relationship between the input u and output y is simply y = k*u, where k is the gain factor. This block is useful for scaling signals or converting between different units.
This component extends from SISO
Usage
BlockComponents.Gain(k)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
k | Constant gain factor that multiplies the input signal | – |
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
Source
dyad
# Multiplies input signal by a constant gain factor.
#
# Multiplies the input signal by a constant parameter `k`. The relationship
# between the input u and output y is simply y = k*u, where `k` is the gain factor. This block is useful
# for scaling signals or converting between different units.
component Gain
extends SISO
# Constant gain factor that multiplies the input signal
parameter k::Real
relations
y = k * u
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "k=$(k)", "x": 500, "y": 500, "rot": 0}
],
"icons": {"default": "dyad://BlockComponents/Gain.svg"}
}
}
endFlattened Source
dyad
# Multiplies input signal by a constant gain factor.
#
# Multiplies the input signal by a constant parameter `k`. The relationship
# between the input u and output y is simply y = k*u, where `k` is the gain factor. This block is useful
# for scaling signals or converting between different units.
component Gain
# Input signal port
u = RealInput() {
"Dyad": {
"placement": {
"icon": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0},
"diagram": {"iconName": "input", "x1": -100, "y1": 450, "x2": 0, "y2": 550, "rot": 0}
}
}
}
# Output signal port
y = RealOutput() {
"Dyad": {
"placement": {
"icon": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
"diagram": {"iconName": "output", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
}
}
}
# Constant gain factor that multiplies the input signal
parameter k::Real
relations
y = k * u
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "k=$(k)", "x": 500, "y": 500, "rot": 0}
],
"icons": {"default": "dyad://BlockComponents/Gain.svg"}
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses