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
BlockComponents.ProductTest()
Behavior
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": {
"diagram": {"iconName": "default", "x1": 320, "y1": 340, "x2": 420, "y2": 440, "rot": 0}
}
}
}
# Constant block that outputs the value 2
c2 = Constant(k = 2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 320, "y1": 550, "x2": 420, "y2": 650, "rot": 0}
}
}
}
# Product block that multiplies its two inputs
product = Product() {
"Dyad": {
"placement": {
"icon": {"iconName": "product", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0},
"diagram": {"iconName": "product", "x1": 580, "y1": 450, "x2": 680, "y2": 550, "rot": 0}
}
}
}
relations
connect(c1.y, product.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 500, "y": 390}, {"x": 500, "y": 470}], "E": 2}],
"renderStyle": "standard"
}
}
connect(product.u2, c2.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 500, "y": 530}, {"x": 500, "y": 600}], "E": 2}],
"renderStyle": "standard"
}
}
metadata {
"Dyad": {"tests": {"case1": {"stop": 5, "expect": {"final": {"product.y": 6}}}}}
}
endFlattened 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": {
"diagram": {"iconName": "default", "x1": 320, "y1": 340, "x2": 420, "y2": 440, "rot": 0}
}
}
}
# Constant block that outputs the value 2
c2 = Constant(k = 2) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 320, "y1": 550, "x2": 420, "y2": 650, "rot": 0}
}
}
}
# Product block that multiplies its two inputs
product = Product() {
"Dyad": {
"placement": {
"icon": {"iconName": "product", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0},
"diagram": {"iconName": "product", "x1": 580, "y1": 450, "x2": 680, "y2": 550, "rot": 0}
}
}
}
relations
connect(c1.y, product.u1) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 500, "y": 390}, {"x": 500, "y": 470}], "E": 2}],
"renderStyle": "standard"
}
}
connect(product.u2, c2.y) {
"Dyad": {
"edges": [{"S": 1, "M": [{"x": 500, "y": 530}, {"x": 500, "y": 600}], "E": 2}],
"renderStyle": "standard"
}
}
metadata {
"Dyad": {"tests": {"case1": {"stop": 5, "expect": {"final": {"product.y": 6}}}}}
}
end