Description

In this remote laboratory, user can take control of a DC motor by sending a python script to the server. DC Motor is ESCAP 28D2R-219p with integrated 144 pulses per rotation incremental AB encoder.

Characteristics of this motor are:

Max voltage:      12 V
Max no-load speed:    5800 rpm
Stall torque: 94 mNm
Max cont. current: 1.5 A
No-load current: 44 mA
Minimal voltage: 0.15 V
Max cont. torque: 28.4 mNm
Angular acceleration: 48000 rad/s^2
Back EMF constant: 0.0196 Vs/rad
Mechanical constant: 0.0195 Nm/A
Armature restistence: 2.5 Ohm
Moment of inertia: 17.6e-7 kgm^2
Inductance: 0.3 mH
Viscous damping: 1.412e-6 Nms/rad

 

Upon opening remote laboratory, user will see UI with three distinct windows:
First is real time camera stream, where user can see motor rotation.
Second is console, where user can see relevant parameters from experiment in comma separated list (time t, setpoint r(t), control variable u(t), motor velocity in rad/s Ω(t), motor position in deegrees). If any error occurs, user will be notified in console. 

After experiment, user can download experimental results in .m file by clicking "Download results" button.
Experiment will start as soon as user uploads their control script.
Script is written in python, and has following form:
First, user must define class Motor, which will bi initialized by server.
There are two required metods:
def __init__(self) - class constructor, it will be called at the beggining of the experiment. It must contain several variables:
self.period - sampling period (no less than 0.01)
self.duration - experiment duration (no more than 60)
self.r - setpoint
self.upravljanje - control variable
self.emP - emulated load
second method is main loop method: def loop(self,t,vel,pos).
In listing below, a simple program to send step signal to the input of the motor in third second of experiment is given:


#class

class Motor: #class constructor #mandatory variables are initialized def __init__(self): self.period = 0.05 # sampling period 50 ms self.duration = 10 # experiment duration 10 s self.upravljanje = 0 # control variable self.r = 0 # setpoint, will be zero in open loop self.emP = 0 # emulated load, we will keep it zero for this example #control logic #loop is called every self.period seconds, until self.duration time is passed def loop(self, t, vel, pos): if (t<3): self.upravljanje = 0 #send 0% PWM for the first 3 seconds else: self.upravljanje = 10 #send 10% PWM for the rest of experiment return self.upravljanje-eslf.emP #send it to the motor

 

A simple speed servomechanism with PI controller is given in example below:

#class

class Motor: #class constructor #mandatory variables are initialized def __init__(self): self.period = 0.05 # sampling period 50 ms self.duration = 10 # experiment duration 10 s self.upravljanje = 0 # control variable self.r = 0 # setpoint, will be zero in open loop self.emP = 0 # emulated load, we will keep it zero for the first five seconds #user defined variables self.integral = 0 #stores integral of an error self.kP = 0.5 #proportional gain self.kI = 3 #integral gain #control logic #loop is called every self.period seconds, until self.duration time is passed def loop(self, t, vel, pos): self.r = 60 #setpoint 60 rad/s e = self.r - pos #error self.integral += e * self.period #integral self.upravljanje = self.kP * e + self.kI * self.integral #PI controller if (t > 5): self.emP = 3 #emulated disturbance return self.upravljanje - self.emP #send it to the motor

No votes have been submitted yet.

View and write the comments

No one has commented it yet.