You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old August 13th, 2009, 08:51 PM   #1
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
RSLogix 5000 - Periodic or Continuous task?

Hey guys, I wanna to write a bit of code to return value to show if the task is in periodic or continuous mode? is there a tag in RSLogix 5000 to return value of task type? cheers!!!

Simon
  Reply With Quote
Old August 13th, 2009, 11:16 PM   #2
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is offline
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 10,105
You could use a GSV instruction to read the Task object, and grab the Rate or the Priority.

The Rate will be the scheduled interval between executinos for a Periodic Task. I don't know what it will be for the Continuous Task.

The Priority will be the priority level you assign to a Periodic Task. It might be 10 or 11 for the Continuous task, since it is the lowest priority level task and can be interrupted by anything.

This seems an unusual thing to need in logic. What is the reason for having this information as a controller tag ?
__________________
"Luck is probability taken personally"
  Reply With Quote
Old August 14th, 2009, 12:09 AM   #3
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
I've tried GSV using Rate. but since rate is the scan time for periodic task, even if it is set to be continuous task, using rate will still show the default periodic task. So i think can't not tell the task type by using rate. I'll try priority later on, thanks mate.

they reason behind this is, we are developing an AoiSystem module, we need to get the last scan time if it is in continuous task, and to get rate (scan time in periodic) if it is in periodic task. So the program should be able to tell the type of the task... that's what we are aiming for.
  Reply With Quote
Old August 14th, 2009, 05:36 AM   #4
rdrast
Lifetime Supporting Member
United States

rdrast is offline
 
rdrast's Avatar
 
Join Date: Apr 2003
Location: South Carolina Lowcountry
Posts: 3,775
Quote:
Originally Posted by simonwxx View Post
I've tried GSV using Rate. but since rate is the scan time for periodic task, even if it is set to be continuous task, using rate will still show the default periodic task. So i think can't not tell the task type by using rate. I'll try priority later on, thanks mate.
Are you positive? The Cyclic task always seems to have a rate of 10,000 usec, but all of my periodic tasks show their actual rates, none of which is set to 10,000 usec.

I guess you could also look at the "INSTANCE" member of the Task Object, by default, there is always a cyclical task, so unless someone does something convoluted, it should always be Cyclical task instance == 1. Other tasks are numbered sequentially as they are created.

Really though, if it's that critical to you, I'd ignore everything alltoghether, and just maintain a delta of microseconds between successive calls of your AOI. The "StartTime" member of the task object gives two DINT's of the start time of the task in microseconds. Initialize on the first pass, then just calculate the elapsed microseconds between calls.
__________________
------------------------------------
How to ask questions the SMART Way!

Look First, Ask Second!


Last edited by rdrast; August 14th, 2009 at 05:42 AM.
  Reply With Quote
Old August 14th, 2009, 09:21 AM   #5
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 5,709
There does not always have to be a continuous task. Nor will the continuous task always be the first one. I just tested it with a GSV on one of my CLXs and the continuous task is instance 2. So I don't think that is going to work for all cases.


When Rockwell came to town for CATM a few months back in one of the training classes the instructor demonstrated the task monitor and showed that changing the continuous task to periodic could actually make it run faster. The continuous task is constantly interrupted and on his demo it was taking about 12 mS to scan. He converted it to a 10 ms periodic task and it ran in a couple of milliseconds without all the interruptions the continuous task gets. Then he set the task rate to 5mS, more than doubling the rate at which scans were made, yet the task monitor showed the processor still had plenty of time to do everything else because it wasn't spending so much time on task switching overhead. So there could be some very good reasons to not even have a continuous task in the program. I've come across a couple of programs like that.

ETA: here is something interesting... If I look at one of my CLXs that has 4 programs under the main continuous task and I add up the max scan times of each of the four programs I get 3.9ms. But if I look at the continuous task scan time it shows 10 to 11 mS. That means that for at least 6-7mS of every scan of the continuous task the processor is doing something else.
__________________
True craftsmanship is only one more power tool away.

That's the beauty of processors, they don't have emotions they just run code - The PLC Kid.

Last edited by TConnolly; August 14th, 2009 at 10:06 AM.
  Reply With Quote
