Skip to content
LIBRARY
Analog.Basic.Tests.Gyrator.md

Analog.Basic.Tests.Gyrator

MSL validation test: Gyrator.

Recreates ModelicaTest.Electrical.Analog.TestGyrator from MSL. Two constant voltage sources (v1=1 V, v2=1 V) drive a gyrator with G1=1 S and G2=2 S. Both sides are grounded.

Expected steady-state values (algebraic, constant for all t):

  • gyrator.i1 = G2 * v2 = 2 A

  • gyrator.i2 = -G1 * v1 = -1 A

MSL reference: tolerance=1e-6, StopTime=1.

Usage

ElectricalComponents.Analog.Basic.Tests.Gyrator()

Behavior

[connect(const1+y,v1+V)connect(const2+y,v2+V)connect(v1+p,gyrator+p1)connect(v1+n,ground1+g)connect(v2+p,gyrator+p2)connect(v2+n,gyrator+n2)connect(v2+n,ground2+g)connect(v1+n,gyrator+n1)const1.y(t)=const1.kconst2.y(t)=const2.kv1.v(t)=v1.n.v(t)+v1.p.v(t)v1.i(t)=v1.p.i(t)v1.n.i(t)+v1.p.i(t)=0v1.v(t)=v1.uVv1.V(t)v2.v(t)=v2.p.v(t)v2.n.v(t)v2.i(t)=v2.p.i(t)v2.p.i(t)+v2.n.i(t)=0v2.v(t)=v2.uVv2.V(t)gyrator.v1(t)=gyrator.n1.v(t)+gyrator.p1.v(t)gyrator.v2(t)=gyrator.p2.v(t)gyrator.n2.v(t)gyrator.i1(t)=gyrator.p1.i(t)gyrator.i2(t)=gyrator.p2.i(t)0=gyrator.p1.i(t)+gyrator.n1.i(t)0=gyrator.p2.i(t)+gyrator.n2.i(t)gyrator.i1(t)=gyrator.G2gyrator.v2(t)gyrator.i2(t)=gyrator.G1gyrator.v1(t)ground1.g.v(t)=0ground2.g.v(t)=0]

Source

dyad
"""
MSL validation test: Gyrator.

Recreates `ModelicaTest.Electrical.Analog.TestGyrator` from MSL.
Two constant voltage sources (v1=1 V, v2=1 V) drive a gyrator with
G1=1 S and G2=2 S. Both sides are grounded.

Expected steady-state values (algebraic, constant for all t):
- gyrator.i1 = G2 * v2 =  2 A
- gyrator.i2 = -G1 * v1 = -1 A

MSL reference: tolerance=1e-6, StopTime=1.
"""
test component Gyrator
  "Constant signal for primary voltage source (1 V)"
  const1 = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 0, "y1": 310, "x2": 100, "y2": 410, "rot": 0}
      },
      "tags": []
    }
  }
  "Constant signal for secondary voltage source (1 V)"
  const2 = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 320, "x2": 900, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
  "Primary voltage source"
  v1 = ElectricalComponents.Analog.Sources.VoltageSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 160, "y1": 410, "x2": 260, "y2": 310, "rot": 90}
      },
      "tags": []
    }
  }
  "Secondary voltage source"
  v2 = ElectricalComponents.Analog.Sources.VoltageSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 730, "y1": 320, "x2": 830, "y2": 420, "rot": 90}
      },
      "tags": []
    }
  }
  "Gyrator: G1=1 S, G2=2 S"
  gyrator = ElectricalComponents.Analog.Basic.Gyrator(G1 = 1, G2 = 2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 320, "x2": 550, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
  "Primary ground"
  ground1 = ElectricalComponents.Analog.Basic.Ground() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 160, "y1": 580, "x2": 260, "y2": 680, "rot": 0}
      },
      "tags": []
    }
  }
  "Secondary ground"
  ground2 = ElectricalComponents.Analog.Basic.Ground() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 720, "y1": 600, "x2": 820, "y2": 700, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(const1.y, v1.V) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(const2.y, v2.V) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(v1.p, gyrator.p1) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 210, "y": 250}, {"x": 391, "y": 250}, {"x": 391, "y": 321}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(v1.n, ground1.g) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(v2.p, gyrator.p2) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 780, "y": 250}, {"x": 590, "y": 250}, {"x": 590, "y": 321}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(v2.n, gyrator.n2) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 780, "y": 470}, {"x": 571, "y": 470}, {"x": 571, "y": 420}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(v2.n, ground2.g) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 780, "y": 515}, {"x": 770, "y": 515}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(v1.n, gyrator.n1) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 210, "y": 470},
            {"x": 390, "y": 470},
            {"x": 390, "y": 420},
            {"x": 451, "y": 420}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
end
Flattened Source
dyad
"""
MSL validation test: Gyrator.

Recreates `ModelicaTest.Electrical.Analog.TestGyrator` from MSL.
Two constant voltage sources (v1=1 V, v2=1 V) drive a gyrator with
G1=1 S and G2=2 S. Both sides are grounded.

Expected steady-state values (algebraic, constant for all t):
- gyrator.i1 = G2 * v2 =  2 A
- gyrator.i2 = -G1 * v1 = -1 A

MSL reference: tolerance=1e-6, StopTime=1.
"""
test component Gyrator
  "Constant signal for primary voltage source (1 V)"
  const1 = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 0, "y1": 310, "x2": 100, "y2": 410, "rot": 0}
      },
      "tags": []
    }
  }
  "Constant signal for secondary voltage source (1 V)"
  const2 = BlockComponents.Sources.Constant(k = 1) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 1000, "y1": 320, "x2": 900, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
  "Primary voltage source"
  v1 = ElectricalComponents.Analog.Sources.VoltageSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 160, "y1": 410, "x2": 260, "y2": 310, "rot": 90}
      },
      "tags": []
    }
  }
  "Secondary voltage source"
  v2 = ElectricalComponents.Analog.Sources.VoltageSource() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 730, "y1": 320, "x2": 830, "y2": 420, "rot": 90}
      },
      "tags": []
    }
  }
  "Gyrator: G1=1 S, G2=2 S"
  gyrator = ElectricalComponents.Analog.Basic.Gyrator(G1 = 1, G2 = 2) {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 320, "x2": 550, "y2": 420, "rot": 0}
      },
      "tags": []
    }
  }
  "Primary ground"
  ground1 = ElectricalComponents.Analog.Basic.Ground() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 160, "y1": 580, "x2": 260, "y2": 680, "rot": 0}
      },
      "tags": []
    }
  }
  "Secondary ground"
  ground2 = ElectricalComponents.Analog.Basic.Ground() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 720, "y1": 600, "x2": 820, "y2": 700, "rot": 0}
      },
      "tags": []
    }
  }
relations
  connect(const1.y, v1.V) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(const2.y, v2.V) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(v1.p, gyrator.p1) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 210, "y": 250}, {"x": 391, "y": 250}, {"x": 391, "y": 321}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(v1.n, ground1.g) {"Dyad": {"edges": [{"S": 1, "M": [], "E": 2}], "renderStyle": "standard"}}
  connect(v2.p, gyrator.p2) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 780, "y": 250}, {"x": 590, "y": 250}, {"x": 590, "y": 321}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(v2.n, gyrator.n2) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [{"x": 780, "y": 470}, {"x": 571, "y": 470}, {"x": 571, "y": 420}],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
  connect(v2.n, ground2.g) {
    "Dyad": {
      "edges": [{"S": 1, "M": [{"x": 780, "y": 515}, {"x": 770, "y": 515}], "E": 2}],
      "renderStyle": "standard"
    }
  }
  connect(v1.n, gyrator.n1) {
    "Dyad": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 210, "y": 470},
            {"x": 390, "y": 470},
            {"x": 390, "y": 420},
            {"x": 451, "y": 420}
          ],
          "E": 2
        }
      ],
      "renderStyle": "standard"
    }
  }
metadata {}
end


Test Cases

No test cases defined.