Announcement

Collapse
No announcement yet.

data retrieval from multiple arrays

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts


  • data retrieval from multiple arrays

    I have (27) BRX PLCs doing motion control; they're each controlling an integrated servo with step-and-direction outputs. Each PLC has an array set up with 255 positions that stores a "Target Position" that's indexed by a variable called "Cue Number." That cue number comes from a C-more HMI and a 28th PLC at the Operator Station. All this works well.

    I designed and programmed the system this way to ensure that if one of the PLCs in the system failed, you'd only loose the position data for that axis, and not the entire system. That said, the operators are now asking for the ability to "save all the cues" to one location with the press of a button.

    So... how do I pull all 255 target positions from each PLC, and save it in a useful format that someone can use offline? It would be wonderful if I could save the positions to the USB flash drive I already have connected to my C-more, but I'd settle for saving to a micro SD card in the Operator Station PLC.

    Bonus: If the cues were somehow wiped out, how would I go about "reloading" that data back into the array in each of the (27) PLCs, so they'd have valid Target Positions?

    This is a level of data manipulation I've never done in a PLC before. Any help / suggestions / sample code would be very appreciated.


    Thanks,

    Ryan Poethke


  • #2
    One method may be to have the 28th PLC store a copy of the 255 values for each of the 27 PLC's in addition to the cue number being stored now.
    These positions could be written by the 27 PLC's when there is a change in value or the 28th PLC could periodically read the values.
    With a button press, the positions of one or many PLC's could be updated with the last copied value.

    This method would preserve the position data in two places in case of failure.

    With all of the values in one place on the 28th PLC, copying the data to media or emailing out a file would be easier to handle.

    Comment



    • #3
      Originally posted by RogerR View Post
      One method may be to have the 28th PLC store a copy of the 255 values for each of the 27 PLC's in addition to the cue number being stored now.
      These positions could be written by the 27 PLC's when there is a change in value or the 28th PLC could periodically read the values.
      With a button press, the positions of one or many PLC's could be updated with the last copied value.

      This method would preserve the position data in two places in case of failure.

      With all of the values in one place on the 28th PLC, copying the data to media or emailing out a file would be easier to handle.
      Agreed. I just don't know how to easily grab all 255 positions from each PLC. 255 read instructions X 27 PLCs seems like a mess of code to write. My goal is to pull the data into the Operator Station PLC, and then figure out what to do with it, but I don't know how yet.


      Ryan Poethke

      Comment



      • #4
        I believe you can read/write up to 125 sequential locations at a time with DLRX DirectLOGIC Network Read.
        There is no interlocking code required.

        You would still have three read/write instructions per PLC to run the 255 positions.

        Comment



        • #5
          Originally posted by RogerR View Post
          I believe you can read/write up to 125 sequential locations at a time with DLRX DirectLOGIC Network Read.
          There is no interlocking code required.

          You would still have three read/write instructions per PLC to run the 255 positions.

          Recommend native Do-more RX/WX instructions when doing inter-Do-more PLCs. RX/WX have much larger capacities than DLRX/DLWX, which implements the old DirectLOGIC protocol. Do-more protocol supports much larger packets.


          I just checked - RX/WX can handle 250 DWORDs in one packet. Also, RX/WX is table based, so you can put 128 in one row, and 127 in the next row.
          There are 10 kinds of people in this world, those who know binary, and those who do not.

          Comment



          • #6
            Originally posted by franji1 View Post
            [/FONT]
            Recommend native Do-more RX/WX instructions when doing inter-Do-more PLCs. RX/WX have much larger capacities than DLRX/DLWX, which implements the old DirectLOGIC protocol. Do-more protocol supports much larger packets.


            I just checked - RX/WX can handle 250 DWORDs in one packet. Also, RX/WX is table based, so you can put 128 in one row, and 127 in the next row.
            What do I put in the WX instructions to read from TARGETS[CUE_NUMBER], to read from slots 0-127, and 128-255 in the array in the other PLCs? Nothing I've tried seems to be accepted by the WX instructions.

            Once I get the data in one place (in the Operator Station PLC) in a series of arrays, what do I do to save it to the SD card?

            It seems the FILELOG instruction will work to save the data to the SD card. Or should I use FILEWRITE? What's the difference?

            FILEOPEN and FILEQUERY seem to be used to look at file names, and open them. Is that correct?



            Thanks,

            Ryan Poethke

            Comment



            • #7
              I guess I'm not sure what you are trying to do. I thought you were trying to write all 255 values, not one in a specific array index.
              There are 10 kinds of people in this world, those who know binary, and those who do not.

              Comment



              • #8
                Originally posted by franji1 View Post
                I guess I'm not sure what you are trying to do. I thought you were trying to write all 255 values, not one in a specific array index.
                I'm trying to read / store on SD card / write all 255 values from the remote PLC. Can I do that in one shot (I know it needs to be two instructions because of the array's size)? How do I / can I read/write the whole array?


                Thanks,

                Ryan Poethke
                Last edited by Ryan_Poethke; 08-07-2019, 01:14 PM.

                Comment



                • #9
                  In "one shot", no.

                  You must do this in multiple asynchronous steps (asynchronous to the PLC scan):

                  For a specific remote PLC:
                  Step 1: read all 255 values from the remote PLC
                  Step 2: Write those values to the SD card

                  Optionally, to restore the values to a specific PLC
                  Step 1. Read those values from the SD card
                  Step 2. Write those values to the remote PLC

                  Is this what you want to do? How familiar are you with file I/O and string parsing?
                  There are 10 kinds of people in this world, those who know binary, and those who do not.

                  Comment



                  • #10
                    Originally posted by franji1 View Post
                    In "one shot", no.

                    You must do this in multiple asynchronous steps (asynchronous to the PLC scan):

                    For a specific remote PLC:
                    Step 1: read all 255 values from the remote PLC
                    Step 2: Write those values to the SD card

                    Optionally, to restore the values to a specific PLC
                    Step 1. Read those values from the SD card
                    Step 2. Write those values to the remote PLC

                    Is this what you want to do? How familiar are you with file I/O and string parsing?
                    Yes, what you've described is exactly what I'm looking to do.

                    First question: how do I read all 255 values from the remote PLC?

                    I think I can muddle my way through writing to the SD card. However, do I use FILELOG of FILEWRITE to save the data once I have it?

                    I'm not at all familiar with file I/O and string parsing, beyond what I've read in the HELP file for Do-more Designer. Is there any example code available?



                    Thanks,

                    Ryan Poethke

                    Comment



                    • #11
                      I'm pretty sure I've gotten the Do-more Network Read instruction figured out to retrieve the entire contents of the array from each PLC. It seems to need (3) entries to get the entire array; 0-126, 127-253, 254-255 unsigned words.

                      Please see the attached screen cap. Does FILELOG only capture the number of positions in the array shown in COUNT, or will it capture all 256 positions of the array when a count of (1) is entered? Is (1) element the array, or just the first position in the array? Is FILELOG even the correct instruction to be using here; is FILEWRITE what I should be using?

                      I need to log (27) arrays, each with (256) positions.

                      Click image for larger version

Name:	File Log.png
Views:	90
Size:	34.3 KB
ID:	124577

                      I'd just knuckle around and test, but I don't have the hardware in front of me and my onsite time will be somewhat limited, so I'd like this as figured out as possible ahead of time.


                      Thanks,

                      Ryan Poethke

                      Comment



                      • #12
                        We need to figure out the layout of the file. I was thinking you would have 27 files. Are you wanting 1 file with all 27 sets of data? Do you expect to randomly update 1 node at a time, or you always dump everything and always update everything?
                        There are 10 kinds of people in this world, those who know binary, and those who do not.

                        Comment



                        • #13
                          BTW, you can write this portion of code of the file processing using the Simulator. Get it completely working there, then integrate that into the actual PLC after you've worked out all the file I/O stuff on the Sim.
                          There are 10 kinds of people in this world, those who know binary, and those who do not.

                          Comment



                          • #14
                            Originally posted by franji1 View Post
                            We need to figure out the layout of the file. I was thinking you would have 27 files. Are you wanting 1 file with all 27 sets of data? Do you expect to randomly update 1 node at a time, or you always dump everything and always update everything?
                            I was hoping for one data file with (27) columns of data, but I can do multiple files if that's necessary. I was hoping to pull everything down at once (once per day automatically, and more often by an operator pressing a button on the HMI if they wanted to save manually) and create a file with a timestamp. That way, there'd be snapshots saved if someone accidentally saves over a target position. It's happened, and that's why the operators are now asking for this functionality.

                            My hope is to then write code that allows an operator to select a particular file, and upload the positions into the array in each PLC (all of them at once - no picking a single PLC to "recover") so they could recover from an "oops" save. I think I have the reading and writing figured out. My understanding is that I will have to display the selected filename on the HMI to allow the operator to select the desired file and upload its data to the PLCs.

                            Right now, I'll settle for getting the data saved to the SD card though.


                            Thanks,

                            Ryan Poethke

                            Comment



                            • #15
                              FILELOG cannot handle a row containing 256 elements. You will have to do your own file logging using FILEOPEN, multiple FILEWRITEs, FILECLOSE.

                              A STAGE Program that you RUN 27 times, setting SS0 to the desired file name, and copying the 256 data values for a specific block to a common buffer, doing the RUN, when done, copy the next set of 256 data values into the common buffer, then doing the RUN again (with the same file name), again, and again.

                              So I see a HIGH LEVEL STAGE program sequencing the 27 blocks by RUNNING a FILE LEVEL STAGE program 27 times that writes/appends the current block to the file.

                              So the high level PROGRAM basically "RUNs" the low level PROGRAM 27 times, once for each buffer
                              There are 10 kinds of people in this world, those who know binary, and those who do not.

                              Comment

                              Working...
                              X