instrument_list = None if s.isConnected(): instrument_list = s.getConnection().get_instruments() print("Instrument_List : ", instrument_list) active = True l = Loader() prev = None while active: try: i = input("Enter module name : ") print("Got [", i, "]") if prev == None or prev != i and i != "": prev = i l.run(s, i) else: l.run(s) except KeyboardInterrupt: print("Closing connection") s.close() active = False continue except Exception as e: print("Fail : ", e) continue
# array of index, this test code use 2048 points data, # so The index is repeated every 2048 # ex) 0, 1, 2, 3....2047, 0, 1, 2, 3.......2047, 0.... index = 0 st = [] # The array of timestamps which start to inserting data en = [] # The array of timestamps which end to inserting data Test_time = [] # The array of test time try: for length in range(Loop): if index % length_Hdata == 0: #If the index is larger than the data length(2048), it is changed back to 0. index = 0 st.append(get_float_time_stamp()) session.insert_record("root.turbine2.bently3500", length, measurements_list_, data_type_list_, values_list_[index]) en.append(get_float_time_stamp()) # Test_time.append(en[i]-st[i]) index += 1 finally: All_Test_time = en[-1] - st[0] print("Test_time: " + str(All_Test_time)) Writing_frequency = (Sensor * Loop) / All_Test_time print("Writing frequency: " + str(np.around(Writing_frequency, 2))) # close session connection. session.close() print("All executions done!!")
from Session import Session # check if temp file exists and recreate the last session file if it does l_s_clean() # call the session print 'initializing Session :)' sess = Session(get_current_time()) # print initial session info print 'current week: week %d' % sess.current_week print 'total this week.. %s' % secs_to_hours(sess.total_this_week) # set up the timer stop and call timer update_stop = threading.Event() update_l_s(update_stop) # run the loooop!! while sess.active: raw_in = raw_input('eo > ') if (raw_in == 'close'): update_stop.set() sess.close() elif (raw_in == 'session'): print sess.get_total_session_time() # print info on the session print 'Session summary' print 'Total time accum: %s' % secs_to_hours(sess.total_this_week) print 'Total Monthly: %s' % secs_to_hours(sess.total_this_month)