def run(self): """ Main run function """ # Initialize the GBXML self.gbxml = gbXML(self.gbxml) # Get the materials list materials = self.gbxml.get_allMaterials( ) #looks for all material tags in gbxml from Revit AEC database remoteData = wsData( ) #creates a remoteData object that is a wsData type remoteData.getmaterials(materials) # Retrieve the spaces self.spaces = self.gbxml.get_spaces() self.shade_devices = self.gbxml.get_shades( ) # Shade surfaces defined separate from other surfaces area = Area() areaDict = area.getDictionary() areaWinDict = area.getWinDictionary() # For each spaces, calculate Embodied Energy and Embodied Water for a given building EE_spaces = self.buildingEE(self.input_dir, self.shade_devices, areaDict, areaWinDict) #accumulators print(EE_spaces) return None
def setUp(self): self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Single_model.xml')) #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Two_Room_One_Floor_Model.xml')) area = Area() area.createAreaDictionary() area.createWinAreaDictionary() self.areaWinDict = area.getWinDictionary() self.areaDict = area.getDictionary() #self.db = GreenScaleV1(os.path.join(os.path.dirname(__file__), '..\objects')) self.db = os.path.join(os.path.dirname(__file__), '..\objects') #self.db.db_file = 'GreenScaleDBcsv.csv' self.EEspace = GreenscaleSpace() self.duplicates = list() # This is going to have to be optimized for large buildings with many surfaces # Get the first surface to check: spaces = self.gbxml.get_spaces() # Space 1 info, surface "su-8" is [7] and is the interior shared wall here self.space1 = spaces[0] surfaces = spaces[0].surfaces self.surface1 = surfaces[0] # Ext. Wall with window self.surface2 = surfaces[1] # Ext. Wall no openings self.surface3 = surfaces[2] # Ext. Wall with window self.surface4 = surfaces[3] # Ext. Wall with Door self.surface5 = surfaces[4] # Roof self.surface6 = surfaces[5] # Floor
def setUp(self): self.model = GreenScaleV1() self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Single_model.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Two_Room_One_Floor_Model.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Four_Room_Two_Floors_Model.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Fall2013RLMVCRevit_v2_MarcValidation.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Avon.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/L_ShapeFloor.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/FourRoom_with_Zones.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/FourRoomRoundColumn.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/FourRoomSquareColumn.xml') self.model.input_dir = os.path.join(os.path.dirname(__file__), '..\objects') self.db = self.model.input_dir area = Area() area.createAreaDictionary() area.createWinAreaDictionary() self.areaWinDict = area.getWinDictionary() self.areaDict = area.getDictionary() U = GSUtility() devflag = '1' U.setDevFlag(devflag) # Get the surfaces in the space: self.model.run() spaces = self.model.gbxml.get_spaces() self.space1 = spaces[0] self.shade_surfaces = self.model.gbxml.get_shades() surfaces = spaces[0].surfaces
def setUp(self): gbxml = gbXML( os.path.join(os.path.dirname(__file__), 'input/Single_model.xml')) area = Area() area.createAreaDictionary() area.createWinAreaDictionary() self.areaWinDict = area.getWinDictionary() self.areaDict = area.getDictionary() spaces = gbxml.get_spaces() surfaces = spaces[0].surfaces self.surface = Surface() self.surface1 = surfaces[0] self.surface2 = surfaces[1] self.surface3 = surfaces[2] self.surface4 = surfaces[3] self.surface5 = surfaces[4] self.surface6 = surfaces[5] # Create a fake weather self.weather = Weather('Washington', datetime(year=1997, month=1, day=1, hour=3), datetime(year=1997, month=1, day=1, hour=4)) # And a timestep self.tstep2 = datetime(year=1997, month=1, day=1, hour=4) # get the weather at the tstep self.wtstep2 = self.weather.get_weather_step(self.tstep2) # And another timestep self.tstep = datetime(year=1997, month=1, day=1, hour=3) # get the weather at the tstep self.wtstep = self.weather.get_weather_step(self.tstep)
def setUp(self): #self.model = GreenScaleV1() #self.gbxml = os.path.join(os.path.dirname(__file__), 'input/EDIT One Room Flat Roof with Materials.xml') self.gbxml = gbXML( os.path.join(os.path.dirname(__file__), 'input/Single_model.xml')) #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Two_Room_One_Floor_Model.xml')) #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Four_Room_Two_Floors_Model.xml')) #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Vet_Center_V2.xml')) #self.db = GreenScaleV1(os.path.join(os.path.dirname(__file__), '..\objects')) self.db = os.path.join(os.path.dirname(__file__), '..\objects') #self.db.db_file = 'GreenScaleDBcsv.csv' self.EEtest = GreenscaleEE() # Get the first surface to check: spaces = self.gbxml.get_spaces() # This is for the Single_model.xml: # Space 1 info, surface "su-8" is [7] and is the interior shared wall here space1 = spaces[0] surfaces = spaces[0].surfaces self.surface1 = surfaces[0] # Ext. Wall with window self.surface2 = surfaces[1] # Ext. Wall no openings self.surface3 = surfaces[2] # Ext. Wall with window self.surface4 = surfaces[3] # Ext. Wall with Door self.surface5 = surfaces[4] # Roof self.surface6 = surfaces[5] # Floor area = Area() #print "test" self.areaWinDict = area.getWinDictionary self.areaDict = area.getDictionary
def setUp(self): self.gbxml = gbXML( os.path.join(os.path.dirname(__file__), 'input/Single_model.xml')) # Get the first surface to check: spaces = self.gbxml.get_spaces() #space_boundaries = list() #space_boundaries = spaces[0].surfaces surfaces = spaces[0].surfaces self.surface1 = surfaces[0] self.solar = TransmittedSolar() area = Area() #print "test" self.areaWinDict = area.getWinDictionary # Create a fake weather self.weather = Weather('Washington', datetime(year=1997, month=1, day=1, hour=3), datetime(year=1997, month=1, day=1, hour=4)) # And a timestep self.tstep2 = datetime(year=1997, month=1, day=1, hour=4) # get the weather at the tstep self.wtstep2 = self.weather.get_weather_step(self.tstep2) # And another timestep self.tstep = datetime(year=1997, month=1, day=1, hour=3) # get the weather at the tstep self.wtstep = self.weather.get_weather_step(self.tstep)
def setUp(self): self.model = ModelV1() self.model.location = 'Washington' self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Single_model.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Two_Room_One_Floor_Model.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Two_Room_One_Floor_Model.xml') #self.model.gbxml = os.path.join(os.path.dirname(__file__), 'input/Four_Room_Two_Floors_Model.xml') area = Area() area.createAreaDictionary() area.createWinAreaDictionary() self.areaWinDict = area.getWinDictionary() self.areaDict = area.getDictionary() U = GSUtility() devflag = '1' U.setDevFlag(devflag) self.model.Q_total = 0 self.Q_total = self.model.Q_total # Set desired thermal capacitance multiplier, 0.45 for example self.model.Coeff = 1 self.Coeff = self.model.Coeff # Set 0 to ignore shadow factors, set 1 if you do want to include calculations from shadows self.model.ShadowsFlag = 0 # 1 means calculate shadows, 0 means ignore shadows self.ShadowsFlag = self.model.ShadowsFlag self.model.terrain = "Flat or Open Countryside" # User Input Terrain Type self.terrain = self.model.terrain self.model.timestep = 1 self.timestep = self.model.timestep # Need to use version with the year=1997 to pass the Weather Test Cases #self.model.start_date = datetime(year=1997, month=1, day=1, hour=3) #self.model.end_date = datetime(year=1997, month=1, day=1, hour=4) #self.model.start_date = datetime(year=1997, month=1, day=1, hour=0) #self.model.end_date = datetime(year=1997, month=1, day=1, hour=23) self.model.start_date = datetime(year=1997, month=1, day=1, hour=0) self.model.end_date = datetime(year=1997, month=12, day=31, hour=23) self.model.run() spaces = self.model.gbxml.get_spaces() self.space1 = spaces[0] self.temp_record = self.model.gbxml.temp_record self.spaces_dict = self.model.gbxml.spaces_dict self.shgc_dictionary = self.model.gbxml.shgc_dictionary self.shadow_record = self.model.gbxml.shadow_record self.surfaces_dict = self.model.gbxml.surfaces_dict self.shade_surface_total = self.model.gbxml.shade_surface_total self.shade_surf_list = self.model.gbxml.get_shades()
def setUp(self): self.gbxml = gbXML( os.path.join(os.path.dirname(__file__), 'input/Single_model.xml')) #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Four_Room_Two_Floors_Model.xml')) # To test middle interior floor area = Area() area.createAreaDictionary() area.createWinAreaDictionary() self.areaWinDict = area.getWinDictionary() self.areaDict = area.getDictionary() spaces = self.gbxml.get_spaces() surfaces = spaces[0].surfaces self.heat = HeatCalculation() self.temp_record = self.gbxml.temp_record self.spaces_dict = self.gbxml.spaces_dict self.shgc_dictionary = self.gbxml.shgc_dictionary self.shadow_record = self.gbxml.shadow_record self.shade_surf_list = self.gbxml.get_shades() self.surfaces_dict = self.gbxml.surfaces_dict self.space1 = spaces[0] #surfaces1 = spaces[0].surfaces #self.space2 = spaces[1] #surfaces2 = spaces[1].surfaces #self.surface6 = surfaces1[5] # su-6 #self.surface11 = surfaces2[5] # su-11 self.surface1 = surfaces[0] self.surface2 = surfaces[1] self.surface3 = surfaces[2] self.surface4 = surfaces[3] self.surface5 = surfaces[4] self.surface6 = surfaces[5] self.G_space_record = dict() self.G_space_record["sp-1-Room"] = 0 # Create a fake weather self.weather = Weather('Washington', datetime(year=1997, month=1, day=1, hour=3), datetime(year=1997, month=1, day=1, hour=4)) # And a timestep self.tstep2 = datetime(year=1997, month=1, day=1, hour=4) # get the weather at the tstep self.wtstep2 = self.weather.get_weather_step(self.tstep2) # And another timestep self.tstep = datetime(year=1997, month=1, day=1, hour=3) # get the weather at the tstep self.wtstep = self.weather.get_weather_step(self.tstep)
def get_A(self, surface, areaDict, areaWinDict): # These area calcualtions can eventually be done with the Area() class method but needs further testing # Calculates the total A of the surface. # Was: A = round(surface.height * surface.width * 0.3048 * 0.3048, 6)...took out the conversion to leave it feet area = Area() #A = area.surfaceArea(surface.cps, surface.azimuth, surface.tilt, surface) #A = round(surface.height * surface.width, 6) #A = area.getArea(surface.obj_id) #if areaDict is not None: # print "areaDict = not None", areaDict #print "test here", surface.obj_id A = areaDict[surface.obj_id] A /= 0.09290304 # The Area() is calculating and storing metric so needs to be put back into imperial for EE #print "1", A return A
def setUp(self): #self.gbxml = gbXML(os.path.join(os.path.dirname(__file__), 'input/Single_model.xml')) self.gbxml = gbXML( os.path.join(os.path.dirname(__file__), 'input/Two_Room_One_Floor_Model.xml')) self.temp = Temperature() self.shgc_dictionary = self.gbxml.shgc_dictionary self.temp_record = self.gbxml.temp_record self.spaces_dict = self.gbxml.spaces_dict self.shadow_record = self.gbxml.shadow_record self.shade_surf_list = self.gbxml.get_shades() self.surfaces_dict = self.gbxml.surfaces_dict # Get the first surface to check: spaces = self.gbxml.get_spaces() # Space 1 info, surface "su-8" is [7] and is the interior shared wall here space1 = spaces[0] surfaces_inspace1 = spaces[0].surfaces self.surface1_in_space1 = surfaces_inspace1[0] self.surface5_in_space1 = surfaces_inspace1[4] self.surface6_in_space1 = surfaces_inspace1[5] self.surface8_in_space1 = surfaces_inspace1[7] # Space 2 info, surface "su-8" is [7] and is the interior shared wall here #space2 = spaces[1] #surfaces_inspace2 = spaces[1].surfaces #self.surface8_in_space2 = surfaces_inspace1[7] # Create a fake weather self.weather = Weather('Washington', datetime(year=1997, month=1, day=1, hour=3), datetime(year=1997, month=1, day=1, hour=4)) area = Area() #print "test" self.areaWinDict = area.getWinDictionary # And a timestep self.tstep2 = datetime(year=1997, month=1, day=1, hour=4) # get the weather at the tstep self.wtstep2 = self.weather.get_weather_step(self.tstep2) # And another timestep self.tstep = datetime(year=1997, month=1, day=1, hour=3) # get the weather at the tstep self.wtstep = self.weather.get_weather_step(self.tstep)
def get_A_noWin(self, surface, A, areaDict, areaWinDict): # Calculates the area of the surface in cm2 minus all the window openings area = Area() #A = area.surfaceArea(surface.cps, surface.azimuth, surface.tilt, surface) #A = round(surface.height * surface.width, 6) # The remove the A of each of the openings for opening in surface.openings: # Only subtract if window if opening.obj_type == "OperableWindow" or opening.obj_type == "FixedWindow": #A -= area.surfaceArea(opening.ocps, surface.azimuth, surface.tilt, opening) #A -= (opening.height * opening.width) Ametric = areaDict[opening.obj_id] Ametric /= 0.09290304 # The Area() is calculating and storing metric so needs to be put back into imperial for EE A -= Ametric #print "3", A return A
def get_A_effective(self, surface, A, areaDict, areaWinDict): # Calculates the total A of the surface. # Was: A = round(surface.height * surface.width * 0.3048 * 0.3048, 6)...took out the conversion to leave it feet area = Area() #A = area.surfaceArea(surface.cps, surface.azimuth, surface.tilt, surface) #A = round(surface.height * surface.width, 6) #print "A: total area: ", A # The remove the A of each of the openings for opening in surface.openings: # Only any opening type if opening.obj_type == "OperableWindow" or opening.obj_type == "FixedWindow" or opening.obj_type == "NonSlidingDoor" or opening.obj_type == "SlidingDoor" or opening.obj_type == "OperableSkylight" or opening.obj_type == "Air": #A -= area.surfaceArea(opening.ocps, surface.azimuth, surface.tilt, opening) #A -= (opening.height * opening.width) Ametric = areaWinDict[opening.obj_id] Ametric /= 0.09290304 # The Area() is calculating and storing metric so needs to be put back into imperial for EE A -= Ametric #print opening.height, opening.width #print "A is: ", A #print "2", A return A
def main( argv, inputfile='D:/Users/Karen/Documents/Revit 2016/NIBS/GBXMLs/RC_FRAME.xml', outputpath='C:/Users/Karen/Desktop/GreenScale Project/GreenScale Project/Installer/GS/Output/', modelflag='3', devflag="1", shadowflag="0", locationfile='C:/Users/Karen/Desktop/GreenScale Project/GreenScale Project/Installer/GS/Locations/USA_MO_St.Louis-Lambert.Intl.AP.724340_TMY3.epw' ): if len(sys.argv) == 8: inputfile = sys.argv[ 1] #2 for python, 1 for .NET, due to indexing differences. Comment out to run with defaults. outputpath = sys.argv[ 2] #3 for python, 2 for .NET, due to indexing differences. Comment out to run with defaults. modelflag = sys.argv[3] devflag = sys.argv[4] shadowflag = sys.argv[5] locationfile = sys.argv[6] # 2016 Version testing with Single Room Model #C:/Users/hfergus2/Desktop/MyPythonExport/Single_Room_2016.xml #Four_Room_2016.xml #Avon_Bldg_2016.xml #Vet_Center_2016.xml #L_1Floor_2016.xml #L_2Floor_2016.xml # 2014 Single Room Model #C:/Users/hfergus2/Desktop/GSbranch/tests/input/Single_model.xml U = GSUtility() U.setDevFlag(devflag) U.devPrint("Started the Python!") #print modelflag #print locationfile #Fall2013RLMVCRevit_v2_MarcValidation #Four_Room_Two_Floors_Model #Two_Room_One_Floor_Model #Single_model #Avon #L_ShapeFloor #FourRoom_with_Zones #FourRoomRoundColumn #FourRoomSquareColumn #/orientation/Avon_Position_E.xml # Report writer (CSV) # We want to log error logging (verbosity 1 of 3), check-pointing (verbosity 2 of 3), etc. #DEBUG Detailed information, typically of interest only when diagnosing problems. #INFO Confirmation that things are working as expected. #WARNING An indication that something unexpected happened, or indicative of some problem in the near future (e.g. disk space low). The software is still working as expected. #ERROR Due to a more serious problem, the software has not been able to perform some function. #CRITICAL A serious error, indicating that the program itself may be unable to continue running. with open(outputpath + 'TM_coder.log', 'w'): pass with open(outputpath + 'TM_user.log', 'w'): pass with open(outputpath + 'EE_coder.log', 'w'): pass with open(outputpath + 'EE_user.log', 'w'): pass with open(outputpath + 'aggr.log', 'w'): pass with open(outputpath + 'Assembly.log', 'w'): pass with open(outputpath + 'Coder.log', 'w'): pass logging.basicConfig(filemode='w', filename=outputpath + "aggr.log", level=logging.INFO) aggr = logging.getLogger('aggr') aggr.setLevel(logging.INFO) # Create the logging file handler fh = logging.FileHandler(outputpath + "aggr.log") formatter = logging.Formatter( '%(asctime)s,%(name)s,%(levelname)s,%(message)s,') fh.setFormatter(formatter) # Add handler to logger object aggr.addHandler(fh) aggr.info("Started") logging.basicConfig(filemode='w', filename=outputpath + "Assembly.log", level=logging.INFO) Assembly = logging.getLogger('Assembly_V1') Assembly.setLevel(logging.INFO) # Create the logging file handler fh = logging.FileHandler(outputpath + "Assembly.log") formatter = logging.Formatter( '%(asctime)s,%(name)s,%(levelname)s,%(message)s,') fh.setFormatter(formatter) # Add handler to logger object Assembly.addHandler(fh) Assembly.info("Assembly Totals:") #TM_coder.info(inputfile) #TM_coder.info(outputpath) logging.basicConfig(filemode='w', filename=outputpath + "Coder.log", level=logging.INFO) Coder = logging.getLogger('Coder_V1') Coder.setLevel(logging.INFO) # Create the logging file handler # C:\Users\hfergus2\Desktop\pygscale\TM_user.log fh = logging.FileHandler(outputpath + "Coder.log") formatter = logging.Formatter( '%(asctime)s,%(name)s,%(levelname)s,%(message)s,') fh.setFormatter(formatter) # Add handler to logger object Coder.addHandler(fh) Coder.info("Data For Developers: Notes from gbxml.py") logging.basicConfig(filemode='w', filename=outputpath + "TM_user.log", level=logging.INFO) TM_user = logging.getLogger('TMuser_V1') TM_user.setLevel(logging.INFO) # Create the logging file handler # C:\Users\hfergus2\Desktop\pygscale\TM_user.log fh = logging.FileHandler(outputpath + "TM_user.log") formatter = logging.Formatter( '%(asctime)s,%(name)s,%(levelname)s,%(message)s,') fh.setFormatter(formatter) # Add handler to logger object TM_user.addHandler(fh) TM_user.info("Thermal Model User Program Started") logging.basicConfig(filemode='w', filename=outputpath + "EE_coder.log", level=logging.INFO) EE_coder = logging.getLogger('EEcoder_V1') EE_coder.setLevel(logging.INFO) # Create the logging file handler fh = logging.FileHandler(outputpath + "EE_coder.log") formatter = logging.Formatter( '%(asctime)s,%(name)s,%(levelname)s,%(message)s,') fh.setFormatter(formatter) # Add handler to logger object EE_coder.addHandler(fh) EE_coder.info("Embodied Energy Coder Program Started") logging.basicConfig(filemode='w', filename=outputpath + "EE_user.log", level=logging.INFO) EE_user = logging.getLogger('EEuser_V1') EE_user.setLevel(logging.INFO) # Create the logging file handler fh = logging.FileHandler(outputpath + "EE_user.log") formatter = logging.Formatter( '%(asctime)s,%(name)s,%(levelname)s,%(message)s,') fh.setFormatter(formatter) # Add handler to logger object EE_user.addHandler(fh) EE_user.info("Embodied Energy User Program Started") # Surface Area Dictionary area = Area() area.createAreaDictionary() area.createWinAreaDictionary() #Check if EE model should be run if (modelflag == '1' or modelflag == '3'): # Input parameters for Embodied Energy Model (EEM) EE_coder.info(" ") EE_coder.info( " ") # Spacing for the excel to be more readable for the students EE_coder.info(" ") EE_coder.info("Missing Materials Data") EEstart = time.clock() EE_user.info("Embodied Energy Data:") pathStr = str(inputfile) EE_user.info("Model File Path:, %s" % pathStr) # Record Model Identifier or Path for Log EE_user.info("Location: " + locationfile) model2 = GreenScaleV1() model2.gbxml = inputfile model2.input_dir = os.path.join(os.path.dirname(__file__), 'objects') U.devPrint("Reaching EE_Model.run function...") model2.run() EE_coder.info(" ") EE_coder.info( " ") # Spacing for the excel to be more readable for the students EE_coder.info(" ") EEend = time.clock() U.devPrint("Time for EE Module: " + str(EEend - EEstart)) print "===================================================================================" print "===================================================================================" print "===================================================================================" #Check if TM model should be run if (modelflag == '2' or modelflag == '3'): # Input parameters for Thermal Model (TM) TMstart = time.clock() TM_user.info("Thermal Model Data") pathStr = str(inputfile) TM_user.info("Model File Path:, %s" % pathStr) # Record Model Identifier or Path for Log TM_user.info(" ") TM_user.info( "St.Louis,Hours 1-24,January 1-December 31,Coeff = 1,No Shadows") #TM_user.info(" ") model1 = ModelV1() model1.gbxml = inputfile model1.location = locationfile #print "check: ", model1.location model1.start_date = datetime(year=1997, month=1, day=1, hour=0) model1.end_date = datetime(year=1997, month=12, day=31, hour=23) model1.Coeff = 1 # Currently using 0.25, 0.45, 1.00 model1.ShadowsFlag = int( shadowflag ) # 1 means calculate shadows, 0 means ignore shadow module model1.Q_total = 0 # Zones are part of the gbxml.py but not sure at this point how to have them set from here... model1.terrain = 'Towns and City Scapes' # Will be one of these from a list of options offered to the user: # 'Flat or Open Countryside' # 'Rough or Wooded Country' # 'Towns and City Scapes' # 'Ocean Front Areas' # 'Urban, Industrial, or Forest' # Using Na's formula for month totals instead of annual total only is currently giving an underestimation for the total heat flux model1.timestep = 1 # Will be set at 1 for every hour every day or 2 for every hour every other day U.devPrint("Reaching TM_Model.run function...") model1.run() TMend = time.clock() U.devPrint("Time for TM Module: " + str(TMend - TMstart)) try: opts, args = getopt.getopt(argv, "hi:o:", ["inputfile=", "outputfile="]) except getopt.GetoptError: #print 'test.py -i <inputfile> -o <outputfile>' sys.exit(2) for opt, arg in opts: if opt == '-h': #print 'test.py -i <inputfile> -o <outputfile>' sys.exit() elif opt in ("-h", "--help"): #usage() sys.exit() elif opt == "-d": global _debug _debug = 1 sys.exit() elif opt in ("-i", "--inputfile"): inputfile = arg elif opt in ("-o", "--outputfile"): outputfile = arg #logging.basicConfig(filename='output.log', level=logging.DEBUG) # Appends new logging #logging.basicConfig(filename='output.log', filemode='w', level=logging.DEBUG) # Replaces whole logging file with level #logging.debug('Tool is functional... ') #logging.warning('Check for correctness: ') #logging.warn('Check for correctness: ') #logging.error('Not passing... ') #logging.critical('Verify this number: ') #log = logging.getLogger('TM_V1') # This error will log the file and line number of errors #try: # raise RuntimeError #except Exception, err: # log.exception("Error!") #print 'Input file is "', inputfile #print 'Output file is "', outputfile Assembly.info(" ") Assembly.info(" ") Assembly.info(" ") EE_coder.info("EE Coder Version Finished") EE_user.info("EE User Version Finished") Assembly.info("Assembly Finished") #TM_coder.info("TM Coder Version Finished") TM_user.info("TM User Version Finished") # Create the .csv reporter [model, KWatts, Joules, EETotal, EWTotal, Cost...][surface area reporting] # This worked before passing in from C#: #outputfile = open('output.csv', 'w') #with open("TM_user.log", 'r') as f: # for line in f: # outputfile.write(line) #outputfile.close() # This worked for passing in from C#: # Embodied Energy Model for Excel: outputfile = open(outputpath + 'ModelOutput.csv', 'w') #C:\Users\hfergus2\Desktop\pygscale\output_EE.csv #outputfileTest.write("Is able to write to this file type...") with open(outputpath + "TM_user.log", 'r') as f: # TM Data by Month and Year Totals for line in f: outputfile.write(line) with open(outputpath + "EE_coder.log", 'r') as f: # EE Model Data for line in f: outputfile.write(line) with open(outputpath + "EE_user.log", 'r') as f: # EE Missing Material Section, if any for line in f: outputfile.write(line) with open(outputpath + "Assembly.log", 'r') as f: # EE Missing Material Section, if any for line in f: outputfile.write(line) # This should be somewhere noted for a user, but is not necessary to be shown now in the Output file #with open(outputpath + "Coder.log", 'r') as f: # Coder notes from gbxml missing data/tag handling, if any # for line in f: # outputfile.write(line) outputfile.close() sys.stdout.write("Models Finished")