DCMotorDCMotor Icon

DCMotor

Usage

DCMotor(R=0.5, L=4.5e-3, k=0.5, J=0.02, f=0.01)

Parameters:

NameDescriptionUnitsDefault value
RArmature resistanceΩ0.5
LArmature inductanceH0.0045
kMotor constantN.m/A0.5
JMotor inertiakg.m20.02
fMotor friction factorN.m.s/rad0.01

Connectors

  • p - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)
  • n - This connector represents an electrical pin with voltage and current as the potential and flow variables, respectively. (Pin)
  • shaft - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. (Spline)
  • housing - This connector represents a rotational spline with angle and torque as the potential and flow variables, respectively. (Spline)

Behavior

\[ \begin{equation} \left[ \begin{array}{c} \mathrm{connect}\left( p, R1_{+}p \right) \\ \mathrm{connect}\left( R1_{+}n, L1_{+}p \right) \\ \mathrm{connect}\left( L1_{+}n, emf_{+}p \right) \\ \mathrm{connect}\left( emf_{+}n, n \right) \\ \mathrm{connect}\left( emf_{+}rotor, inertia_{+}spline_{a}, friction_{+}spline_{a} \right) \\ \mathrm{connect}\left( friction_{+}spline_{b}, emf_{+}housing, housing \right) \\ \mathrm{connect}\left( inertia_{+}spline_{b}, shaft \right) \\ \mathtt{R1.v}\left( t \right) = \mathtt{R1.p.v}\left( t \right) - \mathtt{R1.n.v}\left( t \right) \\ \mathtt{R1.i}\left( t \right) = \mathtt{R1.p.i}\left( t \right) \\ \mathtt{R1.n.i}\left( t \right) + \mathtt{R1.p.i}\left( t \right) = 0 \\ \mathtt{R1.v}\left( t \right) = \mathtt{R1.R} \mathtt{R1.i}\left( t \right) \\ \mathtt{L1.v}\left( t \right) = \mathtt{L1.p.v}\left( t \right) - \mathtt{L1.n.v}\left( t \right) \\ \mathtt{L1.i}\left( t \right) = \mathtt{L1.p.i}\left( t \right) \\ \mathtt{L1.p.i}\left( t \right) + \mathtt{L1.n.i}\left( t \right) = 0 \\ \mathtt{L1.L} \frac{\mathrm{d} \mathtt{L1.i}\left( t \right)}{\mathrm{d}t} = \mathtt{L1.v}\left( t \right) \\ \mathtt{emf.v}\left( t \right) = \mathtt{emf.p.v}\left( t \right) - \mathtt{emf.n.v}\left( t \right) \\ 0 = \mathtt{emf.p.i}\left( t \right) + \mathtt{emf.n.i}\left( t \right) \\ \mathtt{emf.i}\left( t \right) = \mathtt{emf.p.i}\left( t \right) \\ \mathtt{emf.phi}\left( t \right) = \mathtt{emf.rotor.phi}\left( t \right) - \mathtt{emf.housing.phi}\left( t \right) \\ \mathtt{emf.w}\left( t \right) = \frac{\mathrm{d} \mathtt{emf.phi}\left( t \right)}{\mathrm{d}t} \\ \mathtt{emf.k} \mathtt{emf.w}\left( t \right) = \mathtt{emf.v}\left( t \right) \\ \mathtt{emf.tau}\left( t \right) = - \mathtt{emf.k} \mathtt{emf.i}\left( t \right) \\ \mathtt{emf.tau}\left( t \right) = \mathtt{emf.rotor.tau}\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) \\ \mathtt{friction.phi\_rel}\left( t \right) = \mathtt{friction.spline\_b.phi}\left( t \right) - \mathtt{friction.spline\_a.phi}\left( t \right) \\ \mathtt{friction.spline\_b.tau}\left( t \right) = \mathtt{friction.tau}\left( t \right) \\ \mathtt{friction.spline\_a.tau}\left( t \right) = - \mathtt{friction.tau}\left( t \right) \\ \frac{\mathrm{d} \mathtt{friction.phi\_rel}\left( t \right)}{\mathrm{d}t} = \mathtt{friction.w\_rel}\left( t \right) \\ \frac{\mathrm{d} \mathtt{friction.w\_rel}\left( t \right)}{\mathrm{d}t} = \mathtt{friction.a\_rel}\left( t \right) \\ \mathtt{friction.tau}\left( t \right) = \mathtt{friction.d} \mathtt{friction.w\_rel}\left( t \right) \\ \end{array} \right] \end{equation} \]

Source

component DCMotor
  p = Pin()
  n = Pin()
  shaft = Spline()
  housing = Spline()
  R1 = ElectricalComponents.Resistor(R = R)
  L1 = ElectricalComponents.Inductor(L = L)
  emf = ElectricalComponents.RotationalEMF(k = k)
  inertia = RotationalComponents.Inertia(J = J)
  friction = RotationalComponents.Damper(d = f)
  # Armature resistance
  parameter R::Resistance = 0.5
  # Armature inductance
  parameter L::Inductance = 4.5e-3
  # Motor constant
  parameter k::ElectricalTorqueConstant = 0.5
  # Motor inertia
  parameter J::Inertia = 0.02
  # Motor friction factor
  parameter f::RotationalDampingConstant = 0.01
relations
  connect(p, R1.p)
  connect(R1.n, L1.p)
  connect(L1.n, emf.p)
  connect(emf.n, n)
  connect(emf.rotor, inertia.spline_a, friction.spline_a)
  connect(friction.spline_b, emf.housing, housing)
  connect(inertia.spline_b, shaft)
end
Flattened Source
component DCMotor
  p = Pin()
  n = Pin()
  shaft = Spline()
  housing = Spline()
  R1 = ElectricalComponents.Resistor(R = R)
  L1 = ElectricalComponents.Inductor(L = L)
  emf = ElectricalComponents.RotationalEMF(k = k)
  inertia = RotationalComponents.Inertia(J = J)
  friction = RotationalComponents.Damper(d = f)
  # Armature resistance
  parameter R::Resistance = 0.5
  # Armature inductance
  parameter L::Inductance = 4.5e-3
  # Motor constant
  parameter k::ElectricalTorqueConstant = 0.5
  # Motor inertia
  parameter J::Inertia = 0.02
  # Motor friction factor
  parameter f::RotationalDampingConstant = 0.01
relations
  connect(p, R1.p)
  connect(R1.n, L1.p)
  connect(L1.n, emf.p)
  connect(emf.n, n)
  connect(emf.rotor, inertia.spline_a, friction.spline_a)
  connect(friction.spline_b, emf.housing, housing)
  connect(inertia.spline_b, shaft)
metadata {}
end


Test Cases

No test cases defined.