Code Ideas

The Plc Kid

Member
Join Date
Feb 2009
Location
Macon, Georgia
Posts
3,233
I have small project to do with a contrologix system in which i need to be able to enter a time value on the HMI in minutes lets say 15 minutes for example and have it run a valve for that long only part is there are several valves like this and it can only run 60 seconds max before switching to the next valve in cycle.

What is a simple way to take 15 minutes and split it up in 60 second intervals and keep track of it and be able to display total time left.

I have a few ideas about it but they seem very complicated. I feel like i am going around the block to get across the street. There has to be a simple elegant solution.

Can someone point me in the most simple direction?
 
I have small project to do with a contrologix system in which i need to be able to enter a time value on the HMI in minutes lets say 15 minutes for example and have it run a valve for that long only part is there are several valves like this and it can only run 60 seconds max before switching to the next valve in cycle.

What is a simple way to take 15 minutes and split it up in 60 second intervals and keep track of it and be able to display total time left.

I have a few ideas about it but they seem very complicated. I feel like i am going around the block to get across the street. There has to be a simple elegant solution.

Can someone point me in the most simple direction?

You're going to have to provide some more details. What type of PLC? What do you mean by "run a valve" is this a 2-way valve that is to be opened for that period of time?

Don't totally follow your 15 minutes split-up requirement either. Do you mean that you need to have each valve open for a total of x minutes (15 in your example), but that you can only have it open for a max of 1 minute at a time, and that the PLC is setup to come back to the valve after cycling through other valves?

If this is an A-B PLC, you might want to look into using an RTO (Retentive timer On), with the preset set to 900s (for 15 minutes) and the displayed value of time left being (Timer.pre-Timer.acc)
 
How exact do your times have to be?

+ /- 5 seconds

This is a contrologix plc, 15 minutes of total runtime at 60 seconds max each run. There are 8 valves that cycle one after the other only 1 valve on at a time. The max time it can run before sequencing to the next valve is 60 seconds.

It needs to run 15 minutes total before being taken out of the sequence. The 15 minutes is a example value the tag will allow 1-60 minutes when project is complete.
 
So in 15 minutes the valves would fire

1,2,3,4,5,6,7,8,1,2,3,4,5,6,7 a total of one minute for each valve then switch to the next.

Is that correct?

If you start another time interval should the sequence begin with 8 or restart at 1?

I would have a timer whose preset is your overall time. Enable it with your run conditions.

Method A

- While running it enables a self-resetting 1 minute timer.

- Each timeout of the self-resetting timer causes a counter, with a preset of 8, to increment. It will self reset when the DN bit is set.

Method B

- Divide the accumulator of the overall timer by 60000 to get minutes.

- Then use the MOD instruction on the minutes with 8 as source B to get 0 - 7 as an output

Either way you end up with a 0 - 7 number somewhere.

Then just 8 rungs, each with 'run' and a Counter equals 0 comparison on the first, 1 on the second etc. The output of each rung is the appropriate valve.

If the next sequence starts at 1 then reset the counter on start. Otherwise leave it alone and it will start with the next valve in order.
 
Last edited:
The system fills the water supply tank for 8 mixers on 8 lines from a common storage tank.

There are 2 pumps one running and the other as a standby. Valves cycle between all 8 stations and fill the water tank for the time interval set anywhere from 0-60 seconds set by the operator. If a station is turned off the system skips its timer and moves to the next station.

If the pump stays on any one station for more than 60 seconds it could starve some of the other stations.

When the station tank is cleaned it needs to be rinsed and the mixer system dry run and we know how much water that takes which is between 2-20 minutes depending on the line and how long we wish to dry run.

If we just put in 60 seconds it will fill each cycle for that time until the high level sensor is met then it will be out of sequence until the high level is no longer made.

If it goes to high level and we only need 10 minutes worth of water the we have to dump the rest which would be about 60 bucks worth of water which gets expensive fast as this can happen 4-5 times a day on each system.

So when it is in dry run mode i need to be able to put in a 10 minute fill but only 60 seconds at a time so it would run 10 cycles and 60 seconds each giving me 10 minutes and i also need to view elapsed time of the 10 minutes on the hmi screen.
 
Mark

Yes i am in college but this is my first year so we don't even get close to the labs yet. I am getting the boring stuff out of the way right now. This is on my job.

Maybe when i get to that part i will have the basics down pat i hope. I know of several ways to do this i am just looking for the most simple and straight forward way.

I try to avoid making things complex if i can because our techs have trouble with the simple logic when troubleshooting.
 
Does cycle time need to be constant or is it fine for example, if there is only one valve enabled atm, that that valve is open continuosly for more than 60s (up to fulltime of that valve).
 

Similar Topics

Prototype: cstring RecipeMnemonic(void) Code: /* Returns a string as 000.0KN-00C-00.0S Where 000.0KN is programmed force in KN 00C is dither...
Replies
5
Views
1,768
Hi All, Someone at work has put a PLC system on my desk, that's just been taken off an idle production line. He said "It's an S7 PLC. We don't...
Replies
9
Views
148
hello, I'm a student and for my final grade I have to repare a sepro robot. the only problem I have for now is that i have an error code 3...
Replies
0
Views
35
I received an email from a student with the following code attached. This is supposed to control a floodgate system, and supposed to be written...
Replies
23
Views
778
I have a machine which is undergoing upgradation. As part of the process two SEW drives are being replaced., existing Gen B with new Gen C. The...
Replies
3
Views
195
Back
Top Bottom