Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
CHAPTER 2 THEORITICAL FOUNDATION 2.1 Theoretical Foundation This chapter provides the detailed explanations of the terms and theories used in this thesis. The author believed that the terms and theories will help the readers to understand the theory, opinion, and principal work which can be proven scientifically. 2.1.1 Related Work System Distributed Name System A [5] √ B [6] √ C [7] √ IPC Hardware implementati Implementa on tion √ √ Reliabili ty √ √ √ D [8] Sunur’s Home Automation √ √ System 8 √ √ 9 2.1.1.1 Java Communication Interfaces for Control Systems Java Communication Interface for Control Systems journal was written by Zhaoxia(Connie) Huang, Shengxi (Sunny) Zhou and Shengru Tu in 1997. This journal explained many things about the Inter-Process Communication, such as the problem of previous java sockets and datagram, the promotion of Remote Method Invocation (RMI) by Sun’s Javasoft divisions which provides a high-level distributed programming facility by adopting Remote Procedure Call (RPC) Model, and the introduction of CODART Interfaces. The CODART method itself was proposed by Gomaa. It provided an approach for modeling and analyzing systems and supports the design of distributed systems. Actually, the author interested with this journal because the journal covered many things; besides talked about distributed systems and IPC implementation, the journal also talked about reliability implementation; but what will be the weakness of this journal was the journal never explained about the hardware implementation. The journal only focused on the software development. 10 2.1.1.2 DisASTer (Distributed Algorithm Simulation Terrain): A Platform for the Implementation of Distributed Algorithm. DisASTer journal was written by Rainer Oechsle and Tim Gottwald. As stated on the subtitle DisASTer is a platform for the implementation of distributed algorithm. It also provides a java class library that eases the programmer to build a distributed algorithm program in Java. DisASTer journal only talked about the distributed system implementation. The author could not find any literatures about the IPC implementation, hardware implementation and reliability implementation on this journal. 2.1.1.3 Application Integration Messaging/Queuing System Application Integration Environment Environment for for Messaging/Queuing System was written by Vish Narayan in 1995. This journal talked about the integration of a disparate set of application. This paper also highlights the problems and the solutions of DAE bus. At past, the only realistic way to write application was to select the hardware vendor, write to the vendor’s architecture and live with being lock with the vendor. Recently the problem was overcome; there has been an emergence of distributed computing tools, called middleware. Distributed Application Environment (DAE) is one of 11 a middleware. It consists of the set of software function which facilitates multiple applications to support an integrated information view. Later, the author knew that the journal talked about many things, start from the distributed system to hardware implementation. This journal also provides an architecture which the idea can be implemented on the author’s work. The diagram of the related architecture will be provided on the next page. Figure 2 DAE Architecture 2.1.1.4 Throughput Performance of Popular JMS Throughput Performance of Popular JMS Servers was written by Michael Menth, Robert Henjes, Christian Zepfel, and Sebastian Gehrsitz in 1996. Base on this journal: 12 “The Java Messaging Service (JMS) facilitates communication among distributed software components according to publish/subscribe principle” Although the entire journal only talked about the Java Messaging Service and its throughput, the author could find the literatures about what JMS that should be tried by the author for the home automation system. 2.1.2 Hardware 2.1.2.1 Microcontroller According to Microcontroller: Theory and Application book, microcontroller can be describe as “single – chip microcomputers, that have central processing units (CPU), memory, input/output port (I/O), timer and counter, analog - to - digital converter (ADC), digital - to – analog converter (DAC), serial ports, interrupt logic, oscillator circuitry and many more functional blocks on chip. It is more suited for control and automation of machines and processes. [9] “ Microcontroller must have not only an excellent ability to compute but also good input / outputs system [10]. 13 There are many household electronic appliances and complex systems, such as televisions, microwave oven, washing machine, car systems and airplane system, which use microcontroller inside their architecture [11]. 2.1.2.1.1 DT-AVR Low Cost Micro System A single chip AVR microcontroller module based on Atmel ATmega8535 chip that have a built in 8 channel 10-bit ADC (Analog to Digital Converter). This module is equipped with In-system Programming header and RS-232 Serial Port Interface. This module is suitable for intermediate application to advance applications. The examples of the application are LED control, I/O control, driver motor, voltmeter digital, and etc. Actual applications are usually depend on the imagination of the user. Figure 3 DT-AVR Low Cost Micro System 14 2.1.2.1.1.1 AVR Microcontroller AVR stand for Alf and Vegard’s Risc. It has 8 bit architecture, which all instructions are packaged into 16-bit code and most of them are executed in single cycle clock [12]. 2.1.2.1.1.2 Hardware Specification ATmega8535 Microcontroller consists of: a. 32 I/O port, which are Port A, Port B, Port C, and Port D and each of Port consist of 8 I/O port. b. 8 channel ADC (Analog to Digital Converter) 10 bit. c. 3 timers/counters with comparison ability. d. CPU consists of 32 registers e. Watchdog Timer with internal oscillator f. 512 byte SRAM g. 8kb flash memory h. Internal and external interruption i. 512 byte programmable EEPROM 15 j. Analog comparator k. Port USART for serial communication. 2.1.2.2 Downloader According to G. Jack Lipovski the downloader can be describe as “A program running on the personal computer that takes object code of the cross – assembler from the personal computer’s disk or its primary memory and writes it into the target microcontroller’s memory [13]. ” 2.1.2.3 Relay Board (DT-I/O Relay Board Ver 2.0 – 1201) DT-I/O Relay Board Version 2.0 - 1201 is a relay module which is equipped with ULN2803 Darlington Array as current amplifier. It is compatible with DT-AVR Low Cost Series. Figure 4 DT I/O Relay Board 16 2.1.3 Software 2.1.3.1 IDE IDE stands for integrated development environment. It is a program that facilitates software development by providing an editor, a compiler, a debugger and possibly other tools, that work together [14]. Typically an editor shows the source codes and uses color to identified keywords, string, or comments while compiler usually includes linker that allows programmer to compile and run program with a single key stroke. There are so many examples of IDE, such as NetBeans, Bloodshed dev C++ and many others. 2.1.3.1.1 NetBeans IDE 7.0 A free, open-source Integrated Development Environment produced by Oracle Corporation for software developers. There are several useful tools are included inside NetBeans such as tools for create professional desktop application, enterprise application, web, and mobile application base on java programming language. Moreover NetBeans also provided tools base on C/C++ language, PHP, JavaScript and many others [15]. For this thesis, NetBeans is used for creating Java Server Pages and Java Application. 17 2.1.3.1.1.1 Java Server Pages ( JSP ) Java Server Pages (JSP) are Sun’s solution for developing dynamic websites [16]. The JSP pages look like HTML page and store using .jsp extension but actually the JSP gets converted into a servlet with the static HTML simply printed to the servlet’s HttpResponse object. Example of JSP code <%= getDate(); %>. 2.1.3.2 Code Vision Code Vision is one of powerful integrated development environment (IDE) for AVR microcontroller. Code vision is really powerful because the code developer only need to right the code in C language and it will automatically convert C language to assembler language used by AVR microcontroller [17]. Among the microcontroller code developer Code Vision known as an automatic program generator and In-System Programmer (ISP) for the Atmel AVR family of microcontroller. 18 2.1.3.3 Database Base on [18] definition, database can be described as: “A collection of related information that is organized so that it can easily be accessed, managed, and updated. One of the most suitable examples is the telephone directory. The entire telephone directory may be considered as a single file containing list of all citizens having telephone numbers. This file may contain various information about each registered number like names, addresses, and telephone numbers” Every database has some way to get data in and out. To be able to connect and maintain the database we need to communicate using a common language understood by all database. Database management system introduced a standard and common language known as Structured Query Language or SQL. 2.1.3.3.1 MySQL MySQL is a common databases server that competes in the same arena as other mid-market database back end such as Microsoft SQL server, PostgreSQL, and Sybase [19]. Base on [20] argument of his book MySQL crash course, MySQL has several advantages compared to 19 other server. First, MySQL is low cost, it is an opensource program so we need not to pay it when we want to use it. Second, the performance of MySQL is very fast compared to other. Third, MySQL is trusted software. It is already used by the most important and prestigious organization and sites, and all of whom give a good feedback on MySQL software. Last, MySQL has simple characteristic, it can be easily installed and the user interface is really friendly to be used too. 2.1.3.4 SQL As stated before to be able to communicate with the database we need standard language and it called SQL. SQL stand for structured query language. SQL is based on the groundbreaking work of Dr. E.F. Codd [21]. The first implementation of SQL is being developed by IBM during the mid-1970s. 2.1.3.5 Glassfish 3.1 GlassFish is one of the application server to support the Java Platform, Enterprise Edition (Java EE 6) standard with production ready features such as such as clustering and centralized administration [22]. 20 2.1.3.6 Message Queue Base on [23] books, message queue can be defined as: “A buffer-like object through which tasks and ISRs send and receive messages to communicate and synchronize with data. It is like a pipeline. It temporarily hold messages from a sender until the intended receiver is ready to read them.” Message queuing has been used in data processing for many years. It is most commonly used today in electronic mail. Without queuing, sending an electronic message over long distances requires every node on the route to be available for forwarding messages, and the addressees to be logged on and conscious of the fact that you are trying to send them a message. [24] state that there are many advantages of using message queuing, such as: - Message Queuing allows communicate between program without having to write communication code - Message Queuing allows to select the order in which a program processes messages. - Message Queuing allows to balance loads on a system by arranging for more than one program to service a queue when the number of messages exceeds a threshold. 21 - Message Queuing allows to Increase the availability of your applications by arranging for an alternative system to service the queues if your primary system is unavailable. 2.1.3.6.1 Open MQ Open message queue is an enterprise quality, production ready, scalable messaging server. It provides a complete Java Message Service (JMS) implementation for message oriented system integration. In addition, Open MQ provides the additional enterprise features that are necessary for enterprise deployments, large and small. It gets its roots from Java Message Queue and provides all the features, functions and capabilities of the currently available licensed product: Java System Message Queue [25]. 2.1.3.6.2 Active MQ One of the Message Queue products produced by apache. It is a powerful and open-source message queue. Apache Active MQ supports many cross language client and protocols. It comes with easy to use Enterprise Integration Patterns and many advanced features while fully supporting JMS 1.1 and J2EE 1.4. Apache ActiveMQ is released under the Apache 2.0 License [26]. 22 2.1.3.6.3 Rabbit MQ Rabbit MQ is open source message broker software which is complete and highly reliable enterprise messaging system based on the emerging Advanced Message Queuing Protocol (AMQP). Rabbit MQ also one of the robust messaging applications which is very easy to use and runs on almost all major operating systems. [27] 2.1.3.7 Parser Parser is one of the components inside a compiler or interpreter that is very useful in the process of analyzing an input given by the user. Parsing process starts with splitting an input into smaller parts and matches it with the grammatical structure. [28]. Base on [29] there are two types of parser, top-down parsers and bottom-up parsers. Top-down parsers usually starts at the root of derivation tree and fill in. On the other hand, bottom-up parsers usually starts with the leaves and fill in. 2.1.3.8 Java Communication Java Communication API is a Java extension that facilitates developing platform-independent communications applications for 23 technologies such as Smart Cards, embedded systems, point-of-sale devices, and many others [30]. 2.1.3.8.1 JavaComm JavaComm is one published by Sun notorious, because of Java Communication API Coorporation. it requires JavaComm a file is called javax.comm.properties to be placed in the JDK lib directory, something which can't be done with Java WebStart. This is particularly sad, because the need for that file is the result of some unnecessary design/decision in JavaComm and could have easily been avoided by the JavaComm designers. Sun constantly refuses to correct this error, citing the mechanism is essential. 2.1.3.8.2 RxTx RxTx library is a free software. RxTx is available for a number of platforms, not only for Linux used. It can be used either in conjunction with JavaComm (RxTx providing the hardware-specific drivers), or it can be used stand-alone. RxTx provides a richer interface. It also supports more platforms than the existing JavaComm implementations. 24 2.2 Theoretical Framework For this thesis purpose, the author uses the three steps general methodology for research. The first step is group discussion, second is experimental, and the last observational method. 2.2.1 Group Discussion In this step, the author does some discussion with friends, colleague, and author’s supervisor about whether the home automation topic is possible to be done or not, what the author should does first for finishing the thesis, what the author needs for finishing this thesis and many others. This discussion step was really important for the author because by doing this discussion the author could set up a plan in finishing the thesis later. 2.2.2 Experimental After knowing what is needed, the author starts the thesis work by setting up the panel board and creating a program to access it. Setting up the board was not an easy work; the author should look for all components needed for this panel board. Those components are power supply, relay board, and microcontroller. At the first step in experimental method, the author buys all components need for panel board in Glodok and starts assemble it in one panel board. The next step is creating a code which can control the microcontroller and put it inside the microcontroller’s memory. 25 After finishing the program for microcontroller, the author starts preparing the website, the message queue, the lexer, the parser, and java communication api. The last steps which will be done were combining all the things and try to send a command from the website to the panel board as well as record all the things happened during the process. 2.2.3 Observational During the observational time, the author is going to do some test regarding the reliability. The author will do two tests for reliability, first is testing the reliability between browser and the system while the second test is testing the reliability between the system and the panel board. After finishing the testing, the author intends to record all the things happened and show the result for the reader