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

From Cyber-Physical Systems Laboratory
Jump to navigationJump to search
Line 35: Line 35:
  
 
==Software Environment Setup==
 
==Software Environment Setup==
As an
 
  
 
Example sidebar code:
 
Example sidebar code:
  
 
===MATLAB===
 
===MATLAB===
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).
 
  
 
===TinyOS===
 
===TinyOS===
Second-level list elements are links ("mainpage|mainpage" in the example above), where the format is:
 
  
 
===PYTHON===
 
===PYTHON===
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
 
  
 
=== Testing ===
 
=== Testing ===
  
That way you can easily translate these texts through the MediaWiki interface.
 
 
For more advanced translation, see [[Help:Extension:Translate/Unstructured element translation]].
 
  
 
== TOSSIM Network setup in WCPS ==
 
== TOSSIM Network setup in WCPS ==
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.
 
  
 
===Application Layer===
 
===Application Layer===
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>
 
  
 
===Mac Layer===
 
===Mac Layer===
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.
 
 
== Wireless Networking Traces ==
 
 
; 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>
 
 
 
=== Physical Layer ===
 
=== Physical Layer ===
If you use the monobook-style and don't want to miss the expandable Menubar from e.g. Vector-Skin,
+
== Real-world Wireless Traces ==
paste the following code in [[MediaWiki:Common.js]] of your wiki.
+
=== Traces from a 4-story building ===
<source lang="javascript">
+
=== Traces from a cable-stayed bridge ===
///////////////////////////////////////////////////////
 
// 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();
 
});
 
  
 
== Simulink Modeling in WCPS==
 
== Simulink Modeling in WCPS==

Revision as of 15:37, 6 February 2013

WCPS: Wireless Cyber-Physical Simulator

Wireless Structural Control (WSC) systems can play a crucial role in protecting civil infrastructure in the events of earth quakes and other natural disasters. Such systems represent an exemplary class of cyber-physical systems that perform close-loop control using real-time sensor data collected through wireless sensor networks. Existing WSC research usually employ wireless sensors installed on small lab structures, which cannot capture realistic delays and data loss in wireless sensor networks deployed on large civil structures and their impacts on structural control. The lack of realistic studies and tools that capture both the cyber (wireless) and physical (structures) aspects of WSC systems represent a hurdle for cyber-physical systems research for civil infrastructure. This paper advances the state of the art of WSC and Cyber-physical System through the following contributions. First, we developed the Wireless Cyber-Physical Simulator (WCPS), an integrated environment 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 Environment Setup

Example sidebar code:

MATLAB

TinyOS

PYTHON

Testing

TOSSIM Network setup in WCPS

Application Layer

Mac Layer

Physical Layer

Real-world Wireless Traces

Traces from a 4-story building

Traces from a cable-stayed bridge

Simulink Modeling in WCPS

Integrated Simulation in WCPS

WSC Examples with WCPS

Wireless Building Control

Wireless Bridge Control

References

  • B. Li, Z. Sun, K. Mechitov, G. Hackmann, C. Lu, S. Dyke, G. Agha and B. Spencer, "Realistic Case Studies of Wireless Structural Control," ACM/IEEE International Conference on Cyber-Physical Systems (ICCPS'13), April 2013.
  • Z. Sun, B. Li, S.J. Dyke and C. Lu, "Evaluation of Performances of Structural Control Benchmark Problem with Time Delays from Wireless Sensor Network," Joint Conference of the Engineering Mechanics Institute and ASCE Joint Specialty Conference on Probabilistic Mechanics and Structural Reliability (EMI/PMC'12), June 2012.
  • H. Lee, A. Cerpa, and P. Levis. Improving wireless simulation through noise modeling. In IPSN, 2007.
  • P. Levis, N. Lee, M. Welsh, and D. Culler. Tossim: Accurate and scalable simulation of entire tinyos applications. In Sensys, 2003.