Company ABC is a building maintenance company which provides air-conditioning facility to keep the temperature of office building cool in the area of Cyberjaya, Malaysia. Cold water is delivered to buildings to keep the buildings in cool and comfortable level. Under the SLA (service level agreement), Company ABC will pay certain penalty if the company does not fulfill its responsibility to keep the buildings below certain level of temperature.
Company ABC has identify two of the important metrics to monitor namely the temperature and humidity. Of course, there are other factors which have am impact to the cold water delivery efficiency. With sensors deployed to the remote building, Company ABC hopes to receive alerts before the level of temperature of buildings breaching the SLA.
The distance between the cold water delivery center of the Company ABC and those buildings are an important factor as longer distance means that the temperature of the cold water will be higher arriving those buildings. And humidity has a minor impact compared to temperature. The temperature and humidity alert thresholds are set based on Company ABC's collected historical data and distance of the building. Whenever an alert threshold is hit, an alarm will be issued and shown on the Alarm History panel on the dashboard. At the same time, the location pin of the respective building on the map will change its color to indicate the alert. Table below shows the location (latitude and longitude) of the sensors at the buildings.
- DHL_Cyberjaya @ 2.922188, 101.656551
- LHDN_Cyberjaya @ 2.910881, 101.650145
- MMU_Cyberjaya @ 2.927704, 101.642050
- MPEC @ 2.922412, 101.659017
- MaGIC @ 2.909192, 101.654814
- NTT_MSC @ 2.925622, 101.658963
This is the table of thresholds.
The project is built based on the Azure IOT suite remote monitoring solution. A remote monitoring solution for this project is made using this tutorial. The above sensors are add to the remote monitoring solution, as shown in the map below.
Sensors at the following locations are simulated devices:
- MMU_Cyberjaya
- MPEC
- MaGIC
- NTT_MSC
And the following are custom devices:.
- DHL_Cyberjaya (a simulator C program running on a Windows 10 device)
- LHDN_Cyberjaya (live device running on Genuino MKR1000)
Note that the thresholds of the temperature and humidity are estimated based on empirical data with the consideration of the distance between the chiller center and buildings.
This is a simulator written in C language which can be run on any Windows 10 devices. I use my DELL notebook and Advantech ARK-1123 to test this simulator. ARK-1123H is an embedded IoT Gateway which is Azure certified.
.
For detail instruction, follow this "Connect your device to the remote monitoring preconfigured solution (Windows) " guide to get the sensor connected to the Azure IOT preconfigured solution. I have added some random data generation code to make more realistic data. You can get the code (RMDevice.c) from the code section in this project.
void GetNextRawValue(struct RandomGeneratorParam *param) {
double val = (double)rand() / RAND_MAX;
double adjustment = ((2.0 * (*param).deltaValue) * val) - (*param).deltaValue;
(*param).nextValue += adjustment;
if ((*param).nextValue < (*param).minValueToGenerate || (*param).nextValue >(*param).maxNonPeakValueToGenerate) {
(*param).nextValue -= adjustment;
if ((*param).nextValue < (*param).minValueToGenerate || (*param).nextValue >(*param).maxNonPeakValueToGenerate) {
(*param).nextValue = (*param).startValue;
}
}
}
double GetNextValue(struct RandomGeneratorParam *param) {
GetNextRawValue(param);
bool determinePeak = (*param).generatePeaks && ((*param).tickCounter % (*param).peakInterval) == 0;
++((*param).tickCounter);
if (determinePeak) {
return (*param).nextValue + (*param).thresholdWidth;
}
return (*param).nextValue;
}
Create a custom device and add to the preconfigured solution.
.
Running the custom device simulator.
I am using Genuino MKR1000 and DHT11 for this custom device. Follow the "ADD A CUSTOM DEVICE TO THE AZURE IOT SUITE REMOTE MONITORING SOLUTION" guide to set this up. I have changed the code to use the DHT11 sensor. All the code are in the code section of this project. You will need to change the WiFi setting and the device ID and key.
Setup the SSL certificate for the remote monitoring solution. The URL will be like [web-app-name].azurewebsites.net. Follow this link if you need more details on how to set it up.
Upload and run the code from the Arduino IDE: select Tools -> Serial Monitor. You can check the log from here.
Comments