123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import os
- import Operations as op
- import Graph as gr
- import Connection as connect
- import numpy as np
- #***********************************main********************************************
- #--------connect To DB -------------------------
- root_path = os.getcwd()
- db = os.path.join(root_path,"BIII.db")
- conn = connect.create_connection(db)
- #Operations
- #-----------------------get duration of parts------------------------------------------
- #op.get_all_parts(conn)
- #op.get_nok_parts(conn)
- #op.get_durations_lv4(conn)
- #----------calculate quantiles of operation duration ------------
- #op.get_break_length_stat(conn)
- #----------- get stored quantile ---------------------------
- #t_quartile = connect.get_third_quartile(conn)
- #t_quartile = float(t_quartile)*5
- #t_quartile = float(t_quartile)*5
- #t_quartile = float(3)
- #------------- calculate duration of all parts with regards to quantile*2 -----------------------------
- #durations = op.get_durations_part(t_quartile, conn)
- #print(durations)
- #-------------get calculated part duration from db--------------------------
- #query = "select value from results where category ='Duration_Part_Breakl_" + str(t_quartile) + "' order by timestamp desc limit 1"
- #result = np.array([], dtype=[('keys', int), ('data', float)])
- #durations = connect.get_result_from_db(query, result, conn)
- #------------calculate aggregatred duration -------------------------
- #aggr_dur = op.aggregate_duration(durations)
- #-------------calculate break --------------------------
- #breaks = op.get_breaks(480, conn)
- #breaks = op.get_breaks(50, conn)
- #breaks = op.get_breaks(1, conn)
- #breaks = op.get_breaks(t_quartile,conn)
- # ------------- get breaks from db ------------------------
- #query = "select value from results where category ='Duration_BreaksWithin"+str(t_quartile) +"' order by timestamp desc limit 1"
- #result = np.array([], dtype=[('keys', int), ('data', float)])
- #breaks = connect.get_result_from_db(query, result, conn)
- #print("Breaks")
- #print(breaks)
- #--------------- get measures-----------------
- #measures = op.get_all_measures(conn)
- #---------------plot results --------------------------
- #gr.plot_all_measures(measures)
- #gr.plot_duration_part(durations)
- #gr.plot_duration_part(aggr_dur)
- #gr.plot_duration_part(breaks)
- #------Get durations Zylinder-----------
- final_result = op.get_durations_zylinder(conn)
- # show me values below and above the zylinder_values
- greater_one = np.where(final_result['data'] > 1.0)[0]
- smaller_zero = np.where(final_result['data'] < 0.0)[0]
- #result = np.append(greater_one, smaller_zero)
- sum = greater_one.size + smaller_zero.size
- print("-----here comes the sum -----------")
- print(sum)
- gr.plot_zylinder_part(final_result)
- #------------------calculate longer durations (outsiders---------------
- #op.outsiders(durations, conn)
- #-----------close connection---------------
- conn.close()
|