Skip to content
LIBRARY
Examples.SimpleRelayControl.md

Examples.SimpleRelayControl ​

Usage ​

DiscreteComponents.Examples.SimpleRelayControl()

Behavior ​

Source ​

dyad
test component SimpleRelayControl
  discretebinarycontroller = DiscreteComponents.DiscreteBinaryController(k = 2, bool = false, b = 0.05) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 340, "x2": 460, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  secondorder = BlockComponents.Continuous.SecondOrder() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 720, "y1": 340, "x2": 820, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  reference = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 140, "y1": 320, "x2": 240, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
  zeroorderhold = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 340, "x2": 650, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  sampler = DiscreteComponents.Sampler() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 650, "y1": 520, "x2": 550, "y2": 620, "rot": 0}
      },
      "tags": []
    }
  }
  periodicclock = DiscreteComponents.PeriodicClock(dt = 0.2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 670, "x2": 650, "y2": 770, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial secondorder.x = 0.0
  initial secondorder.xd = 0.0
  connect(zeroorderhold.y, secondorder.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(secondorder.y, sampler.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 860, "y": 390}, {"x": 860, "y": 570}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(discretebinarycontroller.y, zeroorderhold.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(sampler.y, discretebinarycontroller.u_m, periodicclock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 290, "y": 570}, {"x": 290, "y": 409}], "E": 2},
        {"S": 3, "M": [{"x": 470, "y": 720}], "E": -1}
      ],
      "junctions": [{"x": 470, "y": 570}],
      "renderStyle": "standard"
    }
  }
  connect(reference.y, discretebinarycontroller.u_s) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
end
Flattened Source
dyad
test component SimpleRelayControl
  discretebinarycontroller = DiscreteComponents.DiscreteBinaryController(k = 2, bool = false, b = 0.05) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 360, "y1": 340, "x2": 460, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  secondorder = BlockComponents.Continuous.SecondOrder() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 720, "y1": 340, "x2": 820, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  reference = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 140, "y1": 320, "x2": 240, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
  zeroorderhold = DiscreteComponents.ZeroOrderHold() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 340, "x2": 650, "y2": 440, "rot": 0}
      },
      "tags": []
    }
  }
  sampler = DiscreteComponents.Sampler() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 650, "y1": 520, "x2": 550, "y2": 620, "rot": 0}
      },
      "tags": []
    }
  }
  periodicclock = DiscreteComponents.PeriodicClock(dt = 0.2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 550, "y1": 670, "x2": 650, "y2": 770, "rot": 0}
      },
      "tags": []
    }
  }
relations
  initial secondorder.x = 0.0
  initial secondorder.xd = 0.0
  connect(zeroorderhold.y, secondorder.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(secondorder.y, sampler.u) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 860, "y": 390}, {"x": 860, "y": 570}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(discretebinarycontroller.y, zeroorderhold.u) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(sampler.y, discretebinarycontroller.u_m, periodicclock.y) {
    "Dyad": {
      "edges": [
        {"S": 1, "M": [], "E": -1},
        {"S": -1, "M": [{"x": 290, "y": 570}, {"x": 290, "y": 409}], "E": 2},
        {"S": 3, "M": [{"x": 470, "y": 720}], "E": -1}
      ],
      "junctions": [{"x": 470, "y": 570}],
      "renderStyle": "standard"
    }
  }
  connect(reference.y, discretebinarycontroller.u_s) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
metadata {}
end


Test Cases ​

No test cases defined.