AngryRobot

NA Broken Line Graph

8 posts in this topic

I need to be able to graph an analog input value on the HMI during the course of a part test procedure.  Is the broken line graph the right tool for this?  I don't believe the graph works in the simulator (or does it?) and I don't have the PLC yet to experiment with it all.

 

Basically, I need to send an update command every 20ms and then graph the analog value at that time.

Share this post


Link to post
Share on other sites

As you said, it is not working in Simulation mode (meh...)

Graphing every 20 ms is quite intensive I'd say. The minimum value for interval-based update in the Broken-Line graph object is every 1000 ms.
Sure you can reduce it using the condition-based update (like triggering it from PLC bit), but I don't know whether we can expect it goes faster or not.

The only issue in using Broken Line Graph is that it is not a value vs time kind of graph, so if you want to achieve that, you must make the variable as an array.
Say your variable is an integer array in size of 10, each index represents value at nth ms.
Every new sampling, you need to shift values inside the array to emulate value vs time graphing.

An easier solution would be using the Trend Graph which directly creates value vs time graph. But you need to plug either SD Card or USB Flash Disk to use it, since it is showing a real data log.

1 person likes this

Share this post


Link to post
Share on other sites

Ok, here is another caveat: I will be evaluating this captured data to determine if the part is good or bad- and the customer wants to save the last 50 good "graphs" and the last 50 bad "graphs".  That is the exact wording used in the customer documentation, they want to "save the graph" so that they can look at them later on the HMI.

So not only do I need to do a live graph of the torque curve as  the test is running, I need to log the data so that I can display the curve again at a later date.  I'm not sure how to use the Trend graph for that; because in my limited experience with that it pushed all of the data into one file, so I'm not sure how I would read out different "graphs" based on the user's selection.  

Share this post


Link to post
Share on other sites

So I was finally able to grab a PLC and HMI off the floor to do some testing with.  It looks like the Broken Line graph will do what I need if I push everything into an array.

 

But in order to "save" the last 50 good graphs and the last 50 failures I am going to have to create 100 individual arrays to push the data into when it is no longer the "current' data.  That's going to be pretty messy.  Is there a way to create an array of arrays?  So I could just say push Current_Data_Array into Saved_Data[0].

Share this post


Link to post
Share on other sites

I would suggest using the Trend Graph instead. Using it, you not only displaying real time logged data, but can load the data that is saved in the SD Card / USB Flash Drive.
The data are tagged with timestamp, so should be easy to search for a certain day / time. Also you won't have issues with arrays.
All tests must be done in a real device though.

Otherwise, if showing graph in the HMI is not a necessity, I would suggest using the DataTrace function in Sysmac, which is on the PLC side.
Here you graph and saving the data log inside your PC, so anytime you can load it up offline and show it.

Share this post


Link to post
Share on other sites

I'm not sure doing it by time stamp will work though.  I'm pretty sure that will continue to capture data between different parts as if they were still part of the same data grouping.  So all of the parts would blend together into one overall trend curve; but I need to be able to display the specific curve for each individual part.

I think I came up with something that is going to work... but it wont be the most memory friendly solution.  I created a two-dimension array, the first dimension is the 50 parts I need to save data for and the second is a 16 element dimension that saves my capture points.  Then I use a WHILE statement to create a pseudo-stack and shift everything through it; then once its been shifted I move my just captured data into the very first dimension and element of the saved data array.

 

IF test3 = TRUE THEN
    Pointer:=INT#49;
        WHILE Pointer <>INT#0 DO
        MemCopy(Save_Data[(Pointer-1),0], Save_Data[Pointer, 0], UINT#16);
        Pointer:=(Pointer-INT#1);
        END_WHILE;
    MemCopy(Capture_Data[0], Save_Data[0,0], UINT#16);
    test3:=FALSE;
END_IF;


         

 

Edited by AngryRobot

Share this post


Link to post
Share on other sites

I ended up changing to a structure that contains an array for the captures and strings for a date and time stamp.  Then I created an array of these structures.  This lets me easily save the data, and move it into a "display" structure to show on the HMI.  

But now I've also found out they want to be able to pull this data from the HMI.  So I've hit a wall again.  I tested with using a data group to log it to a CSV file, but that can only look at one element of the capture array in one element of the structure array at a time.  I don't see any way to have it log the entire structure at once.

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