rslogix5000 1 sec pulse

muds

Member
Join Date
Apr 2014
Location
karachi
Posts
71
HI ,,

I Want to create 1 sec pulse in rslogix 5000.
can anyone tell how to create this. so that i can calculate machine runtime.

thanks,
 
HI ,,

I Want to create 1 sec pulse in rslogix 5000.
can anyone tell how to create this. so that i can calculate machine runtime.

thanks,

How much do you want to count up to ?

Why not use a RTO (Retentive Timer-On) set for 1 hour, and a counter to count hours.

2,147,483,647 hours is 89,478,485 days, or more than 245,146 years !! I think much more than enough for the application....
 
2,147,483,647 hours is 89,478,485 days, or more than 245,146 years !! I think much more than enough for the application....

I pity that poor maintenance technician on 245,147 years

And probably won't have the right version either.
 
I use the system clock for this, built an AOI to handle it but essentially I'm using a GSV to get the WallClockTime parts. I then use a one shot rise/fall on bit.0 of the time part I am interested in to create a second/minute/hour...etc pulse.

That pulse is then used with a counter in various parts of the program where needed.

Note, my AOI is in ST and has output bits for sec/min/hour pulses.
 
Not an original design

It's fairly accurate.

It's only as accurate as it can be, bearing in mind you haven't accounted for the timer accumulator being greater than 1000 which it can be, depending on how frequently it is scanned.

The error will always be positive, so your "Tick" will always be longer than 1 second.
 
Last edited:
HI ,,

I Want to create 1 sec pulse in rslogix 5000.
can anyone tell how to create this. so that i can calculate machine runtime.

thanks,

You don't need a 1 second pulse bit if you create a program within a 1000 ms periodic task. You can then simply operate your math statements unconditionally and they will be processed once per second.

You should know that you'll eventually run into rounding errors if totalizing with floating point math, unless you take measures to prevent this from happening.
 
Paully I like your approach, I do not want to reinvent the wheel, can you post it ?

Here is the ST, the AOI parameter input/output definitions should be pretty obvious.

Code:
// Get PLC Time
GSV(WallClockTime,,localdatetime,DateTime[0]);

// Parse out PLC time to friendly format
year := DateTime[0];
month := DateTime[1];
day := DateTime[2];
hour := DateTime[3];
minute := DateTime[4];
second := DateTime[5];
microsecond := DateTime[6];

// 1 Second pulse generation
// Triggered by the rise/fall of bit 0
SecondOSR.InputBit := second.0;
OSRI(SecondOSR);
SecondOSF.InputBit := second.0;
OSFI(SecondOSF);
secPulse := (SecondOSR.OutputBit OR SecondOSF.OutputBit);

// 1 Minute pulse generation
// Triggered by the rise/fall of bit 0
MinuteOSR.InputBit := minute.0;
OSRI(MinuteOSR);
MinuteOSF.InputBit := minute.0;
OSFI(MinuteOSF);
minPulse := (MinuteOSR.OutputBit OR MinuteOSF.OutputBit);
 
Let me count the ways

The most commonly found in code (also the most inaccurate, but good enough for Motor Run Times

AUX OneSecTmr.DN OneSecTmr
+------TON --+
---| |------------|/|-----------| PRE: 1000 |
+------------+

Use the OneSecTmr.DN bit as your pulse.


The inaccuracy in this code is on the order of 2% ± short. You lose one full scan, plus the overrun of the scan time when the TON was last executed.

Since the "Run Time" is mostly for guestimating ("That's a lot of time; we should get ready to service it") or comparison ("Motor A has more run time than Motor B"), accuracy isn't an issue.


The code that John Morris posted is a more, but not perfectly accurate. It eliminates the missed scan (for not-true TON to reset the .DN bit), but still loses scan elapsed time (as daba pointed out)

Presumably you are counting seconds to display hours. If you use a TON to actually time hours, you lose lots of fractional hours each time the motor turns off. A Retentive timer prevents that loss, and putting the reset before the timer means that the DN bit will be on for one scan.

OneHrPulse.DN OneHrPulse
----------| |-------------[ RES ]

AUX OneHrPulse
+----------RTO--+
--------| |------------| PRE: 3600000 |
+---------------+



The amount of inaccuracy in this timer is on the order of .001%. More than good enough for Run Time, and if you want to include fractional hours, just add your integer hour count + ACC/PRE.


The most accurate 1 sec pulse counter is to

AUX RUNNING_TMR
+-------------RTO--+
--------| |------------| PRE: 2147483647 |
+------------------+

+-----------GRT---+ +------------SUB---+ OneSecPulse
----| RUNNING_TMR.ACC |--------| RUNNING_TMR.ACC |---------( )-
| 1000 | | 1000 |
+-----------------+ | RUNNING_TMR.ACC |
+------------------+


The timer never DONEs out, and is never reset. But it also never accumulates more than 1 second of total elapsed time. It never loses the scan overruns.

Overkill for a Running Time counter, but is as accurate or more as using a Timed Task.
 
How much do you want to count up to ?

Why not use a RTO (Retentive Timer-On) set for 1 hour, and a counter to count hours.

2,147,483,647 hours is 89,478,485 days, or more than 245,146 years !! I think much more than enough for the application....

I used this method (retentive timer) with a customer that wanted run time for different pumps to estimate when to perform maintenance on them.
 
It's only as accurate as it can be, bearing in mind you haven't accounted for the timer accumulator being greater than 1000 which it can be, depending on how frequently it is scanned.

The error will always be positive, so your "Tick" will always be longer than 1 second.

You are correct kind sir, but the application didn't call for T*Ts on timing. It just needed to count out ten minute cycle times, +/- 2 or three seconds was ok.

I wouldn't have used it for high speed bottling/canning.

I figured it would have suited the OP's request.
 

Similar Topics

I need to take seconds and convert to mm:ss. Say i have a cycle that the operator of a machine wants to run for 125 seconds. He will enter 125...
Replies
3
Views
4,213
Hello everyone, I have an RSLogix5000 project which is running live in the factory but I need to make some changes to the logic. I want to test...
Replies
0
Views
1,097
Good Morning Everyone, I'm looking to use the GSV instruction to get I/O fault codes for my project so I know if there's a comms issue in my E/IP...
Replies
5
Views
810
The machine is running production. When trying to go online with the laptop the whole machine looses communication and faults out. Drives, HMI...
Replies
13
Views
1,867
Hello, is it possible to create a data block, something like shared datablock in Siemens STEP 7, in the RS Logix5000 PLC project? I would like...
Replies
3
Views
1,049
Back
Top Bottom