## 3 An Implementation of the Proposed Architecture
### Context-Aware Energy-Saving Smart Classroom Applications  
In the previous subsection, the way of using the proposed architecture was explained with a minimal implementation of a smart classroom called H204. For demonstrating that context-aware energy-saving smart classrooms can be easily implemented with the proposed architecture, an application for manually control classroom devices for saving energy in different teaching scenarios and the logic of a context-aware energy saving application is described in this subsection. Figure 12 is a mobile application for teachers to set devices to predefined configurations in smart classrooms for different teaching scenarios in H204. Different devices will be turned on or off depending on the selected scenario. For example, when the teacher wants to use the whiteboard, then the projector will be turned off, and the screen will be scrolled up. When the teacher wants to use the projector, then the projector will be turned on, the screen will be scrolled down, and the lights near the screen also need to be turned off. When the teacher wants students to have a group discussion with the interactive boards, the projector will be turned off, the screen will be scrolled up, the interactive boards will be turned on, and the lights near the interactive boards will be turned off. Table 14 implements functions such as teaching with the projector (C0002), teaching with the whiteboard (C0003), group discussion (C0004) and turn off everything (C0005) in H204. As shown in Table 14, devices not needed in certain scenario will be turned off for saving energy.  
Figure 11: Sequence diagram of the operation described in Figure 10.  
Figure 13 shows the procedure of a context-aware energy-saving smart classroom application for H204. The procedure scheduled to run once a minute. Devices in an empty classroom will be turned off automatically for saving energy. Doors, fans, and air conditioners will be controlled depending on sensor data and real-time classroom schedule. A very important thing for time-based energy saving policy is that the classroom controlling application must link to the real-time dynamic classroom schedule in the school information systems; otherwise, energy will still be wasted when the real classroom schedule is changed for any reason. The idea of this energy saving application is based on previous studies including References [58; 66; 67; 68; 69]. With the proposed model, low-level device control details can be packed as web application interface calls. Therefore, if the campus or building provides selectable energy source, high-level energy management control logic, such as Reference [63; 64; 65] can be implemented as layer 4 applications in the proposed model without handling different kinds of device control protocols.  
Figure 12: A mobile phone application for teachers to set devices to predefined configurations in smart classrooms for different teaching scenarios. As the explanations in this figure, the functions of the buttons in the top line from left to right are ‘Turn on everything’, ‘Teach with projector’, ‘Teach with whiteboard’, and ‘Teach with projector and whiteboard’. The functions of the buttons in the bottom line from left to right are ‘Group discussion using interactive boards’, ‘Presentation mode’, ‘Take a break’, ‘Turn off everything’.