Skip to content
Add.md

Add ​

Weighted adder that outputs the sum of two scalar inputs with configurable gains.

Combines two input signals by multiplying each by its respective gain parameter and adding the results. The output is calculated as

y=k1â‹…u1+k2â‹…u2

where k1 and k2 are configurable gain factors that determine the weight of each input in the sum.

This component extends from SI2SO

Usage ​

BlockComponents.Add(k1=1.0, k2=1.0)

Parameters: ​

NameDescriptionUnitsDefault value
k1Gain multiplier for the first input (u1)–1
k2Gain multiplier for the second input (u2)–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)

  • y - This connector represents a real signal as an output from a component (RealOutput)

Behavior ​

y(t)=k1u1(t)+k2u2(t)

Source ​

dyad
"""
Weighted adder that outputs the sum of two scalar inputs with configurable gains.

Combines two input signals by multiplying each by its respective gain parameter and adding the results. The output
is calculated as

math y = k1 \cdot u1 + k2 \cdot u2

where k1 and k2 are configurable gain factors that determine the weight of each input in the sum.
"""
component Add
  extends SI2SO()
  "Gain multiplier for the first input (u1)"
  parameter k1::Real = 1.0
  "Gain multiplier for the second input (u2)"
  parameter k2::Real = 1.0
relations
  "Output equation: weighted sum of inputs"
  y = k1 * u1 + k2 * u2
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Add.svg"}
  }
}
end
Flattened Source
dyad
"""
Weighted adder that outputs the sum of two scalar inputs with configurable gains.

Combines two input signals by multiplying each by its respective gain parameter and adding the results. The output
is calculated as

math y = k1 \cdot u1 + k2 \cdot u2

where k1 and k2 are configurable gain factors that determine the weight of each input in the sum.
"""
component Add
  "First real-valued input signal"
  u1 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -50, "y1": 150, "x2": 50, "y2": 250, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 150, "x2": 0, "y2": 250, "rot": 0}
      }
    }
  }
  "Second real-valued input signal"
  u2 = RealInput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": -100, "y1": 750, "x2": 0, "y2": 850, "rot": 0},
        "diagram": {"iconName": "default", "x1": -100, "y1": 750, "x2": 0, "y2": 850, "rot": 0}
      }
    }
  }
  "Real-valued output signal"
  y = RealOutput() {
    "Dyad": {
      "placement": {
        "icon": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0},
        "diagram": {"iconName": "default", "x1": 1000, "y1": 450, "x2": 1100, "y2": 550, "rot": 0}
      }
    }
  }
  "Gain multiplier for the first input (u1)"
  parameter k1::Real = 1.0
  "Gain multiplier for the second input (u2)"
  parameter k2::Real = 1.0
relations
  "Output equation: weighted sum of inputs"
  y = k1 * u1 + k2 * u2
metadata {
  "Dyad": {
    "labels": [{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0}],
    "icons": {"default": "dyad://BlockComponents/Add.svg"}
  }
}
end


Test Cases ​

No test cases defined.

  • Examples

  • Experiments

  • Analyses

  • Tests