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 November 23rd, 2017, 11:17 AM   #1
JJH
Member
United States

JJH is offline
 
JJH's Avatar
 
Join Date: Oct 2015
Location: South Carolina
Posts: 30
RSLogix 5000 Add-On Instruction Global Output

Hi there,

I am trying to create an Add=On Instruction to help me manage some alarm conditions in my application. My AOI has one Boolean output that is used for messaging on the HMI, but I'd like to also have another output (Boolean or integer) that would be attached to o global parameter so that if any alarm is activated, it will create a master alarm that can be used for machine control, and possibly messaging. The reason for this is that I may have numerous alarms and I'm trying to avoid having to create a series chain of all those alarms to turn on a master alarm. My thought was that if I can get any alarm to make a global parameter go true, then I don't have to manage other bits if I delete or add an alarm block.

I'm having trouble coming up with a way to create that output that I can have load a TRUE value into a global parameter, though. I was trying to use an integer so that I could just load a '1' into the variable if any alarm goes off, and a master reset would reset the value to zero. But I'm apparently not setting up the AOI parameters just right.

Has anyone got a suggestion of how I can do this? I can share my block if that would help, it's nothing special, just a way for me to condense alarming features and this one seems to be a little tricky.

Thanks for your suggestions!
  Reply With Quote
Old November 23rd, 2017, 11:22 AM   #2
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,380
Quote:
Originally Posted by JJH View Post
Hi there,

I am trying to create an Add=On Instruction to help me manage some alarm conditions in my application. My AOI has one Boolean output that is used for messaging on the HMI, but I'd like to also have another output (Boolean or integer) that would be attached to o global parameter so that if any alarm is activated, it will create a master alarm that can be used for machine control, and possibly messaging. The reason for this is that I may have numerous alarms and I'm trying to avoid having to create a series chain of all those alarms to turn on a master alarm. My thought was that if I can get any alarm to make a global parameter go true, then I don't have to manage other bits if I delete or add an alarm block.

I'm having trouble coming up with a way to create that output that I can have load a TRUE value into a global parameter, though. I was trying to use an integer so that I could just load a '1' into the variable if any alarm goes off, and a master reset would reset the value to zero. But I'm apparently not setting up the AOI parameters just right.

Has anyone got a suggestion of how I can do this? I can share my block if that would help, it's nothing special, just a way for me to condense alarming features and this one seems to be a little tricky.

Thanks for your suggestions!
Just use an In/Out parameter.

It'll have to be a DINT, not a BOOL, but just OTL bit 0 of the DINT in your AOI.

EDIT : use DINTs wherever possible. Using any other data-type slows the code down as they are always converted to DINTs for processing, then converted back again for storing. It may seem overkill to use a DINT when you may only want to store a number in the range 1 to 5 for example, but it uses no more memory than a SINT or an INT, and will preocess faster....
__________________
___________________________
ControlLogix & SLC Training
a-b train ltd.
abtrain@tiscali.co.uk
www.abtrain.co.uk
tel: 07506 73 9999
nil illegitimi carborundem



Last edited by daba; November 23rd, 2017 at 11:26 AM.
  Reply With Quote
Old November 23rd, 2017, 11:37 AM   #3
JJH
Member
United States

JJH is offline
 
JJH's Avatar
 
Join Date: Oct 2015
Location: South Carolina
Posts: 30
Hello,

Thanks for your prompt and accurate suggestion! I think the INT variable is what was tripping me up. After turning on the different bits of a DINT, I pretty much get the result I was looking for.

Much appreciated!
  Reply With Quote
Old November 24th, 2017, 05:00 AM   #4
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,380
Quote:
Originally Posted by JJH View Post
Hello,

Thanks for your prompt and accurate suggestion! I think the INT variable is what was tripping me up. After turning on the different bits of a DINT, I pretty much get the result I was looking for.

Much appreciated!
I don't think it is the data-type that caused you issues, my suggestion would work equally well with SINT, INT, or DINT. But using DINT is most economical on processing power.

The "trick" was the use of the In/Out parameter type, or, in other words, "by reference", as opposed to Input and Output parameters being "by value".

It actually occurred to me that you can have a BOOL In/Out parameter, for some reason I originally thought they were not permitted, so you could just pass a "Global_Alarm" BOOL flag as In/Out to the AOI, no need to use bits of an xINT data-type.
__________________
___________________________
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 November 24th, 2017, 05:11 AM   #5
Rob...
Supporting Member
United Kingdom

