an inter-wiki page data processor for a m2m system @matsue, 1sep., eskm2013
TRANSCRIPT
An Inter-Wiki Page Data Processor for a M2M System
Takashi Yamanoue, Kentaro Oda and Koichi Shimozono
Kagoshima University, Kagoshima JapanIIAI ESKM 2013, 1st Sep. 2013
• Introduction• Overview of the M2M system• The Data Processor• Usage Example• Comparisons with Related Work• Concluding Remarks
Introduction
• Wiki is friendly to people -> Wiki must be friendly to machines
• Takashi Yamanoue, Kentaro Oda and Koichi Shimozono: A M2M system using Arduino, Android and Wki Software, Proceedings of the 3rd IIAI Internationa Conference on e-Service and Knowledge Management(IIAI ESKM 2012), pp.123-128, Fukuoka, Japan, 20-22 Sep. 2012.
Introduction
Introduction
Introduction
GNDOUT
Vdd
PIRNapionAMN2111
Light SensorDEV-08464
Temperature Sensor.DEV-08777
1kΩ100kΩ
100kΩ
LED
Android TerminalUSB Cable connector
Introduction
• (This time)Add a Data Processor to the mobile terminal.
• The Data Processor– Reads data from the sensors or wiki pages.– Processes the data after that. – Outputs the processed data on a wiki page
or Controls actuators by the processed data. – Is Controlled by the Program which is written on a
Wiki page.
Introduction
Androidterminal
Mobile Terminal
Data Processor
Command
Program
Data
Data
Control
Output
Overview of the M2M system
Actuators
ADK
Androidterminal
Mobile Terminal
Sensors
ADK
Androidterminal
Mobile Terminal
Androidterminal
Mobile Terminal
PukiWiki
PukiWiki
Commands +Sensor data
Commands +Sensor data
Sensor Data
Commands + Program +Output of the Processor
Com
man
ds
Com
man
ds
Sen
sor
Data
Sensor data
Sensors
ADK
Androidterminal
Mobile Terminal
Sen
sor
Data
Com
man
ds,
Prog
ram
Proc
esse
d Dat
a
Commands,
Program
Commands
Com
man
ds,
Pro
gra
m
Processed
Data
Commands + Program +Output of the Processor
The Data Processor
Behavior of a Mobile Terminal
The Data Processor
The Data Processor
Start to read commands and the programfrom the Wiki page.
The Data ProcessorProgram ex.
An Example of the program in a Wiki page
Just like a BASICA Dimension is a Hash tableJust like Lua.
The Data Processor
Output of the Program
The Data Processor
• Equipped with functions for communicating with other objects of the mobile terminal. The data processor can read/write data from/to web pages and sensors/actuators using these functions.
• Equipped with table manipulation functions such like– sumif, countif
of Excel
The Data ProcessorSome of Embedded
Functions
• Sending command to another object.May have a return value
ex(<object>, <command>) Ex. page=ex(“connector” , “getpage http://www.page.ex/”)
The Data ProcessorSome of Embedded
Functions• Extracting result part in the Wiki page
getResultPart(<page>)
The Data ProcessorSome of Embedded
Functions• Parsing CSV and translating the value into an
array
parseCsv(<csv>,<dataTable>, <rowLabel>,<columnLabel>)
The Data ProcessorSome of Embedded
Functions• <csv> <col-label-1>=<val-1-1>,…,<col-label-1-1n>=<val-1-
1n>.
<col-label-2>=<val-2-1>,…,<col-label-2-2n>=<val-2-
2n>.
… <col-label-m>=<val-1-m>, …, <col-label-m-
mn>=<val-m-mn>.
The Data ProcessorSome of Embedded
Functions• <rowLabel> is the hash table
– (“rowcol”, “row”) – (“maxIndex”, maximum row index of the table).
• <columnLabel> is the hash table– (“rowcol”,”col”), – (“maxIndex”, maximum column index of the table), – (<col-label-1>, column index of the label), …, (<col-
label-max>).
The Data ProcessorSome of Embedded
Functions• parseCsv(rpart, dataTable, rowLabel,
columnLabel)• <csv> … rpart device=d, Date=2013/5/5/ 17:6:18, v=0x0c0. device=a-2, Date=2013/5/5/ 17:6:18, v=155. device=a-1, Date=2013/5/5/ 17:6:18, v=53. device=a-0, Date=2013/5/5/ 17:6:45, ave=242, ..., dt=100. device=a-0, Date=2013/5/5/ 17:7:53, ave=242, …, dt=100. …
d Date=2013/5/5/ 17:6:18
0x0c0
a-2 Date=2013/5/5/ 17:6:18
155
a-1 Date=2013/5/5/ 17:6:18
53
a-0 Date=2013/5/5/ 17:6:45
242
a-0 Date=2013/5/5/ 17:7:53
242
(rowcal, col)
(maxIndex, …)
(device, 0)
(Date, 1) (v, 2) (ave,3)
parseCsv(rpart,dataTable,rowLabel,columnLabel)columnLabel
(rowcal, row)
(maxIndex, …)
rowLabeldataTable
The Data ProcessorSome of Embedded
Functions• SumIf
sumif(<dataTable>, <hash table of row or column>,
<index-1>, <operator>, <operand>, <index-2>)
OR
The Data ProcessorSome of Embedded
Functions
The Data ProcessorSome of Embedded
Functions• CountIf
countif(<dataTable>, <hash table of row or column>,
<index-1>, <operator>, <operand>, <index-2>)
OR
The Data ProcessorSome of Embedded
Functions
Usage Example
• A Remote room monitoring/controlling system • Sensor Side
– Acquires human activity, light intensity and temperature data.
– Shows them on 24 wiki pages for each hour of a day• Data Process Side
– Totals up these data into 31 wiki pages for each day of a month,
– By Averaging each sensors’ value of every hour– Controls LEDs of the mobile terminal
Usage Example
Sensor Side Data Process Side
Usage Example
A Wiki page for each hour of a day
Sensor Side
Usage Example
….
command:set out-a-8=0command:get in-d last command:get in-a-2 last command:get in-a-1 lastcommand:get in-a-0 statcommand:set readInterval=300000command:set sendInterval=600000command:set pageName="pir-1-<hour>" …
A Wiki page for each hour, Command part.
Usage Example
….
result: device=a-2,Date=2013/8/30 13:59:4, v=168. device=a-1,Date=2013/8/30/ 13:59:4, v=82. device=a-0,Date=2013/8/30/ 14:0:7, ave=349, sdv=6.8789 …, max=361,min=341, … device=a-0,Date=2013/8/30 14:1:13, ave=349, sdv=6.8349 …, max=360,min=340, …
…
A Wiki page for each hour, Result part.
Usage Example
….
graph: ymax=300 graph: ymin=0graph: x="Date" graph: device="a-2“graph: y-0="v",color="yellow“graph: device="a-1“graph: y-1="v", color="cyan"…
A Wiki page for each hour, Graph part.
Usage Example
• (A part of)Wiki page foreach dayof a month
• Processor Side
Usage Example
Usage Example
command: program daily program: dim dataTable program: dim columnLabel program: dim rowLabel program: ex("service","clear sendBuffer") program: output="" program: url="http://www.yama-lab.org/ adk-wiki-1/index.php?pir-1-"
Usage Example
program: avemax0=0 program: avemax1=0 program: avemax2=0 program: avemin0=1024 program: avemin1=1024 program: avemin2=1024
Usage Example
program: for i=0 to 23 program: page=ex("connector" , "getpage "+url+i) program: rpart=getResultPart(page) program: ex("service","println "+rpart) program: parseCsv(rpart,dataTable,rowLabel,columnLabel)
Usage Example
program: y0=sumif(dataTable, rowLabel, columnLabel("device"), "=", "a-0", columnLabel("sdv")) program: c0=countif(dataTable, rowLabel, columnLabel("device"),"=","a-0") program: ave0=1.0*y0/c0 program: if ave0>avemax0 then avemax0=ave0 program: if ave0<avemin0 then avemin0=ave0
Usage Example
program: dataline="device=a-0, Date="+ dataTable(0,columnLabel("Date"))+ ",ave="+ave0 program: ex("service","println "+dataline) program: ex("service","putSendBuffer "+dataline)
Usage Example
program: if avemax0 < 7.0 then ex("service","set out-a-8=255") else ex("service","set out-d-8=0") program: if avemax1 < 100.0 then ex("service","set out-a-9=255") else ex("service","set out-d-9=0") program: if avemax2 > 160.0 then ex("service","set out-a-10=255") else ex("service","set out-d-10=0") command: end daily command: set pageName="daily-1-<day>" command: set result="" command: run daily
Control actuators
Usage Example
….
result: device=a-0, Date=2013/8/30/ 23:19:8,ave=8.740391630536074 device=a-1, Date=2013/8/30/ 23:19:8,ave=0.07142857142857142 device=a-2, Date=2013/8/30/ 23:19:8,ave=173.28571428571428 device=a-0, Date=2013/8/30/ 0:58:57,ave=8.862115399734035 device=a-1, Date=2013/8/30/ 0:58:57,ave=0.0 device=a-2, Date=2013/8/30/ 0:58:57,ave=177.42857142857142
…
A Wiki page for each day, Result part.
Usage Example
...device=a-1, Date=2013/8/30/ 22:59:8,ave=0.14285714285714285 device=a-2, Date=2013/8/30/ 22:59:8,ave=173.0 device=maxvalues, Data=2013/8/30/ 22:59:8, avemax0=23.272286968015568, avemax1=80.64285714285714, avemax2=177.42857142857142Maximum values of the day. avemax0: a-0, avemax1: a-1, avemax2: a2
My office of two days before yesterday.
Temperature
Light intensity
Human activity
Comparisons with Related Work
• Xively (COSM)– Xively is a real-time open data web service for the
Internet of Things. – has open APIs for uploading and manipulating data– Our M2M system has functions similar to those of
Xively.– the APIs of Xively are used for the Xively site only. – Our system can be used for any PukiWiki site, not only
a specific site.
Comparisons with Related Work
• Scripting Layer for Android (SL4A)– brings popular scripting languages to Android. – We uses our original language processor for the data
processor now. – However the original language is not familiar with
potential users.– We should use SL4A instead of using our original
language processor for this potential users of this M2M system.
Comparisons with Related Work
• Broadcast – Is an embedded web application for remote Android
device management. – uses the SL4A. – Enable Remote Monitoring/Remote Control of an
android device.– However the Broadcast does not have the function for
data exchanging between web pages.
Comparisons with Related Work
• Message Oriented Middleware (MOM) – is software or hardware infrastructure supporting
sending and receiving messages between distributed systems.
– allows application modules to be distributed over heterogeneous platforms and reduces the complexity of developing applications that span multiple operating systems and network protocols.
– Our data processor can be viewed as a MOM.
Concluding Remarks
• Successfully acquired remote room data and totaled up the data using our M2M system.
• It is easy to define the data flow between wiki pages and it is easy to analyze the data of the M2M system by just writing programs on wiki pages.
• This easiness also can be a vulnerability of the security and safety.
Concluding Remarks
• We are considering to enhance the security and safety of the M2M system.
• It is not so difficult to make the data processor not only for this M2M system but also for other purpose.
• We welcome the help of others who would like one to participate in improving and making his or her own sensor/actuator network.
Overview of the M2M system
Actuators
ADK
Androidterminal
Mobile Terminal
Sensors
ADK
Androidterminal
Mobile Terminal
Androidterminal
Mobile Terminal
PukiWiki
PukiWiki
Commands +Sensor data
Commands +Sensor data
Sensor Data
Commands + Program +Output of the Processor
Com
man
ds
Com
man
ds
Sen
sor
Data
Sensor data
Sensors
ADK
Androidterminal
Mobile Terminal
Sen
sor
Data
Com
man
ds,
Prog
ram
Proc
esse
d Dat
a
Commands,
Program
Commands
Com
man
ds,
Pro
gra
m
Processed
Data
Commands + Program +Output of the Processor