Reading
RMC Plots with a Host Controller
This topic describes how to read the RMC plots with a PLC, HMI, PC (via
RMCLink)
or other host controller. If you need help on viewing RMC plots in RMCTools,
see the Plot Overview topic. For help
on configuring the plots, such as changing the sample period or which
registers are plotted, see the Plot
Template Editor topic.
Determining which Data Items to Read
The RMC plot data items you can read via a host
controller are not necessarily the same as the items displayed in the
Plot Manager because the Plot Manager calculates some items. For example,
some velocities are not actually uploaded from the controller, but are
calculated from the position data.
To see which data items are actually captured
and stored in the RMC:
-
In the Plot Template Editor, on a plot tab, choose Custom.
-
In the Plotted Data table header, click Show Data Items. These are the plot data items that you can read via a host controller.
-
The order of the captured data items can be changed by clicking the Up and Down arrows.
Addressing Methods
You can read plot data via any addressing method
that your RMC supports for the protocol being used:
RMC75 and RMC150:
You can directly address the plot registers.
RMC200:
For protocols using Modbus, DF1 (e.g. EtherNet/IP), and FINS addressing,
or for PROFINET Data Records, the plot data registers are not included
in the fixed data map addresses. You will need to assign the plot data
registers to address ranges for your protocol in the Address
Maps. For details, see DF1
Address Map, FINS
Address Map, Modbus
Address Map, or PROFINET
Data Records Address Map.
For other communication types, such as those
using DMCP,
you can address the plot data registers directly, since they use the IEC Address
Map, which includes all RMC200 registers.
Methods
The RMC provides several methods of reading plots with a host controller:
-
Method 2: Read a Captured Plot - Advanced
With this method, you can read any plot in the RMC. However, it requires more sequencing capabilities in the host controller than Method 1.
-
Method 3: Read a Continuous Plot - Continuous Data
With this method, you can read a plot continuously. As long as the host controller reads keep up with the data capture rate, there will be no gaps or overlap in the data. This method requires sequencing capabilities in the host controller.
-
Method 4: Read a Continuous Plot - Newest Data
With this method, you can read a plot continuously. The newest data is always captured whether or not the data causes an overlap or gap with the last data that was read. This method requires sequencing capabilities in the host controller.
The methods refer to the registers listed
in the Registers section below.
Method
1: Read a Captured Plot - Basic
This method makes it very easy to read plot data, but limits the amount of data that can be read. This method allows reading the following:
RMC75: Maximum 2 plots, maximum 4 data sets per plot
RMC150: Maximum 8 plots, maximum 4 data sets per plot
RMC200: Maximum 4 plots, maximum 16 data sets per plot
The numbers of samples each data set that can be read using this method depends on the communication method:
These sample limits do not necessarily limit the length of the plot in seconds, because the sample time of the plot can be changed. You can also configure which registers are plotted. See the Plot Template Editor topic for details.
Due to addressing limitations of the communication protocols themselves, the RMC cannot provide directly mapped registers for all the plot data. The protocols simply do not have enough address space for all the data in the RMC. The Basic method strikes a compromise by providing some of the plot data as directly mapped registers. If you need to read all the plot data, use one of the other methods.
To read a plot using this method, follow these steps:
1.Wait for the Plot to Complete
Before reading the plot data using this method, the plot must have completed capturing data. Reading the plot before it has completed may result in unusable information.
Use the Plot State register to tell whether the plot has completed capturing. The plot has completed when the Plot State register is 2:
0 = not triggered, 1 = capturing, 2 = complete.
2. Read the Plot Data
Read the data from the Static Plot Upload Area. To find the correct addresses to read from, use the Address Maps in RMCTools, or see the appropriate register map topic: RMC75 Register Map - Static Plot Upload, RMC150 Register Map - Static Plot Upload, RMC200 Register Map - File 640-703 Static Plot Upload
For the RMC200, you may need to configure addresses in the Address Map so your external device can access the Static Plot Upload Area.
If there is a chance that the plot ended early, read the PlotCaptured Samples register to find out how many plot samples were actually captured. Plot data beyond the specified number of captured samples is invalid.
Note:
Many host controllers do not support reading files with 4096 elements. However, smaller blocks of data can be read just as well.
Tip:
In order to use the plot data, you will probably need to know the sample period. The Plot Sample Period register contains that information.
Verifying that the Plot wasn't Overwritten
It is possible that while you are reading up a plot, the plot re-triggers and is overwritten. In that case, your data may be unusable. To check whether the plot was overwritten, compare the Plot ID register, before and after reading the plot data.
Reading a Plot While it's Still Capturing
It is possible to begin reading up a plot before it has finished capturing. However, reading beyond the end of the data set's currently-captured limit will result in unusable information.
To begin reading up a plot before it has finished capturing, follow these steps:
1. Make sure the plot is currently capturing
Read the Plot State register and make sure it is 1 or 2, which means it is in the process capturing data or has completed.
2. Check how many samples have been captured
Read the PlotCaptured Samples register to find out how many plot samples have already been captured.
3. Read the Plot Data
Read any of the plot data from sample 0 up to, but not including, the sample number you obtained from the PlotCaptured Samples register in step 2. Reading beyond that will result in unusable data.
Note:
Method 2 can also be used to read a plot while capturing.
Method
2: Read a Captured Plot - Advanced
Use this method to read any data from any plot. This method uses the Dynamic Plot Upload Area registers.
To read a plot using this method, follow these steps:
1.Write the Requested Read Samples per Data Set
Write the number of samples per data set that you would like returned per read to the Requested Read Samples register. The minimum length of the read itself will be affected by this value, as described later.
2.Write 1 to the Upload Mode/Status Register
Write a value of one (1) to the Upload Mode/Status register. This sets the upload mode to "triggered" and resets the Current Index register to zero.
The Current Index register indicates which sample number of the plot the next read will start at. When it resets to 0, the next read will start at sample 0.
3. Read the Plot Data Starting from Dynamic Plot Upload register #0
You can read the plot data in one read or several reads. Each time, start the read at Dynamic Plot Upload register #0 (Upload Mode/Status Register). The Current Index register will automatically be set to the index of the first sample of the data returned in the read. Each read will return the Dynamic Plot Upload registers 0-4 and the plot samples beginning at the sample number in the Current Index register. Since each read includes registers 0-4, you will have access to this information after each read.
If there is a chance that the plot ended early, read the PlotCaptured Samples register to find out how many plot samples were actually captured. Plot data beyond the specified number of captured samples is invalid.
To read the plot data, repeat these steps until you have read the entire plot:
a. Calculate the Length of the Read.
The length of the read must be long enough to receive the number of samples you wrote to the Requested Read Samples register. In addition to returning Dynamic Plot Upload registers 0-4, each read will return an equal number of samples from each data set in the plot. Use the following equation to calculate the length of the read based on how many samples you wish to read:
length = (Requested Read Samples) x (# of data sets) + 5
The number of samples should not be more the number of samples in the plot. Typically, you will make this calculation once and then always make reads of the same length.
Tip: For best performance over TCP/IP, the read length should be less than 350. This keeps the data within one Ethernet frame, which helps prevent communication delays. The Requested Read Samples may need to be reduced to meet this requirement.
b. Read from Dynamic Plot Upload register 0
Read from register 0 with the length calculated in step a.
c. Do any Error Checking
If you wish, you can use Dynamic Plot Upload registers 0-4 to do error checking, as described below:
You can make use of this to read a plot while it's capturing. You can continuously make reads and only use the data when the Samples Uploaded is not zero.
-
Verify that the Current Index is the value you expect. It should be the index of the first sample of the data returned in the read.
-
Verify that the Plot ID is unchanged. If it has changed, it indicates that you are no longer reading from the same plot. The plot has probably re-triggered and is overwritten. Your data may be unusable.
Note:
If you attempt to read a plot with the Upload Mode set to 1, and the plot is untriggered, the Upload Status will be set to 1 to indicate the error, and the Current Index and Samples Uploaded registers will be 0.
d. Copy Plot Data to Buffer
Before the next read, you should, of course, copy the data you just read to a plot buffer. The Samples Uploaded register reflects how many valid samples you read. If you read past the end of the plot, the Samples Uploaded will be zero.
The data is returned in this format:
R0
|
R1
|
R2
|
R3
|
R4
|
A0,A1,A2
... An-1
|
B0,B1,B2
... Bn-1
|
C0,C1,C2
... Cn-1
|
D0,D1,D2
... Dn-1
|
...
|
where
R0= Upload Mode/Status register
R1= Requested Read Samples register
R2= Current Index register
R3= Plot ID register
R4= Samples Uploaded register
A = sample from data set 0, B = sample from data set 1, etc.
n = number of samples read per data set.
Tip:
In order to use the plot data, you will probably need to know the sample period. The Plot Sample Period register contains that information.
Method
3: Read A Continuous Plot (Trending) - Continuous Data
Use this method to read plot data continuously. This method guarantees no gaps or overlap of data, but it requires that the upload keeps up with the capture of data.
To use this method, the plot should be continuously capturing. To set the plot to continuously capture, issue the Rearm Plot (103) command and do not trigger or start the plot. Important: You must disable the plot's automatic trigger in the Plot Template Editor.
This method uses the Dynamic Plot Upload Area registers.
To read a plot using this method, follow these steps:
1. Verify that the Plot is Continuously Capturing.
Use the Plot State register to tell whether the plot is continuously capturing. The plot is continuously capturing when the Plot State register is 0:
0 = not triggered, 1 = capturing, 2 = complete.
2.Write the Requested Read Samples per Data Set
Write the number of samples per data set that you would like returned per read to the Requested Read Samples register. The minimum length of the read itself will be affected by this value, as described later.
3.Write 2 to the Upload Mode/Status Register
Write a value of two (2) to the Upload Mode/Status Register. This sets the upload mode to "continuous" and resets the Current Index register to zero. The Current Index register indicates which sample number of the plot the next read will start at. When it resets to 0, the next read will start at sample 0. In continuous mode, the Current Index may become very large. It is a 32-bit number and will wrap when it reaches its limit.
If you are reading multiple plots simultaneously and need them synchronized with each other, make sure to write a 2 to the Upload Mode/Status Register to all the desired plots before beginning to read the data from any of them. At the first read of data, the RMC will synchronize the data of all the armed (currently continuously capturing) plots in Upload Mode 2 that have not yet been read.
4. Read the Plot Data Starting from Dynamic Plot Upload register #0
Upload Mode 2 will return valid data only if there is enough captured data to fill the request. If there is not enough captured data, the Samples Uploaded register will return 0. Therefore, the typical method of reading a plot is to keep reading the plot data and only using the data when the Samples Uploaded register is non-zero.
If the read falls too far behind to keep up with the data, the Upload Status bits will be set to two (2) to indicate an overrun error. To recover, restart the plot by writing zero (0) to the Current Index register.
Each time you read the plot data, start the read at Dynamic Plot Upload register #0. The Current Index register will automatically be set to the index of the first sample of the data returned in the read. Each read will return Dynamic Plot Upload registers 0-4 and the plot samples beginning at the sample number in the Current Index register. Since each read includes registers 0-4, you will have access to this information after each read.
To read the plot data repeat these steps:
a. Calculate the Length of the Read.
The length of the read must be long enough to receive the number of samples per data set you wrote to the Requested Read Samples register. In addition to returning Dynamic Plot Upload registers 0-4, each read will return an equal number of samples from each data set in the plot. Use the following equation to calculate the length of the read based on how many samples you wish to read:
length = (Requested Read Samples) x (# of data sets) + 5
The number of samples should not be more the number of samples in the plot. Typically, you will make this calculation once and then always make reads of the same length.
Tip: For best performance over TCP/IP, the read length should be less than 350. This keeps the data within one Ethernet frame, which helps prevent communication delays. The Requested Read Samples may need to be reduced to meet this requirement.
b. Read from Dynamic Plot Upload register #0
Read from the Dynamic Plot Upload register #0 with the length calculated in step a.
c. Do any Error Checking
If you wish, you can use Dynamic Plot Upload registers 0-4 to do error checking, as described below:
If the Upload Status is 1, the plot has been triggered, completed capturing, and has been completely uploaded. To recover, issue the Rearm Plot (103) command to set it to continuous capture.
If the Upload Status is 2, the capturing data overran the data you were going to read. To recover from this error, write zero (0) to the Current Index register, which will restart the plot. You will have to restart reading the plot data.
d. Check the Samples Uploaded Register
Verify that the Samples Uploaded register is not zero. If it is, there is not enough captured data to fulfill the request. Repeat steps b, c, and d until the Samples Uploaded register is non-zero.
e. Copy Plot Data to Buffer
Before the next read, you should, of course, copy the data you just read to a plot buffer.
The data is returned in this format:
R0
|
R1
|
R2
|
R3
|
R4
|
A0,A1,A2
... An-1
|
B0,B1,B2
... Bn-1
|
C0,C1,C2
... Cn-1
|
D0,D1,D2
... Dn-1
|
...
|
where
R0= Upload Mode/Status register
R1= Requested Read Samples register
R2= Current Index register
R3= Plot ID register
R4= Samples Uploaded register
A = sample from data set 0, B = sample from data set 1, etc.
n = number of samples read per data set.
Tip:
In order to use the plot data, you will probably need to know the sample period. The Plot Sample Period register contains that information.
Method
4: Read A Continuous Plot (Trending) - Newest Data
Use this method to read plot data continuously. This method captures data whether or not the data causes an overlap or gap with the last data that was read.
To use this method, the plot should be continuously capturing. To set the plot to continuously capture, issue the Rearm Plot (103) command and do not trigger or start the plot. Important: You must disable the plot's automatic trigger in the Plot Template Editor.
This method uses the Dynamic Plot Upload Area registers.
To read a plot using this method, follow these steps:
1. Verify that the Plot is Continuously Capturing.
Use the Plot State register to tell whether the plot is continuously capturing. The plot is continuously capturing when the Plot State register is 0:
0 = not triggered, 1 = capturing, 2 = complete.
2.Write the Requested Read Samples per Data Set
Write the number of samples per data set that you would like returned per read to the Requested Read Samples register. The minimum length of the read itself will be affected by this value, as described later.
3.Write 3 to the Upload Mode/Status Register
Write a value of three (3) to the Upload Mode/Status Register. This sets the upload mode to "continuous-always newest" and resets the Current Index register to zero. The Current Index register indicates which sample number of the plot the last read started at. In continuous mode, the Current Index may become very large. It is a 32-bit number and will wrap when it reaches its limit.
If you are reading multiple plots simultaneously and need them synchronized with each other, make sure to write a 3 to the Upload Mode/Status Register to all the desired plots before beginning to read the data from any of them. At the first read of data, the RMC will synchronize the data of all the armed (currently continuously capturing) plots in Upload Mode 3 that have not yet been read.
4. Read the Plot Data Starting from Dynamic Plot Upload register #0
Upload Mode 3 will always return the newest data whether or not the data causes an overlap or gap with the last data that was read. Use the Current Index register to keep track of the data. The Current Index register indicates which sample number of the plot the last read started at.
Each time you read the plot data, start the read at Dynamic Plot Upload register #0. Each read will return Dynamic Plot Upload registers 0-4 and the plot samples beginning at the sample number in the Current Index register. Since each read includes registers 0-4, you will have access to the Upload Mode/Status, Current Index, Plot ID, and Samples Uploaded after each read.
To read the plot data repeat these steps:
a. Calculate the Length of the Read.
The length of the read must be long enough to receive the number of samples per data set that you wrote to the Requested Read Samples register. In addition to returning Dynamic Plot Upload registers 0-4, each read will return an equal number of samples from each data set in the plot. Use the following equation to calculate the length of the read based on how many samples you wish to read:
length = (Requested Read Samples) x (# of data sets) + 5
The number of samples should not be more the number of samples in the plot.
Typically, you will make this calculation once and then always make reads of the same length.
Tip: For best performance over TCP/IP, the read length should be less than 350. This keeps the data within one Ethernet frame, which helps prevent communication delays. The Requested Read Samples may need to be reduced to meet this requirement.
b. Read from Dynamic Plot Upload register #0
Read from the Dynamic Plot Upload register #0 with the length calculated in step a.
c. Do any Error Checking
If you wish, you can use Dynamic Plot Upload registers 0-4 to do error checking, as described below:
-
Verify that the Upload Status is 0, meaning no errors have occurred. If the Upload Status is 1, the plot has been triggered, completed capturing, and has been completely uploaded. To recover, issue the Rearm Plot (103) command to set it to continuous capture.
-
Verify that the Plot ID is unchanged. If it has changed, it indicates that you are no longer reading from the same plot. The plot may have been re-triggered or reset.
d. Copy Plot Data to Buffer
Before the next read, you should, of course, copy the data you just read to a plot buffer. Use the Current Index to know where to place the data.
The data is returned in this format:
R0
|
R1
|
R2
|
R3
|
R4
|
A0,A1,A2
... An-1
|
B0,B1,B2
... Bn-1
|
C0,C1,C2
... Cn-1
|
D0,D1,D2
... Dn-1
|
...
|
where
R0= Upload Mode/Status register
R1= Requested Read Samples register
R2= Current Index register
R3= Plot ID register
R4= Samples Uploaded register
A = sample from data set 0,
B = sample from data set 1, etc.
:
n = number of samples read per data set.
Tip:
In order to use the plot data, you will probably need to know the sample period. The PlotSample Period register contains that information.
Registers
The following registers are used in the methods
above. The addresses are given here.
Note: For the RMC200,
for some protocols, you cannot directly address the plot registers, but
will need to use the Address
Maps to assign them to addresses for your protocol.
#
|
Register Name
|
Details
|
RMC75 Address (n= plot #)
|
RMC150 Address (n= plot #)
|
RMC200 Address (n= plot #)
|
Access
|
Data Type
|
Plot Status/Configuration Registers
|
2
|
Plot Sample Period
|
The time between consecutive samples.
|
%MD(32+n).2
|
%MD(96+n).2
|
%MD(512+n).2
|
Read/Write
|
REAL
|
8
|
Plot ID
|
If this value changes, it indicates that you are no longer reading from the same plot. The plot has probably re-triggered.
|
%MD(32+n).8
|
%MD(96+n).8
|
%MD(512+n).8
|
Read Only
|
REAL (RMC75/150) DINT (RMC200)
|
9
|
Plot State
|
Use to determine if the plot is ready to read.
0 = not triggered
1 = capturing
2 = complete
|
%MD(32+n).9
|
%MD(96+n).9
|
%MD(512+n).9
|
Read Only
|
REAL (RMC75/150) DINT (RMC200)
|
10
|
Plot Captured Samples
|
The number of plot sample periods that are actually captured. For captured plots, this value is useful for determining how many samples were captured if the plot ended early.
|
%MD(32+n).10
|
%MD(96+n).10
|
%MD(512+n).10
|
Read Only
|
REAL (RMC75/150) DINT (RMC200)
|
Dynamic Plot Upload Registers
|
0
|
Upload Mode/Status
|
Bits 0-3: Upload Mode
1 = triggered
2 = continuous
3 = continuous, always newest
Bits 4-7: Upload Status
0 = normal
1 = plot state mismatches upload mode
2 = data overran (mode 2 only)
|
%MD(40+n).0
|
%MD(104+n).0
|
%MD(576+n).0
|
Read/Write
|
UDINT
|
1
|
Requested Read Samples
|
This register controls the number of samples provided per data set in the Plot Data registers.
|
%MD(40+n).1
|
%MD(104+n).1
|
%MD(576+n).1
|
Read/Write
|
UDINT
|
2
|
Current Index
|
Indicates the plot sample number currently in the Plot Data registers. Use this to keep track of where you are in reading the data.
|
%MD(40+n).2
|
%MD(104+n).2
|
%MD(576+n).2
|
Read/Write
|
UDINT
|
3
|
Plot ID
|
If this value changes, it indicates that you are no longer reading from the same plot. The plot has probably re-triggered.
|
%MD(40+n).3
|
%MD(104+n).3
|
%MD(576+n).3
|
Read Only
|
UDINT
|
4
|
Samples Uploaded
|
The number of samples available in each data set in the Plot Data. This will either match the Requested Read Samples or be zero if there is not enough data available to read.
|
%MD(40+n).4
|
%MD(104+n).4
|
%MD(576+n).4
|
Read Only
|
UDINT
|
5+
|
Plot Data
|
The actual data.
|
%MD(40+n).5-4095
|
%MD(104+n).5-4095
|
%MD(576+n).5-4095
|
Read Only
|
*
|
See Also
Plot Overview
Send comments on this topic.
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion