Specifications
4
Data Acquisition 
  When the “Store Data” button is pressed in the host GUI the software stores data from the dynamic system in a 
circular buffer. The buffer is 2048 data samples in length. After 2048 sample periods the buffer begins to be 
overwritten, and will continue to be overwritten as long as the “Store Data” button is depressed in the host program. 
Pressing either the “Save Data” button or the “Store Data” button again will stop data storage, leaving the last 2048 
data samples in the buffer. If for example the sample rate is set to 500 Hz, then the last 2048/500=4.096 seconds of 
data will be saved in the buffer. The data is saved to a file by pressing the “Save Data” button. 
  The exception to the sampling scheme above occurs when one of the command buttons in the “One Shot 
Commands with Auto Save of Data” is pressed. In this case the command generation and the data storage execute 
until the buffer fills. Then the data is automatically stored to a data file named with the time and date from the 
computer clock. 
  Nine pieces of data are stored at each time step (each sample period): 
TIME(sec) Command(deg/RPM/Amps) Theta1(deg) Theta2(deg) Vel1(RPM) Vel2(RPM) U(Amps) I(Amp) Extra(??) 
The TIME data begins at zero with the oldest data point in the buffer. The units of the Command depend upon 
which program is running: closed-loop position control, closed-loop velocity control, or the open loop program. The 
U variable is the commanded current to the amplifier, and the I variable is the measured current. The Extra variable 
is reserved for future use. 
Associated MATLAB functions for data analysis 
File: mlimport.m function data = mlimport(); Opens a dialogue to select a data file generated by the motor lab 
software. Returns the data in the selected file through a matrix with 9 columns and 2048 rows. The 9 columns of 
the matrix contain the following data: 
TIME(sec) Command(deg/RPM/Amps) Theta1(deg) Theta2(deg) Vel1(RPM) Vel2(RPM) U(Amps) I(Amp) Extra(??) 
example: data = mlimport; 
File: mlolplots.m function mlolplots(data,Iscale); Uses data generated by the motorlab openloop control software 
and imported using mlimport.m. Plots the motion variables along with the current command to the amplifier. If an 
"Iscale" argument is supplied then the commanded current values are scaled by the Iscale value in the plots. 
example: mlolplots(data); Does not scale the current command. 
example: mlolplots(data,Iscale); Multiplies commanded current values by Iscale. 
File: mlposplots.m function mlposplots(data); Uses data generated by the motorlab position control software that 
has been imported using mlimport(). Plots this data in several plots.  example: mlposplots(data); 
File: mlvelplots.m function mlvelplots(data); Uses data generated by the motorlab velocity control software that 
has been imported using mlimport(). Plots this data in several plots. example: mlvelplots(data); 
File: trapprof.m function [x,v,t] =trapprof(DX,Vmax,Amax,DT) Trapezoidal-velocity motion profile generation 
Outputs: x=position vector, v=trapezoidal velocity vector, t=time vector 
Inputs: DX=distance to move, Vmax=maximum velocity, Amax=maximum acceleration, DT=time step for outputs 
example: [x,v,t] =trapprof(DX,Vmax,Amax,DT) 
Associated EXCEL programs 
  Three EXCEL files/programs are also included in the motorlab directory: “Open Loop Plots.xls,” “Position 
Control Plots.xls,” and “Velocity Control Plots.xls.” Each of these files contains a Visual Basic GUI interface in 
the “HeaderSheet” sheet of the file. The GUI’s are used to import data files for the plot sheets. These files 
essentially implement the same plots as the three plot functions for MATLAB discussed above. 










