Skip to content

Commit

Permalink
added analysis options for gas, pellets, and heat pump energy
Browse files Browse the repository at this point in the history
  • Loading branch information
FUEL4EP committed Nov 21, 2022
1 parent 47f9d3d commit be92060
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 33 deletions.
6 changes: 0 additions & 6 deletions .directory

This file was deleted.

111 changes: 91 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# consumption_analysis [![License: CC BY-NC-SA 4.0](https://img.shields.io/badge/License-CC%20BY--NC--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-nc-sa/4.0/) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgit.luolix.top%2FFUEL4EP%2Fconsumption_analysis&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com) <a href='https://ko-fi.com/FUEL4EP' target='_blank'><img height='20' style='border:0px;height:20px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

Python statistic software for consumption analysis of electrical power, fresh water, and oil
Python statistic software for consumption analysis of electrical power, fresh water, oil, gas, pellets, and heat pump energy

# Installation for (K)ubuntu LINUX:
# Installation for [(K)ubuntu] LINUX:


1. Put all python source code files of this github reposotory into a working directory
1. Put all python source code files of this github repository into a working directory
2. Make consal.py executable: 'chmod +x consal.py'

`<working_dir>/..`
Expand All @@ -23,16 +23,25 @@ Optional: Put example data bases into the working directory
* electrical_power_consumption.caf
* oil_consumption.caf
* water_consumption.caf
* gas_energy_consumption.caf
* pellets_energy_consumption.caf
* heat_pump_energy_consumption.caf

**Required python version** 3.x
**Required python version**
- 3.x

**Required python modules:**

optparse, sys, os, numpy, scipy, time, datetime, pylab, matplotlib, re, string, builtins
- optparse, sys, os, numpy, scipy, time, datetime, pylab, matplotlib, re, string, builtins

** Tested operating systems: **
**Tested operating systems:**

Kubuntu 14.04, Kubuntu 16.04, Kubuntu 18.04, Kubuntu 22.04
- Kubuntu 14.04, Kubuntu 16.04, Kubuntu 18.04, Kubuntu 22.04

**Other operating systems:**

- For other Linux OS, the code is working most probably as well
- For Windows OS, minor adaptions of the code might be necessary. Please do this on your own since I do not run any Microsoft OS.

# Supported statistical analyses:

Expand All @@ -48,15 +57,18 @@ Kubuntu 14.04, Kubuntu 16.04, Kubuntu 18.04, Kubuntu 22.04
* time chart of delta of 1 year moving average of consumption (matplotlib chart)
![pic](Images/delta_to_consumption_one_year_ago.png)

# Important note for moving averages

# Usage:
* moving averages over one year will be calculated after at least one year of data collection
* therefore **for the first year** of data entries, no moving averages will be calculated nor displayed

Usage: consal.py [options]

consal.py is doing a statistical analysis of electrical power, water, and oil
consumptions
# Usage:

Usage: python3 ./consal.py [options]

consal.py is doing a statistical analysis of electrical power, water, oil,
gas, pellets, and heat pump energy consumptions

Options:

Expand All @@ -66,7 +78,7 @@ Options:

--nc no consistency check

-n create a new data base
-n create a new data base (always use together with '-i')

-i input measurement(s)

Expand All @@ -86,7 +98,22 @@ Options:
-w analyze water consumption

--wf=FILE file storing data base for water consumption analysis


-g analyze gas consumption
--wg=FILE file storing data base for gas consumption analysis
-p analyze pellets consumption
--wp=FILE file storing data base for pellets consumption analysis
-p analyze pellets consumption
--wp=FILE file storing data base for pellets consumption analysis
--hp analyze heat pump consumption
--whp=FILE file storing data base for heat pump consumption analysis


# Examples on usage:
Expand All @@ -110,42 +137,86 @@ Options:


consal -o

4. Run analysis on provided data base for gas consumption:


consal -g

5. Run analysis on provided data base for pellets consumption:


consal -p

6. Run analysis on provided data base for heat pump energy consumption:


consal --hp

4. Add a new consumption value to an existing data base and then run an analysis of electrical power consumption:
7. Add a new consumption value to an existing data base and then run an analysis of electrical power consumption:

consal -i -e

5. Add a new consumption value to an existing data base and then run an analysis of water consumption:
8. Add a new consumption value to an existing data base and then run an analysis of water consumption:

consal -i -w


6. Add a new consumption value to an existing data base and then run an analysis of heating oil consumption:
9. Add a new consumption value to an existing data base and then run an analysis of heating oil consumption:


consal -i -o

10. Add a new consumption value to an existing data base and then run an analysis of gas consumption:

7. Create a new data base for electrical power consumption:

consal -i -g

11. Add a new consumption value to an existing data base and then run an analysis of pellets consumption:


consal -i -p

12. Add a new consumption value to an existing data base and then run an analysis of heat pump energy consumption:


consal -i \--hp

13. Create a new data base for electrical power consumption:

consal -i -n -e


8. Create a new data base for water consumption:
14. Create a new data base for water consumption:

consal -i -n -w

9. Create a new data base for heating oil consumption:
15. Create a new data base for heating oil consumption:

consal -i -n -o

16. Create a new data base for gas consumption:

consal -i -n -g

17. Create a new data base for pellets consumption:

consal -i -n -p

18. Create a new data base for heat pump energy consumption:

consal -i -n \--hp



# Enjoy and have fun saving energy!

# Enjoy and have fun!

# Update history:

- 13th June 2021: Migration to python3
- 28th October 2022: Fixes due to library updates, update of images
- 21st November 2022: Added analysis options for gas, pellets, and heat pump energy



