Jump to content

LDI(MI) ? - Sequential Sampling application


Recommended Posts

Hello

I've got a new twist to an older project.   I have a sampling system that I'm looking to automate so that instead of sampling A & B sides on a switch-over process, it will sample an entire batch of samples;  one at a time in sequence.    The user will select how many samples they will need to run at the start of the routine.   The sample results will be displayed on the HMI as  Red / Green radio buttons, one for each sample station; on a final results page at the end of the batch. 

I may have as many as 30 sample stations on the system active in the batch, and I didn't want to have to run through sets of sampling routine,  rather have the same sample loop repeat itself until the sample counter clicked off. 

I was thinking that the Load Indirect (MI) would enable me to load the results from each test into a new MI location.  A snip of code is attached.   MI-15 will be my Go/No Go sample results integer, that value will be loaded into a MI location assigned by the STI dialog box in Rung 27.   

Am I on the right track &/or is there a better way to do this?   

thanks, 

Jeff

 

 

 

CODE Capture 120519.JPG

Link to comment
Share on other sites

  • MVP 2023

Another way is to stuff a Data Table from the top.  You get the added bonus of having multiple columns of data if you want.

 1. Define a Data Table with more rows than you'll ever need.

image.png.25f9756a44f1d87ed5da578bbf2b7f2d.png

2.  When it's time to log, here's the logic:

image.png.b3d157cc08b0ef2176e511cc752cafc6.png

And what's inside the blocks:

image.png.cf50692cb07ace1efd17d0a42a313640.png

The Copy Rows function just moves the entire table down by one.  This table has 1000 rows, so the oldest data is blown out.

image.png.889b9cbcb451b1344214dcddf6f80f27.png

The newest data is always written to row 0.

This method makes it real easy to store the data, but a limitation of Visilogic is there is no Data Table widget to get it back out.  So you have to make more a little more logic to read the columns into registers for display.

Your way works, too, and may be better for only keeping track of one value.  The Data Table way if better if you need to grab more than one piece of information for each sample.

Joe T.   

 

 

 

Link to comment
Share on other sites

Thanks Joe, I do appreciate the response.   I've already got a fair amount of code written with the Load Indirect, I'll probably see if I can make this work.   

With allot of this stuff ( PLC work in general ) I have an idea of what I need the outcome to be but I dont know what tools within the software to select to make it happen.  

Will post back either way.   

 

Jeff

Link to comment
Share on other sites

  • MVP 2023

If you are actually wanting to have records of the process, Joe's method of using a Data Table makes it easy as you can write the Table onto an SD as necessary.  Strings are easily read  in *.UDTs, and easily shifted out of the plc using SD Card Explorer.  Alternatively you can do a direct read of a table using the Connection tab under Data Tables/Data Tables in Visilogic.

cheers, Aus

Link to comment
Share on other sites

12 hours ago, Ausman said:

If you are actually wanting to have records of the process, Joe's method of using a Data Table makes it easy as you can write the Table onto an SD as necessary.  Strings are easily read  in *.UDTs, and easily shifted out of the plc using SD Card Explorer.  Alternatively you can do a direct read of a table using the Connection tab under Data Tables/Data Tables in Visilogic.

cheers, Aus

Plus, with the Data Table method  you can use the DataXport utility to copy the  Data Table to an Excel file, saved into a folder or emailed to someone...

JohnR

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...