Old August 14th, 2009, 01:48 PM   #6
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 2,631
If you put the AOI calls inside the respective Tasks, instead of all together in one task, then you will already know what type of task it is.
  Reply With Quote
Old August 17th, 2009, 11:03 PM   #7
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
Quote:
Originally Posted by rdrast View Post
Are you positive? The Cyclic task always seems to have a rate of 10,000 usec, but all of my periodic tasks show their actual rates, none of which is set to 10,000 usec.
here is a bit of code I wrote previously to differentiate continuous and periodic tasks from initial requirement:

Code:
if sysData.stsPowerUp  then
              gsv(task,this,MaxScanTime,ScanTime);
              gsv(task,this,Rate,ScanPeriod);
              gsv(task,this,MaxInterval,IntervalTime[0]);
             if (ABS((IntervalTime[0] - ScanTime) * 1.0 /  IntervalTime[0]) <= 0.01) then // within 1% difference  
                         sttContinous  := 1;
                         sttPeriodic  := 0;
              end_if;
             if (ABS((IntervalTime[0] - ScanPeriod) * 1.0 /  IntervalTime[0]) <= 0.01) then // within 1%  difference
                         sttContinous  := 0;
                         sttPeriodic  := 1;
              end_if;

however, it can be wrong under 2 circumstances:
1. Task in Continuous mode
If ScanPeriod (no matter it is set to be continuous or periodic type, ScanPeriod = periodic scan time) is set to be close enough to IntervalTime[0], 2nd IF statement will be true, sttPeriodic will be set to 1.
2. Task in Periodic mode
if periodic scan time has big difference to MaxInterval time, for example, IntervalTime[0] =503.908ms ScanPeriod = 100.000 ms, then IntervalTime[0] - ScanPeriod) * 1.0 / IntervalTime[0] = 0.8

The result is > > 0.01
Then sttPeriodic will still be 0.


not sure if i made myself clear enough. cheers
  Reply With Quote
Old August 17th, 2009, 11:10 PM   #8
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
Quote:
Originally Posted by rdrast View Post
I guess you could also look at the "INSTANCE" member of the Task Object, by default, there is always a cyclical task, so unless someone does something convoluted, it should always be Cyclical task instance == 1. Other tasks are numbered sequentially as they are created.

every plc program will have only one task which can be set to Continuous, is that right? if it is true, i can simply check if task instance == 1 to differentiate periodic and continuous task...cheers
  Reply With Quote
Old August 18th, 2009, 12:06 AM   #9
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
Quote:
Originally Posted by rdrast View Post
I guess you could also look at the "INSTANCE" member of the Task Object, by default, there is always a cyclical task, so unless someone does something convoluted, it should always be Cyclical task instance == 1. Other tasks are numbered sequentially as they are created.
Hi Rdrast,

I've set the task to periodic and use gsv(task,this,instance,TaskInstance); command, the value of this instance, TaskInstance still == 1. see the attached pic. don't know why is that?
cheers
Attached Images
File Type: jpg Snap1.jpg (59.2 KB, 174 views)
  Reply With Quote
Old August 18th, 2009, 12:26 AM   #10
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
Quote:
Originally Posted by rdrast View Post
I guess you could also look at the "INSTANCE" member of the Task Object, by default, there is always a cyclical task, so unless someone does something convoluted, it should always be Cyclical task instance == 1. Other tasks are numbered sequentially as they are created.
Hi Rdrast, I've go two tasks, i set one to periodic and another continuous, tested. instance of periodic task = 1 and instance of continuous = 3. so i think continuous task instance may not necessary be 1 all the time.
  Reply With Quote
Old August 18th, 2009, 02:31 AM   #11
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 2,631
I'm sure the information you require must be in the Status flags somewhere, I'll try to determine it later when I'm on a real machine.

Anyway, here's a back-door method which may work.

If you SSV the watchdog of a task as zero, then the controller automatically assigns the following (Ref : 1756-QR107C-EN-P Page 6-24):-

Periodic 0.5 Sec
Continuous 5.0 Sec

(The manual does not indicate what the assignment would be for an Event Task).

So your routine could:-

GSV the actual watchdog setting and store it.
SSV 0 to the watchdog.
GSV the new setting, to determine task type.
SSV the original stored setting.

Convoluted, but sould work.

HTH
  Reply With Quote
