0

I'm new to Stackoverflow.

I'm asking for any suggestion about using Zedgraph along with AdvancedHMI.

Currently I had developed a c# application that gathers "real-time" data from a PLC via Ethernet. I'm using a timer to colect data every 10ms, and hold these data into a list. After a test ends, I pass the data to MySQL db.

But sometimes the test is to fast so I'm not able to gather enough points.

So I'm asking for suggestions. Which solution is better for "real-time" graphing, a thread or a timer?

The main problem is because each test have different parameters that must be updated on the fly. Those parameters are coming form the PLC. So the steps I'm doing are the following:

  1. Init the Zedgraph object
  2. Init the timer
  3. Inside the timer I ask the PLC for "Labels, X-Axis (Time[ms] or Distance), etc)
  4. The PLC send a "validData" flag in order to plot or skip the point
  5. Read X and Y points
  6. Update the chart

I'm pretty sure that my method is awful and very inefficient, but I do not have at this time a better solution.

Thanks in advance

1 Answers1

2

You will never get real-time/consistant results doing the timer on windows. The operating system is not a real-time operating system. If you need samples consistantly at 10ms, you will need to use a timer in the PLC and store the data in the PLC. At the end of the test, you would set a bit and the HMI would monitor that bit. Once the HMI see the bit goe true, the HMI would read all of the samples from the PLC.

As for a graph, if you set the project to target .NET 4.0, there is a built in charting component.

Archie
  • 21
  • 1
  • Storing the data in the PLC and then reading it out after the test is definitely the way to go. – Jason Kennaly Feb 22 '13 at 15:07
  • Greetings, thanks for the reply. I know that windows is not a RTOS, thats the reason I write in quotation marks the "real-time". The fact is that the client wants to use a windows PC. I like your suggestion about storing the test's data in the PLC and later show it in the plot app. I will ask the people of the Control Department if they are willing to change the program in the PLC in order to add this feature. Thank you so much for your suggestion. Its really appreaciated. – Felipe Navarro Feb 22 '13 at 15:50