Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First of all you have to install the DDS Feature:

 

Image Modified

After that, you can download the MD PnP Software from here:

http://sourceforge.net/projects/mdpnp/

https://github.com/mdpnp/mdpnp

Start the application

 

Image RemovedImage Added

Choose Domain Id 0 (or remeber the choosen value) and run "Start ICE_Supervisor".

Image RemovedImage Added

You can now "Create a local an ICE Device Adap..."Adapter"

Image Added

 Image Removed

And choose e.g. Simulated Pulse Oximeter. Call "Start Simlulated Pulse Oximeter" . After some time, you see e.g.and call "Start PO_Simulator".

Now you will get to the main screen:

Image Added

When you double click on Puls Ox (Simulated) you will see:

Image AddedImage Removed

Now back to Odysseus:

...

Code Block
languagepql
#PARSER PQL
#RUNQUERY
sampleArray := RECEIVEDDSSOURCE({
                    source = 'SampleArray',
                  transport  qosfile= 'dds'${WORKSPACEPROJECT}/ice_library.xml',
                   datahandler idlfile= 'tuple'${WORKSPACEPROJECT}/ice.idl',
                  options=[  topic='SampleArray',
                    ['qosFile','${WORKSPACEPROJECT}/USER_QOS_PROFILES.xml']topictype='ice::SampleArray',
                    qoslibrary='ice_library',
                    ['idlFile','${WORKSPACEPROJECT}/ice.idl'],
qosprofile='waveform_data',
                    domain=0                                                                                                                 
                  }                                                                                        
                )

There are two important files:

USER_QOS_PROFILES.xml 
ice.idl

They contain information necessary for DDS. You can download the files from the following locations:

https://github.com/mdpnp/mdpnp/blob/master/data-types/x73-idl/src/main/idl/ice/ice.idl

https://github.com/mdpnp/mdpnp/blob/master/data-types/x73-idl-rti-dds/USER_QOS_PROFILES.xml

Copy them to the workspace.

If you changed the domain, please update domain value in the options above.

Now run the query, and show as table. You should see something like:

Image Added

As you can see, the values attribute contains a list, and the time attributes a tuple.

Storing to a relational database

If you want to store this data in a database this is not possible directly. You have to "flatten" the data. This can be done as follows:

Code Block
languagepql
mappedValues = MAP({
                    expressions = ['topic','SampleArray'],
                     'unique_device_identifier',                                                        
                     ['topicTypeelementAt(time,0)','SampleArrayseconds'],
                     ['qosLibraryelementAt(time,1)','ice_librarynanoseconds'],                                  
                    [ 'qosProfile','waveform_data']values'                                  
                    ]                  
                  },
                    ['domain','0']
sampleArray
                )
table1 = UNNEST({
              attribute = 'values'            
            },
            mappedValues
          )          ],  
          
table1_WithNumbers = MAP({
                  schema        expressions = [
                      [        'unique_device_identifier',
                              'Stringseconds'],
                             ['metric_id', 'Stringnanoseconds'],
                    ['instance_id          ['counter()','Longpos'],
                              ['unit_idvalues','String']value']
                               ]
                        },
                    ['frequency','long'],    table1
                      )
table2 = MAP({
              expressions = [
                'unique_device_identifier',
                ['valueselementAt(time,0)','List<Double>seconds'],
                    ['elementAt(time,1)','Tuple<Long,Long>nanoseconds'],
                'metric_id',
  ]              'instance_id',
                'unit_id',
                'frequency'            
                }
              ]            
            },
        
    sampleArray
          )

There are two important files:

USER_QOS_PROFILES.xml 
ice.idl

They contain information necessary for DDS. You can download the files from the following locations:

http://sourceforge.net/p/mdpnp/code/ci/master/tree/data-types/x73-idl/src/main/idl/ice/ice.idl
https://github.com/mdpnp/hello-openice/blob/master/USER_QOS_PROFILES.xml

Copy them to the workspace.

If you changed the domain, please update domain value in the options above.

Now run the query, and show as table. You should see something like:

Image Removed

As you can see, the values attribute contains a list, and the time attribute a tuple. If you want to store this data e.g. in a database this is not possible directly. You have to "flatten" the data. This can be done as follows:

...

table1_WithNumbers is only necessary if you want to keep the order of the measurements.

The output will be as:

Image Added

and

Image Added

 

Storing to a document store

You can store complex objects to a document store like MongoDB. For this, you have to convert the tuple to a KeyValueObject. This can be done with the TupleToKeyValueOperator.

See MongoDB Feature for more information on the Mongo DB feature.

Code Block
#RUNQUERY
kv = TUPLETOKEYVALUE(sampleArray)
mongo = MONGODBSINK({PORT = port, HOST = 'host', COLLECTIONNAME = 'collectionname', DATABASE = 'database'}, kv)