Skip to content

Commit

Permalink
Fixed issues with Generation components
Browse files Browse the repository at this point in the history
Fixed #487 and #512

1. For now we used surface.name instead of surface.id to check for PV
surfaces.
2. "Always ON" schedule will be added to the file in case there is any
generation objects.
  • Loading branch information
mostaphaRoudsari committed Jul 10, 2016
1 parent 55889b0 commit 0cb8c11
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions src/Honeybee_ Run Energy Simulation.py
Expand Up @@ -1597,7 +1597,7 @@ def writeHBcontext(shadingPyClasses):
# check if there is an energyPlus material

# Add surface to a list so that zone surfaces can be checked against honeybee generator PV surfaces
WriteIDF.zonesurfaces.append(srf.ID)
WriteIDF.zonesurfaces.append(srf.name)

if srf.EPConstruction != None:
srf.construction = srf.EPConstruction
Expand Down Expand Up @@ -1667,7 +1667,9 @@ def writeHBcontext(shadingPyClasses):
hb_hivegen = sc.sticky["honeybee_generationHive"]()

HBsystemgenerators = hb_hivegen.callFromHoneybeeHive(HBGenerators_)


# Generation objects use "always on" schedule
EPScheduleCollection.append('ALWAYS ON')

# This code here is used to extractingruntime periods if outputs are specified externally
# If the function returns and exception that means that external outputs are not specified.
Expand Down Expand Up @@ -1748,7 +1750,7 @@ def extracttimeperiod(simulationOutputs):

# CHECK that HBgenerator names are unique for this simulation - Otherwise E+ will crash

for HBsystemcount,HBsystemgenerator in enumerate(HBsystemgenerators):
for HBsystemcount, HBsystemgenerator in enumerate(HBsystemgenerators):

# Append to HBgeneratoroutputs as if we append to simulationOutputs the original default outputs will never run

Expand Down Expand Up @@ -1809,22 +1811,19 @@ def extracttimeperiod(simulationOutputs):
# CHECK
# If PV surfaces are part of a zone make sure that, that zone is connected to _HBZones
# that is the PV surfaces are contained in HBsystemgenerator.HBzonesurfaces

PVsurfaceinzones = []

for surface in HBsystemgenerator.HBzonesurfaces:

PVsurfaceinzones.append(surface.ID in WriteIDF.zonesurfaces)

if all(x== True for x in PVsurfaceinzones) != True:
warn = "It has been detected that there are PV generators attached to sufaces of a Honeybee zone\n"+\
" However this Honeybee zone has not been connected to the _HBZones input on this component\n"+\
" Please connect it to run the EnergyPlus simulation!"
print warn
ghenv.Component.AddRuntimeMessage(w, warn )

return -1


if not surface.name in WriteIDF.zonesurfaces:

warn = "It has been detected that there are PV generators attached to sufaces of a Honeybee zone\n"+\
" However this Honeybee zone has not been connected to the _HBZones input on this component\n"+\
" Please connect it to run the EnergyPlus simulation!"
print warn
ghenv.Component.AddRuntimeMessage(w, warn)

return -1

if HBsystemgenerator.simulationinverter != None:

if HBsystemgenerator.battery != None:
Expand Down
Binary file modified userObjects/Honeybee_ Run Energy Simulation.ghuser
Binary file not shown.

0 comments on commit 0cb8c11

Please sign in to comment.