Sign in to follow this  
Followers 0
vegost

Map IOs to structure

3 posts in this topic

Hi,

This is going to be a long question, but I want to be thorough so please bear with me.

We have a system consisting of ABB equipment for motion control and IO handling. In order to simplify the overall architecture, we want to replace the motion control part of this system (which at present consists of a bunch of different CPU cards and PCBs) with one Omron NJ controller an use its SW library for motion control instead.

With regards to IO handling we want to leave the IOs as they are now and just map them from the ABB PLC to the NJ controller and back using an Anybus X-gateway (i.e. the ABB PLC will collect the IOs from its modules, send them via Profinet to the Anybus, which will map them on EtherCAT to the NJ controller).

Now, in the NJ controller, rather than putting all the IOs in the global variable list, I want to create structures (one Digital Input structure consisting of booleans, one Analog Input structure consisting of long reals and so on). The reason I want to use a structure rather than an array, is that the structure let's me specify variable names, which is nice.

Here is my problem: How can I map the digital inputs from the Anybus to the Digital Input structure?

The data from the Anybus is packed into bytes of data, so I want to find the most convenient way to take these bytes from my IO-table, split them up and map them to the bools of my structure. I can't seem to find good solutions to this problem online. From the Omron Instruction docs W502, the function AryByteTo seems to do exactly what I want, but it seems like my output variable in that case needs to be an array instead of a struct.

If I don't find a good solution to this I am stuck with just hard coding every DI to its variable in my struct, which is time consuming to say the least considering well over thousand IOs.

Hope someone will help. Thanks in advance.

Share this post


Link to post
Share on other sites

You cannot use elements of a structure in the I/O map.  This is also a frustration I have run into.  I have seen many customers who simply create a structured text program to copy the inputs one at a time into a structure, and write the output variables in the same fashion.

You can consider using a UNION, which allows the same variable to be broken up in different ways, for example one word is two bytes is 16 bits.   Create a union for a byte which is also an array of 8 BOOL.  Create a variable of that data type and try to use that in the I/O map.  If the I/O map still won't take it, you can move the byte from the I/O map into the union in structured text easily enough.

Share this post


Link to post
Share on other sites
Just now, Crossbow said:

You cannot use elements of a structure in the I/O map.  This is also a frustration I have run into.  I have seen many customers who simply create a structured text program to copy the inputs one at a time into a structure, and write the output variables in the same fashion.

You can consider using a UNION, which allows the same variable to be broken up in different ways, for example one word is two bytes is 16 bits.   Create a union for a byte which is also an array of 8 BOOL.  Create a variable of that data type and try to use that in the I/O map.  If the I/O map still won't take it, you can move the byte from the I/O map into the union in structured text easily enough.

This.

UNION type does work in I/O Mapping, and for Digital I/O especially should work better compared to Structure. It works exactly like the CX-One I/O Mapping where you can access CIO Address as a whole or bit per bit

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
Sign in to follow this  
Followers 0