Difference between revisions of "WCPS: Wireless Cyber-Physical Simulator"

From Cyber-Physical Systems Laboratory
Jump to navigationJump to search
 
(428 intermediate revisions by 3 users not shown)
Line 1: Line 1:
WCPS: Wireless Cyber-Physical Simulator
+
----
 +
Wireless Cyber-Physical Simulator (WCPS) is an open-source simulation environment for wireless control systems. By integrating Simulink and the TOSSIM wireless sensor simulator in a holistic simulation environment, WCPS accurately captures the dynamics of both the physical systems and the wireless sensor-actuator networks used for control. WCPS has been used for [http://research.engineering.wustl.edu/~boli/papers/iccps13.pdf realistic case studies of wireless structural control systems for civil infrastructure], [http://www.cse.wustl.edu/~lu/papers/iccps16.pdf studying routing and control of cyber physical system], and [http://research.engineering.wustl.edu/~boli/papers/iccps15_final.pdf incorporating emergency alarms in reliable wireless process control]. The broad application of WCPS is to support cyber-physical systems research on large-scale wireless control systems through high-fidelity joint cyber and physical simulations. This site includes the code release, tutorial, and simulation examples for wireless structural control systems.
  
Wireless Structural Control (WSC) systems can play a crucial role
+
== What's New ==
in protecting civil infrastructure in the events of earth quakes and
+
* '''[Software Release]''' WCPS-EC is released. [https://github.com/WU-CPSL/WCPS-EC here].
other natural disasters. Such systems represent an exemplary class
+
* '''[Software Release]''' WCPS-RT is released. [https://github.com/WU-CPSL/WCPS-RT here].
of cyber-physical systems that perform close-loop control using
+
* '''[Software Release]''' Dockerized [[WCPS v3.0]] for industrial process control is released. [http://wsn.cse.wustl.edu/index.php/WCPS_v3.0 here].
real-time sensor data collected through wireless sensor networks.
+
* '''[Software Release]''' [https://nees.org/groups/wireless_control_benchmark Benchmark Problem in Active Structural Control with Wireless Sensor Network].
Existing WSC research usually employ wireless sensors installed
+
* '''[Software Release]''' WCPS v2.0 is released.
on small lab structures, which cannot capture realistic delays and
+
* '''[Software Update]''' [https://nees.org/groups/wireless_control_benchmark Benchmark Wireless Structural Control Problem], July 29, 2014.
data loss in wireless sensor networks deployed on large civil structures
+
* '''[News]''' [http://spectrum.ieee.org/podcast/at-work/test-and-measurement/smart-bridges Smart Bridges - Interview and Podcast on Cyber-Physical Systems for Resilient Bridges], August 07, 2013.
and their impacts on structural control. The lack of realistic
+
* '''[News]''' [http://news.medill.northwestern.edu/chicago/news.aspx?id=222339 Washington Bridge Collapse Could Be a Wake-up Call], May 30, 2013.
studies and tools that capture both the cyber (wireless) and physical
+
* '''[News]''' [http://www.indyposted.com/195455/matthew-roblez-structural-engineering-saves-lives/#.UZ7GqGSAAy8 Matthew Roblez: Structural Engineering Saves Lives], May 22, 2013.
(structures) aspects of WSC systems represent a hurdle for
+
* '''[News Release]''' [http://news.wustl.edu/news/Pages/25358.aspx Engineering Professor Working to Help Bridges Survive Natural Disaster], April 26, 2013.
cyber-physical systems research for civil infrastructure. This paper
+
* '''[Paper]''' [http://research.engineering.wustl.edu/~boli/papers/iccps13.pdf Realistic Case Studies of Wireless Structural Control], ACM/IEEE International Conference on Cyber-Physical Systems (ICCPS'13), April 2013.
advances the state of the art of WSC and Cyber-physical System
+
* '''[Software Update]''' A complete package of Cygwin with TinyOS 2.1.1, MLA, TOSSIM pre-installed was released [http://wsn.cse.wustl.edu/index.php/WCPS:_Wireless_Cyber-Physical_Simulator#Download_WCPS here], April 01, 2013.
through the following contributions. First, we developed the
+
* '''[Software Update]''' WCPS v0.1.1 and the four cases studies for the ICCPS'13 paper was released [http://wsn.cse.wustl.edu/index.php/WCPS:_Wireless_Cyber-Physical_Simulator#Download_WCPS here], March 10, 2013.
Wireless Cyber-Physical Simulator (WCPS), an integrated environment
+
* '''[Tutorial]''' Wireless structural control examples from a [http://research.engineering.wustl.edu/~boli/downloads/wcps_structural_perspective.pdf structural perspective], March 09, 2013.
that combines realistic simulations of both wireless sensor
 
networks and structures. WCPS integrates Simulink and TOSSIM,
 
a state-of-the-art sensor network simulator featuring a realistic wireless
 
model seeded by signal traces. Second, we performed two
 
realistic case studies each matching a structural model with wireless
 
traces collected from real-world environments. The building
 
study combines a benchmark building model and wireless traces
 
collected from a multi-story building. The bridge study combines
 
the structural model of the Cape Girardeau bridge over the Mississippi
 
River and wireless traces collected from a similar bridge
 
(the Jindo Bridge) in Korea. These case studies shed lights on the
 
challenges of WSC and the limitations of a traditional structural
 
controller under realistic wireless conditions. Finally, we proposed
 
a cyber-physical co-design approach to WSC that integrates a novel
 
holistic scheduling scheme (for sensing, communication and control)
 
and an Optimal Time Delay Controller (OTDC) that substantially
 
improves structural control performance.
 
  
==Software Installation==
+
== WCPS Architecture ==
As an administrator of your own wiki, to [[Help:Editing|edit]] your own [[MediaWiki:Sidebar]], replace your wiki page's <title> in the title bar with <MediaWiki:Sidebar>. (The ''editinterface'' permission needs to be enabled and is enabled for administrators by default; for information on assigning it to other groups, see [[Manual:User rights]].) You may need to use the syntax ''//yourdomain/yourwiki/index.php?title=MediaWiki:Sidebar&action=edit'' if you use long URLs.
+
[[File:Wcps_architecture_wcpsv3.png|600px|thumb|right|Figure 1. WCPS Architecture]]  
 +
In the Fig.1, WCPS simulates
 +
the feedback control loop of the control system as follows.
 +
Sensor data is generated from plant models such as structures and water tanks. Through a cross-platform function call from Simulink, sensor data is injected to the
 +
corresponding wireless sensors in TOSSIM. Following the routes
 +
and transmission schedule calculated by the network manager module,
 +
TOSSIM simulates the end-to-end wireless communication of
 +
the sensor data packets from the sensors to the base station, and
 +
then return the packet delay and loss to the Interfacing Block in
 +
Simulink through the Python interface. The Packet Collector module
 +
extracts packet delivery information(the delay and loss)from the message pool. Sensor
 +
data and their loss and delay are provided to the Data Block,
 +
which can feed the sensor data to the controller at the right time
 +
based on the packet delay (if the packet is not lost). WCPS utilizes
 +
basic API (e.g., the dos, UNIX command) of MATLAB to
 +
do cross-platform function calls. In TOSSIM, we re-implement a
 +
printf method in TinyOS to send simulation results to the
 +
Interfacing Block.
  
If you are sure you are logged in with the relevant rights but do not see the ''edit'' link, click on the ''create'' tab at the top of the page - this will take you to the edit page.
+
User inputs to WCPS includes reference signals of the plants and wireless traces used
 +
as input to TOSSIM.
 +
The scheduler module calculates transmission schedules. Networking
 +
schedule is then deployed into the MAC layer code of
 +
wireless nodes and becomes effective after a TinyOS compilation.
 +
The TDMA MAC layer in WCPS is developed based on the MAC
 +
Layer Architecture (MLA) library and further adapted for
 +
TOSSIM under TinyOS 2.1.1. Received Signal Strength Indication(
 +
RSSI) and wireless noises traces are collected from real-world
 +
environments and provided to the wireless model used by TOSSIM
 +
for realistic wireless network simulations.
 +
The interfaces between the Simulink model
 +
and TOSSIM are encapsulated as two MATLAB embedded functions
 +
in Simulink: the Interfacing Block and the Data Block, as is shown in Fig.2. The
 +
Interfacing Block extracts delay and loss information from TOSSIM
 +
messages, and the Data Block decides what data will be used for
 +
discrete control during each sampling period. The federated architecture
 +
of WCPS provides great flexibilities to incorporate different
 +
structural models and implement alternative scheduling-control
 +
approaches.
 +
[[File:simulink.png|600px|thumb|center|Figure 2. Simulink Model]]
 +
 
 +
==Environment Installation==
 +
* Install TinyOS
  
Example sidebar code:
 
[[Image:Example sidebar.png|thumb|Sidebar example]]
 
 
<pre>
 
<pre>
* navigation
+
WCPS is implemented and tested on MacOS X (snowleopard), Windows XP, and Windows 7.
** mainpage|mainpage
+
Current release of WCPS is under  TinyOS 2.1.1, which can be installed following the two methods.
** Special:Recentchanges|Recent changes
 
 
</pre>
 
</pre>
 +
* Follow the TinyOS official tutorial on installation of TinyOS for your specific platform: [http://docs.tinyos.net/tinywiki/index.php/Getting_started#User_Contributed_Methods Link]
 +
* Directly download the pre-tested TinyOS 2.1.1 image from here: [http://research.engineering.wustl.edu/~boli/downloads/tinyos-2.1.1.dmg TinyOS2.1.1 for SnowLeopard(and possibly later versions)] [Cygwin package coming soon.]
  
===Headings===
+
* Install Mac Layer Architecture(MLA)
The navigation bar can be split into sections, each with a heading of its own. The heading for each section is taken from the first-level list element ("navigation" and "new heading" in the example above).
+
<pre>
 +
The MAC Layer Architecture (MLA) provides a component-based architecture for MAC protocols in wireless sensor networks. MLA extends the Unified Power
 +
Management Architecture to provide the hardware-independent interfaces required by timing sensitive MAC protocols, and defines platform-independent
 +
reusable components that implement MAC layer logic on top of them. The MLA architecture can be used to develop a large number of platform-independent
 +
MAC implementations, with little or no further effort required to adapt these implementations to new hardware platforms. Our current implementation of MLA
 +
is built on top of TinyOS 2.1.1. It currently supports platforms which use the CC2420 radio stack and has been tested on TelosB motes. In addition to providing
 +
interfaces and components for building new MAC layer implementations, MLA includes implementations of five representative MAC layers. Specifically for WCPS, we
 +
adopt and further change the pure-TDMA MAC protocol for centralized data communication.  
 +
</pre>
  
If this text corresponds to the name of an interface message (an existing page of that title in the MediaWiki namespace), then the text of that page is used as a label; otherwise, the header title is used as-is.
+
* Follow the instructions here: [http://wsn.cse.wustl.edu/index.php?title=MAC_Layer_Architecture Install MLA].
  
'''Bug:''' no sidebar is shown in the Nostalgia skin ([[bugzilla:10794|bug 10794]]).
+
* Install MATLAB and Simulink
 +
* If you already have MATLAB  MATLAB 7.11.0.584 (2010b) or later version, skip this step. Otherwise, follow the tutorial here: [http://www.mathworks.com/help/install/index.html install MATLAB]
  
===Links===
+
* Install Python
Second-level list elements are links ("mainpage|mainpage" in the example above), where the format is:
+
If you already have Python 2.7.2 or later version installed, skip this step. Otherwise, follow the manual here: [http://www.python.org/getit/ install Python]
<pre>** target|link text</pre>
 
  
; target
+
<pre>
: The link target can be the name of an interface message (page in the MediaWiki namespace) or wiki page, or an external link. In either case, the [[Help:Links|link]] can be internal, interwiki, or external. In some cases (such as links with the "&" character), an interface message is necessary. The link target cannot be made dependent on the interface language set in the preferences.
+
Below is the installation guide of WCPS v3.0.
 +
For Mac OSX Users who would like to run WCPS on their own computer, please follow first instruction link below for a detailed installation and test procedures.
 +
For OSX/Linux/UNIX/Windows users, please follow the second instruction link below for ruining Dockerized WCPS in a Docker container.
 +
</pre>
  
:Algorithm followed:
+
*Install [[WCPS v3.0]] on Mac. [[Run_WCPS_On_Mac_Guide]]
:# Get the target text.
+
*Run [[WCPS v3.0]] using Docker Container. [[Run_WCPS_In_Docker_Container_Guide]]
:# If there is an existing or default interface message with that name, use the content of that message instead of the target text.
 
:# If the output from the previous step is a valid url (beginning with http:// or other [[Manual:$wgUrlProtocols|url protocol]]), the link will point to that url.
 
:# Else, it will treat it as the link target of a wikilink (linking to that page name or interwiki).  
 
:# In case it would end up linking to '-', the whole entry is removed from the sidebar (that's useful for removing an entry on all languages by changing the message holding the link).
 
  
 +
== Download WCPS ==
 +
* Dockerized WCPSv3: [https://hub.docker.com/r/yehan/wcpsv3/ Docker image], [https://github.com/WU-CPSL/WCPSv3_docker local Matlab folder].
 +
* [https://github.com/WU-CPSL/WCPSv3 Local WCPSv3 installation folder].
 +
* [http://research.engineering.wustl.edu/~boli/downloads/cygwin.zip A complete package of Cygwin with TinyOS 2.1.1, MLA, TOSSIM pre-installed] with a [http://research.engineering.wustl.edu/~boli/downloads/WCPS_Cygwin_Installation_Usage_Tutorial.txt WCPS Cygwin Installation & Usage Tutorial]
 +
* [http://research.engineering.wustl.edu/~boli/downloads/wcpsv0.1.1.zip WCPS v0.1.1 and four extensive case studies] for [http://research.engineering.wustl.edu/~boli/papers/iccps13.pdf ICCPS'13 paper]
  
: Examples:
+
== Use WCPS ==
:* "<code>** '''portal-url'''|portal</code>" uses the text of [[MediaWiki:Portal-url]] (which contains "{{MediaWiki:Portal-url}}").
 
:* "<code>** '''Special:Recentchanges'''|Recent changes</code>" links to [[Special:Recentchanges]], since there is no interface message of that name.
 
:* "<code>** '''w:Foo'''|Some interwiki page</code>" links to [[w:Foo]] for the same reason.
 
:* "<code>** '''<nowiki>http://www.mediawiki.org</nowiki>'''|MediaWiki home</code>" links to http://www.mediawiki.org for the same reason.
 
  
 +
Wireless network plays a critical role in close-loop wireless control system. Sitting on top of WCPS, simulating
 +
a wireless TDMA network is as easy as collecting these NesC files below:
  
; text
+
* "Makefile" takes advantage of the fact that it's not necessary to recompile all the files not changed while specifying all necessary libraries.
: The link text can be the name of an interface message (page in the MediaWiki namespace) or plain text.  
+
* "TestNetwork.h" defines necessary message structures for the wireless communication.
:* If the link text is the name of an existing or default interface message, the content of that message will be used. MediaWiki will check for localized versions; for example, if the current language is fr (French) and the link text is the interface message "forum", it will check for "forum/fr" before using "forum".
+
* "TestNetworkAppC.nc" connects claimed application interfaces to interfaces that are defined in the hardware library.
:* Otherwise, the link text is used as the target as-is.  
+
* "TestNetworkC.nc" implements send/receive functionality of a wireless node.
:* Notice that the link text is '''not''' optional as in normal wiki links. If the link text is missing, <u>the item is ignored</u>.  
+
* "tossim-call.py" configures TOSSIM network and does packet injection into the Tossim network.[http://research.engineering.wustl.edu/~boli/downloads/TinyosFiles.zip All above necessary files.].
 +
* Re-implemented TOSSIM libraries for TDMA simulation.[http://research.engineering.wustl.edu/~boli/downloads/pure-tdma.zip TDMA components for TOSSIM.].
 +
* Wireless traces: [http://research.engineering.wustl.edu/~boli/downloads/building_noise_n_rssi.zip Traces for 5-sensor wireless network in a building].
  
: Examples:
+
Put all the above files into the same folder, prompt a terminal (or a Cygwin window), and in the terminal run
:* <code>** Homepage|'''mainpage'''</code> uses [[MediaWiki:Mainpage]] (which contains "{{:MediaWiki:Mainpage}}").
+
<pre>
:* <code>** Special:Recentchanges|'''Recent changes'''</code> uses "Recent changes", since there is no interface message of that name.
+
Make micaz sim
 +
</pre>
  
===Order of elements===
+
If TinyOS and python is configured correctly, go ahead and run in the terminal:
By default, the sidebar consists of elements in this order: navigation, search, toolbox, languages. The order can be changed (in [[rev:37232|MediaWiki 1.13+]]) by adding special keywords (SEARCH, TOOLBOX and LANGUAGES) to [[MediaWiki:Sidebar]] using the heading syntax. For example, the following code moves the search box to the top of the sidebar:
 
 
<pre>
 
<pre>
* SEARCH
+
./tossim-call.py
 
 
* navigation
 
** mainpage|mainpage
 
** Special:Recentchanges|Recent changed
 
* new heading
 
** portal-url|portal
 
** http://www.mediawiki.org|MediaWiki home
 
 
</pre>
 
</pre>
  
== Translations ==
+
Having collected aforementioned TinyOS files, a simplified example that uses key networking Interfacing Block and Data Block of WCPS is shown in Fig. 3.
You can translate the strings, which you use, by editing the according pages in the MediaWiki namespace.
+
[[File:Simple_wcps_example.png|500px|thumb|center|Figure 3. A Simple Example that uses Interfacing and Data Block of WCPS. ]]
 
 
'''Example:''' The string, which will replace the item named "mainpage", is taken from [[MediaWiki:Mainpage]]. To set/change this text for users, who display your wiki in German, you can put the according text on the page [[MediaWiki:Mainpage/de]].
 
 
 
That way you can easily translate these texts through the MediaWiki interface.
 
 
 
For more advanced translation, see [[Help:Extension:Translate/Unstructured element translation]].
 
 
 
==Advanced customization==
 
The sidebar can be fully customized by implementing [[w:JavaScript|JavaScript]] or [[w:Cascading Style Sheets|Cascading Style Sheets]], or by editing the [[w:PHP|PHP]] files directly. Before using these methods, note that:
 
* JavaScript is fragile: it will not work for users with JavaScript disabled, and scripts frequently fail in different browsers or skins.
 
* Editing the PHP files can easily cause unexpected errors, and your changes will be lost in the next update unless you manually change the new files.
 
 
 
===Force UI-messages to follow content===
 
Some pages should sometimes follow the content language, especially for multilingual sites. This can be controlled with the setting [[Manual:$wgForceUIMsgAsContentMsg|$wgForceUIMsgAsContentMsg]]. Each message overridden in this way must be explicitly given, for example to let the sidebar link to versions given by the content language for the main page and the portal page add the following to <code>LocalSettings.php</code>
 
; code
 
<div style="margin-left:2em;"><source lang="javascript">
 
$wgForceUIMsgAsContentMsg = array( 'mainpage', 'portal-url' );
 
</source></div>
 
 
 
===Add or remove sections (JavaScript)===
 
The ''toolbox'', which appears ''under'' the search bar, is a dynamic element and cannot be easily customized without the use of skinning extensions (otherwise it requires programming in PHP.) If you still want to do so, you can copy skins/MonoBook.php, creating a new [[skins|skin]]. You can then make a custom skin to generate these links in your preferred fashion.
 
 
 
Another javascript solution is below.
 
 
 
For this solution to work on the entire mediawiki site, this script has to be copied to [[MediaWiki:Common.js]] ([[MediaWiki:Common.js]] is available for Mediawiki 1.9 +).
 
 
 
For this solution to work only for a specific user, add this script to [[Special:Mypage/monobook.js]] (or another js-page, depending on your prefered [[meta:Help:User style|skin]]).
 
 
 
Now simply configure which link should appear in which section. You also can remove some links if you want to.
 
 
 
; code
 
<div style="margin-left:2em;"><source lang="javascript">
 
function ModifySidebar(action, section, name, link) {
 
    try {
 
        switch (section) {
 
          case "languages":
 
            var target = "p-lang";
 
            break;
 
          case "toolbox":
 
            var target = "p-tb";
 
            break;
 
          case "navigation":
 
            var target = "p-navigation";
 
            break;
 
          default:
 
            var target = "p-" + section;
 
            break;
 
        }
 
 
 
        if (action == "add") {
 
            var node = document.getElementById(target)
 
                              .getElementsByTagName('div')[0]
 
                              .getElementsByTagName('ul')[0];
 
 
 
            var aNode = document.createElement('a');
 
            var liNode = document.createElement('li');
 
 
 
            aNode.appendChild(document.createTextNode(name));
 
            aNode.setAttribute('href', link);
 
            liNode.appendChild(aNode);
 
            liNode.className='plainlinks';
 
            node.appendChild(liNode);
 
        }
 
 
 
        if (action == "remove") {
 
            var list = document.getElementById(target)
 
                              .getElementsByTagName('div')[0]
 
                              .getElementsByTagName('ul')[0];
 
 
 
            var listelements = list.getElementsByTagName('li');
 
 
 
            for (var i = 0; i < listelements.length; i++) {
 
                if (listelements[i].getElementsByTagName('a')[0].innerHTML == name ||
 
                    listelements[i].getElementsByTagName('a')[0].href == link) {
 
 
 
                    list.removeChild(listelements[i]);
 
                }
 
            }
 
        }
 
 
 
    } catch(e) {
 
      // lets just ignore what's happened
 
      return;
 
    }
 
}
 
 
 
function CustomizeModificationsOfSidebar() {
 
    //adds [[Special:CategoryTree]] to toolbox
 
    ModifySidebar("add", "toolbox", "CategoryTree", "http://en.wikipedia.org/wiki/Special:CategoryTree");
 
    //removes [[Special:Upload]] from toolbox
 
    ModifySidebar("remove", "toolbox", "Upload file", "http://en.wikipedia.org/wiki/Special:Upload");
 
}
 
 
 
addOnloadHook(CustomizeModificationsOfSidebar);
 
</source></div>
 
 
 
; Usage
 
: <tt>function CustomizeModificationsOfSidebar()</tt> has to be customized for adding or removing links in specific sections:
 
 
 
: <tt>ModifySidebar("''action''", "''section''", "''name''", "''link''");</tt>
 
 
 
{| class="prettytable" style="margin-left:2em;"
 
! parameter
 
! value
 
|-
 
| <tt>action</tt>
 
| ''add'' to add a link; ''remove'' to remove a link
 
|-
 
| <tt>section</tt>
 
| ''navigation'', ''toolbox'', ''languages'' but also any other existing customized section; the given link will be added to or removed from this section
 
|-
 
| <tt>name</tt>
 
| contains the text of the link
 
|-
 
| <tt>link</tt>
 
| contains the URL of the link
 
|}
 
 
 
; restricting modifications to specific usergroups
 
<div style="margin-left:2em;">
 
If you want to restrict the modification of the links to a specific usergroup (e.g. ''bureaucrat''), change
 
<source lang="javascript">addOnloadHook(CustomizeModificationsOfSidebar);</source>
 
to
 
<source lang="javascript">
 
if (isArray(wgUserGroups)) {
 
    if (wgUserGroups.Contains('bureaucrat')) {
 
        addOnloadHook(CustomizeModificationsOfSidebar);
 
    }
 
}
 
</source>
 
and add
 
<source lang="javascript">
 
function isObject(obj) {
 
    return typeof obj == "object" && obj != null;
 
}
 
 
 
function isArray(obj) {
 
    return isObject(obj) && obj.constructor.toString().indexOf("Array") != -1;
 
}
 
 
 
Array.prototype.Contains = function(element,strict) {
 
    for(i in this) {
 
          if(this[i] == element && !strict || this[i] === element) return true;
 
          }
 
    return false;
 
}
 
</source>
 
 
 
For restricting the modifications to IPs instead of a specific usergroup use
 
<source lang="javascript">
 
if (!isArray(wgUserGroups)) {
 
        addOnloadHook(CustomizeModificationsOfSidebar);
 
}
 
</source>
 
</div>
 
 
 
===Make Expanding/Collapsing Sidebar for all users | only monobook===
 
If you use the monobook-style and don't want to miss the expandable Menubar from e.g. Vector-Skin,
 
paste the following code in [[MediaWiki:Common.js]] of your wiki.
 
<source lang="javascript">
 
///////////////////////////////////////////////////////
 
// Codesnippet to make your sidebaritems expandable  //
 
// Use this code ONLY for monobook-Style.            //
 
///////////////////////////////////////////////////////
 
 
 
$(document).ready(function(){
 
 
 
  //set the default expanded Items by their headline
 
  var defaultExpandItems= ['Navigation', 'Orga'];
 
  //set the basic-name for the cookies, which save the current state of expanding
 
  var expandCookieName = "disdance_project_wiki_nav_expanded_";
 
 
 
  var maxHeights=[]
 
  var expandeds=[];
 
  var labels=[];
 
  initNav();
 
});
 
 
 
function initNav(){
 
    $('#p-logo').css({'position':'relative', 'display':'block'});;
 
    $('.generated-sidebar h5,#p-tb h5 ').each(function(i){
 
     
 
          var id = $(this).parent().attr('id');         
 
          maxHeights[id]=$(this).next('div').height();
 
          var str = $(this).html();
 
          labels[id]=str;   
 
         
 
          if ($.cookie(expandCookieName+id)=='false'  ){             
 
                expandeds[id]=false;
 
                minimize( $(this));
 
               
 
        } else if ($.cookie(expandCookieName+id)=='true'  ){
 
                expandeds[id]=true;
 
                maximize( $(this));
 
       
 
        } else if (defaultExpandItems.indexOf(str)==-1){
 
                expandeds[id]=false;
 
                minimize( $(this));
 
        } else {
 
                expandeds[id]=true;
 
                maximize( $(this));
 
        }
 
        $(this).css({'cursor':'pointer'});
 
        $(this).click(toggleNav);
 
    });
 
}
 
 
 
function minimize(target){
 
    var id=$(target).parent().attr('id');
 
    //You can change the expires-parameter to save the Cookie longer/shorter than 7 days like in this Code
 
    $.cookie(expandCookieName+id,'false', { expires: 7});
 
    var str = labels[id]+"  ►";
 
    $(target).next('div').animate({'height':'0px'});
 
    $(target).html(str);   
 
}
 
 
 
function maximize(target){
 
    var id=$(target).parent().attr('id');
 
    //You can change the expires-parameter to save the Cookie longer/shorter than 7 days like in this Code
 
    $.cookie(expandCookieName+id,'true', { expires: 7});
 
    var str = labels[id]+"  ▼";
 
    var  newHeight = maxHeights[id];
 
    $(target).next('div').animate({'height':newHeight+'px'});
 
    $(target).html(str);   
 
}
 
 
 
function toggleNav(e){
 
    var id=$(e.target).parent().attr('id');
 
    expandeds[id]=!expandeds[id];
 
    if(expandeds[id]==true){
 
      maximize(e.target);
 
    }
 
    else{
 
      minimize(e.target);
 
    }
 
}
 
 
 
///////////////////////////////////////////////////////
 
///////////////////////////////////////////////////////
 
</source>
 
  
===Sidebar width Monobook skin (CSS)===
+
This examples shows:
You can change the width of your sidebar by adding the following CSS rules to your [[MediaWiki:Monobook.css]]<!-- This intentionally says Monobook.css not Common.css -->, note that this is an '''article''' not a file. This changes the width to 15em, the actions position and portlet width should be an em or so less, so I've set them to 14em in this example.
 
<source lang="css">
 
/* increase sidebar width */
 
#column-content { margin-left: -15em }
 
#column-content #content { margin-left: 15em }
 
#p-logo a, #p-logo a:hover { width: 15em }
 
#p-cactions { left: 14.5em }
 
.portlet { width: 14em }
 
div#column-content { margin-left: -14em }
 
div#content { margin-left: 14em }
 
</source>
 
  
===Sidebar width in Vector Skin (CSS)===
+
* How input data in Simulink is injected to TOSSIM network;
 +
* How TOSSIM Interfacing Block runs as a Matlab Embedded function;
 +
* What type of data is output from the Interfacing Block;
 +
* How data usage strategies are applied to the data in the Data Block.
 +
* What type of data is eventually output from the Data Block and provided for future control use.
  
You can change the width of your sidebar by adding the following CSS rules to your [[MediaWiki:Vector.css]]. The standard width in vector skin is 10em. The following example changes the width to 12em:
+
Source code for the example can be found [http://research.engineering.wustl.edu/~boli/downloads/simple_example.zip here].
 +
To run this integrated example, simply download, unzip the source code, and run Run_delay_data_func.m in Matlab.
  
<source lang="css">
+
== WCPS-RT ==
/* increase Vector sidebar width */
 
div#mw-panel {width:12em;}
 
div#footer, #mw-head-base, div#content {margin-left: 12em;}
 
#left-navigation {left: 12em;}
 
</source>
 
  
===Change sidebar content when logged in (PHP)===
+
[[File:Wcps_architecture_wcps_RT.png|300px|thumb|right|Figure 4. WCPS-RT Architecture]]
You can modify the sidebar using a hook. Create a small extension of your own or put the code directly into your LocalSettings.php file.
+
Given the complexity of wireless communication in physical environments, simulators cannot always capture the real-world behavior of WSANs. Network-in-the-loop simulations have been developed to address the limitation of wireless simulations by incorporating physical wireless networks.
  
Some example code adding a 'navigation' sidebar block with a login link for logged out users.
+
To experiment with wireless control over real-world WSANs, we develop wireless cyber-physical simulator real-time (WCPS-RT). WCPS-RT integrates MATLAB/Simulink Desktop Real-time (SLDRT) and a 3-floor WSAN testbed. It captures realistic wireless dynamics that are hard to simulate accurately, and leverages simulation support for controllers and physical plants.
{{Warning|The sidebar's array is cached after this hook is run, if you use sidebar caching and do user specific things in this hook like something that only shows up when logged in or out it may end up cached and not look correctly for some users.}}
+
The architecture of WCPS-RT is shown in Fig. 4.
<source lang="php">
 
<?php
 
$wgHooks['SkinBuildSidebar'][] = 'lfHideSidebar';
 
function lfHideSidebar($skin, &$bar) {
 
global $wgUser;
 
// Hide sidebar for anonymous users
 
if ( !$wgUser->isLoggedIn() ) {
 
$bar = array(
 
'navigation' => array(
 
array(
 
'text'  => wfMsg( 'login' ),
 
'href'  => SpecialPage::getTitleFor( 'Login' )->getLocalUrl(),
 
'id'    => 'n-login',
 
'active' => ''
 
)
 
)
 
);
 
}
 
return true;
 
}
 
</source>
 
===Parser functions in sidebar===
 
Although its not exactly recommended, the sidebar does support [[extension:ParserFunctions|ParserFunctions]], provided the <tt>**</tt> is outside the parser function, and the parser function does not span multiple lines. For example:
 
<pre>
 
*Heading
 
**{{#ifeq:{{NAMESPACE}}|User|Page-to-link-to{{!}}text-to-show-on-user-page}}
 
**{{#ifeq:{{NAMESPACE}}|Talk|Another-Page-to-link-to{{!}}text-to-show-on-talk-page}}
 
</pre>
 
  
works. However the following would '''not''' work since the parser function spans multiple lines:
+
SLDRT is used to simulate the physical part of the WNCS: physical plants, controllers, state observers, and physical disturbance.
<pre>
+
In practice, industrial plants usually operate continuously or at very high rates. However, the wireless communication and controller execute at a relatively low rate because of the communication and computation latencies. Therefore, SLDRT modules are operated at different rates in our design.
*Heading
 
{{#ifeq:1|1|
 
**foo{{!}}bar
 
|
 
**baz{{!}}fred
 
}}</pre>
 
  
{{Warning|1=There is a bug on 1.18 where if a line on MediaWiki:Sidebar contains pipe characters ({{!}}) before expanding parser functions, but not after expanding parser functions, an exception is thrown on all pages ([[bugzilla:33321|bug 33321]]). If such a construction is accidentally introduced to the sidebar, it forces the user to revert MediaWiki:Sidebar using the [[API]] or [[manual:edit.php|edit.php]]. This is fixed in later versions of MediaWiki}}
+
The 3-floor WSAN testbed is deployed on the 3rd to 5th floors of Jolley Hall at Washington University in St. Louis. It consists of 70 TelosB motes.  
 +
Each mote is equipped with Chipcon CC2420 radio compliant with the IEEE 802.15.4 standard and a TI MSP430 microcontroller.  
 +
40 Raspberry Pis with a backplane network are used for the management of the WSAN.
  
==Troubleshooting==
+
The interfaces between SLDRT and WSAN are  socket connections between the PCs that run SLDRT and the Pis, and serial connections between the Pis and the end nodes. In this way, the end nodes of the sensing and actuation flows  can be any nodes in the testbed.
===Changes not showing up===
 
MediaWiki aggressively caches content if possible, which often causes the navigation bar to persist after changes. [[Manual:Purge|Purging the cache]] of affected pages should correct the situation. To perform a mass-purge of all caches at once, [http://www.freebsd.org/cgi/man.cgi?query=touch touch] the <tt>'''LocalSettings.php'''</tt> file or [http://www.mysql.org/doc/refman/5.0/en/truncate.html truncate] the <tt>'''objectcache'''</tt> table in your database (you may have to do both).
 
  
You also need to have [[Manual:%24wgUseDatabaseMessages|$wgUseDatabaseMessages]] set to <tt>true</tt>.
+
== WCPS-EC ==
  
===Lowercase link labels===
+
[[File:Wcps_architecture_wcps_EC.png|350px|thumb|right|Figure 5. WCPS-EC Architecture]]
If your links are not being capitalized as intended, try adding spaces around the bar character; for example:
 
<pre>** http://www.example.com/download.php?file=44555 | Download</pre>
 
  
===Sections disappear or show unexpected content===
+
We built a real-time hybrid simulator, wireless cyber-physical simulator edge-computing (WCPS-EC), which integrates (1) Real controllers running on various computation platforms; (2) Real Wi-Fi network and Ethernet, or simulated network using TOSSIM; (3) Simulink Desktop Real-time (SLDRT), which simulates robotic arm in real-time.
If a section does not display or displays unexpected content, check that the header text isn't the name of an interface message by searching [[Special:Allmessages]]. If it is, use a different header text, or create a new interface message and use it.
 
  
For example, if you want to use "Sidebar" as header text, create the interface message "MediaWiki:Sidebar-header" containing only "Sidebar". Then, use <code><nowiki>* sidebar-header</nowiki></code> as header.
+
The architecture of WCPS-EC is shown in Fig. 5. Compared with WCPS-RT, WCPS-EC includes immigrated controllers running on various computation platforms instead of controllers running in MATLAB/Simulink. In addition, WCPS-EC can reflect the impacts of real communication network and computation platform during run-time.
  
Sections are not displayed if there are no links of the form <code>** target|link text</code> (e.g. when the target was forgotten).
+
In WCPS-RT, the worst-case end-to-end latency is below one sampling period. Hence the actuation commands are set to have fixed latency of one sampling period. However, in multi-tier control systems, the end-to-end latency can be longer than one sampling period. In addition, we consider a more realistic control system setup with (1) clock-driven sensors that sample the plant outputs periodically every sampling period; (2) an event-driven controller which calculates the actuation commands as soon as the sensor data arrives; and (3) event-driven actuators, which means actuators can respond to updated actuation commands immediately.
  
===Broken links after updating [[Special:Version]]===
+
== Talks ==
This will happen e.g., each time there are newer translations for your
+
*Y. Ma, C. Lu, B. Sinopoli and S. Zeng, [http://cps.cse.wustl.edu/index.php/File:EMSOFT.pdf Exploring Edge Computing for Multi-Tier Industrial Control], ESWEEK 2020 - ACM International Conference on Embedded Software (EMSOFT), September 2020.
site language's sidebar items. One could add new redirect pages each
+
* Yehan Ma, [http://cps.cse.wustl.edu/index.php/File:ICII.pdf Efficient Holistic Control over Industrial Wireless Sensor Actuator Networks] , IEEE International Conference on Industrial Internet (ICII'18), Seattle, October 23, 2018.
time, but a better solution would be to use one's own sidebar item names
+
* Chenyang Lu, [http://www.cse.wustl.edu/~lu/talks/iccps16.pdf Wireless Routing and Control: a Cyber-Physical Case Study] , ACM/IEEE International Conference on Cyber-Physical Systems (ICCPS'16), Vienna, April 11, 2016.
instead of trying to keep track of the current MediaWiki translations.
+
* Chenyang Lu, [http://spectrum.ieee.org/podcast/at-work/test-and-measurement/smart-bridges Smart Bridges - Interview and Podcast on Cyber-Physical Systems for Resilient Bridges], IEEE Spectrum, August 07, 2013.
 +
* Chenyang Lu, [http://www.cse.wustl.edu/~lu/talks/temple-wcn.pdf Real-Time Wireless Control Networks for Cyber-Physical Systems], Computer Science Colloquium, Temple University, April 12, 2013.
 +
* Bo Li, [http://research.engineering.wustl.edu/~boli/papers/WCPS-iccps13.pdf Realistic Case Studies of Wireless Structural Control], ACM/IEEE International Conference on Cyber-Physical Systems (ICCPS'13), Philadelphia, PA, April 11, 2013.
  
===Ancient version of MediaWiki===
+
==Publication==
If you have a pre-release version of 1.5 Beta, or earlier, it is still possible in some cases to edit the sidebar:
+
*Y. Ma, C. Lu, B. Sinopoli and S. Zeng, [https://www.cse.wustl.edu/~lu/papers/emsoft20.pdf Exploring Edge Computing for Multi-Tier Industrial Control], IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems (TCAD), Special Issue on ESWEEK 2020 - Proceedings of ACM International Conference on Embedded Software (EMSOFT), September 2020.
*Prior to 1.5 branching (between [[rev:9150]] and [[rev:9177]]) the message utilized was briefly '''MediaWiki:Navbar'''.
+
*Y. Ma, C. Lu and Y. Wang, [https://www.cse.wustl.edu/~lu/papers/tcps20.pdf Efficient Holistic Control: Self-Awareness across Controllers and Wireless Networks], ACM Transactions on Cyber-Physical Systems, Special Issue on Self-Awareness in Resource Constrained Cyber-Physical Systems, 4(4), Article 41, June 2020.
*Before this, version 1.4 had (from [[rev:5528]] to [[rev:9150]]) a global variable, titled [[Manual:$wgNavigationLinks|$wgNavigationLinks]].
+
*Y. Ma and C. Lu, [https://www.cse.wustl.edu/~lu/papers/icii18-holistic-control.pdf Efficient Holistic Control over Industrial Wireless Sensor-Actuator Networks], IEEE International Conference on Industrial Internet (ICII'18), October 2018.
 +
* Y. Ma, D. Gunatilaka, B. Li, H. Gonzalez and C. Lu, [http://www.cse.wustl.edu/~lu/papers/tcps18.pdf Holistic Cyber-Physical Management for Dependable Wireless Control Systems], ACM Transactions on Cyber-Physical Systems, Special Issue on Dependability in Cyber Physical Systems and Applications, 3(1), Article No. 3, August 2018.
 +
* B. Li, Y. Ma, T. Westenbroek, C. Wu, H. Gonzalez, C. Lu. (2016, April). [http://www.cse.wustl.edu/~lu/papers/iccps16.pdf Wireless Routing and Control: a Cyber-Physical Case Study]. ACM/IEEE 7th International Conference on Cyber-Physical Systems (ICCPS'16), April 2016.
 +
* B. Li, L. Nie, C. Wu, H. Gonzalez, C. Lu.[http://research.engineering.wustl.edu/~boli/papers/iccps15_final.pdf Incorporating Emergency Alarms in Reliable Wireless Process Control]. ACM/IEEE 6th International Conference on Cyber-Physical Systems (ICCPS'15), April 2015.
 +
* B. Li, Z. Sun, K. Mechitov, G. Hackmann, C. Lu, S. Dyke, G. Agha and B. Spencer, "[http://research.engineering.wustl.edu/~boli/papers/iccps13.pdf Realistic Case Studies of Wireless Structural Control]," ACM/IEEE International Conference on Cyber-Physical Systems (ICCPS'13), April 2013.
  
==See also==
+
== Get Support ==
* [[Sidebar]]
+
*WCPS v3.0: Yehan Ma: yehan.ma@wustl.edu
* [[Extension:SideBarMenu]]
 

Latest revision as of 07:59, 23 November 2020


Wireless Cyber-Physical Simulator (WCPS) is an open-source simulation environment for wireless control systems. By integrating Simulink and the TOSSIM wireless sensor simulator in a holistic simulation environment, WCPS accurately captures the dynamics of both the physical systems and the wireless sensor-actuator networks used for control. WCPS has been used for realistic case studies of wireless structural control systems for civil infrastructure, studying routing and control of cyber physical system, and incorporating emergency alarms in reliable wireless process control. The broad application of WCPS is to support cyber-physical systems research on large-scale wireless control systems through high-fidelity joint cyber and physical simulations. This site includes the code release, tutorial, and simulation examples for wireless structural control systems.

What's New

WCPS Architecture

Figure 1. WCPS Architecture

In the Fig.1, WCPS simulates the feedback control loop of the control system as follows. Sensor data is generated from plant models such as structures and water tanks. Through a cross-platform function call from Simulink, sensor data is injected to the corresponding wireless sensors in TOSSIM. Following the routes and transmission schedule calculated by the network manager module, TOSSIM simulates the end-to-end wireless communication of the sensor data packets from the sensors to the base station, and then return the packet delay and loss to the Interfacing Block in Simulink through the Python interface. The Packet Collector module extracts packet delivery information(the delay and loss)from the message pool. Sensor data and their loss and delay are provided to the Data Block, which can feed the sensor data to the controller at the right time based on the packet delay (if the packet is not lost). WCPS utilizes basic API (e.g., the dos, UNIX command) of MATLAB to do cross-platform function calls. In TOSSIM, we re-implement a printf method in TinyOS to send simulation results to the Interfacing Block.

User inputs to WCPS includes reference signals of the plants and wireless traces used as input to TOSSIM. The scheduler module calculates transmission schedules. Networking schedule is then deployed into the MAC layer code of wireless nodes and becomes effective after a TinyOS compilation. The TDMA MAC layer in WCPS is developed based on the MAC Layer Architecture (MLA) library and further adapted for TOSSIM under TinyOS 2.1.1. Received Signal Strength Indication( RSSI) and wireless noises traces are collected from real-world environments and provided to the wireless model used by TOSSIM for realistic wireless network simulations. The interfaces between the Simulink model and TOSSIM are encapsulated as two MATLAB embedded functions in Simulink: the Interfacing Block and the Data Block, as is shown in Fig.2. The Interfacing Block extracts delay and loss information from TOSSIM messages, and the Data Block decides what data will be used for discrete control during each sampling period. The federated architecture of WCPS provides great flexibilities to incorporate different structural models and implement alternative scheduling-control approaches.

Figure 2. Simulink Model

Environment Installation

  • Install TinyOS
WCPS is implemented and tested on MacOS X (snowleopard), Windows XP, and Windows 7. 
Current release of WCPS is under  TinyOS 2.1.1, which can be installed following the two methods.
  • Install Mac Layer Architecture(MLA)
The MAC Layer Architecture (MLA) provides a component-based architecture for MAC protocols in wireless sensor networks. MLA extends the Unified Power 
Management Architecture to provide the hardware-independent interfaces required by timing sensitive MAC protocols, and defines platform-independent 
reusable components that implement MAC layer logic on top of them. The MLA architecture can be used to develop a large number of platform-independent 
MAC implementations, with little or no further effort required to adapt these implementations to new hardware platforms. Our current implementation of MLA
is built on top of TinyOS 2.1.1. It currently supports platforms which use the CC2420 radio stack and has been tested on TelosB motes. In addition to providing
interfaces and components for building new MAC layer implementations, MLA includes implementations of five representative MAC layers. Specifically for WCPS, we 
adopt and further change the pure-TDMA MAC protocol for centralized data communication. 
  • Install MATLAB and Simulink
  • If you already have MATLAB MATLAB 7.11.0.584 (2010b) or later version, skip this step. Otherwise, follow the tutorial here: install MATLAB
  • Install Python

If you already have Python 2.7.2 or later version installed, skip this step. Otherwise, follow the manual here: install Python

Below is the installation guide of WCPS v3.0. 
For Mac OSX Users who would like to run WCPS on their own computer, please follow first instruction link below for a detailed installation and test procedures.
For OSX/Linux/UNIX/Windows users, please follow the second instruction link below for ruining Dockerized WCPS in a Docker container.

Download WCPS

Use WCPS

Wireless network plays a critical role in close-loop wireless control system. Sitting on top of WCPS, simulating a wireless TDMA network is as easy as collecting these NesC files below:

  • "Makefile" takes advantage of the fact that it's not necessary to recompile all the files not changed while specifying all necessary libraries.
  • "TestNetwork.h" defines necessary message structures for the wireless communication.
  • "TestNetworkAppC.nc" connects claimed application interfaces to interfaces that are defined in the hardware library.
  • "TestNetworkC.nc" implements send/receive functionality of a wireless node.
  • "tossim-call.py" configures TOSSIM network and does packet injection into the Tossim network.All above necessary files..
  • Re-implemented TOSSIM libraries for TDMA simulation.TDMA components for TOSSIM..
  • Wireless traces: Traces for 5-sensor wireless network in a building.

Put all the above files into the same folder, prompt a terminal (or a Cygwin window), and in the terminal run

 Make micaz sim

If TinyOS and python is configured correctly, go ahead and run in the terminal:

./tossim-call.py

Having collected aforementioned TinyOS files, a simplified example that uses key networking Interfacing Block and Data Block of WCPS is shown in Fig. 3.

Figure 3. A Simple Example that uses Interfacing and Data Block of WCPS.

This examples shows:

  • How input data in Simulink is injected to TOSSIM network;
  • How TOSSIM Interfacing Block runs as a Matlab Embedded function;
  • What type of data is output from the Interfacing Block;
  • How data usage strategies are applied to the data in the Data Block.
  • What type of data is eventually output from the Data Block and provided for future control use.

Source code for the example can be found here. To run this integrated example, simply download, unzip the source code, and run Run_delay_data_func.m in Matlab.

WCPS-RT

Figure 4. WCPS-RT Architecture

Given the complexity of wireless communication in physical environments, simulators cannot always capture the real-world behavior of WSANs. Network-in-the-loop simulations have been developed to address the limitation of wireless simulations by incorporating physical wireless networks.

To experiment with wireless control over real-world WSANs, we develop wireless cyber-physical simulator real-time (WCPS-RT). WCPS-RT integrates MATLAB/Simulink Desktop Real-time (SLDRT) and a 3-floor WSAN testbed. It captures realistic wireless dynamics that are hard to simulate accurately, and leverages simulation support for controllers and physical plants. The architecture of WCPS-RT is shown in Fig. 4.

SLDRT is used to simulate the physical part of the WNCS: physical plants, controllers, state observers, and physical disturbance. In practice, industrial plants usually operate continuously or at very high rates. However, the wireless communication and controller execute at a relatively low rate because of the communication and computation latencies. Therefore, SLDRT modules are operated at different rates in our design.

The 3-floor WSAN testbed is deployed on the 3rd to 5th floors of Jolley Hall at Washington University in St. Louis. It consists of 70 TelosB motes. Each mote is equipped with Chipcon CC2420 radio compliant with the IEEE 802.15.4 standard and a TI MSP430 microcontroller. 40 Raspberry Pis with a backplane network are used for the management of the WSAN.

The interfaces between SLDRT and WSAN are socket connections between the PCs that run SLDRT and the Pis, and serial connections between the Pis and the end nodes. In this way, the end nodes of the sensing and actuation flows can be any nodes in the testbed.

WCPS-EC

Figure 5. WCPS-EC Architecture

We built a real-time hybrid simulator, wireless cyber-physical simulator edge-computing (WCPS-EC), which integrates (1) Real controllers running on various computation platforms; (2) Real Wi-Fi network and Ethernet, or simulated network using TOSSIM; (3) Simulink Desktop Real-time (SLDRT), which simulates robotic arm in real-time.

The architecture of WCPS-EC is shown in Fig. 5. Compared with WCPS-RT, WCPS-EC includes immigrated controllers running on various computation platforms instead of controllers running in MATLAB/Simulink. In addition, WCPS-EC can reflect the impacts of real communication network and computation platform during run-time.

In WCPS-RT, the worst-case end-to-end latency is below one sampling period. Hence the actuation commands are set to have fixed latency of one sampling period. However, in multi-tier control systems, the end-to-end latency can be longer than one sampling period. In addition, we consider a more realistic control system setup with (1) clock-driven sensors that sample the plant outputs periodically every sampling period; (2) an event-driven controller which calculates the actuation commands as soon as the sensor data arrives; and (3) event-driven actuators, which means actuators can respond to updated actuation commands immediately.

Talks

Publication

Get Support

  • WCPS v3.0: Yehan Ma: yehan.ma@wustl.edu