Exemple #1
0
def writeDeviceTimeshiftable(machine, hnum):
    if machine.name == "WashingMachine" and len(machine.StartTimes) > 0:
        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.StartTimes, None, 60)
        writeCsvLine('WashingMachine_Starttimes.txt', hnum, text)

        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.EndTimes, None, 60)
        writeCsvLine('WashingMachine_Endtimes.txt', hnum, text)

        text = str(hnum) + ':'
        text += machine.LongProfile
        writeCsvLine('WashingMachine_Profile.txt', hnum, text)

    elif len(machine.StartTimes) > 0:
        #In our case it is a dishwasher
        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.StartTimes, None, 60)
        writeCsvLine('Dishwasher_Starttimes.txt', hnum, text)

        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.EndTimes, None, 60)
        writeCsvLine('Dishwasher_Endtimes.txt', hnum, text)

        text = str(hnum) + ':'
        text += machine.LongProfile
        writeCsvLine('Dishwasher_Profile.txt', hnum, text)
Exemple #2
0
def writeDeviceThermostat(machine, hnum):
    text = str(hnum) + ':'
    text += profilegentools.createStringList(machine.StartTimes, None, 60)
    writeCsvLine('Thermostat_Starttimes.txt', hnum, text)

    text = str(hnum) + ':'
    text += profilegentools.createStringList(machine.Setpoints)
    writeCsvLine('Thermostat_Setpoints.txt', hnum, text)
Exemple #3
0
def writeDeviceBufferTimeshiftable(machine, hnum):
    if machine.BufferCapacity > 0 and len(machine.StartTimes) > 0:
        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.StartTimes, None, 60)
        writeCsvLine('ElectricVehicle_Starttimes.txt', hnum, text)

        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.EndTimes, None, 60)
        writeCsvLine('ElectricVehicle_Endtimes.txt', hnum, text)

        text = str(hnum) + ':'
        text += profilegentools.createStringList(machine.EnergyLoss, None, 1,
                                                 False)
        writeCsvLine('ElectricVehicle_RequiredCharge.txt', hnum, text)

        text = str(hnum) + ':'
        text += str(machine.BufferCapacity) + ',' + str(machine.Consumption)
        writeCsvLine('ElectricVehicle_Specs.txt', hnum, text)
Exemple #4
0
def writeDeviceTimeshiftable(machine, hnum):
	text = []
	
	if len(machine.StartTimes) > 0:
		text.append('\tmachine = node.newElement("TrianaTimeShiftable")')
		text.append('\tmachine.setPosition(coordx+150, coordy+75)')
		if config.intervalLength  == 1:
			text.append('\tmachine.set("DemandProfile", ['+machine.LongProfile+'])')
		else:
			text.append('\tmachine.set("DemandProfile", ['+machine.ShortProfile+'])')
		text.append('\tmachine.set("StartTimes",  ['+profilegentools.createStringList(machine.StartTimes, None, 60)+'])')
		text.append('\tmachine.set("EndTimes",  ['+profilegentools.createStringList(machine.EndTimes, machine.StartTimes, 60)+'])')
		text.append('\tmachine.set("PredictedStartTimes",  ['+profilegentools.createStringList(machine.StartTimes, None, 60)+'])')
		text.append('\tmachine.set("PredictedEndTimes",  ['+profilegentools.createStringList(machine.EndTimes, machine.StartTimes, 60)+'])')
		text.append('\tmachine.set("LoadType", "Power")')
		text.append('\tmachine.set("Name", "'+machine.name+'"+str(houseNum))')
		text.append('\tmachine.set("TimeBase", '+str(config.timeBase)+')')
		text.append('\ttriana.newConnection("TrianaEnergyStream", pool.Stream, machine.Stream)')

		text.append('\tif control:')
		text.append('\t\ttsc = node.newElement("TrianaTimeShiftableController", "'+machine.name+'Controller"+str(houseNum))')
		text.append('\t\ttsc.setPosition(coordx+150, coordy+150)')
		text.append('\t\ttsc.set("TimeBase", '+str(config.timeBase)+')')
		if machine.name == "WashingMachine":
			text.append('\t\ttsc.set("CostPrice", cfg[\'WM_cost\'])')
			text.append('\t\ttsc.set("MinPlanningImprovement", cfg[\'WM_improvement\'])')
			text.append('\t\tif cfg[\'WM_readonly\'].count(houseNum) > 0:')
			text.append('\t\t\ttsc.set("ReadOnly", True)')
		else:
			text.append('\t\ttsc.set("CostPrice", cfg[\'DW_cost\'])')
			text.append('\t\ttsc.set("MinPlanningImprovement", cfg[\'DW_improvement\'])')
			text.append('\t\tif cfg[\'DW_readonly\'].count(houseNum) > 0:')
			text.append('\t\t\ttsc.set("ReadOnly", True)')
		text.append('\t\ttriana.newConnection("TrianaControlConnection", machine.Control, tsc.Children)')
		text.append('\t\ttriana.newConnection("TrianaControlConnection", tsc.Parent, houseController.Children)')

		f = open(config.folder+'/House'+str(hnum)+'.py', 'a')
		for line in range(0, len(text)):
			f.write(text[line] + '\n')
		f.close()
