def handle(self, *args, **options): settings = Settings() active_well = settings.get_active_well() d = 100 h = d for cnt in range(100): m = 1 if int(random.uniform(1, 10)) == 1: m = -1 d += int(random.uniform(1, 10)) * m if d - ((d / 100) * 100) <= 20 and d > 120: g = int(random.uniform(90, 110)) else: g = int(random.uniform(30, 35)) if d > h: h = d bd = WITS0(well=active_well, time_stamp=datetime.utcnow(), recid=1, itemid=8, value=d) bd.save() hd = WITS0(well=active_well, time_stamp=datetime.utcnow(), recid=1, itemid=10, value=h) hd.save() time.sleep(10) mdwrt = ToolMWDRealTime(well=active_well, time_stamp=datetime.utcnow(), type="gammaray", value=g) mdwrt.save() time.sleep(10)
def handle(self, *args, **options): settings = Settings() active_well = settings.get_active_well() g = 30 m = 1 for cnt in range(100) : g += (int(random.uniform(1,15)) * m) print g mdwrt = ToolMWDRealTime(well=active_well, time_stamp=datetime.utcnow(), type='gammaray', value=g ) mdwrt.save() if g>75 : m=-1 if g<30 : m=1 time.sleep(20)