AngryRobot

Using the Same AOI input parameter in multiple places (coils)?

6 posts in this topic

I'm writing an AOI to handle some logic to control a clamping cylinder.  The extend and return commands can come from several different places within the PLC program as well as from the robot in the work cell.

 

My original idea was just to set the extend and return input parameters as DINT's then address all of the coils as EXTEND_CLAMP.0, etc.  That works just fine, but it isn't as clean as just being able to use Clamp_Control.Extend in all of the coils.  I know Logix will return a duplicate coil warning if I simply use the AOI parameter over and over again, but will it prevent the OTE's from operating? 

 

What is the best practice for something like this?  AOIs and function blocks are relatively new to me.  I was always taught to avoid duplicate coils in straight ladder program; but function blocks throw a different wrench into the works.

Share this post


Link to post
Share on other sites

Only use the controlling AOI in one place and centralize your controlling logic from all external sources.  Treat the AOI the same way you would a standard coil and do not try to control it from multiple places by using the same instance in multiple places.  The advantage of AOIs is not so much to be able to use the same instance multiple places but instead centralize the controlling code and make it modular for re-use (say for instance your clamp has auto/manual control, or needs to trigger an unlock output before releasing the clamp).  If you have multiple clamps that need to operate in the same manner, make that control the AOI and create Clamp1, Clamp2, Clamp3...instances of that AOI but include each INSTANCE only once in your code.  Then the outputs of that AOI will be fed to the correct physical outputs and the inputs will be fed from your controlling logic.

Hopefully that makes sense and I didn't over-generalize.

 

Share this post


Link to post
Share on other sites

To expand on Zener's post

Quote

I'm writing an AOI to handle some logic to control a clamping cylinder.  The extend and return commands can come from several different places within the PLC program as well as from the robot in the work cell.

Don't duplicate the AOI. It's not IO, it's a control or calculation methodology. If you have multiple inputs from the program, create a tag in the AOI called XC DINT[10] or however many you need. Then in logic I like structured text but this can be done in ladder too)

IFXC.0 OR XC.1 OR XC.2...OR XC.9 THEN

OC := 1;

ELSE

OC := 0;

END_IF;

Then use XC.0...XC9 in your logic or if you're a function block person drop the AOI into a function block routine and tie the IO in that way. 

Alternately you could map the IO in the same structured text file like so:

XC.0 := tag in logic 0;

XC.1 := tag in logic 1;

XC.2 := tag in logic 2;

etc...

Do yourself a favor and shorten your tags up. EXTEND_CLAMP.0... etc could be XC.0 etc. Less typing in the program and the HMI. Use the description if you need to get wordy. If I could go back 10 or 15 years and redo the programs that I wrote that were full of wordy tags I would. 

If you really want to streamline (containerize) your logic learn to use User Defined Datatypes (UDT's)

Edited by Michael Lloyd

Share this post


Link to post
Share on other sites
Quote
On 12/28/2016 at 11:01 AM, AngryRobot said:

I'm writing an AOI to handle some logic to control a clamping cylinder.  The extend and return commands can come from several different places within the PLC program as well as from the robot in the work cell.

 

Duplicate OTEs will cause problems!

You want to create "request" logic which can be used anywhere in your code, the AOI processes the request and the AOI controls the actual OTE that is tied to the actual output. You can do this with a simple OTL. Create a new tag called "Clamp_Control.Extend_Request" use this tag with a OTL anywhere your logic is that needs to control the clamp. This eliminates the issue of duplicate OTEs. However, when using an OTL you must make sure it is properly unlatched. Modify the AOI to do this on each logic scan.

In the AOI, it's simply:

Output := Clamp_Control.Extend_Request;

Clamp_Control.Extend_Request := 0;

Quote
On 12/28/2016 at 1:20 PM, Zener said:

Only use the controlling AOI in one place and centralize your controlling logic from all external sources. 

 

Agree on controlling the AOI in one place, but modifying it so the AOI controls the physical output.

Quote
On 12/28/2016 at 5:21 PM, Michael Lloyd said:

Do yourself a favor and shorten your tags up. EXTEND_CLAMP.0... etc could be XC.0 etc. Less typing in the program and the HMI. Use the description if you need to get wordy. If I could go back 10 or 15 years and redo the programs that I wrote that were full of wordy tags I would. 

If you really want to streamline (containerize) your logic learn to use User Defined Datatypes (UDT's)

 

I always recommend following/creating/modifying a naming convention like you see in higher level languages, from wikipedia:

In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote variables, types, functions, and other entities in source code and documentation.

Reasons for using a naming convention (as opposed to allowing programmers to choose any character sequence) include the following:

  • to reduce the effort needed to read and understand source code;[1]
  • to enable code reviews to focus on more important issues than arguing over syntax and naming standards.
  • to enable code quality review tools to focus their reporting mainly on significant issues other than syntax and style preferences.
Edited by Paullys50
Multi-quoting is not enjoyable.

Share this post


Link to post
Share on other sites
Just now, MD SULTAN ALAM said:

Thanks That Explains a Lot :)

But Can SomeOne Plz Look Into My Matter too... :(

http://forums.mrplc.com/index.php?/topic/32019-8_decimal-point%C2%A0displays-as-only-4_decimals/

satec.jpg

Asking this question on numerous other posts is not going to endear you to anyone...

Your question was answered. Your data format is a 16 bit integer. The number your trying to read with modbus is going to be in TWO 16 bit integers unless you explicitly ask for floating point or DINT data (which you didn't ). You need to assemble the two registers into one DINT. 

Share this post


Link to post
Share on other sites

Thanks for everyone's responses here.

I ended up just setting my input parameter as DINT; then I just address coils throughout the program as bits of that DINT when I need to perform the required function.  

 

IE:I have created my cylinder control FB and named the instance that controls the EOAT clamp "clamp".  My inputs for extend and retracted are simply named "extend_register" and "return_register".   I have a rung in my manual control logic to extend a clamp, so I address that OTE as "clamp.extend_register.1".  Similarly in the auto routine I address an OTE as "clamp.extend_routuine.2".  My AOI just runs a comparison to zero on the DINT.

I toyed around with the method of using an OTL and request logic, but I had already finished off the program before I saw the response and I didn't want to rewrite it a section of it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now