Liuppa, Université de Pau Wireless Software Components Design for Management with PauWare and WMX Fabien Romeo Liuppa, Université de Pau
Agenda Domain: CBSE applied to Wireless Systems Key Problem: Software Components Management PauWare: Executable Models Velcro: PauWare on Wireless Systems WMX: Wireless Management Perspective: Autonomic Computing
Agenda Domain: CBSE applied to Wireless Systems Demo: Bean Builder Key Problem: Software Components Management PauWare: Executable Models Demo: Home Automation System Velcro: PauWare on Wireless Systems Demo: Traffic Light WMX: Wireless Management Demo: Traffic Light – Composition Management Perspective: Autonomic Computing
Component-Based Software Engineering Quality – Time – Cost How to develop high-quality software in a fast and cost-effective way? Software Components : Reuse vs. Invent Build vs. Create Architecture Infrastructure
Extra-functionnal aspects Definition Low coupling, Late binding Elementary piece «A software component is a unit of composition with contractually specified interfaces and explicit context dependencies only. A software component can be deployed independently and is subject to composition by third parties. » Component Software – Beyond Object-Oriented Oriented Programming Second Edition, Addison-Wesley (2002) Required Services Provided Services : API, pre / post conditions, Extra-functionnal aspects —Szyperski, C., Gruntz, D., and Murer, S.
Component Model A simple example : JavaBeans « A Java Bean is a reusable software component that can be manipulated visually in a builder tool. » – JavaBeans Specification 1.01 Methods Properties (attributes) Events Events BeanInfo
Demo : Bean Builder https://bean-builder.dev.java.net/ Mini Browser ClockWork
Analysis / Problems Information on components Documentation Reflexion : structure Bugs : where does the problem comes ? NIH syndrome : it’s the COTS components fault! Blind Trust : it’s the in-house built components fault! Component sellers only provide error-proof components. Incompatibilities Incomplete modeling until assembly : how to get an internal model of COTS components?
Ubiquitous Computing Inside Numerous component models pect, koala, pecos, beanome, frogi, … Trends in computing International Data Corporation, Transition to the Information Highway Era, in Information Industry and Technology Update everyware software
Ubiquitous Computing Today Boom of Wireless Technologies Domotics Automobile And lots of other applications… But …
Mobile Phone Trouble Connect Magazine (June 2006) [www.connect.de] software 42% electronics 13% keypad PERCENT OF MALFUNCTIONS 10% display 9% case 7% other 19%
Car Trouble German Automobile Association ADAC electrical/ electronic systems 32.1% ignition systems* 14.0% engine 11.7% radiator/cooling systems 8.2% wheels or tires 7.0% PERCENT OF MALFUNCTIONS fuel systems 6.3% injection systems* 6.1% gears/transmission 5.5% chassis* 4% *also contain electronics other 5.1%
Research Agenda Toward Open-World Software: Issues and Challenges (IEEE Computer Magazine, October 2006): « A highly dynamic and open system necessitates runtime monitoring to watch for situations that might require suitable reactions to assure the desired level of global quality. […] As a result of monitoring, it should be possible to handle deviations from expected behaviors and plan for a reconfiguration. » I. Crnkovic, “Component-based Software Engineering for Embedded Systems,” in ICSE’05. A. Möller, J. Fröberg, and M. Nolin, “Industrial Requirements on Component Technologies for Embedded Systems,” in CBSE’04. —Luciano Baresi, Elisabetta Di Nitto, and Carlo Ghezzi
Application Management Monitoring Sensors Controlling Activators What to monitor? What to control? Where is the line between the application and the management system? Management System sensors activators Application
Objectives Management of the components’ behavior Behavioral models available at runtime Remote and Wireless Access Execution on « light-weight » devices
MDA + CBSE MDA (Model-Driven Architecture) CBSE Model Centric Developpements Model Transformation UML : structural models and behavioral models CBSE Structural Models : architecture, composition, interfaces… Technological Component Model (model = format) PIM PSM PSM PSM
Queue->add(client) Statecharts [Harel 1987] : Statecharts = state-diagrams : XOR + depth : hierarchie On Off create/ stop/ restart/ destroy/ Wait Process On request / + orthogonality : AND Wait Process On [Queue->isNotEmpty] / Listen request / Queue->add(client) + broadcast-communication : Asynchronous Communication Notation: ^signal
The PauWare Engine Power the execution of Statecharts models (simulation, verification, implementation) All-terrain Java Implementation (J2EE, J2SE et J2ME) Statecharts PauWare Engine PauWare Library Model of the application dynamics
The PauWare Library Declaration of states : Composition of states : Classes Statechart and Statechart_monitor Composition of states : XOR and AND operators Declaration of transitions : fires(String event, Statechart from, Statechart to, boolean guard, Object target, String action, Object[] args); Generation of events : _statechart_monitor.run_to_completion("event"); Statechart Statechart_monitor
Example : Light Light /* the code is incomplete */ On Off Light turnOff turnOn do / display /* UML statecharts */ Statechart _On = new Statechart("On"); _On.doActivity(this,"display"); Statechart _Off = new Statechart("Off"); _Off.inputState(); /* PauWare engine */ Statechart_monitor _Light = new Statechart_monitor(_On.xor(_Off),"Light"); /* UML transitions */ _Light.fires("turnOn",_Off,_On); _Light.fires("turnOff",_On,_Off); /* UML events */ public void turnOn() throws Statechart_exception { _Light.run_to_completion("turnOn"); } public void turnOff() throws Statechart_exception { _Light.run_to_completion("turnOff"); /* the code is incomplete */
Demo : Home Automation System + PauWareView
PauWare Component Model A State Machine Execution Engine (diagrammes UML 2) Model verification at development time Support for implementation Models persist at runtime State Machine Components ? Structure-Behavior Binding (i.e. component-statechart) Support for horizontal composition and vertical composition (hierarchical)
PauWare Component Model « interface » Light functional interface turnOn() turnOff() On Off Light turnOff turnOn do / display Light « implement » « class » Light implementation class « service » turnOn() « service » turnOff() « action » display() _Light 1 _Composytor::Statechart_monitor
Horizontal Composition Components have the same granularity Client / Server or Peer to Peer Provided Interfaces / Required Interfaces Low coupling Distributed Application Statecharts Communication by signal JMS, Message-Driven Bean
Example : Traffic Light RedLight:Light TrafficLight YellowLight:Light GreenLight:Light TrafficLight Start entry: goRed Red Yellow Green goRed/ ^RedLight.turnOn goGreen/ ^GreenLight.turnOn, ^RedLight.turnOff goYellow/^YellowLight.turnOn, ^GreenLight.turnOff goRed/^RedLight.turnOn, ^YellowLight.turnOff On Off Light turnOff turnOn do / display
Vertical Composition (De)composition composite/compound Hierarchie (cf. Fractal) A higher coupling Life-cycle Dependances, encapsulation, … Theoretical Foundations Revised formalization of aggregation and composition in UML (IEEE TSE 29(5) et 29(11) - 2003) State Machines of compound components integrated into the State Machine of the composite as concurrent macro states : public class Light extends _PauWare.Composable {/* ... */} Light redLight, yellowLight, greenLight; Statechart_monitor trafficLight = new Statechart_monitor(redLight.state_machine() .and(yellowLight.state_machine()) .and(greenLight.state_machine()) .and(start.xor(red).xor(yellow).xor(green)));
Example : Traffic Light RedLight:Light YellowLight:Light GreenLight:Light « delegate » TrafficLight Start entry: goRed Red Yellow Green goRed/ ^self.RedLight::turnOn goGreen/ ^self.GreenLight::turnOn, ^self.RedLight::turnOff goYellow/^self.YellowLight::turnOn, ^self.GreenLight::turnOff goRed/^self.RedLight::turnOn, ^self.YellowLight::turnOff GreenLight:Light YellowLight:Light RedLight:Light
Demo : Traffic Light
Velcro PauWare java.lang.reflect PauWare (java.lang.reflect) Velcro
WMX Wireless Management eXtensions http://www.univ-pau.fr/~fromeo/wmx http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/jmxperience.jsp http://www.univ-pau.fr/~fromeo/wmx Unreliable Communication: Asynchronous Mode ? Interface de Management Controle Manager Statechart Monitor Replication ? Coherence ? What to transmit and how ? - Events ? - States ?
Coherence of statecharts (1) Application Side Management Side turnOff Forwarding events causes problems with guards Unknown? Component Component turnOff [component.temperature < 40] turnOff [component.temperature < 40] On On Off Off On On Off Off event turnOn turnOn turnOff component.temperature = 43 And we don’t want to send low states (attributes)
Coherence of statecharts (2) Application Side Management Side turnOff If we forward the transitions… Component Component turnOff [component.temperature < 40] On On Off Off On On Off Off transition turnOn component.temperature = 43 as we still don’t want to send low states (attributes)…
Coherence of statecharts (3) Application Side Management Side turnOff … the statecharts are synchronized … Component Component turnOff [component.temperature < 40] On On Off Off On On Off Off transition turnOn On Off component.temperature = 39 we didn’t have to send low states (attributes) because the internal manager did it for us…
UML Modeling Managed Component Business Component Internal Manager external effector external application port Managed Component provided interface internal effector external pulled sensor Business Component internal pulled sensor Internal Manager required interface internal management port internal management port external management port internal pushed sensor external pushed sensor
Detailed Model «interface» Business Component functional interface service1() service2() «interface» Internal Pushed Sensor control_service1() control_service2() control_serviceX() «interface» External Pushed Sensor state_changed(transition) «interface» Internal Pulled Sensor guard1() guard2() «interface» External Pulled Sensor in(state) «require» «require» «require» Business Component «interface» Internal Effector service1() service2() serviceX() action0() action1() action2() action3() action4() Internal Manager «interface» External Effector execute(action) to_state(state) «require» «implement» «implement» «class» Business component implementation class «service» service1() «service» service2() «service» serviceX() «action» action0() «action» action1() «action» action2() «action» action3() «action» action4() «guard» guard1() «guard» guard2() «class» Internal Manager implementation class control_service1() control_service2() control_serviceX() execute(action) to_state(state) in(state) 1 _Composytor::Statechart_monitor serviceX is not part of the functional interface since it is only sent internally
Composition Management Desynchronization of automates (example : Traffic Light) Undetectable Error by Model Checking It is supposed to work Shows the possibility to define management policies based on the replicated statechart
States – Sub-states (1) RedLight On Off TrafficLight YellowLight Start turnOff On On Off Off do / display turnOn TrafficLight On Off YellowLight turnOff turnOn do / display Start goRed/ ^RedLight.turnOn Red entry: goRed goRed/^RedLight.turnOn, ^YellowLight.turnOff goGreen/ ^GreenLight.turnOn, ^RedLight.turnOff Yellow goYellow/^YellowLight.turnOn, ^GreenLight.turnOff On Off GreenLight turnOff turnOn do / display Green
States – Sub-states (2) RedLight On Off TrafficLight YellowLight Start turnOff On On Off Off do / display turnOn TrafficLight YellowLight Start goRed/ ^RedLight.turnOn turnOff Red entry: goRed On On Off Off goRed/^RedLight.turnOn, ^YellowLight.turnOff do / display goGreen/ ^GreenLight.turnOn, ^RedLight.turnOff Yellow turnOn goYellow/^YellowLight.turnOn, ^GreenLight.turnOff On Off GreenLight turnOff turnOn do / display Green
States – Sub-states (3) RedLight On Off TrafficLight YellowLight Start turnOff On On Off Off do / display turnOn TrafficLight On Off YellowLight turnOff turnOn do / display Start goRed/ ^RedLight.turnOn Red entry: goRed goRed/^RedLight.turnOn, ^YellowLight.turnOff goGreen/ ^GreenLight.turnOn, ^RedLight.turnOff Yellow goYellow/^YellowLight.turnOn, ^GreenLight.turnOff GreenLight Green turnOff On On Off Off do / display turnOn
/ ^self.to_state(state) Composite Manager CompositeManager in(state) / ^managed.in(state) Control to_state(state) / ^managed.to_state(state) Monitor state_changed(transition) execute(action) / ^managed.execute(action) Undefined State Composition Defined State Composition part_state_changed / ^self.check [valid_state_guard] part_state_changed [not valid_state_guard] check / ^self.to_state(state) [consistency_guard] consistency_guard = [( !(state = compositeState1) && !(self.managedIn(compositeState1)) && part1Manager.managedIn(part1ComposedState1) && … && partNManager.managedIn(partNComposedState1) ) || … || ( !(state = compositeStateN) && !(self.managedIn(compositeStateN)) && part1Manager.managedIn(part1ComposedStateN) && … && partNManager.managedIn(partNComposedStateN) )] valid_state_guard = [( part1Manager.managedIn(part1ComposedState1) && … && partNManager.managedIn(partNComposedState1) ) || … || ( part1Manager.managedIn(part1ComposedStateN) && … && partNManager.managedIn(partNComposedStateN) )]
Part Manager PartManager Monitor Control in(state) / ^managed.in(state) state_changed(transition) / ^CompositeManager.part_state_changed Monitor Control to_state(state) / ^managed.to_state(state) execute(action) / ^managed.execute(action)
Demo : Traffic Light Composition Management with WMX
Towards Autonomic Computing Cf. Cyril Ballagny’s on-going thesis…
Performances? Deployed on a HP iPAQ hx4700 Complex Case Studies : JVM IBM J9 Complex Case Studies : Home automation system Railcar System (J2EE + JMS) …, your system
Overhead per state change Performances – Quantitative Study Benchmark 100.000 loops of state changes (adaptated from JAC Benchmark) Intel Centrino 1600MHz, 512 Mo RAM, WinXP, JVM 1.5 SUN Implementation Benchmark Overhead per state change Pure Java 2 ms 0 μs Java + reflect API 14 ms 0,12 μs JMX (internal access) 721ms 7,19 μs PauWare (w/o cache) 1491 ms 14,89 μs PauWare (w cache) 1027 ms 10,25 μs Velcro (w/o cache) 1529 ms 15,27 μs Velcro (w cache) 1038 ms 10,36 μs Following implementations include I/O or networking Pure Java + System.out.print() 2584 ms 25,82 μs WMX (velcro + sockets) 3893 ms 38,91 μs JMX + RMI connector 22077ms 220,75 μs
Conclusion PauWare Velcro + WMX SELF-* Liuppa Project Perspectives Components driven by executable statecharts But also a framework for experimenting research results in MDA, CBSE, … Velcro + WMX Management of the software components’ behavior in the context of wireless systems SELF-* Liuppa Project Perspectives Integration into other component models (OSGi, Fracal, …) Persistance at runtime of other types of models, (other views for management) Autonomic Computing (Cyril) SOUL System Oriented UAV Laboratory UAV Unmanned Air Vehicle (drone) AESE Aéronautique, Espace et Systèmes Embarqués
[PauWare] « Power is not a means, it is an end. » — George Orwell, Nineteen Eighty-Four Thank you for reading! Fabien Romeo, Franck Barbier, Jean-Michel Bruel, Autonomic Management of Component-Based Embedded Software, IFIP/IEEE Symposium on Integrated Management, Munich, Germany, 21-25 may, 2007. (to appear) Fabien Romeo, Cyril Ballagny, Franck Barbier, PauWare : un modèle de composant basé état, Actes des Journées Composants, Canet en Roussillon, France, 4-6 octobre, pp. 1-10, 2006. Code available at http://www.pauware.com http://www.univ-pau.fr/~fromeo/wmx
Management Communication Demo Management Communication (WMA) Management Console (JMX) Wireless Components (J2ME)
Librairie PauWare Event State-based programming support public void f_c() throws Statechart_exception { _Programmable_thermostat.fires(_Ambient_temperature_displaying,_Ambient_temperature_displaying); _Programmable_thermostat.fires(_Target_temperature_displaying,_Target_temperature_displaying,true,this,"switch_mode"); _Programmable_thermostat.fires(_Program_target_temperature_refreshing,_Program_target_temperature_refreshing,true,this,"switch_mode"); _Programmable_thermostat.run_to_completion(); } UML-2 run-to-completion model execution mode
Exécution de modèles
Demo Fan switch Is on Is auto Season switch Is on Is cool Is off auto on/ ^programmable thermostat.fan switch turned on Is auto off/ ^programmable thermostat.season switch turned off Is cool Is heat Is on cool heat Is off Season switch
Conception des composants Exemple des UML 2.0 Components (source : UML2.0 Superstructure)
Un composant composite (source : UML2.0 Superstructure)