DiaSwarm

DiaSwarm provides a design language dedicated to the domain of orchestrating masses of objects. The language provides high-level, declarative constructs that allow a developer to deal with masses of objects at design time, prior to programming the application. The DiaSwarm compiler generates programming frameworks, which provide high-level support to the developer, while ensuring that programming is driven by design.

 

DiaSwarm v 1.1 has been released.

The new version of the design language is a support for the submission on Personal and Ubiquitous Computing Journal - Springer (Special Issue on “Ubiquitous Intelligence and Computing for Enabling a Smarter World”). The generator provides some of the extensions introduced in the article. The new version of the ParkingManagement application introduces personalized parking suggestions presented in the article in Chapter 6.

DiaSwarm studio v1.1                              Runtime environment v1.1                               ParkingManager application v1.1

 

To import and run the ParkingManager application you need to:

1. Import the application archive into Eclipse (File -> Import -> Existing Projects into Workspace -> Select archive file -> Finish)

2. Add the runtime library to the application classpath (Right click on the project ->Build Path -> Configure Build Path... -> Libraries -> Add external JAR -> Select the library)

3. Run the application via the provided Main class.

 

DiaSwarm installation guide Running the ParkingManager application Hello World application
youtube logo youtube logo youtube logo



 

Documentation


Provided Software Packages

Step-by-Step Installation Guide

DiaSwarm Hello World Application

Running the ParkingManager Application

Grammar



 

Provided Software Packages

Please note that all software packages are available under attachments at the bottom of the page.

  • DiaSwarm Studio v. 1.0

DiaSwarm Studio is available as an Eclipse plugin. The tool provides of a domain-specific language and a compiler dedicated to the domain of orchestrating masses of sensors.

  • Runtime environment

This is a library allowing you to execute DiaSwarm applications locally. The runtime environment comprises the Apache Hadoop framework v. 1.2.1 allowing you to run MapReduce jobs locally without the need to install the framework separately.

  • ParkingManager application

This is an example of an orchestrating application dedicated to the management of parking lots in a city. It uses presence sensors to monitor the availability of parking spaces through magnetic field variations. The application defines a few context components, which transform sensed data to determine the availability of parking lots and average occupancy of parking lots in 24 hr. Furthermore, the application suggests parking lots to drivers entering the city. Please note that the availability of parking places is computed every 30 seconds. The average occupancy of parking lots is computed every 2 minutes.

 

Step-by-Step Installation Guide

Requirements:

  1. JDK 1.7 or higher
  2. Eclipse Luna IDE (tested with version 4.4.2)
  3. Latest version of the Xtext Eclipse plugin (tested with version 2.8.2)
  4. DiaSwarm Studio plugin v. 1.0

1. Get the latest Eclipse distribution for your OS from here.

eclipse distribution


2. Install the latest version of the Xtext plugin via the update site.

2.1 Run Eclipse and select Help > Install New Software from the menu.

eclipse install new software


2.2 Use the update site link to install the latest version of Xtext. You will be prompted to restart Eclipse.

eclipse xtext install 1

3. Install the DiaSwarm plugin from the provided zip file.

eclipse diaswarm install 1



 

DiaSwarm Hello World Application

The Hello World application is an example of an air pollution surveillance system in a city. The application gathers data from air pollution sensor, which are deployed in different locations and push data periodically. The application calculates every minute the average pollution level in a location. Such information is available to citizens via information panels. The development of this application is described entirely from design to execution in the following video. The application code is available at the bottom of the page.


youtube logo




Running the ParkingManager Application

1. Download the ParkingManager application archive from the attachments at the bottom of this page.

2. Import the ParkingManager application to your Eclipse workspace.

import parking manager application


import parking manager application

import parking manager application

3. You can now run the application's Main class and track the application execution via log messages in the system console.

3.1 Please note that the first results after the initial banner start appearing 30 seconds later (in accordance with the data delivery contract of the ParkingAvailability context). The logs from the execution of a MapReduce job are available in log files and will appear after refreshing the project.

eclipse run application


eclipse run application

 


 

Grammar

DomainModel =
(IncludeSpec
| ActionDef
| AbstractElement)*;

AbstractElement =
StructDef
| EnumDef
| DeviceDef
| ContextDef
| ControllerDef;

IncludeSpec = 'include' STRING;

StructDef = 'structure' ID '{' (StructFieldDef ';')+ '}';

StructFieldDef = ID 'as' DataTypeRef;

EnumDef = 'enumeration' ID '{' ID (',' ID)* '}';

VariableDef = ID 'as' DataTypeRef;

DataTypeRef =
(StructDef
| EnumDef
| PrimitiveTypeRef) (ListTag)?;

ListTag = '[]';

PrimitiveTypeRef =
'Integer'
| 'Boolean'
| 'String'
| 'Float'
| 'Binary';

DeviceDef = 'device' ID ('extends' DeviceDef)?
'{' (AttributeDef | SourceDef | ActionImpl)* '}';

AttributeDef = 'attribute' ID 'as' DataTypeRef ';' ;

SourceDef = 'source' ID 'as' DataTypeRef
('indexed' 'by' VariableDef (',' VariableDef)*)? ';' ;

ActionImpl = 'action' ActionDef ';' ;

ActionDef = 'action' ID '{' (OrderDef)+ '}';

OrderDef = ID '('(VariableDef(',' VariableDef)*)?')' ';' ;

ContextDef = 'context' ID 'as' DataTypeRef
'{' (InteractionContractDef)* '}';

InteractionContractDef =
'when' ('required' (PullInteractionContract)?
| ('provided' PushInteractionContract BehaviorPublication)
| ('periodic' PushInteractionContract BehaviorPublication)) ';';

PullInteractionContract = ('get' DataRequirement)
(',' DataRequirement)*;

PushInteractionContract = DataRequirement (PullInteractionContract)?;

DataRequirement = DataSource
('grouped' 'by' AttributeDef
('every' Periodicity)?)?
('with' (('map' 'as' DataTypeRef) &
('reduce' 'as' DataTypeRef)))?;

DataSource = SourceRef | ContextDef;

SourceRef = SourceDef 'from' DeviceDef (Periodicity)?;

Periodicity = '';

BehaviorPublication =
'always' 'publish'
| 'no' 'publish'
| 'maybe' 'publish';

TimeUnit = 'hr' | 'min' | 's';

ControllerDef = 'controller' ID '{' (ControllerBehaviorDef)* '}' ;

ControllerBehaviorDef = 'when' 'provided' ContextDef
('get' ContextDef (',' ContextDef)*)?
'do' ActionRef (',' ActionRef)* ';' ;

ActionRef = ActionDef 'on' DeviceDef;

ID = '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;

INT = ('0'..'9')+;

STRING =
'"' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */
| !('\\'|'"') )* '"' |
"'" ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */
| !('\\'|"'") )* "'";