logo

Project 3: Perl script to count Air Conditioner Cycles using temperature data

2017-10-07


Objective:

Use perl scripting and temperature data stream set-up in project 1 to calculate the number of air conditioning cycles in a given time.

Materials:

1. Temperature data as per project 1.

2. Linux workstation.

Software:

1. Linux OS

2. Perl 5 version 22

3. Gnuplot 5.0

Theory:

1. The temperature cycle that we are interested is a low frequency event. Outdoor temperature raises indoor temperature until upper set point is reached, at which point air conditioner activates forcing temperature down until lower set point is reached turning air conditioner off. This creates sinusoidal data, and the time between upper set points is one cycle.

2. The raw temperature sensor appears to have some noise. One pass of a smoothing, used rectangular boxcar moving average, appears to improve the temperature trend.

Moving Average Smoothing
Compare Raw to Smooth Temp Data Chart
Compare Raw to Smooth Temp Data Chart

3. The derivative of the temperature versus time will provide zeros at the peaks (i.e. tangent slope is 0). This can be used to count the air conditioner cycles. The derivative of smoothed temperature vs. time data yielded noisy data, so derivative data was smoothed.

Equation
Compare Raw to Smooth Derivative Data Chart
Compare Raw to Smooth Derivative Data Chart

4. To find zeros loop through data and look for sign changes. Estimate cycle count by halfing number of zeros found.

Perl Script:

Click here to get a copy of perl script.

Click here to get a copy of the data.

Perl Script: Explained

Text output of cycle counter

GNUplot Script

Text output of gnuplot script

Conclusion

You can now incorporate some data analysis along with recording the temperature data. That is it for this project.

Design credit knxops.com in cooperation with Ltimas and co.
Copyright © 2019 by Gregory Altimas aka Greg Altimas