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
Source
# 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
# 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