Пример #1
0
    def get_day_flyability(self, ground, day):
        day_flyability = {}

        weather_slices = WeatherTimeSlice.objects.filter(day_of_occurance=day)

        if empty(weather_slices):
            raise UnflyableError("No weather time slices")

        for wts in weather_slices:
            wts_time,flyability = self.get_wts_flyability(ground, wts)
            day_flyability[wts_time]=flyability

        if logger:
            logger.debug("Flyability for day %s: %s" % (day.id, day_flyability))

        if empty(day_flyability):
            raise UnflyableError("Empty day_flyability")

        return day_flyability
Пример #2
0
    def get_landing_conditions(self, check_day):

        landing_list = list(Landing.objects.filter(site=self))

        if empty(landing_list):
            raise UnflyableError("No landings for site %s" %self)

        if logger:
            logger.debug("Landing list is %s" % landing_list)
            logger.debug("Flyable landings with %s site on %s day" % (self,check_day))

        return self.get_ground_conditions(landing_list, check_day)
Пример #3
0
    def get_ground_conditions(self, ground_list, check_day):
        ground_status = {}
        for ground in ground_list:
            ground_status[ground] = self.get_day_flyability(ground, check_day)
            if logger:
                logger.debug( "Ground check for the %s ground at %s" % (ground.name, ground.site))


        if logger:
            logger.debug("Resultant ground status dict: %s" % (ground_status))

        if empty(ground_status.iteritems()):
            raise UnflyableError("Ground status has no statuses")
        else:
            return ground_status
Пример #4
0
class chessboard(object):
	global row,column,pos_hash,empty
	pos_hash={}
	empty=empty()	
	def __init__(self, arg,arg1):
		super(chessboard, self).__init__()
		self.row = arg
		self.column= arg1
		self.x = [[empty for i in range(self.row)] for j in range(self.column)]
		self.display()
	def pos(self,row,col,char,player):
		self.x[row][col]=char
		print(self.x[row][col].position,char.name)
		pos_hash[char.name]=[row,col]
	def display(self):
		for i in range(self.row):
			for t in range(self.column):
				sys.stdout.write(" "+self.x[i][t].name)
			print("\n")
	def valid(self,pos):
		if(pos[0]<=self.row-1 and pos[0]>=0 and pos[1]<=self.column-1 and pos[1]>=0):
			return True
		else:
			return False
	def find_char(self,char):
		if char in pos_hash:
			pos=pos_hash[char]
			if(self.x[pos[0]][pos[1]].name==" - "):
				del pos_hash[char]
				return False
			else:
				return self.x[pos[0]][pos[1]]
		else:
			print("It is dead ! Get over it")
			return False
	def conseq(self,conseq,player):
		for i in conseq:
			x=self.x
			print("value of iter",x)
			if(x[i[0]][i[1]].player!=player and x[i[0]][i[1]].player!=None):
				x[i[0]][i[1]].alive=False
				x[i[0]][i[1]]=empty
	def emptyy(self,row,col):
		self.x[row][col]=empty
Пример #5
0
wing.sref = 31.00
wing.span = 34.10
wing.mac = wing.sref / wing.span
wing.Nwr = 2 * 41 + 22
wing.deltaw = (wing.span**2) / (wing.Nwr * wing.sref)
wing.t_c = 0.128
wing.Nwer = 10.

horizontal.area = 10.  #FAKE NUMBER!!!!!
horizontal.span = wing.sref * ((1. + 3. / 16.) / 9.)
horizontal.mac = horizontal.area / horizontal.span
horizontal.Nwr = 16.
horizontal.deltah = (horizontal.span**2) / (horizontal.Nwr * horizontal.area)
horizontal.t_c = 0.12  # I have no idea

vertical.area = 10.  #FAKE NUMBER!!!!!
vertical.span = wing.sref * ((11. / 16.) / 9.)
vertical.mac = horizontal.area / horizontal.span
vertical.Nwr = 10.
vertical.deltah = (vertical.span**2) / (vertical.Nwr * vertical.area)
vertical.t_c = 0.12  # I have no idea

aircraft.nult = 1.75
aircraft.gw = 109633.3 / 1000.
aircraft.qm = 28.87
aircraft.Ltb = wing.sref * ((2. + 1. / 8.) / 9.)

weights = empty.empty(wing, aircraft, horizontal, vertical)

#print weights
wing.sref   = 31.00
wing.span   = 34.10
wing.mac    = wing.sref/wing.span
wing.Nwr    = 2*41+22
wing.deltaw = (wing.span**2)/(wing.Nwr*wing.sref)
wing.t_c    = 0.128
wing.Nwer   = 10.

horizontal.area   = 10. #FAKE NUMBER!!!!!
horizontal.span   = wing.sref*((1.+3./16.)/9.)
horizontal.mac    = horizontal.area/horizontal.span
horizontal.Nwr    = 16.
horizontal.deltah = (horizontal.span**2)/(horizontal.Nwr*horizontal.area)
horizontal.t_c    = 0.12 # I have no idea

vertical.area   = 10. #FAKE NUMBER!!!!!
vertical.span   = wing.sref*((11./16.)/9.)
vertical.mac    = horizontal.area/horizontal.span
vertical.Nwr    = 10.
vertical.deltah = (vertical.span**2)/(vertical.Nwr*vertical.area)
vertical.t_c    = 0.12 # I have no idea

aircraft.nult = 1.75
aircraft.gw   = 109633.3/1000.
aircraft.qm   = 28.87
aircraft.Ltb  = wing.sref*((2.+1./8.)/9.)


weights = empty.empty(wing,aircraft,horizontal,vertical)

#print weights