-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoxModel.py
53 lines (40 loc) · 1.54 KB
/
BoxModel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import urllib2
class BoxModel(object):
#dummy data from user input
def __init__(self, post):
self.historical = post['historical']
self.shading_efficiency = 0
self.avgTempCoefficient = 0
self.tempCoefficientList = []
#Efficiency Temperature Portion of Model
def avg_coefficient(self, histHourly, actualHourly):
'''Calculate temperature T = Tamb + Coefficient'''
actualHourly - histHourly = tempCo
self.tempCoefficientList.append(abs(tempCoefficient))
return sum(self.tempCoefficientList)/(float(len(self.tempCoefficientList)))
def avg_hist_temp(self, hist):
return sum(hist)/len(hist)
def temperature_efficiency(self, avgCoefficient, avgHistTemp):
return avgCoefficient + avgHistTemp
#Efficiency Shading
def shading_efficiency(self, percentA, percentLight):
self.shading_efficiency = percentA*percentLight
#Efficiency degradation
def panel_degradation_efficiency(self, year):
return 0.99**year
#HTTP CLASS , place import at type of file
import requests
'''
Example requests
--------------------------------------------
payload = {'key1': 'value1', 'key2': 'value2'}
r = requests.get("http://httpbin.org/get", params=payload)
Response
--------------------------------------------
r.text
r.json()
Custom Headers
--------------------------------------------
headers = {'user-agent': 'my-app/0.0.1'}
r = requests.get(url, headers=headers)
'''