Esempio n. 1
0
	def _storeData(self, s=None):
		"""
		Stores the data. The strategy is to store it all, it has to be processed later.
		The purpose of this function is to standardize the column 'design', so the numerous data files are easily
		accessed and generic scripts can be written for them.

		s has to be given if this is the first time the method is called and an output should  be created.
		"""
		e=self.excelOut
		if not e: #start a new instance.
			if not s:
				raise Exception('simulation instance has to be provided at first call for _storeData')
			e=ExcelOutput(template='sim/planting/template_art3.xls', out=self.filename)
			self.excelOut=e
			e.changeSheet(0)
			#set all the parameters
			paramRow=3
			type=copy.copy(s.m.type) #we need to shift 2aXh because of new directions...
			e.modify(paramRow, 0, s.m.type) #machine type
			e.modify(paramRow, 1, s.G.terrain.ttype) #terrain type
			e.modify(paramRow, 2, s.G.terrain.stumpFile) #terrain type
			e.modify(paramRow, 3, s.G.terrain.stumpsPerH) #stumps/ha
			e.modify(paramRow, 4, s.G.terrain.groundModel)
			e.modify(paramRow, 5, s.G.terrain.blockQuota*100) #percent
			e.modify(paramRow, 6, s.G.terrain.boulderFreq)
			e.modify(paramRow, 7, s.G.terrain.meanBoulderV*1000)
			e.modify(paramRow, 8, s.G.terrain.humusType) #humustype
			e.modify(paramRow, 9, s.stats['noSurfBoulders'])#set in plantmsim
			e.modify(paramRow, 10, round(s.stats['meanSurfBoulderDiam']*10,1))#changed to dm, set in plantmsim
			e.modify(paramRow, 12, s.m.craneMaxL)
			e.modify(paramRow, 13, s.m.plantMinDist*100)
			e.modify(paramRow, 14, s.m.pDevs[0].plantHeads[0].width*100)
			e.modify(paramRow, 15, s.G.simParam['TSR'])
			if s.G.simParam['inverting']==True and s.G.simParam['ExcavatorInverting']==True:
				noManRemInv = 5
				cycleTimeInv = s.G.simParam['tInvExcavator']
			elif s.G.simParam['inverting']==True and s.G.simParam['KOInverting']==True:
				noManRemInv = 11
				cycleTimeInv = s.G.simParam['tCWhenInvKO']
			elif s.G.simParam['inverting']==False:
				noManRemInv = 5
				cycleTimeInv = 0
			e.modify(paramRow, 16, cycleTimeInv)
			e.modify(paramRow, 17, noManRemInv)
			if s.G.simParam['rectangular']==False: scoopshape='SemiCyl'
			elif s.G.simParam['rectangular']==True: scoopshape='Rect'
			e.modify(paramRow, 18, scoopshape)
			e.modify(paramRow, 19, s.G.simParam['multiplierFindMuSite'])
			e.modify(paramRow, 20, s.G.simParam['moundRadius'])
			if s.G.simParam['inverting']==True:
				e.modify(paramRow, 21, s.G.simParam['SBMinvert'])
			elif s.G.simParam['inverting']==False:
				e.modify(paramRow, 21, s.G.simParam['SBMmound'])
		e.changeSheet(1) #the time-data sheet
		tdrow=2+self.sims
		for col,val in enumerate(self.timeData):
			e.modify(tdrow,col,round(val,2)) #writes the time data. Request from BTE to round off
		e.save()
		return e
Esempio n. 2
0
	def _storeData(self, s=None):
		"""
		stores the data. The strategy is to store it all, it has to be processed later.
		The purpose of this function is to standardize the column "design", so the numerous data files are easily
		accessed and generic scripts can be written for them.

		s has to be given if this is the first time the method is called and an output should  be created.
		"""
		e=self.excelOut
		if not e: #start a new instance.
			if not s:
				raise Exception('simulation instance has to be provided at first call for _storeData')
			e=ExcelOutput(template='sim/planting/template.xls', out=self.filename)
			self.excelOut=e
			e.changeSheet(0)
			#set all the parameters
			paramRow=3
			type=copy.copy(s.m.type) #we need to shift 2aXh because of new directions...
			e.modify(paramRow, 0, s.m.type) #machine type
			e.modify(paramRow, 1, s.G.terrain.ttype) #terrain type
			e.modify(paramRow, 2, s.G.terrain.stumpFile) #terrain type
			e.modify(paramRow, 3, s.G.terrain.stumpsPerH) #stumps/ha
			e.modify(paramRow, 4, s.G.terrain.groundModel)
			e.modify(paramRow, 5, s.G.terrain.blockQuota*100) #percent
			e.modify(paramRow, 6, s.G.terrain.boulderFreq)
			e.modify(paramRow, 7, s.G.terrain.meanBoulderV*1000)
			e.modify(paramRow, 9, s.m.craneMaxL)
			if s.m.type[0:2]=='2a':
				e.modify(paramRow, 10, s.m.craneIntersect)
				e.modify(paramRow, 11, s.m.angleLim[0]*180/pi)
				e.modify(paramRow, 12, s.m.angleLim[1]*180/pi)
			if len(s.m.pDevs[0].plantHeads)==2: e.modify(paramRow, 13, s.m.pDevs[0].plantSepDist*100)
			e.modify(paramRow, 14, s.m.pDevs[0].plantHeads[0].width*100)
			e.modify(paramRow, 15, s.m.stockingRate)
			e.modify(paramRow, 16, s.m.plantMinDist)
			e.modify(paramRow, 17, s.m.times['switchFocus'])
			e.modify(paramRow, 18, str(s.G.automatic['automove']))
			e.modify(paramRow, 19, str(s.G.automatic['mound']))
			e.modify(paramRow, 20, s.m.velocities['radial'])			
			e.modify(paramRow, 21, str(self.bestCase))
			e.modify(paramRow, 22, str(self.worstCase))
		e.changeSheet(1) #the time-data sheet
		tdrow=2+self.sims
		for col,val in enumerate(self.timeData):
			print tdrow, col, val
			e.modify(tdrow,col,round(val,2)) #writes the time data. Request from BTE to round off
		e.save()
		return e