Code covered by the BSD License  

Highlights from
Data-driven Control

4.83333

4.8 | 6 ratings Rate this file 90 Downloads (last 30 days) File Size: 452 KB File ID: #42758

Data-driven Control

by

 

14 Aug 2013 (Updated )

Files used in webinar Data-driven Control conducted on 12 July 2012

| Watch this File

File Information
Description

Files used in webinar Data-driven Control: How to Design a Controller When a Plant Model is Not Available on 12 July 2012

Through this webinar and product demonstrations, you will learn how to design and implement a PID controller when a plant model is not available. Through a DC motor control example, you will learn how to:

- Apply input signals (voltage) to the motor and collect output (angular position) test data
- Identify and validate linear and nonlinear plant models using multiple data sets
- Design a linear controller based on the linear motor model and simulate its performance against the nonlinear model
- Implement and test the controller on a target hardware platform

Required Products Control System Toolbox
Simulink
Simulink Control Design
System Identification Toolbox
MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (20)
09 Dec 2014 Isaiah De Freitas

@Pravallika I tried running mex -setup but i got back the same error when i tried to build. This is what i did

>mex -setup

Please verify your choices:

Compiler: Microsoft Visual C++ 2012
Location: C:\Program Files (x86)\Microsoft Visual Studio 11.0

Are these correct [y]/n? y

***************************************************************************
Warning: MEX-files generated using Microsoft Visual C++ 2012 require
that Microsoft Visual Studio 2012 run-time libraries be
available on the computer they are run on.
If you plan to redistribute your MEX-files to other MATLAB
users, be sure that they have the run-time libraries.
***************************************************************************


Trying to update options file: C:\Users\Isaiah\AppData\Roaming\MathWorks\MATLAB\R2013a\mexopts.bat
From template: C:\PROGRA~1\MATLAB\R2013a\bin\win64\mexopts\msvc110opts.bat

Done . . .

09 Dec 2014 Pravallika

Thanks Steve!

@Eric, Isaiah: Like Steve mentioned, running mex -setup to choose a compiler should help.

Also, you can get the real time pacer block from here:
http://www.mathworks.com/matlabcentral/fileexchange/29107-real-time-pacer-for-simulink/

09 Dec 2014 Steve Ramdass

Hey Eric, you should try running "mex -setup" and select a C Compiler. @Isaiah De Freitas, you should run mex -setup too in matlab command window. It will ask you a series of questions there for selection of a C-compiler. Hope you all get through. Cheers....

Excellent Tutorial

09 Dec 2014 Eric Coleman

Hi, Excellent Tutorial. Unfortunately I can't get it to work for me. I am using 2013a. When i try to build the EmbededOpenLoop i get the following error >

"EmbeddedOpenLoop_sfun", ...

'EmbeddedOpenLoop_sfun.bat' is not recognized as an internal or external command,
operable program or batch file."

Also, when I try to build the Host_serial_final_Matlab i get the following error

"Level-2 MATLAB S-function 'msfun_realtime_pacer' does not exist."

Also i should note that I changed the file format from .mdl to .slx because it was recommended .

08 Dec 2014 Isaiah De Freitas

For both the "Open Loop" and "Host_serial_final_MATLAB" simulink systems after i set up the uno under the tools option and click run or build, I get the following errors "Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks.
Use 'mex -setup' to select a supported C-compiler" reported by Simulink and "Model error" reported by simulink. I am using 2012b.
*********************************************
By the way, aid anyone get it to work on 2014a ?

05 Dec 2014 saif malik

@pravallika Thankyou so much pravallika.. Appreciate it!

05 Dec 2014 Isaiah De Freitas

no problem, and thanks on behalf of saif.

01 Dec 2014 Isaiah De Freitas  
01 Dec 2014 Pravallika

@Isaiah: Thanks for explaining the connections! You should be able to follow any of the instructions that show up on google search to change the servo motor to continuous rotation as well.

@Ariful, Saif: To address the error -
1) Right click on the block it in the error: 'Host_serial_final_MATLAB/Serial Motor Interface'.
2) Click on Properties.
3) Go to the 'Callbacks' tab.
4) Click on 'StartFcn' in the list on the left pane.
5) Edit the commands in the pane on the right to reflect your COM port settings.

28 Nov 2014 Isaiah De Freitas

I hope both of you all receive a solution soon. Correct me if I am wrong but I think the connections are like:
First off remove the internal circuitry of the RC servo leaving only the wires connected to the DC motor and the wires coming from the pot. Connect the DC motor wires to the respective (one for forward and one lead for backward) PWM output pins ( i think in this case we used pins 10 and 11) of your motor shield/driver. Connect the wiper lead from the pot to an analog input pin ( in this case i think it is pin 0). Keep in mind also that we have to use an external power source for the motor driver.

28 Nov 2014 saif malik

@ariful
Hi! I have the same error..I am using matlab 2013a. If you somehow resolve it do let me know. Also plz tell me how have you physically connected the hardware as I cannot understand the connections in the pdf paper.
Plz reply asap..

26 Nov 2014 Ariful

Hi Thanks for this webniar. when i tried to work with this i am getting the following error fro the host serial model. i have successfully downloaded the model on arduino uno and my port is 6 for uno. please help me eliminate the error.
thanks again

Error evaluating 'StartFcn' callback of SubSystem block 'Host_serial_final_MATLAB/Serial Motor Interface'.

Open failed: Port: COM4 is not available. Available ports: COM3, COM6.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.

13 Nov 2014 Pravallika

@Isaiah:
If I was to physically move the horn(arm) of the motor after a desired input angle was set, will the horn retract back to its desired angle?

- Yes. In fact, you might find it difficult to move the motor position since the controller will be acting against you.

Is this a hobby servo motor modified by removing the internal circuitry?

- Yes, we modified it for continuous rotation.

11 Nov 2014 Isaiah De Freitas

This is excellent work.
I have just two questions (anyone can answer) :

If I was to physically move the horn(arm) of the motor after a desired input angle was set, will the horn retract back to its desired angle?
Also,
Is this a hobby servo motor modified by removing the internal circuitry?

03 Mar 2014 miguel

10-bit to Angle ?

27 Feb 2014 Pravallika

@Mohamed: If you have confirmed that your model simulates slower than real-time, you can use other techniques to speed up your simulation such as Accelerator mode. You can then use one of the Pacer blocks on MATLAB Central to slow your simulation down to soft real-time. If this does not work for you, please feel free to contact our technical support who might be able to recommend an appropriate suggestion once they have more details pertaining to your application.

@phil: Thank you for your feedback. You are right, we could not use External mode on Arduino Uno as it is unsupported due to memory limitations of the board. Due to this, we created a host model that runs soft real-time on the PC that communicates with the application on the board. However, for Arduino Mega 2560 external mode is supported in MATLAB R2012b. You should be able to forgo the host model and collect your data via external mode.

19 Feb 2014 Mohamed

Great Work ...
but, I need to decrease the sampling time to 0.0004 in order to identify a fast motor.
How can I do this without losing the real time.

11 Feb 2014 Mohamed  
25 Dec 2013 phil

This is a great webinar. It might be worth mentioning that you can not use this method of data collection in External mode. When using the arduino mega for example. You can not log signal data in external mode. Rather you should connect a regular scope and save its data to the workspace. (this is with R2012b)

16 Sep 2013 Madhu  
Updates
14 Aug 2013

Added updated zip file with copyright info.

Contact us