I've tried to look up some topics around the net regarding controlling the speed of a mobile plant running on tracks.The speed is to be controlled by a proportional valve which in turn controls the swashplates of a hydraulic powerpack driven by a diesel engine.
I have a 2000 pulses / rev encoder installed on the machine and wired back to to the High Speed inputs of the Micrologix 1400.I've built some code to simulate the process of controlling the speed with a PID loop.Instead of incrementing the HSC counts from the encoder itself on the machine I just add a constant value into F8:0 every time code is scanned.I fire a program file every 300 ms and subtract
Simulating montion by incrementing the value of F8:0 with a constant number will give us a constant speed as the number of pulses /time is a constant.Derivative of distance is speed where I consider pulses as k*distance.
When I chnage the number of which I increment F8:0 then I'll have acceleration as the number of pulses accumulated on the previous scan will be smaller than in the scan where the constant increased.Which is kool.
If I put another instruction in "ADD" to increment the number which I increment F8:0 with and trend it I will have the acceleration value jumping all over the place.Which comes down to scanning issues I think.Unfortunately I can't even attempt to apply a PID on the acceleration under this conditions.I really don't know how to cut the scantime out of it without using physicall hadware.
With the physicall plant the limitation imposed by the customer is that the Acceleration has to be less than or equal with 1.4m/s2 and maximum speed is 16km/h.I did simulate controlling the speed with a PID and that looks quite ok but when I try to simulate controlling the acceleration I just can't without having a stable value for it which I cannot obtain in my simulation.
To summarize I apply pressure on a pedal which is a 0-10v DC Analog input to the Micrologix.That dictates the speed to with I have to accelerate (max speed is 16Km/h = 10V) so I simply scale this input.The problem is that I have to limit the acceleration to 1.4 m/s2.I was told that the hydraulics can achieve more than 1.4 m/s2 (specially if there is no load).Could you please give some feedback whether I should use a PID at all or not and if yes whom should I controll with the PID the acceleration orthe speed .
Thank you for your time.
Hi Guys,
This is driving me nuts.I've made another file using the code posted here by someone called Ken Roach or similar which uses the free running timer to calculate the HZ from the encoder counts.Cool.If I have the frequency [Hz] I have the speed.
Since I have a micrologix 1100 but I have no encoder I thought I use the PTO function of the PLC.So when HSC reaches the preset value of 10 it executes the STI and I attempt to calculate the speed.Which is ok.However if you graph that speed the bloody speed will not be constant even after I do the first 1000 pulses of the PTO which I configured as acceleration.
I simply can't understand why I the PTO is asynchronous to the scan and I am using the S:4 TIME why the speed is not constant when the pulses generated by the PTO will be picked up by the HSC ??????????????? The HSC function operates asynchroniusly to the scan and since I wired O:2/0 straight to I:0.0 I should have the same number of pulses (after acc) between two consecutive HSC High Preset = 10 .Really simple.
Please help and point me out of here.Have a look in the attached file.Connect DC+ to O:2/0 COM then THE WIRE FROM O:2/0 goes to I/0 I/0 com goes to DC -.
