RIO Toolkit

Exercise1 Get and Set data from/to a CERN device

Goal

Implement GET/SET operations fora CERN device using the RIO Toolkit.

Scenario

RIO toolkit provides access to CERN devices. You can Get, Set and Subscribe data.

Figure 1. RIO Toolkit

Design

Implement the Get and Set operations for the “Japc2Lv_T2-cwo-864-pm04” device.

Implementation

  1. Open RIO-get-and-set.vifrom the <RADE-exercises>\RIO\Get-Set directory.Figure 2 and Figure 3 showthe front panel and block diagram.


Figure 2. RIO-get-and-set.viFront Panel

Figure 3. RIO-get-and-set.viBlock Diagram
Get information about fields and their data types
/
  1. Open theparamDescription.vi from the RIO palette and get information about the data fields and data types of the Japc2Lv_T2-cwo-864-pm04/ScalarProperty” parameter.


Figure 4. Fields and their data types for “Japc2Lv_T2-cwo-864-pm04/ScalarProperty”parameter.
/
  • Find paramDescription.vifrom the RIO palette and open it.

/
  • Set”Japc2Lv_T2-cwo-864-pm04/ScalarProperty” in the URL field and run theVI.

  • Find the following fields:
Field name / Field type
I32 / Long
D64 / Double
  • Close the VI.

PART I: Implement a Get operation
  1. Modify the Block Diagram to implementa Get operation. Modify the “get” state as shown in Figure 5.


Figure 5. Get operation
/
  • Open the “get” state and add open.vi,operation.viand close.vifrom the RIO palette to the block diagram.

  • Select “JAPC-Get” function and wire Object and error connectors as shown in Figure 6.

Figure 6. Open, Operation and Close functions
  • Create a Cluster Constant (from Cluster, Class and Variant palette) and put the following field into the cluster as shown in Figure 7.
Field name / Field type
D64 / Double

Figure 7. Cluster constant field
IMPORTANT! / The items in the cluster should have exactly the same names and data types as the fields of a device.
TIP / Right-click on a constant, go to Visible Items and select Label to set a label.
  • Wire URL, Cycle and Data typeinputsof theopen.vias shown in Figure 8.

Figure 8. Open.vi
INFO / Data from the device will be sentas Variant, in the formatthat is connected to the Data type input of the open.vi.
Note:In this example only one field is requested. Therefore, thefield could also be extracted by using just the numeric constant without the enclosing cluster.
/
  • Put Variant To Data function from Variant palette to the Block Diagram.

  • Connect variant, type and errorconnectors of the Variant To Dataas shown in Figure 9.

Figure 9. VariantToData
  • Add Unbundle By Name function to the Block Diagram. Connect it as shown in Figure 10.

Figure 10. UnbundleBy name
  1. Save the VI

PART II: Implement a Set operation
  1. Modify the Block Diagram to implementa Set operation. Modify the “set” state as shown in Figure 11.

Figure 11. Set operation
/
  • Open the“set” state and add open.vi,operation.viand close.vifrom the RIO palette.

  • Select “JAPC-Set”function and wire Object and errorconnectors as shown in Figure 12.

Figure 12. Open, Operation and Close functions
  • Create a Cluster Constant (from Cluster, Class and Variant palette) and put the following fields into the cluster as shown in Figure 13:
Field name / Field type
D64 / Double
I32 / Long
  • Connect the cluster constant to the Data type input of the open.vi as shown in Figure 11.
  • Add Bundle By Name function to the Block Diagram and wire it as shown in Figure 13.

Figure 13. Bundle By Name function
  • Wire the bundled data to the Datainput of the operation.vias shownin Figure 11.

  1. Save the VI.

Testing

Test the VI to verify its operation.
  1. Run the VI.

  1. Press the Get Data button and verify you received data.

  1. Set some valuesin offset and gain and press the Set Data button

  1. Play with Set and Get operations.

NOTE / The settable parameters (I32,D64) affect the received parameter (D64). When several people are settingI32 and D64 at the same time, you will get the latest value depending on the current settings.

Exercise2 Subscribe to data from a device

Goal

Implement the Subscribe operation for a CERN device using RIO Toolkit.

Scenario

RIO toolkit provides access to CERN devices. You can Get, Set and Subscribe to data.

Design

Implement the Subscribe operation for the “Japc2Lv_T2-cwo-864-pm04/ScalarProperty” device.

Implementation

  1. Open the RIO-subscription.vi from the <RADE-exercises>\RIO\Subscription directory. Figure 14 and Figure 15 show the Front Panel and Block Diagram.


Figure 14 RIO-subscription Front Panel

Figure 15 RIO-subscription.vi Block Diagram
Implement subscription operation
  1. Modify the Block Diagram to implementa Subscription operation as shown in Figure 16.


Figure 16 Subscription operation
/
  • Add open.vi,operation.viand close.vifrom the RIO palette to the block diagram.
  • Place the operation.vi in the loop.

  • Select “JAPC-Subscribe”function and wire Object and error connectors as shown in Figure 17.
  • Connect the error wire of close.vitotheerror outindicator.

Figure 17Open, Operation and Close functions
  • Connectthe error wire of Variant To Dataas shown in Figure 18 and Figure 19.

Figure 18 False case

Figure 19 True case
/
  • Replace error loop tunnels with a shift register.

  • WireURL,Cycleand Data type inputs of the open.vi as shown in Figure 20.


Figure 20 Open.vi inputs
  • Connect theTimeout?output of theoperation.vi to thecase structureas shown in Figure 21.
  • Connect the data cluster with the Variant To Dataas shown in Figure 21.
  • Add anUnbundle By Name functionto the block diagram and connect it with the chart indicator and the Variant To Datafunction as shown in Figure 21.


Figure 21 Variant to Data connections
  1. Check for errors in the loop:


/
  • Right-click on the wire of the stop button and select
    Insert->Boolean palette->OR.

  • Connect the error wire to theOR function as shown in Figure 22.


Figure 22 Checking for an error
  1. Save the VI

Testing

Test the VI to verify its operation.
  1. Run the VI.
  2. Check that you receive data.

1