Nate Hammersmith

na NA Data History Program

8 posts in this topic

Does anyone have any idea how I can create a Data History though the NA screen. I know I can do a Data Log with a Data Set then use a Trend Graph but, I want to create the "Table Like" Data History found in the Omron NB screen. I use data histories for a UI to an operator to review previous Cycle Times, Poka Yoke values, and Temperatures monitoring with a time stamp as to when the data was recorded. Any ideas? 

I am using a NX102-9020

NA5 Screen

Share this post


Link to post
Share on other sites

Personally, I would create a structure that matches what you want to display, then create an array of that structure for data storage.  Then I would make displays on the screen to show the data.  Right click on the Data Display object once you create it and then choose create duplicate objects to rapidly develop your screen.  You could then use the StackPush Function to push your data onto the stack when needed.

1 person likes this

Share this post


Link to post
Share on other sites
On 4/29/2020 at 10:28 AM, Michael Walsh said:

Personally, I would create a structure that matches what you want to display, then create an array of that structure for data storage.  Then I would make displays on the screen to show the data.  Right click on the Data Display object once you create it and then choose create duplicate objects to rapidly develop your screen.  You could then use the StackPush Function to push your data onto the stack when needed.

Okay,  thanks for the reply Michael!

    I'll have to read up on the StackPush Function. To make sure I understand what you suggest:  When I create a structure "Data_History" with a member as "Cycle_Time", which is a Uint,  can I create an additional member for a Date_Time variable to time stamp the "Cycle_Time" and push those two elements together on the Stack in order two view both elements somewhat together on my NA5 via data displays? 

 

Share this post


Link to post
Share on other sites

Yes, create a structure that has both the CycleTime (as a real or UINT, or whatever) and an element that has a Date_Time data type.  Then push a variable of that structure onto a stack that is an array of that structure.

1 person likes this

Share this post


Link to post
Share on other sites

An update of progress for the forum and a couple questions:

Like Micahel suggested, I created a structure with the variables and datatypes i needed to record.Strcutre.thumb.jpg.3aaa637a262f35fb5facf

I then created two variables in global:

Variables.thumb.jpg.a56814856ae2d2e7eb30

I wrote the Stack Push Logic and populated that variable that i created in order to store it in the array. Also wrote a clear in order to clear the stack if necessary.

5eba97f14402e_CTlogic.thumb.JPG.565bcd3d

Then I created the screen with data displays: each Object is tied to the variable in the structure as part on an array. An example expression within the data display assuming my PLC is called "Nylon" would be: "Nylon_Cycle_Time_History_Array(0).Cycle_Time_TS" .

Capture.JPG

Share this post


Link to post
Share on other sites

I now need to store more values in a more table like format and possibly use a scroll to view the additional records. Thoughts on how? The ability to create a table OR display the entire contents of an Array would be wonderful in the NA5 right about now. 

    One more small application question: when using stack push, what is the best way to cycle back through the stack with new data? I have tried using StackFIFO and used the same Num Variable as the stack push. Unfortunately, this logically pushes twice (once for the Stack push that I wrote to execute and another for the FIFO stack push that I wrote to decrement the Stack Num In order to keep writing new data to the HMI). I want to push the first value out of the stack after the data equals the Num value. Maybe some arithmetic on the Num Variable of the stack push to reset back to 1? 

    Finally, does anyone know why the Array[0} will not populate. I have to wait one cycle to see the stack in array[1] and array[0] doesnt want to populate.

 

Thanks for any info in advance!

Share this post


Link to post
Share on other sites

Array[0] does not populate the first time because you do TruncTime after you push.  Switch the order....

Your variable for the stack is 11 records long ( 0-10 ).

I would do this:  

Create three variables of the structure. 

 pushvars.jpg.a11f689ad6933ca8078fe54297c

The CurrentData is what you push onto the stack.

CycleTimeHistory is the stack, I have set this up with 100 records, but you can make it more if you desire.  Set the retain attribute to true for the history so that the data is still there after turning the power off to the machine.

CycleTimeDisplayArray is just what is displayed on the screen and is 10 records long.

 

Then, add this code:

Rung 0 sets the index pointer to 0 when you power the machine on.

Rung 1 just moves the current time in to the current record for testing purposes.

Rung 2 is the push instruction just like you did it.  

pushlad1.jpg.8daa0962ddf7de9651a9f276fe5

Rung 3 is the Page up functionality.  The page up button on the screen will subtract 10 from the index pointer.  Then this rung makes sure that Index is not <0 ( in this case, Index is a UINT, so when you subtract from 0 a UINT rolls over to a big number near 65535).  So, if I subtract 10 and is > 99, then I must have gone below 0.  If it goes below 0, I set Index = 0.

Rung 4 works the same way, but it is just a single line up at a time, so I subtract 1.

pushlad2.jpg.05105a6691c158719ed512de3a0

Rung 5 Is the page down functionality.  The page down button on the screen will add 10 from the index pointer.  Then this rung makes sure that Index is not >90.  If the result in Index is >90 then Index is set to 90.

 Rung 6 is the same as 5, but is a single line, so 1 is added to Index each time the button is pressed.

pushlad3.jpg.7e82d1e41d04519531732a80a63

Lastly, the calculated Index value is used to move 10 records from the history array to the display array.

oushlad4.jpg.1320c46cee4198dad6e604e3add

2 people like this

Share this post


Link to post
Share on other sites

Wow,

Thank you Michael! I will implement and post final product to the forum. Thank you again for sharing your insight.

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