how to pograme LQR using PLC?

zenocorp

Member
Join Date
Mar 2008
Location
kota kinabalu, sabah
Posts
4
hi, this is my first post in this forum.
i am a final year electrical student from one of the University in Malaysia.

i currently have a project which involve running a DC motor using PLC. the speed of the DC motor is control by LQR algorithm(linear quadratic regulator). The problem is, how can i use the PLC to pograme my LQR controller?


this is my blog diagram.

f_blockdiagram_ee96927.jpg




this is my flow chart

f_mylatestflom_a97f040.jpg
 
To boldly go where no one ( sane ) has gone before

zenocorp said:
hi, this is my first post in this forum.
i am a final year electrical student from one of the University in Malaysia.
Duh.

i currently have a project which involve running a DC motor using PLC.
A PLC will not output enough power except for the smallest DC motors.

the speed of the DC motor is control by LQR algorithm(linear quadratic regulator).
Why an LQR? Don't tell us it is the professor's stupid idea, ... again. Do you think you are the first student with a stupid professor problem? You can read that as a stupid problem or stupid professor. I don't care they both apply.

Give your self and us a break and get a DSP evaluation kit. They are cheap and much better for this kind of work. You need a matrix library and you will not find one on a PLC.

The problem is, how can i use the PLC to pograme my LQR controller?
With great difficulty without the matrix library. You are using the wrong tool. You should be doing this in Scilab or Matlab. I would give you an 'F' right at the start for using hammer to cut down a tree.

The fastest and cheapest way to do motor control is to buy an already made motion controller that fits or communicates with whatever PLC you are using. As a future engineer your job is to make optimal decisions and this is going to be one of them.

You are the first to ask about LQR.
Why would anybody use LQR for motion control?
What is your cost function? How are you going to find the values to stick in the arrays for your cost function?
How are you going to change speeds? By step or by gentle ramp?
How do you keep a LQR from overshooting position?
How many states do you think you will need?
Are you really going to calculate the feed back gains on a PLC? This is the part that is insane. ( For the PLC people, calculating the gains involves minimizing a cost function. This is done using the Ricatti equation which is a bad a$$ equation involving lots of matrices and inversions etc and we all know that PLCs can do that stuff easily ;) )

Now for the simple questions we get around here:
What is the size of the DC motor and load,
What is the control output to the DC motor?
How much power ( voltage, current)?
What kind of feed back are you using?
 
hi, thaks for the reply

erm what is matrix library?so can i still program my LQR controller using PLC without matrix library?
or i need to programe my LOQ using matlab and the transfer it to PLC?


"Give your self and us a break and get a DSP evaluation kit. They are cheap and much better for this kind of work. You need a matrix library and you will not find one on a PLC."

im affraid i cannot change the project title. the stupid title is "DC motor control using LQR algotithm". just consider it as a stupid idea which my lecture (she is not a professor-she only has a degree) gave me to try it out. (y)


"Why would anybody use LQR for motion control?"
erm i think is to ensure the DC motor running at optimum speed
(full speed and half speed)


im not a good student. so can you please kindly help me out with your question? please..
i dont know what is cost function & overshooting position.


"How are you going to change speeds? By step or by gentle ramp?"
im going to change the speed controling the supplied voltage to the DC motor. for example: 5v for DC motor running at full speed and mayb 2v my DC motor run at half speed.?

by step or gentle ramp? i dun even have it in my dictionary..:oops:




"Are you really going to calculate the feed back gains on a PLC? This is the part that is insane. ( For the PLC people, calculating the gains involves minimizing a cost function. This is done using the Ricatti equation which is a bad a$$ equation involving lots of matrices and inversions etc and we all know that PLCs can do that stuff easily ;) )"
i use the feedback to calculate the error (refering to my block diagram) which e(t)= sp-pv. the reason i calculate the error is again to ensure the motor running at desired speed. in case it doesent, the LQR will help me to correct it.





"Now for the simple questions we get around here:
What is the size of the DC motor and load,
What is the control output to the DC motor?
How much power ( voltage, current)?
What kind of feed back are you using?"


i have not decide the exact motor for my project yet. maybe i will use the motor from CLIFTON PRECISION SERVO- MOTOR MODEL JDH-2250-HF-2C-E.
f_cliftonprecm_0ead659.jpg



