Thanks for sharing your knowledge with me.
I have been trying to set up de CTRL_PID controller on the position control of 1 cilinder.
At first i hade troubles with the speed of the position feedback. The sample time of the analog input card was >100ms. No go.
I have bought a new analog input card with 2,5ms interval. Cpu cycle time around 6ms.
The cilinder needs to travel 200mm in 1,5sec i know the system is to sloo to make a exact position control. (cilinders travels at 0,13mm/s).
I 'am using the PID function as P controller. I and D are zero. If i try to ad the I or D i get a really unstable oscilating system.... (P=4,I=0,D=0).
I will try your idea of using the sramp function to control the setpoint. Does this mean i need the PID controller to be aggrasive to react fast at small setpoint changes doesnt it?
If you use only a PID control (input: diff between actual and target position) you will have an extreme raising output when the axis starts. I use this method sometimes to move hydraulic axes, but those axes don't move very fast. The advantage is that I can limit the output to a desired speed value. So the axis will move with a constant speed towards the target position. When it reaches the target area the PID comes into action. And you need an acceleration ramp for the target speed within your drive, this limits the jump when the axis starts (I usually use servo drives, they provide ramps for accel and deccel of the command speed). As already told before: This is used for slow axes with slow to medium speed and high accuracy of reaching the target pos.
The idea I have described previously was to use SRAMP to create a target position ramp. The diff between the SRAMP-output and the actual position is the input for the PID control. SRAMP generates acceleration and deceleration ramps (the ramp has the shape on an trapeze).
In this case there should be no accel/deccel ramps active in your drive / analogues output / amplifier card, so that the motor speed can follow the PID output without any delay.
This is how the position control of a servo drive works. But servo drives usually have no other work to do beside, so they have a quick response time (cycle times normally are less than 1ms).
So dont't expect a high performance positioning control when using a PLC with 6ms cycle time and a 2,5ms response from the analogue input (dont't forget the response time of the hydraulic control). If your hardware is limited to those values mentioned above you should use an external positioning control.