Expand Down
Binary file added __pycache__/graphics.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/io_module.cpython-38.pyc
Binary file not shown.
Binary file added __pycache__/messaging.cpython-38.pyc
Binary file not shown.
78 changes: 71 additions & 7 deletions consal.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

desc="""consal.py is doing a statistical analysis of electrical power, water, and oil consumptions"""
desc="""consal.py is doing a statistical analysis of electrical power, water, oil, gas, pellets, and heat pump consumptions"""

# $Rev: 75 $:
# $Rev: 78 $:
# $Author: ewald $:
# $Date: 2022-10-28 12:14:14 +0200 (Fr, 28. Okt 2022) $:
# $Id: consal.py 75 2022-10-28 10:14:14Z ewald $
# $Date: 2022-11-21 14:31:33 +0100 (Mo, 21. Nov 2022) $:
# $Id: consal.py 78 2022-11-21 13:31:33Z ewald $

__my_version__ = "$Revision: 75 $"
__my_version__ = "$Revision: 78 $"

ELECTRICAL_POWER_CONSUMPTION_FILE="electrical_power_consumption.caf"
WATER_CONSUMPTION_FILE="water_consumption.caf"
OIL_CONSUMPTION_FILE ="oil_consumption.caf"
GAS_CONSUMPTION_FILE ="gas_energy_consumption.caf"
PELLETS_CONSUMPTION_FILE ="pellets_energy_consumption.caf"
HEAT_PUMP_CONSUMPTION_FILE ="heat_pump_energy_consumption.caf"
TIME_COL=0
VALUE_COL= 1
STRICTLY_INCREASING=1
Expand Down Expand Up @@ -569,12 +572,36 @@ def main():
parser.add_option("--wf", type="string",
help="file storing data base for water consumption analysis",
metavar="FILE",dest="file_water")

parser.add_option("-g", help="analyze gas consumption", dest="gas",
action='store_true')

parser.add_option("--wg", type="string",
help="file storing data base for gas consumption analysis",
metavar="FILE",dest="file_gas")

parser.add_option("-p", help="analyze pellets consumption", dest="pellets",
action='store_true')

parser.add_option("--wp", type="string",
help="file storing data base for pellets consumption analysis",
metavar="FILE",dest="file_pellets")

parser.add_option("--hp", help="analyze heat pump energy consumption", dest="heat_pump",
action='store_true')

parser.add_option("--whp", type="string",
help="file storing data base for heat pump energy consumption analysis",
metavar="FILE",dest="file_heat_pump")

parser.set_defaults(verbose=0, no_consistency_check=False, no_greater_than_check=False, newDB=False,
wdir=WORKING_DIR, epower=False,
file_epower=ELECTRICAL_POWER_CONSUMPTION_FILE, oil=False,
file_oil=OIL_CONSUMPTION_FILE, water=False,
file_water=WATER_CONSUMPTION_FILE, version=False, input_flag=False)
file_water=WATER_CONSUMPTION_FILE, gas=False,
file_gas=GAS_CONSUMPTION_FILE, pellets=False,
file_pellets=PELLETS_CONSUMPTION_FILE, heat_pump=False,
file_heat_pump=HEAT_PUMP_CONSUMPTION_FILE, version=False, input_flag=False)

(options, args) = parser.parse_args()

Expand Down Expand Up @@ -623,8 +650,45 @@ def main():
#run analysis
water.consumption_analysis('water consumption', options.wdir,
options.file_water, 'fresh water [m^3]', not(options.no_consistency_check),options.input_flag,options.newDB )

#analyze gas consumption
if options.gas:
stdMsg("\n\nStarting analysis of gas energy consumption ..\n")
#check if data base file is existing and readable
check_database_file(options.wdir, options.file_gas, options.newDB)
#initialize data analysis
gas=consumption()
#run analysis
gas.consumption_analysis('gas energy consumption',
options.wdir, options.file_gas, 'gas energy [kWh]',
not(options.no_consistency_check), options.input_flag, options.newDB)

#analyze pellets consumption
if options.pellets:
stdMsg("\n\nStarting analysis of pellets energy consumption ..\n")
#check if data base file is existing and readable
check_database_file(options.wdir, options.file_pellets, options.newDB)
#initialize data analysis
pellets=consumption()
#run analysis
pellets.consumption_analysis('pellets energy consumption',
options.wdir, options.file_pellets, 'pellets energy [kWh]',
not(options.no_consistency_check), options.input_flag, options.newDB)

#analyze heat pump energy consumption
if options.heat_pump:
stdMsg("\n\nStarting analysis of heat pump energy consumption ..\n")
#check if data base file is existing and readable
check_database_file(options.wdir, options.file_heat_pump, options.newDB)
#initialize data analysis
heat_pump=consumption()
#run analysis
heat_pump.consumption_analysis('heat pump energy consumption',
options.wdir, options.file_heat_pump, 'heat pump energy [kWh]',
not(options.no_consistency_check), options.input_flag, options.newDB)


if not options.epower and not options.oil and not options.water:
if not options.epower and not options.oil and not options.water and not options.gas and not options.pellets and not options.heat_pump:
stdMsg("\n\nNo analysis has been selected!")

stdMsg("\nFinished\n")
Expand Down
3 changes: 3 additions & 0 deletions gas_energy_consumption.caf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
19317.607824074075 14.99
19317.60783564815 15.0
19317.60790509259 15.01
3 changes: 3 additions & 0 deletions heat_pump_energy_consumption.caf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
19317.608263888887 9.99
19317.608275462964 10.0
19317.60837962963 10.001
3 changes: 3 additions & 0 deletions pellets_energy_consumption.caf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
19317.6075 12.99
19317.607511574075 13.0
19317.60767361111 13.02

0 comments on commit be92060

Please sign in to comment.