TestDCMotorLoadControlled
IconTestDCMotorLoadControlled
Usage
TestDCMotorLoadControlled(w_motor=1, tau_load=-0.3, load_step_start_time=2, k=0.5, Ti=0.1, Td=1e5, Nd=10)
Parameters:
Name | Description | Units | Default value |
---|---|---|---|
w_motor | Motor desired speed | rad/s | 1 |
tau_load | Amplitude of load torque step | N.m | -0.3 |
load_step_start_time | Load step start time | s | 2 |
k | Controller gain | – | 0.5 |
Ti | Controller time constant of the integrator block | s | 0.1 |
Td | Controller Time constant of the derivative block | s | 100000 |
Nd | Maximum derivative gain | – | 10 |
Behavior
\[ \begin{equation} \left[ \begin{array}{c} AnalysisPoint\left( \mathtt{controller.y}\left( t \right), u, \left[ \begin{array}{c} \mathtt{source.V}\left( t \right) \\ \end{array} \right] \right) \\ AnalysisPoint\left( \mathtt{speed\_sensor.w}\left( t \right), y, \left[ \begin{array}{c} \mathtt{controller.u\_m}\left( t \right) \\ \end{array} \right] \right) \\ AnalysisPoint\left( \mathtt{speed\_reference.y}\left( t \right), r, \left[ \begin{array}{c} \mathtt{controller.u\_s}\left( t \right) \\ \end{array} \right] \right) \\ \mathtt{load\_source.y}\left( t \right) = \mathtt{load.tau}\left( t \right) \\ \mathrm{connect}\left( source_{+}p, motor_{+}p \right) \\ \mathrm{connect}\left( motor_{+}n, source_{+}n, ground_{+}g \right) \\ \mathrm{connect}\left( motor_{+}shaft, load_{+}spline \right) \\ \mathrm{connect}\left( motor_{+}housing, load_{+}support, fixed_{+}spline \right) \\ \mathrm{connect}\left( speed_{reference_{+}y(t)}, controller_{+}u_{s(t)} \right) \\ \mathrm{connect}\left( speed_{sensor_{+}w(t)}, controller_{+}u_{m(t)} \right) \\ \mathrm{connect}\left( controller_{+}y(t), source_{+}V(t) \right) \\ \mathtt{controller.u\_ff}\left( t \right) = \mathtt{signal\_ff.y}\left( t \right) \\ \mathrm{connect}\left( speed_{sensor_{+}spline}, motor_{+}shaft \right) \\ \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{motor.R1.v}\left( t \right) = \mathtt{motor.R1.p.v}\left( t \right) - \mathtt{motor.R1.n.v}\left( t \right) \\ \mathtt{motor.R1.i}\left( t \right) = \mathtt{motor.R1.p.i}\left( t \right) \\ \mathtt{motor.R1.n.i}\left( t \right) + \mathtt{motor.R1.p.i}\left( t \right) = 0 \\ \mathtt{motor.R1.v}\left( t \right) = \mathtt{motor.R1.R} \mathtt{motor.R1.i}\left( t \right) \\ \mathtt{motor.L1.v}\left( t \right) = \mathtt{motor.L1.p.v}\left( t \right) - \mathtt{motor.L1.n.v}\left( t \right) \\ \mathtt{motor.L1.i}\left( t \right) = \mathtt{motor.L1.p.i}\left( t \right) \\ \mathtt{motor.L1.p.i}\left( t \right) + \mathtt{motor.L1.n.i}\left( t \right) = 0 \\ \mathtt{motor.L1.L} \frac{\mathrm{d} \mathtt{motor.L1.i}\left( t \right)}{\mathrm{d}t} = \mathtt{motor.L1.v}\left( t \right) \\ \mathtt{motor.emf.v}\left( t \right) = \mathtt{motor.emf.p.v}\left( t \right) - \mathtt{motor.emf.n.v}\left( t \right) \\ 0 = \mathtt{motor.emf.n.i}\left( t \right) + \mathtt{motor.emf.p.i}\left( t \right) \\ \mathtt{motor.emf.i}\left( t \right) = \mathtt{motor.emf.p.i}\left( t \right) \\ \mathtt{motor.emf.phi}\left( t \right) = \mathtt{motor.emf.rotor.phi}\left( t \right) - \mathtt{motor.emf.housing.phi}\left( t \right) \\ \mathtt{motor.emf.w}\left( t \right) = \frac{\mathrm{d} \mathtt{motor.emf.phi}\left( t \right)}{\mathrm{d}t} \\ \mathtt{motor.emf.k} \mathtt{motor.emf.w}\left( t \right) = \mathtt{motor.emf.v}\left( t \right) \\ \mathtt{motor.emf.tau}\left( t \right) = - \mathtt{motor.emf.k} \mathtt{motor.emf.i}\left( t \right) \\ \mathtt{motor.emf.tau}\left( t \right) = \mathtt{motor.emf.rotor.tau}\left( t \right) \\ \mathtt{motor.inertia.phi}\left( t \right) = \mathtt{motor.inertia.spline\_a.phi}\left( t \right) \\ \mathtt{motor.inertia.phi}\left( t \right) = \mathtt{motor.inertia.spline\_b.phi}\left( t \right) \\ \frac{\mathrm{d} \mathtt{motor.inertia.phi}\left( t \right)}{\mathrm{d}t} = \mathtt{motor.inertia.w}\left( t \right) \\ \frac{\mathrm{d} \mathtt{motor.inertia.w}\left( t \right)}{\mathrm{d}t} = \mathtt{motor.inertia.a}\left( t \right) \\ \mathtt{motor.inertia.J} \mathtt{motor.inertia.a}\left( t \right) = \mathtt{motor.inertia.spline\_b.tau}\left( t \right) + \mathtt{motor.inertia.spline\_a.tau}\left( t \right) \\ \mathtt{motor.friction.phi\_rel}\left( t \right) = \mathtt{motor.friction.spline\_b.phi}\left( t \right) - \mathtt{motor.friction.spline\_a.phi}\left( t \right) \\ \mathtt{motor.friction.spline\_b.tau}\left( t \right) = \mathtt{motor.friction.tau}\left( t \right) \\ \mathtt{motor.friction.spline\_a.tau}\left( t \right) = - \mathtt{motor.friction.tau}\left( t \right) \\ \frac{\mathrm{d} \mathtt{motor.friction.phi\_rel}\left( t \right)}{\mathrm{d}t} = \mathtt{motor.friction.w\_rel}\left( t \right) \\ \frac{\mathrm{d} \mathtt{motor.friction.w\_rel}\left( t \right)}{\mathrm{d}t} = \mathtt{motor.friction.a\_rel}\left( t \right) \\ \mathtt{motor.friction.tau}\left( t \right) = \mathtt{motor.friction.d} \mathtt{motor.friction.w\_rel}\left( t \right) \\ \mathtt{ground.g.v}\left( t \right) = 0 \\ \mathtt{source.v}\left( t \right) = - \mathtt{source.n.v}\left( t \right) + \mathtt{source.p.v}\left( t \right) \\ \mathtt{source.i}\left( t \right) = \mathtt{source.p.i}\left( t \right) \\ \mathtt{source.p.i}\left( t \right) + \mathtt{source.n.i}\left( t \right) = 0 \\ \mathtt{source.v}\left( t \right) = \mathtt{source.uV} \mathtt{source.V}\left( t \right) \\ \mathtt{fixed.spline.phi}\left( t \right) = \mathtt{fixed.phi0} \\ \mathtt{load.support.phi}\left( t \right) = \mathtt{load.phi\_support}\left( t \right) \\ \mathtt{load.support.tau}\left( t \right) = - \mathtt{load.spline.tau}\left( t \right) \\ \mathtt{load.phi}\left( t \right) = \mathtt{load.spline.phi}\left( t \right) - \mathtt{load.phi\_support}\left( t \right) \\ \mathtt{load.spline.tau}\left( t \right) = - \mathtt{load.tau}\left( t \right) \\ \mathtt{load\_source.y}\left( t \right) = ifelse\left( t \geq \mathtt{load\_source.start\_time}, \mathtt{load\_source.height} + \mathtt{load\_source.offset}, \mathtt{load\_source.offset} \right) \\ \mathtt{speed\_reference.y}\left( t \right) = \mathtt{speed\_reference.k} \\ \mathtt{controller.u\_s}\left( t \right) = \mathtt{controller.add\_p.u1}\left( t \right) \\ \mathtt{controller.u\_s}\left( t \right) = \mathtt{controller.add\_i.u1}\left( t \right) \\ \mathtt{controller.u\_s}\left( t \right) = \mathtt{controller.add\_d.u1}\left( t \right) \\ \mathtt{controller.u\_m}\left( t \right) = \mathtt{controller.add\_p.u2}\left( t \right) \\ \mathtt{controller.u\_m}\left( t \right) = \mathtt{controller.add\_i.u2}\left( t \right) \\ \mathtt{controller.u\_m}\left( t \right) = \mathtt{controller.add\_d.u2}\left( t \right) \\ \mathtt{controller.u\_ff}\left( t \right) = \mathtt{controller.add\_ff.u2}\left( t \right) \\ \mathtt{controller.y}\left( t \right) = \mathtt{controller.limiter.y}\left( t \right) \\ \mathtt{controller.add\_p.y}\left( t \right) = \mathtt{controller.proportional.u}\left( t \right) \\ \mathtt{controller.add\_d.y}\left( t \right) = \mathtt{controller.derivative.u}\left( t \right) \\ \mathtt{controller.add\_i.y}\left( t \right) = \mathtt{controller.integrator.u}\left( t \right) \\ \mathtt{controller.proportional.y}\left( t \right) = \mathtt{controller.add\_pid.u1}\left( t \right) \\ \mathtt{controller.derivative.y}\left( t \right) = \mathtt{controller.add\_pid.u2}\left( t \right) \\ \mathtt{controller.integrator.y}\left( t \right) = \mathtt{controller.add\_pid.u3}\left( t \right) \\ \mathtt{controller.add\_pid.y}\left( t \right) = \mathtt{controller.gain\_pid.u}\left( t \right) \\ \mathtt{controller.gain\_pid.y}\left( t \right) = \mathtt{controller.add\_ff.u1}\left( t \right) \\ \mathtt{controller.add\_ff.y}\left( t \right) = \mathtt{controller.add\_sat.u2}\left( t \right) \\ \mathtt{controller.add\_ff.y}\left( t \right) = \mathtt{controller.limiter.u}\left( t \right) \\ \mathtt{controller.limiter.y}\left( t \right) = \mathtt{controller.add\_sat.u1}\left( t \right) \\ \mathtt{controller.add\_sat.y}\left( t \right) = \mathtt{controller.gain\_track.u}\left( t \right) \\ \mathtt{controller.gain\_track.y}\left( t \right) = \mathtt{controller.add\_i.u3}\left( t \right) \\ \mathtt{controller.add\_p.y}\left( t \right) = \mathtt{controller.add\_p.k1} \mathtt{controller.add\_p.u1}\left( t \right) + \mathtt{controller.add\_p.k2} \mathtt{controller.add\_p.u2}\left( t \right) \\ \mathtt{controller.add\_d.y}\left( t \right) = \mathtt{controller.add\_d.k1} \mathtt{controller.add\_d.u1}\left( t \right) + \mathtt{controller.add\_d.k2} \mathtt{controller.add\_d.u2}\left( t \right) \\ \mathtt{controller.add\_i.y}\left( t \right) = \mathtt{controller.add\_i.k1} \mathtt{controller.add\_i.u1}\left( t \right) + \mathtt{controller.add\_i.k2} \mathtt{controller.add\_i.u2}\left( t \right) + \mathtt{controller.add\_i.k3} \mathtt{controller.add\_i.u3}\left( t \right) \\ \mathtt{controller.proportional.y}\left( t \right) = \mathtt{controller.proportional.k} \mathtt{controller.proportional.u}\left( t \right) \\ \frac{\mathrm{d} \mathtt{controller.derivative.x}\left( t \right)}{\mathrm{d}t} = \frac{ - \mathtt{controller.derivative.x}\left( t \right) + \mathtt{controller.derivative.u}\left( t \right)}{\mathtt{controller.derivative.T}} \\ \mathtt{controller.derivative.y}\left( t \right) = \frac{\mathtt{controller.derivative.k} \left( - \mathtt{controller.derivative.x}\left( t \right) + \mathtt{controller.derivative.u}\left( t \right) \right)}{\mathtt{controller.derivative.T}} \\ \frac{\mathrm{d} \mathtt{controller.integrator.x}\left( t \right)}{\mathrm{d}t} = \mathtt{controller.integrator.k} \mathtt{controller.integrator.u}\left( t \right) \\ \mathtt{controller.integrator.y}\left( t \right) = \mathtt{controller.integrator.x}\left( t \right) \\ \mathtt{controller.add\_pid.y}\left( t \right) = \mathtt{controller.add\_pid.k1} \mathtt{controller.add\_pid.u1}\left( t \right) + \mathtt{controller.add\_pid.k2} \mathtt{controller.add\_pid.u2}\left( t \right) + \mathtt{controller.add\_pid.k3} \mathtt{controller.add\_pid.u3}\left( t \right) \\ \mathtt{controller.gain\_pid.y}\left( t \right) = \mathtt{controller.gain\_pid.k} \mathtt{controller.gain\_pid.u}\left( t \right) \\ \mathtt{controller.add\_ff.y}\left( t \right) = \mathtt{controller.add\_ff.k1} \mathtt{controller.add\_ff.u1}\left( t \right) + \mathtt{controller.add\_ff.k2} \mathtt{controller.add\_ff.u2}\left( t \right) \\ \mathtt{controller.limiter.y}\left( t \right) = clamp\left( \mathtt{controller.limiter.u}\left( t \right), \mathtt{controller.limiter.y\_min}, \mathtt{controller.limiter.y\_max} \right) \\ \mathtt{controller.add\_sat.y}\left( t \right) = \mathtt{controller.add\_sat.k1} \mathtt{controller.add\_sat.u1}\left( t \right) + \mathtt{controller.add\_sat.k2} \mathtt{controller.add\_sat.u2}\left( t \right) \\ \mathtt{controller.gain\_track.y}\left( t \right) = \mathtt{controller.gain\_track.k} \mathtt{controller.gain\_track.u}\left( t \right) \\ \mathtt{signal\_ff.y}\left( t \right) = \mathtt{signal\_ff.k} \\ 0 = \mathtt{speed\_sensor.spline.tau}\left( t \right) \\ \mathtt{speed\_sensor.w}\left( t \right) = \frac{\mathrm{d} \mathtt{speed\_sensor.spline.phi}\left( t \right)}{\mathrm{d}t} \\ \end{array} \right] \end{equation} \]
Source
test component TestDCMotorLoadControlled
motor = DCMotor()
ground = ElectricalComponents.Ground()
source = ElectricalComponents.VoltageSource()
fixed = RotationalComponents.Fixed()
load = RotationalComponents.TorqueSource()
load_source = BlockComponents.Step(height = tau_load, start_time = load_step_start_time)
speed_reference = BlockComponents.Constant(k = w_motor)
controller = BlockComponents.LimPID(k = k, Ti = Ti, Td = Td, Nd = Nd, y_max = 5, y_min = -5)
signal_ff = BlockComponents.Constant(k = 0)
speed_sensor = RotationalComponents.VelocitySensor()
# Motor desired speed
parameter w_motor::AngularVelocity = 1
# Amplitude of load torque step
parameter tau_load::Torque = -0.3
# Load step start time
parameter load_step_start_time::Time = 2
# Controller gain
parameter k::Real = 0.5
# Controller time constant of the integrator block
parameter Ti::Time = 0.1
# Controller Time constant of the derivative block
parameter Td::Time = 1e5
# Maximum derivative gain
parameter Nd::Real = 10
relations
initial motor.L1.i = 0
initial motor.inertia.w = 0
u: analysis_point(controller.y, source.V)
y: analysis_point(speed_sensor.w, controller.u_m)
r: analysis_point(speed_reference.y, controller.u_s)
connect(load_source.y, load.tau)
connect(source.p, motor.p)
connect(motor.n, source.n, ground.g)
connect(motor.shaft, load.spline)
connect(motor.housing, load.support, fixed.spline)
connect(speed_reference.y, controller.u_s)
connect(speed_sensor.w, controller.u_m)
connect(controller.y, source.V)
connect(controller.u_ff, signal_ff.y)
connect(speed_sensor.spline, motor.shaft)
end
Flattened Source
test component TestDCMotorLoadControlled
motor = DCMotor()
ground = ElectricalComponents.Ground()
source = ElectricalComponents.VoltageSource()
fixed = RotationalComponents.Fixed()
load = RotationalComponents.TorqueSource()
load_source = BlockComponents.Step(height = tau_load, start_time = load_step_start_time)
speed_reference = BlockComponents.Constant(k = w_motor)
controller = BlockComponents.LimPID(k = k, Ti = Ti, Td = Td, Nd = Nd, y_max = 5, y_min = -5)
signal_ff = BlockComponents.Constant(k = 0)
speed_sensor = RotationalComponents.VelocitySensor()
# Motor desired speed
parameter w_motor::AngularVelocity = 1
# Amplitude of load torque step
parameter tau_load::Torque = -0.3
# Load step start time
parameter load_step_start_time::Time = 2
# Controller gain
parameter k::Real = 0.5
# Controller time constant of the integrator block
parameter Ti::Time = 0.1
# Controller Time constant of the derivative block
parameter Td::Time = 1e5
# Maximum derivative gain
parameter Nd::Real = 10
relations
initial motor.L1.i = 0
initial motor.inertia.w = 0
u: analysis_point(controller.y, source.V)
y: analysis_point(speed_sensor.w, controller.u_m)
r: analysis_point(speed_reference.y, controller.u_s)
connect(load_source.y, load.tau)
connect(source.p, motor.p)
connect(motor.n, source.n, ground.g)
connect(motor.shaft, load.spline)
connect(motor.housing, load.support, fixed.spline)
connect(speed_reference.y, controller.u_s)
connect(speed_sensor.w, controller.u_m)
connect(controller.y, source.V)
connect(controller.u_ff, signal_ff.y)
connect(speed_sensor.spline, motor.shaft)
metadata {}
end
Test Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses
- Tests