def send_resupply(self,stat_id,amt): '''Station stat_id wants amt goods''' #sanity checks print amt if stat_id not in globalvars.stations: return False stat = globalvars.stations[stat_id] if stat.location not in ['LEO','GEO','ISS','HEO']: return False dv = botex.Course(botex.earthSurface,botex.fetchLocation(stat.location)).deltavee() amount_to_ship = 13150* (10.366/(math.exp((dv)/(450*9.8)) - 1)) if stat.financial_account < amount_to_ship*get_launch_cost(): return False #cost of launch + supplies cargo_vessel = Station() cargo_vessel.location = stat.location #cargo_vessel.modules.append(module.DragonCargoModule().id) #cargo_vessel.add_item('MMH',412.8) #cargo_vessel.add_item('NTO',877.2) #check sum tot = 0 for a in amt: assert amt[a] > 0 tot += amt[a]*amount_to_ship cargo_vessel.add_item(a,amount_to_ship*amt[a]) assert tot <= 14000 #3320 #print amount_to_ship, tot #quit() stat.financial_account -= get_launch_cost()*cargo_vessel.mass global launch_rate launch_rate += 1 #launched! WOOO! print 'LAUNCHED!',amt #dock vessel to stat #cargo_vessel.home_station = stat_id #cargo_vessel.home_relationship = 'Wholly-Owned Subsidiary' cargo_vessel.dock(stat_id) return True
#test.modules.append(module.BasicLivingModule().id) #test.modules.append(module.BasicHydroponicsModule().id) #test.modules.append(module.BasicHabitationModule().id) test.modules.append(module.GenericLH2LOXEngineModule().id) test.modules.append(module.LH2ElectrolysisModule().id) test.modules.append(module.MicrowavePowerAntenna().id) test.add_item('Water',10000) test.financial_account = 1000000000 #act = actors.Human() #test.actors.append(act.id) test.init_storage_std() test.location = 'GEO' #print 'Stationkeeping:',test.stationKeepingDeltavee(util.seconds(1,'year')) #print test.burn(10) #quit() test2 = Station('Tourist Test Station') test2.modules.append(module.SolarPowerModule().id) test2.modules.append(module.BasicLivingModule().id) #test2.modules.append(module.BasicHydroponicsModule().id) test2.modules.append(module.BasicHabitationModule().id) test2.financial_account = 1000000000 test2.init_storage_std() act = actors.Human()