Rob... is offline
 
Join Date: Jul 2016
Location: Manchester
Posts: 120
Quote:
Originally Posted by daba View Post
Just use an In/Out parameter.

It'll have to be a DINT, not a BOOL, but just OTL bit 0 of the DINT in your AOI.

EDIT : use DINTs wherever possible. Using any other data-type slows the code down as they are always converted to DINTs for processing, then converted back again for storing. It may seem overkill to use a DINT when you may only want to store a number in the range 1 to 5 for example, but it uses no more memory than a SINT or an INT, and will preocess faster....
I presume you're talking about a SINT or INT using the same amount of logic memory as a DINT. Surely they don't take up the same amount of data memory?
  Reply With Quote
Old November 24th, 2017, 06:00 AM   #6
JJH
Member
United States

JJH is offline
 
JJH's Avatar
 
Join Date: Oct 2015
Location: South Carolina
Posts: 30
Yes, I used an In/Out BOOL for the AOI parameter and then used a DINT variable and the .0, .1, .2 etc bits of the DINT for the individual alarms. Then I used a NEQ block after all the alarms to create a "master" alarm.
  Reply With Quote
Old November 24th, 2017, 08:49 AM   #7
daba
Lifetime Supporting Member + Moderator
United Kingdom

daba is offline
 
daba's Avatar
 
Join Date: Jul 2004
Location: uk
Posts: 4,380
Quote:
Originally Posted by Rob... View Post
I presume you're talking about a SINT or INT using the same amount of logic memory as a DINT. Surely they don't take up the same amount of data memory?
Yes they do... the controller has a 32-bit architecture, so the minimum allocation for data will be 1 32-bit memory word.

I have an L62 controller here with 4,146,928 bytes free data and logic memory.

I won't create any logic, just database tags......

After creating a SINT - 4,146,840 = 88 bytes used
After creating an INT - 4,146,756 = 84 bytes used
After creating a DINT - 4,146,668 = 88 bytes used

Not sure why the INT only consumes 84, but the SINT and the DINT both use the same amount, for a quarter the size of the physical data.

This is one reason why UDTs are so useful. Packing your data into UDT structures can reduce the amount of memory used considerably, although this isn't too much of an issue these days with MegaBytes to play with.

In a UDT, consecutive BOOL members are "packed" into one (or more, if you have more than 32 BOOL memebrs) memory word.

Consecutive SINTs are "packed", and so are INTs.

That is why, when creating UDTs, most efficiency is gained by creating the members in size order, either ascending or descending, it doesn't make any difference.

An example....

A UDT with three BOOLs, two INTs, two DINTS, and a Timer, created in this order....

bool1
int1
timer
dint1
bool2
int2
dint2
bool3

has a "size" of 32 bytes

re-ordering them in size order

bool1
bool2
bool3
int1
int2
dint1
dint2
timer

has a size of 28 bytes, 4 bytes less.

It might not sound a lot, but that saving is amplified the larger the data-type, and if you are creating large arrays of UDT tags, that extra saving can be dramatic.
__________________
___________________________
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 November 24th, 2017, 08:56 AM   #8
Rob...
Supporting Member
United Kingdom

Rob... is offline
 
Join Date: Jul 2016
Location: Manchester
Posts: 120
There's not a thanks button, but much appreciated for that detailed response!

I've actually spent some time reading up on it since. Makes sense now.
  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
How To Enter Rslogix 5000???? sundar_scada LIVE PLC Questions And Answers 14 April 2nd, 2016 03:50 PM
Rslogix 5000 ALMD instruction help MJC LIVE PLC Questions And Answers 2 December 4th, 2014 03:24 PM
RSLogix 5000 Add On Instructions pr_wainwright LIVE PLC Questions And Answers 2 May 1st, 2012 08:24 AM
RSLogix 500 - How to write to more than one output card with a single instruction? Warren Boswell LIVE PLC Questions And Answers 1 March 26th, 2008 09:17 AM
RSLogix 5000 V15 Features Samneggs LIVE PLC Questions And Answers 18 April 20th, 2006 05:45 PM


All times are GMT -5. The time now is 04:05 PM.


.