Exemple #5
0
def writeDeviceBufferTimeshiftable(machine, hnum):
	text = []
	
	if machine.BufferCapacity > 0 and len(machine.StartTimes) > 0:
		text.append('\tmachine = node.newElement("TrianaBufferTimeShiftable", "ElectricalVehicle"+str(houseNum))')
		text.append('\tmachine.setPosition(coordx+150, coordy-75)')
		text.append('\tmachine.set("StartTimes", ['+profilegentools.createStringList(machine.StartTimes, None, 60)+'])')
		text.append('\tmachine.set("EndTimes", ['+profilegentools.createStringList(machine.EndTimes, machine.StartTimes, 60)+'])')
		text.append('\tmachine.set("PredictedStartTimes", ['+profilegentools.createStringList(machine.StartTimes, None, 60)+'])')
		text.append('\tmachine.set("PredictedEndTimes", ['+profilegentools.createStringList(machine.EndTimes, machine.StartTimes, 60)+'])')
		text.append('\tmachine.set("Capacity", '+ str(machine.BufferCapacity) +')')
		text.append('\tmachine.set("InitialSoC", '+ str(machine.BufferCapacity) +')')
		text.append('\tmachine.set("MinPower", 1380.0)')
		if machine.Consumption == 3700:
			machine.Consumption = 3680.0
			text.append('\tmachine.set("MaxPower", '+ str(machine.Consumption) +')')
			text.append('\tmachine.set("ChargingPowers", [1380.0, 1610.0, 1840.0, 2070.0, 2300.0, 2530.0, 2760.0, 2990.0, 3220.0, 3450.0, 3680.0] )')
		else:
			machine.Consumption = 7360.0
			text.append('\tmachine.set("MaxPower", '+ str(machine.Consumption) +')')
			text.append('\tmachine.set("ChargingPowers", [1380.0, 1610.0, 1840.0, 2070.0, 2300.0, 2530.0, 2760.0, 2990.0, 3220.0, 3450.0, 3680.0, 3910, 4140, 4370, 4600, 4830, 5060, 5290, 5520, 5750, 5980, 6210, 6440, 6670, 6900, 7130, 7360] )')
		text.append('\tmachine.set("SoCSetpoints", ['+profilegentools.createStringList(machine.Setpoint, None, 1, False)+'])')
		text.append('\tmachine.set("EnergyLoss", ['+profilegentools.createStringList(machine.EnergyLoss, None, 1, False)+'])')
		text.append('\tmachine.set("PredictedSoCSetpoints", ['+profilegentools.createStringList(machine.Setpoint, None, 1, False)+'])')
		text.append('\tmachine.set("PredictedEnergyLoss", ['+profilegentools.createStringList(machine.EnergyLoss, None, 1, False)+'])')
		text.append('\tmachine.set("Efficiency", 1.0)')
		text.append('\tmachine.set("TimeBase", '+str(config.timeBase)+')')
		text.append('\tmachine.set("LoadType", "Power")')
		text.append('\ttriana.newConnection("TrianaEnergyStream", pool.Stream, machine.Stream)')
		
		text.append('\tif control:')
		text.append('\t\tmachinec = node.newElement("TrianaBufferTimeShiftableController", "EVController"+str(houseNum))')
		text.append('\t\tmachinec.setPosition(coordx+150, coordy-150)')
		text.append('\t\tmachinec.set("TimeBase", '+str(config.timeBase)+')')
		text.append('\t\tmachinec.set("CostPrice", cfg[\'EV_cost\'])')
		text.append('\t\tmachinec.set("MinPlanningImprovement", cfg[\'EV_improvement\'])')
		text.append('\t\tif cfg[\'EV_readonly\'].count(houseNum) > 0:')
		text.append('\t\t\tmachinec.set("ReadOnly", True)')
		text.append('\t\ttriana.newConnection("TrianaControlConnection", machine.Control, machinec.Children)')
		text.append('\t\ttriana.newConnection("TrianaControlConnection", machinec.Parent, houseController.Children)')
		
		f = open(config.folder+'/House'+str(hnum)+'.py', 'a')
		for line in range(0, len(text)):
			f.write(text[line] + '\n')
		f.close()