RMCLink Component

How to: Read Plots from the RMC70, RMC150, and RMC200

This topic describes how to read the RMC70/150/200 plots via RMCLink. More information is available in the RMCTools help.

Reading plots is demonstrated in the RMCLink VBA example for Microsoft Excel.

Determining which Data Items to Read

The RMC plot data items you can read via RMCLink 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:

  1. In the Plot Configuration Editor, on a plot tab, choose Custom.

  2. In the Plotted Data table header, click Show Data Items. These are the plot data items that you can read via a host controller.

  3. The order of the captured data items can be changed by clicking the Up and Down arrows. To apply any changes to the RMC, click the Download button in the Plot Configuration Editor toolbar.

Methods

The RMC provides several methods of reading plots with a host controller:

The instructions for these 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:

These sample limits do not necessarily limit the length of the plot in seconds, because the sample time of the plot can be changed.

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.

 

Reading a Plot Using the Basic Method

  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, as listed in the RMC70 Address Map, RMC150 Address Map, and RMC200 Address Map topics.

Tip: In order to use the plot data, you will probably need to know the sample period. The 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 Captured 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 Captured Samples register in step 2. Reading beyond that will result in unusable data.

Note: Method 2 below 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 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.

  2. Write the Requested Read Samples
    Write the number of samples you would like returned per read to the Requested Read Samples register. This value is the number of samples per data set you want to receive each read. The minimum length of the read itself will be affected by this value, as described later.

  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.

To read the plot data, repeat these steps until you have read the entire plot:

    1. 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.

    2. Read from Dynamic Plot Upload register 0
      Read from register 0 with the length calculated in step a.

    3. 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 Samples Uploaded is the value you expect. It should be the number of samples read from each data set. If it is zero, you have read past the end of the currently captured data and the data will be unusable. 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.

    1. 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 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 Configuration 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 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.

  3. Write the Requested Read Samples
    Write the number of samples you would like returned per read to the Requested Read Samples register. This value is the number of samples per data set you want to receive each read. The minimum length of the read itself will be affected by this value, as described later.

  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:

    1. 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.

    2. Read from Dynamic Plot Upload register #0
      Read from the Dynamic Plot Upload register #0 with the length calculated in step a.

    3. 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.

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.

      • Verify that the Plot ID register 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.

    1. 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.

    2. 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 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 Configuration 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 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.

  3. Write the Requested Read Samples
    Write the number of samples you would like returned per read to the Requested Read Samples register. This value is the number of samples per data set you want to receive each read. The minimum length of the read itself will be affected by this value, as described later.

  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:

    1. 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.

    2. Read from Dynamic Plot Upload register #0
      Read from the Dynamic Plot Upload register #0 with the length calculated in step a.

    3. 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.

    1. 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 Sample Period register contains that information.

Registers

The following registers are used in the methods above. The addresses are given here.

#

Register Name

Details

RMC70 Address
(n= plot #)

RMC150 Address
(n= plot #)

RMC200 Address
(n= plot #)

Data
Type

Plot Status/Configuration Registers

 

Plot Sample Period

 

File 32+n, Element 2

File 96+n, Element 2

File 512+n, Element 2

REAL

 

Plot ID

 

File 32+n, Element 8

File 96+n, Element 8

File 512+n, Element 8

REAL

 

Plot State

0 = not triggered

1 = capturing

2 = complete

File 32+n, Element 9

File 96+n, Element 9

File 512+n, Element 9

REAL

 

Captured Samples

 

File 32+n, Element 10

File 96+n, Element 10

File 512+n, Element 10

REAL

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)

File 40+n, Element 0

File 104+n, Element 0

File 576+n, Element 0

UDINT

1

Requested Read Samples

 

File 40+n, Element 1

File 104+n, Element 1

File 576+n, Element 1

UDINT

2

Current Index

 

File 40+n, Element 2

File 104+n, Element 2

File 576+n, Element 2

UDINT

3

Plot ID

 

File 40+n, Element 3

File 104+n, Element 3

File 576+n, Element 3

UDINT

4

Samples Uploaded

 

File 40+n, Element 4

File 104+n, Element 4

File 576+n, Element 4

UDINT

5+

Plot Data

 

File 40+n, Element 5-4095

File 104+n, Element 5-4095

File 576+n, Element 5-4095

*

 

See Also

How Do I Overview | RMCLink Component


Send comments on this topic.

Copyright (c) 2024 Delta Computer Systems, Inc. dba Delta Motion