$(instance)RotationalEMFTest Icon

RotationalEMFTest

Simple circuit that showcases the usage of RotationalEMF().

Usage

RotationalEMFTest()

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( input_{signal_{+}y(t)}, sine_{voltage_{+}V(t)} \right) \\ \mathrm{connect}\left( fixed_{+}spline, rot_{emf_{+}housing} \right) \\ \mathrm{connect}\left( rot_{emf_{+}p}, sine_{voltage_{+}p} \right) \\ \mathrm{connect}\left( sine_{voltage_{+}n}, rot_{emf_{+}n} \right) \\ \mathrm{connect}\left( rot_{emf_{+}rotor}, inertia_{+}spline_{a} \right) \\ \mathtt{rot\_emf.v}\left( t \right) = - \mathtt{rot\_emf.n.v}\left( t \right) + \mathtt{rot\_emf.p.v}\left( t \right) \\ 0 = \mathtt{rot\_emf.n.i}\left( t \right) + \mathtt{rot\_emf.p.i}\left( t \right) \\ \mathtt{rot\_emf.i}\left( t \right) = \mathtt{rot\_emf.p.i}\left( t \right) \\ \mathtt{rot\_emf.phi}\left( t \right) = \mathtt{rot\_emf.rotor.phi}\left( t \right) - \mathtt{rot\_emf.housing.phi}\left( t \right) \\ \mathtt{rot\_emf.w}\left( t \right) = \frac{\mathrm{d} \mathtt{rot\_emf.phi}\left( t \right)}{\mathrm{d}t} \\ \mathtt{rot\_emf.k} \mathtt{rot\_emf.w}\left( t \right) = \mathtt{rot\_emf.v}\left( t \right) \\ \mathtt{rot\_emf.tau}\left( t \right) = - \mathtt{rot\_emf.k} \mathtt{rot\_emf.i}\left( t \right) \\ \mathtt{rot\_emf.tau}\left( t \right) = \mathtt{rot\_emf.rotor.tau}\left( t \right) \\ \mathtt{fixed.spline.phi}\left( t \right) = \mathtt{fixed.phi0} \\ \mathtt{input\_signal.y}\left( t \right) = ifelse\left( \mathtt{input\_signal.start\_time} < t, \mathtt{input\_signal.offset} + \mathtt{input\_signal.amplitude} \sin\left( \mathtt{input\_signal.phase} + 6.2832 \mathtt{input\_signal.frequency} \left( - \mathtt{input\_signal.start\_time} + t \right) \right), \mathtt{input\_signal.offset} \right) \\ \mathtt{sine\_voltage.v}\left( t \right) = \mathtt{sine\_voltage.p.v}\left( t \right) - \mathtt{sine\_voltage.n.v}\left( t \right) \\ \mathtt{sine\_voltage.i}\left( t \right) = \mathtt{sine\_voltage.p.i}\left( t \right) \\ \mathtt{sine\_voltage.p.i}\left( t \right) + \mathtt{sine\_voltage.n.i}\left( t \right) = 0 \\ \mathtt{sine\_voltage.v}\left( t \right) = \mathtt{sine\_voltage.uV} \mathtt{sine\_voltage.V}\left( t \right) \\ \mathtt{inertia.phi}\left( t \right) = \mathtt{inertia.spline\_a.phi}\left( t \right) \\ \mathtt{inertia.phi}\left( t \right) = \mathtt{inertia.spline\_b.phi}\left( t \right) \\ \frac{\mathrm{d} \mathtt{inertia.phi}\left( t \right)}{\mathrm{d}t} = \mathtt{inertia.w}\left( t \right) \\ \frac{\mathrm{d} \mathtt{inertia.w}\left( t \right)}{\mathrm{d}t} = \mathtt{inertia.a}\left( t \right) \\ \mathtt{inertia.J} \mathtt{inertia.a}\left( t \right) = \mathtt{inertia.spline\_a.tau}\left( t \right) + \mathtt{inertia.spline\_b.tau}\left( t \right) \\ \end{array} \right] \end{equation} \]

Source

