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 January 23rd, 2018, 02:26 PM   #1
skyfox
Member
United States

skyfox is offline
 
skyfox's Avatar
 
Join Date: Nov 2006
Location: CA
Posts: 174
Logix5K - Possible to Enable/Disable a Periodic task programmatically?

Can this be done based on a pre-selected condition while the PLC is in Run mode?

(Logix 5K V20 - Compactlogix L43 CPU)
  Reply With Quote
Old January 23rd, 2018, 02:37 PM   #2
jstolaruk
Member
United States

jstolaruk is offline
 
Join Date: Dec 2004
Location: Detroit, SE Michigan
Posts: 3,089
A periodic task can be triggered by an event (tag). So you could enable-disable the event as you need it.
__________________
"You can live to be a hundred if you give up all the things that make you want to live to be a hundred." Woody Allen
  Reply With Quote
Old January 23rd, 2018, 03:01 PM   #3
blftech
Member
United States

blftech is offline
 
Join Date: Sep 2009
Location: Las Vegas
Posts: 14
From the Allen Bradley manual;
One downside of a periodic task is t
hat it always executes regardless of whether or not the input that it is monitoring changes state. This over-execution burdens the controller and lowers the performance of the remaining tasks. To alleviate this situation, event tasks provide a more effective way of balancing the need for high-speed processing with CPU performance.
  Reply With Quote
Old January 23rd, 2018, 03:01 PM   #4
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is offline
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 13,618
The SSV instruction can modify the execution properties of a task, including whether it's Enabled or Disabled, and whether it processes outputs or not, or to change its execution rate.

Look at the drop-down options in the SSV for the Task Object, and you'll find both then EnableTask attribute and the DisableUpdateOutputs attribute and the Rate attribute.

Can I ask why you want to do that ?
  Reply With Quote
Old January 23rd, 2018, 03:04 PM   #5
Ken Roach
Lifetime Supporting Member + Moderator
United States

Ken Roach is offline
 
Ken Roach's Avatar
 
Join Date: Apr 2002
Location: Seattle, WA
Posts: 13,618
A note: strictly speaking, Periodic and Event tasks are different because they're triggered by different things in the operating system.

In the ControlLogix operating system, there is only one Continuous Task, and different CPUs support different numbers of non-periodic tasks. Each of those can be either Periodic or Event type.

The 1768-L43 controller supports up to 16 Tasks.
  Reply With Quote
Old January 23rd, 2018, 06:45 PM   #6
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,201
You can terminate the execution of the rest of the periodic task by programming a TND instruction, driven by your control bit, as the first rung of the MainProgram of the periodic task.

Pretty fast, effective, and wholly visible to an observer of the code.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 24th, 2018, 03:01 AM   #7
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 77
Diving even deeper, any Periodic task is going to contain one or more Programs, and each of those Programs can be Inhibited by means of an SSV.

Thus the OP could leave the Task alone, but kill one program and leave others running.

Or do as daba suggested, and disable a Routine within the Program by use of a TND, or a conditional JSR.

But all of these techniques, while they will work, obscure the bigger picture of "Why?". These practices of enabling and disabling code, are more common in other programming languages, like C++, than in PLC programming.

In "disabled" code, OTEs don't reset their outputs, particularly real-world ones, which lead to "duplicate destructive bit" coding. TONs that have been enabled still keep track of time, even if the .ACC isn't "ticking", and so forth.

Not good programming technique.
  Reply With Quote
Old January 25th, 2018, 12:03 PM   #8
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,201
Quote:
Originally Posted by Aardwizz View Post
Diving even deeper, any Periodic task is going to contain one or more Programs, and each of those Programs can be Inhibited by means of an SSV.

Thus the OP could leave the Task alone, but kill one program and leave others running.

Or do as daba suggested, and disable a Routine within the Program by use of a TND, or a conditional JSR.

But all of these techniques, while they will work, obscure the bigger picture of "Why?". These practices of enabling and disabling code, are more common in other programming languages, like C++, than in PLC programming.

In "disabled" code, OTEs don't reset their outputs, particularly real-world ones, which lead to "duplicate destructive bit" coding. TONs that have been enabled still keep track of time, even if the .ACC isn't "ticking", and so forth.

Not good programming technique.
May not be, but when asked the questions, you always try to think of why would someone want to do that....

.... I'm still thinking ....

I'd have to research whether a disabled task, or an unscheduled program, is "pre-scanned", My vote would be not, but I'll find out.

The TND solution does mean that the code in the periodic (or event) tasks are pre-scanned.

I have just thought of a scenario where you might want to disable period tasks....

Say you had flow totalisers that had a lot of math in them, you don't need to execute that code if the system isn't running, so it could be taken out of the scan.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 25th, 2018, 01:03 PM   #9
Aardwizz
Member
United Kingdom

Aardwizz is offline
 
Aardwizz's Avatar
 
Join Date: Dec 2017
Location: Swindon
Posts: 77
The "PLC way" to disable code is to put a -|/|- contact on the rungs that you're interested in.

Like you correctly are concerned about, is the logic prescanned or not, and what are the consequences. Neither one of us knows the answer off the top of our heads, and that fact in itself raises red flags that this path isn't a good way to go.

I understand that sometimes, "desperate times call for desperate measures", but proper DESIGN alleviates headaches later on. Too often, people don't want to design (c.f., "why can't AOI's be edited online?") -- they just want to throw a bunch of code at something, get it working, and move onto the next fire / code-sling.
  Reply With Quote
Old January 25th, 2018, 05:14 PM   #10
mellis
Member
United States

