Presentation is loading. Please wait.

Presentation is loading. Please wait.

Use of Multiple Devices

Similar presentations


Presentation on theme: "Use of Multiple Devices"— Presentation transcript:

1 Use of Multiple Devices
FESA: Introduction Use of Multiple Devices 1 CERN BE/CO 1

2 Defining Multiple Devices
FESA: Introduction Data fields defined in the device-data section Properties defined in the device-interface section Devices are defined in the instance file The Eclipse Plugin provides editing tools to work with device definitions: Table Editing View: 2 CERN BE/CO 2

3 Working with Multiple Devices
FESA: Introduction The number of devices in a deploy unit is only known at run-time Get/Set Actions – the device in question is available as a parameter Realtime actions The device collection contains all devices that can trigger the action The device collection can be filtered (see selection criteria later) Your code may select which devices (e.g. isMockDevice) void GenerateNumber::execute(fesa::RTEvent* pEvt) { std::vector<Device*>::iterator device; for(device=deviceCol_.begin();device!=deviceCol_.end();++device) If ( (*device)→isMockDevice.get() // fake reading (*device)→number.set(42,pEvt→getMultiplexingContext()); } Else // real reading (*device)→number.set(driver->read(),pEvt→getMultiplexingContext()); 3 CERN BE/CO 3

4 Device and Global Data FESA: Introduction Global Data items are the same for all devices in a FESA class global-data acquisition and setting data global-interface Acquisition and setting properties There is always only one global device The Global Device has no events-mapping so unique actions cannot be triggered Actions triggered for a device may access the global device By default a class includes the global Diagnostic property used for logging and tracing 4 CERN BE/CO 4

5 Use of Global Data FESA: Introduction The Global Device is intended for use by the class developer or expert The Global Device is present in the database There is no standardised nomenclature for applications to easily access the global device Design the the global-interface for FESA Explorer use For tasks such as device aggregation or collection of statistics it is recommended to use a class association Use the global device to share state between devices The Global Device and hence data can be accessed in code via the Service Locator 5 CERN BE/CO 5

6 Working with the Global Device
FESA: Introduction Example: Ambient temperature compensation Read a temperature sensor at longer intervals and store as global data When individual devices are measured retrieve ambient from the global device and perform compensation void ReadSensor::execute(fesa::RTEvent* pEvt) { double ambientTemp = this->MyClassServiceLocator_->getGlobalDevice() ->ambientTemperature.get(pEvt->getMultiplexingContext()); std::vector<Device*>::iterator device; for(device=deviceCol_.begin();device!=deviceCol_.end();++device) double value = driver→read(device->hardwareID); value = compensationFunction(value,ambientTemp); (*device)→sensorValue.set(value); } 6 CERN BE/CO 6

7 Exercise: Global Data Build on a class with a timer event
Create a global acquisition data item, e.g. ambientTemperature Configure the timer event to trigger an RT-Action for one device In the RT-Action set the global data via the Global Device Create a Server Acquisition Property Add a value-item, do not link it to any data fields Create a custom Get Action Copy data from the Global device to the data container (Code Snippets: Usage of client-data in server-actions) Add extra devices in the instance file From FESA Explorer communicate with each device

8 Selection-criterion The device-collection includes all devices that may process an event by default To limit the device-colection for a specific event use the selection-criterion

9 Selection-criterion The selection-criterion allows you to execute a RTAction for a set of devices that fulfill the same filter criteria. This device-selection must be created at design time. Each device-selection will run in a separate instance of the RTAction. The selection-criterion can be based on: hardware-fields: host and logical-address. device's name, description, accelerator, timingDomain and mainMuxCriterion. fields.

10 Concepts selection-criterion One or more operands
Select for equal field-values All equal operands have the same RTAction instance selection-rule Define the logical connection between the different operands Unary-operation (directly define relevant operand) Binary-operation (define result of an operation between two operands)

11 Field-value Refer to any field Two possibilities:
Implicit: FESA will create one device-group for all devices which share the same field-value. Explicit: The user has to specify a value. All devices with that value will be in the same device-group.

12 Binary/Unary-operation

13 Example You have 5 devices in your .instance file with a numeric field called groupNumber. The groupNumber will be: For the Device1Group1 the value will be 1. For the Device1Group2 and Device2Group2 will be 2. For the Device1Group3 and Device2Group3 will be 3. Also you have 3 RTA triggered by the same event. You can check it in your .design file. Run the deploy unit in order to see how all the RTA iterate all the devices. Exercise: The RTA1 , the deviceCollection should contain only devices with groupNumber=1 The RTA2 , the deviceCollection should contain only devices with groupNumber=2 The RTA3 , the deviceCollection should contain only devices with groupNumber=3 On any problems:


Download ppt "Use of Multiple Devices"

Similar presentations


Ads by Google