Attached is the source code for a simple C# program using RMCLink that does real-time trending of a plot in the RMC75E and RMC150E. All you need to do is enter the IP address, RMC type, and the desired plot template number. RMCLink needs to be installed as well, of course.
You should first set up the plot in the RMC. Make sure to include only items with a REAL data type. For example, don’t include the Status Bits in the plot.
TrendingExampleCS.zip (122 KB)
Instead of starting a new thread, I want to post here since my questions relate to plotting. What I need to do is plot the data (target pressure, actual pressure, control output, actual pressure rate) when the “Ramp pressure up” or “Ramp Pressure Down” buttons are clicked on my GUI. I can do that part of it simple enough with methods provided from Measurement Studio (NI) tools. I have read the help files both in RMC tools and RMCLink as well as downloaded and looked at the Trending Example (my program is vb.NET). However, I’m still a bit hazy on what all I need to do on the vb coding side of it to make it work. I want to just set up the “Individual Plot Settings” within RMC tools and download to the controller. I do not foresee any need for me to change those configurations from my program GUI. Currently, I have the plot settings set at the defaults in RMC Tools as those settings should work fine. Which brings me to my first question - Will that work or am I still required to configure the plot settings from my vb program and write to the RMC? Relating to that, I only have one plot tab viewable (0 - Axis 0) on the plot template editor. I only have one axis wired up to my RMC but I have two others (three axis’ total) configured as I will be adding two more servo axis. Should I have two more plot tabs viewable for the other two axis’ ??
Considering what I am trying to accomplish with my GUI, what is the best method - read a captured plot basic, advanced, or one of the trending methods? With that said, this is only for tuning purposes so I’d like to keep it as simple as possible as far as plotting the data. What methods do I need to use when writing the code and in what order? ie…capture, trigger, read, write, etc?
Are you using NI, or VB, or both? We have an updated RMC LabVIEW driver that would make this very simple. I could send it to you. I believe we also have a VB example for the plot upload and trending as well, which I could send to you.
As for the details, a VB program does not need to set up any plots. The plot configuration can be done all from RMCTools, then the VB program just uploads the plot. As for the plot template tabs, it is very handy having one per plot. You can put all of them on one plot template if you like, but I prefer one axis per plot template.
If this is just for tuning, then the read a captured plot - basic method would be the easiest, and if you only need the 4 data sets you listed (target pressure, actual pressure, control output, actual pressure rate), then you are set. The basic method allows reading 4096 samples per data set, which should be plenty enough. The procedure for the read a captured plot - basic method is very simple:
- Send the command to ramp the pressure (with the default plot settings, a plot is automatically triggered each time a motion command is sent to the axis)
- Wait the amount of time that the plot duration is set for (or you can look at the Plot State register to see if the capture is complete)
- Read directly from the Static Plot Upload Area.
I am using both NI Measurement Studio and VB (Visual Studio 2012), but not Labview. With that said, I think I was making it more difficult than what it really needed to be. Because I have the NI measurement studio tools, I’m just reading and writing the data from those registers every .001 seconds into 1000 element arrays, and then plotting that data to my waveformgraph. ie…"targetPrsAxis0.PlotYAppend(trgtPrsToPlot, 0.001). The waveform graph, I have the X-axis set for 1 second, so it plots the 1000 elements of the array at .001 time increments onto the Waveformgraph. I’m not sure if 1 kHz is good enough but for simply tuning purposes, I thought it was. I don’t have the RMC actually doing any work right now but it is hooked up with transducers and the plotting of the data appears to be working, even if it is completely flatlined on the graph at 0, but that’s consistent right now to those registers in the RMC. The goal is to try and mimic the tuning tools in RMC tools, particularly the ramp up, ramp down, and the plotting of the pressure curves, etc. so that the technician can tune a pressure axis from the GUI and not from RMC tools, for obvious reasons. It will all be manual tuning though, but that’s the best I can do without exposing the Tuning Wizard in RMC tools.
I see. And yes, 1 kHz is plenty, especially since the default loop time of the RMC is 1 msec.