Difference between revisions of "WCPS: Wireless Cyber-Physical Simulator"
Line 14: | Line 14: | ||
Sensor data is generated from structural models. Through a crossplatform | Sensor data is generated from structural models. Through a crossplatform | ||
function call from Simulink, sensor data is injected to the | function call from Simulink, sensor data is injected to the | ||
+ | |||
+ | [[File:Wcps_framework.png|300px|humb|right|WCPS Architecture]] | ||
+ | |||
corresponding wireless sensors in TOSSIM. Following the routes | corresponding wireless sensors in TOSSIM. Following the routes | ||
and transmission schedule calculated by the network manager module, | and transmission schedule calculated by the network manager module, | ||
Line 29: | Line 32: | ||
Interfacing Block. | Interfacing Block. | ||
− | |||
User inputs to WCPS includes excitation signals to the structure | User inputs to WCPS includes excitation signals to the structure |
Revision as of 17:17, 14 March 2013
End-user's Tutorial on using WCPS: The Wireless Cyber-Physical Simulator
WCPS is design for, but not limited to, realistic Wireless Structural Control simulations. The efficient integration of Simulink and TOSSIM has made WCPS an ideal choice for realistic wireless control simulations. The following tutorial introduces how to install and configure MATLAB, TinyOS, and PYTHON environments, as well as the WCPS framework. The tutorial herein is specifically organized for end-users who do not do much development but instead trying to do wireless control simulations with Simulink and TOSSIM. A more advanced tutorial for developers can be found [here].
Change Log
- Release: March 10, 2013, WCPS v0.1.1 released.
- Tutorial: March 09, 2013, WSC Examples from a structural perspective.
WCPS Principle
As shown in the architecture illustrated in Fig. 2, WCPS simulates the feedback control loop of the control system as follows. Sensor data is generated from structural models. Through a crossplatform 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 then to extracts packet delivery information(the delay and loss)from the message pool of returned values in Simulink. Sensor data and their loss and delay are then provided to the Data Block, which then 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 TOSSIM simulation results to the Interfacing Block.
User inputs to WCPS includes excitation signals to the structure
(e.g., acceleration caused by earthquakes) and wireless traces used
as input to TOSSIM. Excitation signal of the structure is provided
to the structure models in the format of MAT files.
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 [17] 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 [18] used by TOSSIM
for realistic wireless network simulations.
As shown in Fig. 2, the interfaces between the Simulink model
and TOSSIM are encapsulated as two MATLAB embedded functions
in Simulink: the Interfacing Block and the Data Block. 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.
Live Example
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.
- Follow the TinyOS official tutorial on installation of TinyOS for your specific platform: Link
- Directly download the pre-tested TinyOS 2.1.1 image from here: [under construction Cygwin] TinyOS2.1.1 for SnowLeopard and later versions.
Install Mac Layer Architecture(MLA)
- Follow the instructions here: Install MLA.
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
Installation Check
To test if TinyOS, Python and WCPS were configured correctly, pleas read ahead and do the following example.
A Simple Example with WCPS
Wireless Network Setup
- Makefile
"Makefile" takes advantage of the fact that it's not necessary to recompile all the project files that has not been changed. To have the "Makefile" for our project, copy the code below into a txt file and save as "Makefile" without any suffix.
- TestNetwork.h
"TestNetwork.h" defines necessary message structures for the wireless communication. Copy the code below into a txt file and save as "TestNetwork.h".
- TestNetworkAppC.nc
"TestNetworkAppC.nc" connects claimed application interfaces to interfaces that are defined in the hardware librare. Copy the code below into a txt file and save as "TestNetworkAppC.nc".
- TestNetworkC.nc
"TestNetworkC.nc" Implements send/receive functionality of a wireless node. Copy the code below into a txt file and save as "TestNetworkC.nc".
- tossim-call.py
"tossim-call.py" configures TOSSIM network and does packet injection into the Tossim network. Copy the code below into a txt file and save as "tossim-call.py".
- Wireless traces
- Make
To run the network simulation above, we need wireless RSSI (strength of the wireless communication signal) and wireless Noise for Tossim to build Signal to Noise Ratio (SNR) model. Two options to do are:
1) Use the provided RSSI and noise traces for test purposes.
2) Use the code [rssi.zip] to collect the RSSI values and use code [noise.zip] to collect the wireless noise traces.
Example Test
And you are ready to go for the wireless network setup.
Get Support
- TinyOS and TOSSIM: Bo Li: boli@seas.wustl.edu
- Simulink Models: Zhuoxiong Sun: SUN152@purdue.edu
Put all the above files into the same folder, prompt a terminal (or a Cygwin window), and: 1. In the terminal, Make micaz sim and hit return 2. In the terminal ./tossim-call.py
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, D. Dyke, and C. Lu. "A novel data utilization and control strategy for wireless structural control systems with tdma network," In Proc. ASCE IWCCE 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.