Old August 18th, 2009, 05:22 AM   #12
rdrast
Lifetime Supporting Member
United States

rdrast is offline
 
rdrast's Avatar
 
Join Date: Apr 2003
Location: South Carolina Lowcountry
Posts: 3,775
Quote:
Originally Posted by simonwxx View Post
Hi Rdrast, I've go two tasks, i set one to periodic and another continuous, tested. instance of periodic task = 1 and instance of continuous = 3. so i think continuous task instance may not necessary be 1 all the time.
Aye, that has been pointed out to me. My error, I made the mistake of assuming it would always be present, but was shown cases where the cyclic task was deleted, then periodic tasks added, which changes the instance number.
__________________
------------------------------------
How to ask questions the SMART Way!

Look First, Ask Second!

  Reply With Quote
Old August 18th, 2009, 07:19 AM   #13
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 2,631
My guess it's going to be a (as yet un-documented) bit in the Staus DINT, or more likely, an attribute you could get with a CIP message to the controller (yes, the controller can read itself, Path = 1,[slot#] )

I'm still trying to find a list of CIP Class Instance and Attributes for the controller, does anyone have this, or know where it can be found?

After all, RSLogix5000 can read it, so it does give up it's secrets.
  Reply With Quote
Old August 18th, 2009, 09:23 PM   #14
simonwxx
Member
New Zealand

simonwxx is offline
 
Join Date: Aug 2009
Location: Hamilton
Posts: 8
Quote:
Originally Posted by daba View Post
So your routine could:-

GSV the actual watchdog setting and store it.
SSV 0 to the watchdog.
GSV the new setting, to determine task type.
SSV the original stored setting.

Convoluted, but sould work.

HTH
Hey mate, sounds a good one, I've tried your method, and test it. seen the program can't catch 0.5 or 5 seconds value. It give me 0 value instead. below is my code.
Attached Images
File Type: jpg Snap1.jpg (30.3 KB, 138 views)
  Reply With Quote
Old August 19th, 2009, 03:21 AM   #15
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 2,631
Yes, I discovered this myself, it returns the zero value you SSV.

I spoke with an ex-colleaguethat now works tech support, and he confirmed that a lot of info that could be got is unpublished, and not in the public domain - yet. If you must pursue this, then get in touch with application support in your country.

Having said that, I've re-read your original post, and admit to being a little confused as to what you actually do want.

Quote:
we need to get the last scan time if it is in continuous task, and to get rate (scan time in periodic) if it is in periodic task
What exactly is it you want if the task is periodic ?
The periodic rate (the time interval between executions), or the periodic task scan time (how long the task takes to execute) ? If it is the periodic rate you want, then this is fixed by task configuration and will not change, unless you write a GSV to change it. If it is important that the periodic rate doesn't get changed, then you could write a GSV to set it in a protected routine.

Secondly, don't forget that the Continuous Task's Last Scan Time, will include all of the time that interrupting periodic tasks (or event tasks) take to execute during the continuous task scan. You have not mentioned these Event tasks, how do these figure in your data collection. Also the "System Overhead Time-Slice" setting will affect the scan time, especially when the option to use unused SOTS is checked on.

And finally, (and it has to be asked), how and why is this information so important to you? It is not a usual thing for the application to know about this level of detail about it's execution, the information is provided primarily for programmers/SI's to configure the controller, in order for the program to effectively achieve its function. Once set-up correctly, nothing is going to change it (barring a few exceptions.

I don't see how gathering this information is going to help.

regards, daba
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Logix 5000 PID Instruction in a COntinuous Task plcnovel LIVE PLC Questions And Answers 29 August 13th, 2007 12:11 PM
RSLogix 5000 FB Totalizing - Periodic or Main Task BillRobinson LIVE PLC Questions And Answers 2 May 24th, 2007 11:35 AM
rslogic500 /controllogic 5500 mgomezov LIVE PLC Questions And Answers 23 June 14th, 2006 11:36 PM
RSLogix 5000 V15 Features Samneggs LIVE PLC Questions And Answers 18 April 20th, 2006 05:45 PM
PIDE's in periodic tasks RSLogix 5000 BENNY LIVE PLC Questions And Answers 18 August 25th, 2005 11:06 AM


All times are GMT -5. The time now is 03:54 PM.


.