Jump to content
Lacey

Struct Command only Partially Working

Recommended Posts

Sorry for the delayed response on this. I have been out on leave for the last few months. I have attached my programs. It is a multi-controller set up. Node 10 is the main HMI in our Control room and Node 11 communicates with it and with 12 and 13 all of which are located in a different location and communicate via fiber and TCP/IP back to 10. Our encoders all talk over unican. I am not having issues with 11 and 13, my problem lies with PLC 12. For some reason my commands are not transferring all the information back to nodes 11 and 10. I have attached all four of my programs for your review.

 

I have a program that is sending information from slave to master and vise versa. This program was written for me and I do not completely understand all the communications aspects of it but my problem I believe lies with a struct command on the Master. I have a struct collect command collecting information from mixed data locations to vector. I am collecting data from three locations, ML20- Length 5, MB150-length 16, and ML 160-lenth 6. The struct extract command in the ladder of the slave is extracting the data correctly for everything but the ML 160's. For some reason the ML160 data will not transfer to the slave. Does anyone have any ideas what issue could be and how I can fix this?

Thank you so much for your help on this!

Newest_USACE_10_9v4 3.21.2018 Set Node Lake Levels.vlp

Newest_USACE_11_9v4 3.21.2018 Set Node Lake Levels.vlp

Newest_USACE_13_9v4 3.21.2018 Set Node Lake Levels.vlp

USACE_12_9v4 3.21.2018 Set Node Lake Levels.vlp

Edited by Lacey
more information and attached files

Share this post


Link to post
Share on other sites

Are you transferring all 46 bytes to the slave? Does the extract Struct exactly match the collect Struct? If so, then what PLC are you using and what communications protocol are you using? If you post your code here we can be of better help.

Share this post


Link to post
Share on other sites

The extract Struct is set up exactly the same and I'm not sure about the first question. As for communications we are using TCP/IP we have a V1210 Connected with three V130-33-R4's. I'm sorry I am new to this forum, to what code are you referring?

Thank you for helping.

Share this post


Link to post
Share on other sites
54 minutes ago, Lacey said:

As for communications we are using TCP/IP

MODBUS TCP/IP?

54 minutes ago, Lacey said:

I am new to this forum, to what code are you referring?

Code is the software you're running in the PLC (screenshots of the relevant ladder logic or best would be posting the .vlp file)

56 minutes ago, Lacey said:

I'm not sure about the first question

There is a vector length associated with the data exchange with the slave. That vector length in your case should be 23 MIs (each MI is 2 bytes).

Share this post


Link to post
Share on other sites

Perhaps relevant, perhaps not.  I only use structs under Unican.

I am particularly careful implementing structs as it is very easy to get confused with source and destination addresses.  The method I always use is to take a screenshot of the source struct, and very carefully compare it to the ladderwork at the receive end.  If you have anything at all out of whack it won't work.....the "sequence" must be exactly the same.

Also, Flex, is there a max MI limit using structs under Modbus TCP/IP, like under Unican?  Perhaps this is the issue?

cheers,

Aus

Share this post


Link to post
Share on other sites

Ausman, I believe you can transmit a maximum 200 registers with a single MODBUS command. That doesn't appear to be an issue here.

Share this post


Link to post
Share on other sites

Thanks Flex, noted.

Lacey...forgot to say that it is also very easy to make the mistake of having your Struct Extract write unintentionally into vectors or single elements that are in use elsewhere in your program.  This then looks like the struct hasn't been extracted properly, but it is just the normal program doing it's thing.  This is also one of the reasons I do the screenshot bit, to ensure that I have sufficient vector lengths that aren't "actively" used elsewhere and are just a "temporary storage area", or that I am definitely writing the vector or single element to a used destination that I know is correct.

cheers,

Aus

Share this post


Link to post
Share on other sites
On 3/23/2018 at 7:47 AM, Flex727 said:

I believe you can transmit a maximum 200 registers with a single MODBUS command.

No.  The official Modbus specification is 125 registers per transfer.

Lacey - you still need to upload your .vlp files for us to be more effective in helping- this is a rather complex problem and very hard to describe in the verbose method of a forum post. 

Otherwise we're just guessing at what you've done.

Joe T.

Share this post


Link to post
Share on other sites
41 minutes ago, Joe Tauser said:

The official Modbus specification is 125 registers per transfer.

Thanks for the correction, Joe. That's what I get for typing off the top of my head.

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

×