Add3
IconAdd3
Output the sum of the three scalar inputs.
Usage
Add3(k1=1.0, k2=1.0, k3=1.0)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
k1 | Gain of u1 | – | 1 |
k2 | Gain of u2 | – | 1 |
k3 | Gain of u3 | – | 1 |
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
)u3
- 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
\[ \begin{align} y\left( t \right) &= \mathtt{k1} \mathtt{u1}\left( t \right) + \mathtt{k2} \mathtt{u2}\left( t \right) + \mathtt{k3} \mathtt{u3}\left( t \right) \end{align} \]
Source
# Output the sum of the three scalar inputs.
component Add3
u1 = RealInput() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "input1", "x1": -50, "y1": 150, "x2": 50, "y2": 250}}
}
}]
u2 = RealInput() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "input2", "x1": -50, "y1": 450, "x2": 50, "y2": 550}}
}
}]
u3 = RealInput() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "input3", "x1": -50, "y1": 750, "x2": 50, "y2": 850}}
}
}]
y = RealOutput() [{
"JuliaSim": {
"placement": {"icon": {"iconName": "output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
}
}]
# Gain of `u1`
parameter k1::Real = 1.0
# Gain of `u2`
parameter k2::Real = 1.0
# Gain of `u3`
parameter k3::Real = 1.0
relations
y = k1*u1+k2*u2+k3*u3
metadata {"JuliaSim": {"icons": {"default": "jsml://BlockComponents/Add3.svg"}}}
end
Flattened Source
# Output the sum of the three scalar inputs. component Add3 u1 = RealInput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "input1", "x1": -50, "y1": 150, "x2": 50, "y2": 250}} } }] u2 = RealInput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "input2", "x1": -50, "y1": 450, "x2": 50, "y2": 550}} } }] u3 = RealInput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "input3", "x1": -50, "y1": 750, "x2": 50, "y2": 850}} } }] y = RealOutput() [{ "JuliaSim": { "placement": {"icon": {"iconName": "output", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}} } }] # Gain of `u1` parameter k1::Real = 1.0 # Gain of `u2` parameter k2::Real = 1.0 # Gain of `u3` parameter k3::Real = 1.0 relations y = k1*u1+k2*u2+k3*u3 metadata {"JuliaSim": {"icons": {"default": "jsml://BlockComponents/Add3.svg"}}} end
Test Cases
Related
- Examples
- Experiments
- Analyses