PDA

View Full Version : TON timer to delay output



rbenesch
09-26-2016, 09:18 AM
I have a TON timer configured to enable an output that is only working once after the initial startup of the controller.

I have multiple outputs working in conjunction. One output enables the throttle on a standalone diesel engine while the others run a combination of conveyor\spinner. The timer starts with the diesel engine throttle, runs for 1600ms, and should then enable the conveyor\spinner outputs. The timer is reset when the conveyor\spinner are shut off and the engine throttles down.

It acts accordingly during the very first run sequence, however on following run sequences the conveyor\spinner outputs are starting at the same time as the engine throttle. This is problematic when there is a load applied to the conveyor as it can stall the engine.

Any reason why it would only run correctly once and then not on following run sequences? It acts as if it is not resetting the timer correctly, however when watching it through Codesys TON.IN and TON.Q both reset to FALSE and PT/ET appear to run and act accordingly as well.

EDIT: I should mention as well that the conveyor\spinner outputs are PWM.

rbenesch
09-27-2016, 11:23 AM
I figured out a workaround to this.

After some more testing I determined that the timer was functioning correctly, and even though the output was set to "FALSE" it was still running with the last known PWM output value. For example, if I was running at 5, turned off the conveyor, changed the conveyor to 10, and started the conveyor - the throttle would ramp up and the conveyor would start running at 5 immediately. After the timer expired, the conveyor would then switch to running at 10. What I needed was for the conveyor to always start at 0 when the throttle was ramping up.

To work around this, I created a TOF timer of 5ms that resets the PWM output to its lowest value before turning off the conveyor\spinner. Now, when the TON timer starts, the last know PWM value is always set to 0 and the after a brief delay for the throttle to ramp up, utilizes the user entered value for the conveyor\spinner.

wthamm
09-27-2016, 02:21 PM
Ryan, you are correct, turning OFF the ENABLE of a PWM block will freeze the last value of the PWM. To turn it OFF, set the value to 0 - this can be done through a SELECT statement and toggling between the requested value and 0.