• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
DDS Tutorial -- Part I
 

DDS Tutorial -- Part I

on

  • 624 views

The Data Distribution Service (DDS) is a standard for efficient and ubiquitous data sharing built upon the concept of a, strongly typed, distributed data space. The ability to scale from resource ...

The Data Distribution Service (DDS) is a standard for efficient and ubiquitous data sharing built upon the concept of a, strongly typed, distributed data space. The ability to scale from resource constrained embedded systems to ultra-large scale distributed systems, has made DDS the technology of choice for applications, such as, Power Generation, Large Scale SCADA, Air Traffic Control and Management, Smart Cities, Smart Grids, Vehicles, Medical Devices, Simulation, Aerospace, Defense and Financial Trading.

This two part webcast provides an in depth introduction to DDS – the universal data sharing technology. Specifically, we will introduce (1) the DDS conceptual model and data-centric design, (2) DDS data modeling fundamentals, (3) the complete set of C++ and Java API, (4) the most important programming, data modeling and QoS Idioms, and (5) the integration between DDS and web applications.

After attending this webcast you will understand how to exploit DDS architectural features when designing your next system, how to write idiomatic DDS applications in C++ and Java and what are the fundamental patterns that you should adopt in your applications.

Statistics

Views

Total Views
624
Views on SlideShare
615
Embed Views
9

Actions

Likes
2
Downloads
27
Comments
2

2 Embeds 9

http://icorsaro.net 7
http://www.icorsaro.net 2

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel

