Critique my code

gbradley

Lifetime Supporting Member
Join Date
Apr 2002
Location
Corona, Ca.
Posts
1,637
I don't code very often, but I appreciate good advice, so I am asking for some criticism.

[Long story]We have an old Hydraulic Press that was run by an old SLC 100 with an Expansion module, and it lost it's last remaining extra output. I replaced the PLC with a Micrologix 1200.
One thing that I learned on this Forum was to run the power for the E-stop from a PLC Output so that if your Processor faults, the motor will shut off.
I decided to add a timer so that if they leave the motor idling for 2 minutes then the PLC will automatically shut off the motor.[/Long story]

I was worried about overflow faulting the processor on accumulated minutes, hours.
Do I really need to put the rungs 3 and 4 in there?
That was my main question, but it's all fair game.
Thanks
 
I would say that rung 3 is not needed since rung 2 takes care of limiting the value.
I would keep rung 4 else the plc may fault after about 4 years.
 
I usually just reset the overlow bit on the last rung, and then latch a bit, instead of trying to cover every possibility.
If I see the bit going true, I investigate to determine cause.

ovflw_trp.png
 
I would say that rung 3 is not needed since rung 2 takes care of limiting the value.
I would keep rung 4 else the plc may fault after about 4 years.
Thanks AJ that makes sense.
...
If I see the bit going true, I investigate to determine cause.

Thanks Ken, I have a different machine where the PLC has faulted on more than one occasion.
When it faulted, I just reinstalled the program.
I'll use your trick to see if I can find out why.
 
If the overflow flag on the last rung goes true, you can add the same logic at strategic locations in your ladder, but use a different bit/flag for each one, then you have a good idea which section of logic is the cause.
 

Similar Topics

Hello all, working on my first adventure into PIDs, done a lot of searching, learned alot, and now I would like you to check my logic to make sure...
Replies
5
Views
3,857
Hi. I have taken over a Building Management System that hasn’t performed well since installed. It’s a ControlLogix main with wireless messaging to...
Replies
21
Views
6,015
Hey everyone! I work for a small family business and am working on adding automation capabilities to our surface mining operations, for a little...
Replies
41
Views
11,594
(*convert rpm into inches per sec //1.5708 * rpm /1800 * 12"*) BridgeWriteSpdInSec:= 1.5708 * INT_TO_REAL(Bridge_write_speed_rpm) /1800.0 * 12.0...
Replies
3
Views
1,969
(* convert the inputs to floats *) input_min:= raw_min_real; input_max:= raw_max_real; scaled_min:= eu_min_real; scaled_max:= eu_max_real...
Replies
2
Views
2,127
Back
Top Bottom