mellis is offline
 
Join Date: Nov 2004
Location: Cincinnati, Ohio
Posts: 802
Quote:
Originally Posted by Aardwizz View Post
OTEs don't reset their outputs, particularly real-world ones,
Maybe I'm not understanding what you mean by "OTEs don't reset their outputs".

If a rung isn't executing, it doesn't affect the status of an OTE instruction at all. It can be stuck at 1 or 0. It doesn't matter what method of "not executing" you are using. Disabling code that controls real outputs directly is very tricky and I don't really see much use for it.

However, if you are referring to how an OTE resets on power failure, it doesn't matter if the code is ever executed. Any tag referenced by an OTE is reset on power up or program to run transition. Unscheduled? Hmmm. not so sure.

Last edited by mellis; January 25th, 2018 at 05:18 PM.
  Reply With Quote
Old January 26th, 2018, 06:43 PM   #11
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,201
Quote:
Originally Posted by mellis View Post
Any tag referenced by an OTE is reset on power up or program to run transition. Unscheduled? Hmmm. not so sure.
Guess I'm going to have to bite the bullet and test this, I did say I would..... but it's late now, been out for dinner, and just finishing a nice bottle of wine, so now is not a good time I think.

Besides, it's the weekend, so no-one is gonna read this till they get back to work, right ?
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old January 28th, 2018, 04:51 PM   #12
ASF
Lifetime Supporting Member
Australia

ASF is offline
 
Join Date: Jun 2012
Location: Australia
Posts: 2,409
You're forgetting that we upside-down folk get to Monday morning a lot earlier than you right-way-up folk, daba

Fortunately for you, I remember that we had this discussion last year, and you quite comprehensively tested many scenarios, including unscehduled tasks: http://www.plctalk.net/qanda/showthr...=110282&page=4

See posts 56 and onward
  Reply With Quote
Old January 29th, 2018, 10:17 AM   #13
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,201
Quote:
Originally Posted by ASF View Post
You're forgetting that we upside-down folk get to Monday morning a lot earlier than you right-way-up folk, daba

Fortunately for you, I remember that we had this discussion last year, and you quite comprehensively tested many scenarios, including unscehduled tasks: http://www.plctalk.net/qanda/showthr...=110282&page=4

See posts 56 and onward
Yes indeed, ASF. It's a good job one of us has got some memory left, I had forgotten all about that discussion.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  Reply With Quote
Old February 10th, 2018, 09:50 AM   #14
skyfox
Member
United States

skyfox is offline
 
skyfox's Avatar
 
Join Date: Nov 2006
Location: CA
Posts: 174
Sorry for the delayed reply. Thank you all for your responses. Reason wanting to Disable/Enable this is customer wants an option to log data from 10 tags at a rate of 100 samples a second for a short period of time at a time of their choosing vs the normal data log rate of 10 samples a second where a test can run for several days. Even though the entire program has a scan time of less than 4ms including the 10ms and 100ms periodic tasks running concurrently with the main task. However, one of the periodic task will be logging data at any given time. Just wanting to figure out a way to disable the 10ms task as they would may be run that for few hours once every six months where as the 100ms task logging data takes place on a daily basis.

Thanks again for everyone's help.

Cheers.

Last edited by skyfox; February 10th, 2018 at 09:52 AM.
  Reply With Quote
Old February 11th, 2018, 05:43 AM   #15
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,201
Quote:
Originally Posted by skyfox View Post
Sorry for the delayed reply. Thank you all for your responses. Reason wanting to Disable/Enable this is customer wants an option to log data from 10 tags at a rate of 100 samples a second for a short period of time at a time of their choosing vs the normal data log rate of 10 samples a second where a test can run for several days. Even though the entire program has a scan time of less than 4ms including the 10ms and 100ms periodic tasks running concurrently with the main task. However, one of the periodic task will be logging data at any given time. Just wanting to figure out a way to disable the 10ms task as they would may be run that for few hours once every six months where as the 100ms task logging data takes place on a daily basis.

Thanks again for everyone's help.

Cheers.
Whoa !!

Hold on a minute.....

10 tags, sampled every 10mS isn't going to give you much recording time.

Say each tag was a DINT or a REAL, they are 32-bits, or 4 bytes each.

100 samples per second will therefore be 400 bytes per second.

400 bytes per second is 24,000 bytes per minute, or 1,440,000 bytes per hour.

But that is only 1 tag, you want to store 10 tags, so that would need 14,400,000 bytes per hour.

Your L43 Controller only has 2MB of memory, so clearly you are not going to be able to do this, even for 1 hour, let alone "... a few hours... ". A few minutes is all you are going to get, and that is with not much code and other tags in the controller. Also each data-point will need its own array tag, since the size limit of a single tag is 2MB.

You are going to need an external data capture/historian to achieve this.
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem


  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
Factorytalk Periodic Task Syntax jknott LIVE PLC Questions And Answers 11 December 10th, 2014 09:14 AM
Scaling Anlog Input Channel in a Periodic Task -L5K shiftedbits LIVE PLC Questions And Answers 6 August 24th, 2012 04:49 AM
PID Periodic Task & redundant system plcnovel LIVE PLC Questions And Answers 16 August 15th, 2007 10:30 AM
rslogic500 /controllogic 5500 mgomezov LIVE PLC Questions And Answers 23 June 14th, 2006 11:36 PM
Off the Wall Question just_lionel LIVE PLC Questions And Answers 6 June 6th, 2006 12:21 AM


All times are GMT -5. The time now is 08:46 PM.


.