12 of 2 previous next

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • Hello Dan,

    The problem is not so much strong typing as the type system. The example I did used the active floor and active building just to show different ways of organizing the information. That said, I'll explain in the Part II of the webcast how to deal with extensibility. To give you a preview, the extensibility problem can be easily solved by using the new DDS type systems which provides you with structural typing. This way, without giving away strong typing you enjoy extensibility and avoid recompilation. If you can't wait for the Part II of the tutorial, take a look at: http://www.slideshare.net/Angelo.Corsaro/extensible-and-efficient-data-centric-architectures?from_search=1

    A+
    Are you sure you want to
    Your message goes here
    Processing…
  • One concern about strongly typed code is the potential for requiring recompile and re-deployment. The change to TCell would require all users of TCell to be recompiled and re-deployed. It was not completely clear in the example but I think that Partition is an alternative. TCell could remain unchanged if floor is selected by partition instead of field within the modified TCell topic. But then the code that creates publishers and subscribers would probably have to change to use the right partition names. How could the example go 3-D w/o having to re-deploy?
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    DDS Tutorial -- Part I DDS Tutorial -- Part I Presentation Transcript

    • OpenSplice | DDS Tutorial -- Part I -Angelo CORSARO, Ph.D. Chief Technology Officer OMG DDS Sig Co-Chair PrismTech angelo.corsaro@prismtech.com
    • Grasping the Idea
    • DDS is a standard technology for ubiquitous, interoperable, secure, platform independent, and real-time data sharing across network connected devices
    • Data Distribution Service (DDS) • DDS’ Global Data Space is fully distributed, highly efficient and scalable Data Reader Data Writer QoS Data Writer TopicD Data Reader QoS TopicA Data Writer QoS QoS TopicC Data Reader TopicB ... Data Writer Data Reader DDS Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. • DDS provides a Global Data Space abstraction that allow applications to autonomously, anonymously, securely and efficiently share data
    • Data Distribution Service (DDS) • Data Writer DataWriters and DataReaders are automatically and dynamically matched by the DDS Discovery A rich set of QoS allows to control existential, temporal, and spatial properties of data QoS Data Writer TopicD Data Reader QoS TopicA Data Writer QoS QoS TopicC Data Reader TopicB ... Data Writer Data Reader DDS Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Data Reader
    • Fully Distributed Data Space Conceptual Model Actual Implementation Data Reader QoS Data Writer TopicD Data Writer QoS QoS TopicC TopicD TopicD TopicA QoS TopicD Data Reader Data Reader QoS Data Writer TopicB Data Reader DDS Global Data Space Data Reader QoS Data Writer TopicB ... Data Writer QoS QoS Data Reader QoS TopicA Data Writer QoS TopicA Data Writer QoS TopicC Data Reader Copyright  2013,  PrismTech  –    All  Rights  Reserved. Data Writer
    • Fully Distributed Data Space Data Writer QoS QoS TopicD TopicD Data Reader The  communication   between  the   DataWriter  and  the   DataReader  can  use   UDP/IP  (Unicast   and  Multicast)or   TCP/IP QoS Data Writer TopicA QoS TopicD Data Reader QoS Data Writer QoS TopicA Data Writer QoS TopicC Data Reader Copyright  2013,  PrismTech  –    All  Rights  Reserved. TopicB
    • Key Highlights Elegant and High Level Data Sharing Abstraction Polyglot and platform independent • • • Java, Scala, C, C++, C#, JavaScript, CoffeeScript etc. Android, Windows, Linux,VxWorks, etc. Peer-to-Peer by nature, Brokered when useful Copyright  2013,  PrismTech  –    All  Rights  Reserved. • •
    • Key Highlights Content and Temporal Filtering (both sender and receiver filtering supported) • • Queries 20+ QoS to control existential, temporal, and spatial properties of data Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Key Highlights • • ~35-50 usec latency* 7M msgs/sec node-to-node throughput* (*) Performance measured on Linux Host with i7 processor on a 1Gbps Ethernet network Copyright  2013,  PrismTech  –    All  Rights  Reserved. • High Performance and Scalable
    • Who is Using DDS?
    • Use Cases Training & Simulation Systems Naval Combat Systems Copyright  2013,  PrismTech  –    All  Rights  Reserved. Integrated Modular Vetronics Air Traffic Control & Management Unmanned Air Vehicles Aerospace Applications
    • Use Cases Large Scale SCADA Systems Smart Cities Copyright  2013,  PrismTech  –    All  Rights  Reserved. Agricultural Vehicle Systems Train Control Systems Complex Medical Devices High Frequency Auto-Trading
    • Decomposing DDS
    • Information Organization
    • Domain • • DDS data lives within a domain • The number 0 identifies the default domain A domain represent an impassable communication plane DDS Domain Copyright  2013,  PrismTech  –    All  Rights  Reserved. • A domain is identified with a non negative integer, such as 1, 3, 31
    • Partitions • Partitions are the mechanism provided by DDS to organize information within a domain • • Access to partitions is controlled through QoS Policies Partitions are defined as strings: • “system:telemetry” “system:log” “data:row-­‐2:col-­‐3” Partitions addressed by name or regular expressions: • • ”system:telemetry” “data:row-­‐2:col-­‐*” Partitions Copyright  2013,  PrismTech  –    All  Rights  Reserved. • • •
    • Information Definition
    • Topic A Topic defines a domain-wide information’s class QoS name: identifies the topic within the domain • qos: is a collection of policies that express the non-functional properties of this topic, e.g. reliability, persistence, etc. type: is the programming language type associated with the topic. Types are extensible and evolvable TopicA QoS QoS TopicC TopicB ... Name Topic e Typ • • QoS Copyright  2013,  PrismTech  –    All  Rights  Reserved. A Topic is defined by means of a (name, type, qos) tuple, where TopicD Qo S • •
    • Topic and Instances As explained in the previous slide a topic defines a class/type of information Topics can be defined as Singleton or can have multiple Instances Topic Instances are identified by means of the topic key A Topic Key is identified by a tuple of attributes -- like in databases Remarks: • • A Singleton topic has a single domain-wide instance A “regular” Topic can have as many instances as the number of different key values, e.g., if the key is an 8-bit character then the topic can have 256 different instances Copyright  2013,  PrismTech  –    All  Rights  Reserved. • • • • •
    • Example
    • Active Floor • • Assume we are building an active floor • This information is then used by the application that uses the active floor for positioning or entertainment Copyright  2013,  PrismTech  –    All  Rights  Reserved. This active floor is made by a matrix of pressure sensors used to detects position, and indirectly movement Cell:  (i,j)
    • Active Floor • The generic active cell can be modeled with a topic that has an instance for each value of (i,j). The topic type can be defined as: struct  TCell  {      short  row;        short  column;      float  pressure;  //  in  kPa }; #pragma  keylist  TCell  row  column Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Each cell is now distinguishable and associated with a topic instance Cell:  (i,j)
    • Active Floor How can we know when something is on the cell? • The detection can be based on the difference between the atmospheric pressure, say P0, and the pressure sensed by the cell • We can model this as a Singleton Topic ReferencePressure defined by the type: struct  TReferencePressure  {      float  pressure;  //  in  kPa      float  precision;   }; #pragma  keylist  TReferencePressure Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Cell:  (i,j)
    • Active Floor time 4 e ssur Pre 2 3 • 3 time Each sensor has associated a topic instance identified by the (row,column) coordinate -- the instance key struct  TCell  {      short  row;      short  column;      float  pressure;  //  in  kPa }; #pragma  keylist  Cell  row  column time • Each instance produces a stream of pressure values that in DDS terms are called samples Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • Going 3D
    • Active Floors on a Building ti me re su es Pr 1 re su es Pr 2 3 4 Let’s assume now that we have a building that uses active floors to detect presence and movement How can we organize the out data model? ti me 0 re su es Pr 0 • • 1 Copyright  2013,  PrismTech  –    All  Rights  Reserved. 2 ti me 3
    • Active Floors on a Building 1 re su es Pr 1 re su es Pr 2 3 4 ti me 0 re su es Pr 0 • The first thing to do is to introduce the third dimension to our cell: struct  TCell  {      short  row;      short  column;      short  floor;      float  pressure;  //  in  kPa }; #pragma  keylist  TCell  row  column  floor Copyright  2013,  PrismTech  –    All  Rights  Reserved. ti me 2 ti me 3
    • Active Floors on a Building ti me ti me 1 re su es Pr 1 re su es Pr 2 3 4 ti me 0 re su es Pr 0 As we move from a single floor to a building we need to add some more structure to our data • 2 • We can now use: • • • • A Domain for each Building A Partition for each Floor A Partition for reference value, i.e. Partition A Partition for the configuration information, e.g. how many floors, how many rows/cols per floor Copyright  2013,  PrismTech  –    All  Rights  Reserved. 3
    • Active Floors on a Building 1 re su es Pr 1 re su es Pr 4 Floor Partitions: • 2 3 Thus the resulting structure is: ti me 0 re su es Pr 0 • • • • • • “building:f-­‐1” “building:f-­‐2” ... Reference Values Partition: • “building:refvals” Configuration Partition: • “building:config” Copyright  2013,  PrismTech  –    All  Rights  Reserved. ti me 2 ti me 3
    • Producing Information
    • DataWriter Conceptually, the DataWriter QoS should be the same as the Topic QoS or more stringent • However, DDS does enforce a specific relationship between the Topic and DataWriter QoS e Typ • Topic DW Copyright  2013,  PrismTech  –    All  Rights  Reserved. A DataWriter (DW) is a strongly typed entity used to produce samples for one or more instances of a Topic, with a given QoS Qo S •
    • DataWriter Define a new topic instance Write samples for a topic instance Dispose the topic instance e Typ • • • Topic DW Copyright  2013,  PrismTech  –    All  Rights  Reserved. The DataWriter controls the life-cycle of Topic Instances and allows to: Qo S •
    • Consuming Information
    • DataReader Conceptually, the DataReader QoS should be the same as the Topic QoS or less stringent • However, DDS does enforce a specific relationship between the Topic and DataReader QoS e Typ • Topic DR Copyright  2013,  PrismTech  –    All  Rights  Reserved. A DataReader (DR) is a strongly typed entity used to access and/or consume samples for a Topic, with a given QoS Qo S •
    • DataReader time 4 e ssur Pre 2 3 • 3 time time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader • 3 time 2 time 3 4 e ssur Pre n=3 time Depending on its QoS a DataReader may provide access to: • • • last sample last n samples all samples produced since the DataReader was created Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • DataReader e ssur Pre 4 Samples are stored in the DataReader Cache • time 2 3 • 3 Samples can be read or taken from the cache • time • Samples taken are evicted from the cache • time Samples read remain in the cache and are simply market as read The cache content can be selected based on content or state. More on this later... Copyright  2013,  PrismTech  –    All  Rights  Reserved. 1 2 e ssur Pre 0 1 e ssur Pre 0
    • Putting all Together
    • DDS Entities Domain (e.g. Domain 123) Domain Participant Topic Partition (e.g. “Telemetry”, “Shapes”, ) Topic Instances/Samples Ta • • • • Tb Publisher Subscriber Tx Ty Tc DataWrter DataReader DomainParticipant: Provides access to a data cloud -- called a domain in DDS Topic: Domain-wide definition of a kind of Information Publisher/Subscriber: Provide scope to data sharing through the concept of partitions DataReader/DataWriter: Allow to read/write data for a given topic in the partitions their Subscriber/Publisher are associated with. Copyright  2013,  PrismTech  –    All  Rights  Reserved. T1 T1 T3
    • DomainParticipant The DomainParticipant is the programming entity that gives access to a DDS domain • A DomainParticipant is created as follows: //  ISO  C++  DDS  API int  domain_id  =  18; auto  dp  =  DomainParticipant(domain_id); //  Java  5  DDS  API int  domain_id  =  18; DomainParticipantFactory  dpf  =              DomainParticipantFactory.getInstance(env) DomainParticipant  dp  =          dpf.createParticipant(domainId); Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Topic Given a DomainParticipant we can define (or discover) Topics within a domain. This can be done as follows: //  ISO  C++  DDS  API auto  topic  =  Topic<TCell>(dp,  “Cell”); • //  Java  5  DDS  API Topic<TCell>  topic  =          dp.createTopic(“Cell”,  TCell.class); As this declaration does not explicitly provide QoS for the Topic, the default QoS will be used Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Publisher/Subscriber Publisher/Subscriber, through the Partitions they are associated with, define the scope of a write/read operation • • Partitions association is done through the Partition QoS Policy This association can be defined as a list of string as well as a list of regular expressions Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Publisher/Subscriber Definition of a Publisher/Subscriber in the default partition: //  ISO  C++  DDS  API auto  pub  =  Publisher(dp); • //  ISO  C++  DDS  API auto  sub  =  Subscriber(dp);   Definition of a Publisher/Subscriber with Partition settings //  ISO  C++  DDS  API auto  pub_qos  =        dp.default_publisher_qos()        <<  Partition(”af:telemetry”); auto  pub  =  Publisher(dp,  pub_qos); //  ISO  C++  DDS  API auto  sub_qos  =        dp.default_subscriber_qos()        <<  Partition(”af:telemetry”); auto  sub  =  Subscriber(dp,  sub_qos); Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Publisher/Subscriber //  Java  5  DDS  API Publisher  pub  =  dp.createPublisher(); • //  Java  5  DDS  API Subscriber  sub  =  dp.createSubscriber();   Definition of a Publisher/Subscriber with Partition settings //  Java  5  DDS  API PublisherQos  pubQoS  =        dp.getDefaultPublisherQos()          .with(pf.Partition(”af:telemetry”)); //  Java  5  DDS  API SubscriberQos  subQoS  =        dp.getDefaultSubscriberQos()          .with(pf.Partition(”af:telemetry”)); Publisher  pub  =        dp.createPublisher(pubQoS); Subscriber  sub  =        dp.createSubscriber(subQoS); Copyright  2013,  PrismTech  –    All  Rights  Reserved. • Definition of a Publisher/Subscriber in the default partition:
    • DataWriter A DataWriter with default QoS can be declared as follows: //  ISO  C++  DDS  API auto  dw  =  DataWriter<TCell>(pub,  topic); //  Write  the  cell  c(1,1)  using  `writer` TCell  c11  =  {1,  1,  15}; dw.write(c11); //  Write  the  cell  c(1,2)  using  the  `operator  <<` TCell  c12  =  {1,  2,  5}; dw  <<  c12; //  Java  5  DDS  API DataWriter<TCell>  dw  =  pub.createDataWriter<TCell>(topic); TCell  c11  =  new  TCell(1,  2,  15); dw.write(c11); Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • DataReader A DataReader with default QoS can be declared as follows: //  ISO  C++  DDS  API auto  dr  =  DataReader<TCell>(sub,  topic); //  Read  Samples auto  samples  =  dr.read(); //  Do  something  with  it std::for_each(samples.begin(),  samples.end(),  do_something); //  Java  5  DDS  API DataReader<TCell>  dr  =  sub.createDataReader<TCell>(topic); Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Does DDS “JavaScripts”?
    • Topic JavaScript var myTopic = new dds.Topic(domainID, topicName, topicType); Example: var topic = new dds.Topic(0, 'Cell', 'com.activefloor.Cell'); CoffeeScript Example: topic = new dds.Topic(0, 'Cell', 'com.activefloor.Cell') Copyright  2013,  PrismTech  –    All  Rights  Reserved. myTopic = new dds.Topic(domainID, topicName, topicType)
    • DataWriter CoffeeScript dw = new dds.DataWriter(topic, qos) Example: dw = new dds.DataWriter(topic) dw.write(cell) Copyright  2013,  PrismTech  –    All  Rights  Reserved. cell = {} cell.x = 3 cell.y = 5 cell.pressure = 3
    • DataReader CoffeeScript dr = new dds.DataReader(topic, qos) Example: Copyright  2013,  PrismTech  –    All  Rights  Reserved. dr = new dds.DataReader(topic)
    • Binding a DataReader A DataReader can be bound to a user provided function that will handle incoming data or to a cache • Notice, that as you are in control of how data-readers are bound to cache you can be very creative Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Binding to User Function CoffeeScript dr.addListener(f) Example: Copyright  2013,  PrismTech  –    All  Rights  Reserved. dr.addListener((s) -> console.log(JSON.stringify(s)))
    • Binding to a Cache CoffeeScript cache = new DataCache(historyDepth) bind(keyMapper)(dr, cache) // Binding bindCell = dds.bind((s) -> s.x + “-” + s.y) ccache = new DataCache(historyDepth) bindCell(cache, cdr) // Working with the Cache: Compute number of active cells activeCells = ccache.map((c) -> if (c > p0) then 1 else 0).fold(0)((a, c) -> a + c) Copyright  2013,  PrismTech  –    All  Rights  Reserved. Example:
    • Demo
    • Shapes Application • The iShapes application is used by DDS vendors to demonstrate some of the basic mechanism as well as product interoperability • Three Topics • Circle, Square, Triangle One Type struct ShapeType { string color; long x; long y; long shapesize; }; #pragma keylist ShapeType color Spotted shapes represent subscriptions Pierced shapes represent publications Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Copyright  2013,  PrismTech  –    All  Rights  Reserved. Android Shapes
    • Data Modeling
    • Data Centricity • • DDS is Data Centric, it provides an elegant, efficient and scalable data sharing abstraction When designing the architecture of a DDS-based system the DataModel is the first thing that should be devised One of the most common question from DDS novices is how to come up with a good data model. Data Reader Data Writer QoS Data Writer TopicD Data Reader QoS TopicA Data Writer QoS QoS TopicC Data Reader TopicB ... Data Writer Data Reader DDS Global Data Space Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Data Modeling in DDS A good starting point for identifying DDS topics is to describe your system in a natural language and then use the following table: English Language DDS Common Noun Topic Proper Noun Topic Instance Transitive Verb Relationship Intransitive Verb Attribute Type Adjective Topic Attribute Adverb Relationship Attribute Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Relationships As in DBMS, relationships can be expressed, depending on cardinality and relation attributes, by: • • Keys and foreign keys Relationship Topics Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • Normalization • Notice that the nature of DDS may induce further data normalization to deal with conflicting QoS requirements, such as: • • Mix of frequently and infrequently changing data Mix of attributes that have different persistence requirements Copyright  2013,  PrismTech  –    All  Rights  Reserved. • As in DBMS, Topics should be normalized to improve modularity, efficiency and limit if not avoid anomalies. Typically you should have your Topics in the 3NF
    • Part I Summary & Remarks
    • Summary & Remarks DDS provides an elegant Data Space abstraction that allows application to share data ubiquitously and efficiently -- the Data Space implementation is fully distributed • DDS provides primitives for defining classes of information as well as organizing it • Data Modeling and normalization draws heavily from DBMS theory and practice with some additional considerations w.r.t. the nature of DDS Copyright  2013,  PrismTech  –    All  Rights  Reserved. •
    • :: Connect with Us :: ¥opensplice.com ¥opensplice.org ¥forums.opensplice.org ¥opensplicedds@prismtech.com ¥@acorsaro ¥@prismtech ¥ crc@prismtech.com ¥youtube.com/opensplicetube ¥slideshare.net/angelo.corsaro ¥sales@prismtech.com