Skip to content
ProductTest.md

ProductTest

Multiplies two constant values together.

This component takes two constant values (3 and 2) and multiplies them together using a Product block, resulting in an output value of 6. The component demonstrates the basic connection patterns for creating a multiplication operation between constant signals in the modeling language.

Usage

ProductTest()

Behavior

product.u1(t)=c1.y(t)product.u2(t)=c2.y(t)c1.y(t)=c1.kc2.y(t)=c2.kproduct.y(t)=product.u2(t)product.u1(t)

Source

dyad
# Multiplies two constant values together.
#
# This component takes two constant values (3 and 2) and multiplies them together using a Product block,
# resulting in an output value of 6. The component demonstrates the basic connection patterns for creating
# a multiplication operation between constant signals in the modeling language.
test component ProductTest
  # Constant block that outputs the value 3
  c1 = Constant(k=3) [{
    "Dyad": {
      "placement": {"icon": {"iconName": "constant1", "x1": -50, "y1": 100, "x2": 50, "y2": 300}}
    }
  }]
  # Constant block that outputs the value 2
  c2 = Constant(k=2) [{
    "Dyad": {
      "placement": {"icon": {"iconName": "constant2", "x1": -50, "y1": 700, "x2": 50, "y2": 900}}
    }
  }]
  # Product block that multiplies its two inputs
  product = Product() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "product", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }]
relations
  # Connects the output of constant c1 to the first input of the product block
  connect(product.u1, c1.y)
  # Connects the output of constant c2 to the second input of the product block
  connect(product.u2, c2.y)
metadata {
  "Dyad": {"tests": {"case1": {"stop": 5, "expect": {"final": {"product.y": 6}}}}}
}
end
Flattened Source
dyad
# Multiplies two constant values together.
#
# This component takes two constant values (3 and 2) and multiplies them together using a Product block,
# resulting in an output value of 6. The component demonstrates the basic connection patterns for creating
# a multiplication operation between constant signals in the modeling language.
test component ProductTest
  # Constant block that outputs the value 3
  c1 = Constant(k=3) [{
    "Dyad": {
      "placement": {"icon": {"iconName": "constant1", "x1": -50, "y1": 100, "x2": 50, "y2": 300}}
    }
  }]
  # Constant block that outputs the value 2
  c2 = Constant(k=2) [{
    "Dyad": {
      "placement": {"icon": {"iconName": "constant2", "x1": -50, "y1": 700, "x2": 50, "y2": 900}}
    }
  }]
  # Product block that multiplies its two inputs
  product = Product() [{
    "Dyad": {
      "placement": {"icon": {"iconName": "product", "x1": 950, "y1": 450, "x2": 1050, "y2": 550}}
    }
  }]
relations
  # Connects the output of constant c1 to the first input of the product block
  connect(product.u1, c1.y)
  # Connects the output of constant c2 to the second input of the product block
  connect(product.u2, c2.y)
metadata {
  "Dyad": {"tests": {"case1": {"stop": 5, "expect": {"final": {"product.y": 6}}}}}
}
end


Test Cases

Test Case case1