as for my feedback/decoder, i will use the tachometer which will measure the speed of the motor to be feedback to my summing point.
 
zenocorp said:
hi, thaks for the reply

erm what is matrix library?so can i still program my LQR controller using PLC without matrix library?
This is going to be hard.

or i need to programe my LOQ using matlab and the transfer it to PLC?
A ray of hope! Use Matlab to calculate the gains for the PID controller.

im affraid i cannot change the project title. the stupid title is "DC motor control using LQR algotithm". just consider it as a stupid idea which my lecture (she is not a professor-she only has a degree) gave me to try it out. (y)
I consider this to be the true test of this problem. An engineer needs to know what is an isn't possible. I have to tell potential customers this all the time and if they buy someone elses motion controller then I lost a sales but at least I will not be asked why it does work as imagined. Often engineers work for bosses like your instructor. If so what do you do?

"Why would anybody use LQR for motion control?"
erm i think is to ensure the DC motor running at optimum speed
(full speed and half speed)

im not a good student. so can you please kindly help me out with your question? please..
i dont know what is cost function & overshooting position.
[/quote]
Well there is the problem. You didn't even search for LQR before posting so you have no clue what you are asking for.

"How are you going to change speeds? By step or by gentle ramp?"
im going to change the speed controling the supplied voltage to the DC motor. for example: 5v for DC motor running at full speed and mayb 2v my DC motor run at half speed.?

by step or gentle ramp? i dun even have it in my dictionary..:oops:
You can change speed in steps, or use linear ramps or s-ramps. Most motion controllers don't change the speed in steps. The target speed is slowly ( gently ) ramped from one speed to another. Because you are doing velocity control you don't need to worry about over shooting a position set point, you just need to worry about over shooting a velocity set point.


"Are you really going to calculate the feed back gains on a PLC? This is the part that is insane. ( For the PLC people, calculating the gains involves minimizing a cost function. This is done using the Ricatti equation which is a bad a$$ equation involving lots of matrices and inversions etc and we all know that PLCs can do that stuff easily ;) )"
i use the feedback to calculate the error (refering to my block diagram) which e(t)= sp-pv. the reason i calculate the error is again to ensure the motor running at desired speed. in case it doesent, the LQR will help me to correct it.

Basically the LQR is just a PID control with a optimized way of calculating the gains. Calculating the optimal gains in Matlab is easy. There is an example on the net. Matlab has a function the calculates the optimal gains. A PLC does not. BTW, Matlab is made from two word. Matrix and laboratory. Matlab is a good place to do matrix math. A PLC is not.


"Now for the simple questions we get around here:
What is the size of the DC motor and load,
What is the control output to the DC motor?
How much power ( voltage, current)?
What kind of feed back are you using?"


i have not decide the exact motor for my project yet. maybe i will use the motor from CLIFTON PRECISION SERVO- MOTOR MODEL JDH-2250-HF-2C-E.
f_cliftonprecm_0ead659.jpg



as for my feedback/decoder, i will use the tachometer which will measure the speed of the motor to be feedback to my summing point.
I would be doing the two parts of the projects in parallel.
1. Calculating the optimal gains.
2. Getting the PID to control the motor. Controlling the motor will be tough because it is small and has a very short time constant relative to the PLC scan.
 

Similar Topics

Hi, I'm trying to use the IO Device Library (Product Versions) which is configured to work with the 1756-EN4TR & 1756-EN2TR but my system uses...
Replies
0
Views
38
Hello, As part of our project, we are using an M241 controller. This controller interfaces with an industrial computer and a router via a switch...
Replies
2
Views
72
I'm trying to write a data in Arduino using MODWR function block .I used the code I got from online for both PLC and Arduino. I made the wiring...
Replies
4
Views
82
Hey all, i have a panelview screen (image attached), with 4 items on it. Program 1, Program 2, ...3, ...4. The PLC i am using is a compactlogix...
Replies
5
Views
158
I am trying to set up a piece of equipment with a Horner HE-X4R. I'd like to use structured text and so far I'm just trying to get a basic On/off...
Replies
0
Views
66
Back
Top Bottom