PLCS.net - Interactive Q & A

PLCS.net - Interactive Q & A (http://www.plctalk.net/qanda/index.php)
-   LIVE PLC Questions And Answers (http://www.plctalk.net/qanda/forumdisplay.php?f=2)
-   -   rslogix5000 1 sec pulse (http://www.plctalk.net/qanda/showthread.php?t=113584)

muds January 3rd, 2018 01:24 AM

rslogix5000 1 sec pulse
 
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,

tarik1978 January 3rd, 2018 01:48 AM

The bellow thread should help you
http://www.plctalk.net/qanda/showthread.php?t=43936

daba January 3rd, 2018 07:13 AM

Quote:

Originally Posted by muds (Post 763802)
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....

Aabeck January 3rd, 2018 07:42 AM

Quote:

Originally Posted by daba (Post 763824)
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.

widelto January 3rd, 2018 08:02 AM

Its better to use an AOI called "elapsed time add on instruction".
Go and download it from :
http://search.rockwellautomation.com...time%20elapsed

Paully's5.0 January 3rd, 2018 08:42 AM

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.

John Morris January 3rd, 2018 08:52 AM

1 Attachment(s)
Not an original design

It's fairly accurate.

widelto January 3rd, 2018 08:55 AM

Paully I like your approach, I do not want to reinvent the wheel, can you post it ?

daba January 3rd, 2018 10:33 AM

Quote:

Originally Posted by John Morris (Post 763832)
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.

Bit_Bucket_07 January 3rd, 2018 11:30 AM

Quote:

Originally Posted by muds (Post 763802)
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's5.0 January 3rd, 2018 11:57 AM

Quote:

Originally Posted by widelto (Post 763834)
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);


Aardwizz January 3rd, 2018 01:02 PM

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.

A_G January 3rd, 2018 01:43 PM

Quote:

Originally Posted by daba (Post 763824)
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.

John Morris January 3rd, 2018 02:47 PM

Quote:

Originally Posted by daba (Post 763846)
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.

rankhornjp January 3rd, 2018 03:07 PM

There is a P_RunTime AOI that will track runtimes and number of starts, its part of the PlantPAX library.

http://literature.rockwellautomation...m010_-en-e.pdf


All times are GMT -5. The time now is 09:12 AM.

.