11/17/2011 6:37 PM | |
Posts: 5225 Rating:
|
Hi, Please find attached a piece of untested code that aims at controlling the speed of a device as to ensure the movement reaches a set position. The block requires the knowledge: - target position - target speed - actual (measured) speed - actual (measured) position - predicted ramp down time for a set speed At each scan the block determines at which position will it come to a halt if it stops at that moment. It is assumed that the deceleration rate is constant. If the predicted stop position is far away, the system aim to run at the target (normal) speed. If the predicted stop is futher than the target position, the system aims to run at ZERO speed. While decelerating, the system still checks if it will make the target position. No action is taken if the new predicted stop position overshoots the target position. If however the stop will be short, the system reads the current speed and tries to maintain a constant speed. This action causes a step action -- which may or may not cause problems. The deceleration continues normally when target and prediction is again on track. This control is yet untested. I foresee issues for making a smooth transition from one speed to another when trying to adapt the ramp down to. an adaptable ramping function would be great to use here. I have doubts if MC_Velocity block will be able to handle small changes in speed commands or changing from one target speed to the next within a small time. This code is possible to use for either analog output or pulse output. It should also be possible to run this code from a timed interrupt. I do not have the means to test the design. If I have a fully thought out theory and viable solution I might be able to get a sponser to test it. So theory first. I thank you for any comments, additions and ideas you have to give. Greetings. - William AttachmentB11_MotorSpeed.pdf (682 Downloads) |
This contribution was helpful to
1 thankful Users |
11/19/2011 8:36 PM | |
Joined: 9/8/2009 Last visit: 7/17/2023 Posts: 1410 Rating:
|
Here is a code for trajectory planner from linuxcnc, license is GPL Version 2, so I think it can be used for redistribution: http://git.linuxcnc.org/gitweb?p=emc2.git;a=blob;f=src/emc/motion/simple_tp.c;h=fd6a791c8da7e65258f607491731769f0f9ed8a5;hb=refs/heads/master http://wiki.linuxcnc.org/emcinfo.pl?Simple_Tp_Notes |
11/20/2011 4:50 PM | |
Posts: 5225 Rating:
|
Marko, That is inspired thought! It did not occur to me to use EMC2 as reference. Well done! I'm sure the EMC2 followers would love to hear about a PLC using some of EMC2 principles. But hey!.. I thought you were against my idea of doing velocity control. I must say I prefer the method you refer to above my half baked idea.
The 2nd link does not read so easy. I have looked at MATH EXPLAINED LINK instead. Working through this was worth the while. It gives a good understanding on how the deceleration works. The 1st link I gave the once-over but can be very helpful indeed. SCL might be more convenient but I do not foresee problems doing this in LAD. What makes me excited is making this concept work on a S7-200 PLC. There is a bit more to work with controlling the PTO.
I am loosing you here. The control output of the traject-code is velocity -- not position. It is not clear this can be the setpoint. I will agree if the HSC gives speed or if you use an analog feedback for speed. The the process error will be speed and PID output will be speed.
Yes agreed. <<As alternate method>> I have had a thought yesterday after rereading a post on using a PID to generate a PWM signal. There is nothing that says we can not use the PID_PWM output of the PID to give a speed reference to a pulse driven device. The question that comes to mind is.. what is the maximum pulse per second rate we can expect from the PWM? |
11/20/2011 4:58 PM | |
Posts: 5225 Rating:
|
As a side note.. I rather like the description given for a PID at this LINK. Within is pseudo code for designing a PID controller. A lean PI controller can be designed from this if required. What I like is that there is a bit more control over the outcome when using this algorithm. |
Follow us on