Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to save feeder files for temperature set-points in K (default). #28

Merged
merged 1 commit into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Corpus/feeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ class IDEAS_Feeder(object):
The Community class defines a set of hosueholds.
'''

def __init__(self, name, nBui, path):
def __init__(self, name, nBui, path, sh_K=True):
'''
Create the community based on number of households and simulate for
output towards IDEAS model.
'''
self.name = name
self.nBui = nBui
self.sh_K = sh_K #defines whether space heating set-point temperature will be written in K (otherwise deg Celsius)
# we create, simulate and pickle all 'nBui' buildings
self.simulate(path)
# then we loop through all variables and output as single file
Expand Down Expand Up @@ -64,6 +65,8 @@ def output(self, variables):
hou = cPickle.load(open(str(self.name)+'_'+str(i)+'.p','rb'))
for variable in variables:
var = eval('hou.'+variable)
if variable in ['sh_day','sh_bath','sh_night'] and self.sh_K:
var=var+273.15 # make it in Kelvin
if len(dat[variable]) != 0:
dat[variable] = np.vstack((dat[variable],var))
else:
Expand Down
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
family.simulate()

# Test feeder
fee.IDEAS_Feeder('Example', 5, strobeDir)
fee.IDEAS_Feeder('Example', 5, strobeDir, sh_K=True)

# cleanup
if cleanup:
Expand Down