# Simple circuit that showcases the usage of RotationalEMF().
test component RotationalEMFTest
  rot_emf = RotationalEMF(k=1) [{
    "JuliaSim": {"placement": {"icon": {"x1": 300, "y1": 700, "x2": 500, "y2": 900, "rot": 0}}}
  }]
  fixed = RotationalComponents.Fixed() [{
    "JuliaSim": {"placement": {"icon": {"x1": 0, "y1": 700, "x2": 200, "y2": 900, "rot": 180}}}
  }]
  input_signal = BlockComponents.Sine(amplitude=1, frequency=1, offset=0, start_time=0) [{
    "JuliaSim": {"placement": {"icon": {"x1": 300, "y1": 100, "x2": 500, "y2": 300, "rot": 0}}}
  }]
  sine_voltage = VoltageSource() [{
    "JuliaSim": {"placement": {"icon": {"x1": 500, "y1": 400, "x2": 700, "y2": 600, "rot": 0}}}
  }]
  inertia = RotationalComponents.Inertia(J=100) [{
    "JuliaSim": {"placement": {"icon": {"x1": 600, "y1": 700, "x2": 800, "y2": 900, "rot": 0}}}
  }]
relations
  connect(input_signal.y, sine_voltage.V) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 600, "y": 200}], "E": 2}]}}]
  connect(fixed.spline, rot_emf.housing) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(rot_emf.p, sine_voltage.p) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 400, "y": 500}], "E": 2}]}}]
  connect(sine_voltage.n, rot_emf.n) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 750, "y": 500},
            {"x": 750, "y": 650},
            {"x": 550, "y": 650},
            {"x": 550, "y": 950},
            {"x": 400, "y": 950}
          ],
          "E": 2
        }
      ]
    }
  }]
  connect(rot_emf.rotor, inertia.spline_a) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
metadata {
  "JuliaSim": {
    "tests": {"case1": {"stop": 10, "expect": {"signals": ["rot_emf.tau", "rot_emf.phi"]}}}
  }
}
end
Flattened Source
# Simple circuit that showcases the usage of RotationalEMF().
test component RotationalEMFTest
  rot_emf = RotationalEMF(k=1) [{
    "JuliaSim": {"placement": {"icon": {"x1": 300, "y1": 700, "x2": 500, "y2": 900, "rot": 0}}}
  }]
  fixed = RotationalComponents.Fixed() [{
    "JuliaSim": {"placement": {"icon": {"x1": 0, "y1": 700, "x2": 200, "y2": 900, "rot": 180}}}
  }]
  input_signal = BlockComponents.Sine(amplitude=1, frequency=1, offset=0, start_time=0) [{
    "JuliaSim": {"placement": {"icon": {"x1": 300, "y1": 100, "x2": 500, "y2": 300, "rot": 0}}}
  }]
  sine_voltage = VoltageSource() [{
    "JuliaSim": {"placement": {"icon": {"x1": 500, "y1": 400, "x2": 700, "y2": 600, "rot": 0}}}
  }]
  inertia = RotationalComponents.Inertia(J=100) [{
    "JuliaSim": {"placement": {"icon": {"x1": 600, "y1": 700, "x2": 800, "y2": 900, "rot": 0}}}
  }]
relations
  connect(input_signal.y, sine_voltage.V) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 600, "y": 200}], "E": 2}]}}]
  connect(fixed.spline, rot_emf.housing) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
  connect(rot_emf.p, sine_voltage.p) [{"JuliaSim": {"edges": [{"S": 1, "M": [{"x": 400, "y": 500}], "E": 2}]}}]
  connect(sine_voltage.n, rot_emf.n) [{
    "JuliaSim": {
      "edges": [
        {
          "S": 1,
          "M": [
            {"x": 750, "y": 500},
            {"x": 750, "y": 650},
            {"x": 550, "y": 650},
            {"x": 550, "y": 950},
            {"x": 400, "y": 950}
          ],
          "E": 2
        }
      ]
    }
  }]
  connect(rot_emf.rotor, inertia.spline_a) [{"JuliaSim": {"edges": [{"S": 1, "E": 2}]}}]
metadata {
  "JuliaSim": {
    "tests": {"case1": {"stop": 10, "expect": {"signals": ["rot_emf.tau", "rot_emf.phi"]}}}
  }
}
end

Test Cases

Test Case case1

Signal `rot_emf.tau` for test `case1` of `RotationalEMFTest`

Signal `rot_emf.phi` for test `case1` of `RotationalEMFTest`