Page 305 - 2020학년도 MDP과제발표회 자료집 (통신과) (3)
P. 305

s25.measureStop()


                           timestamp  =  datetime.now()
                           g10,  interval10,  r10,  PM10count,  total_interrupt_count10,  wrong_level_count10
             =  s10.read()
                           g25,  interval25,  r25,  PM25count,  total_interrupt_count25,  wrong_level_count25
             =  s25.read()


                           #  If  PM10count  is  less  than  Zero  (Negative  Value)  set  PM10  Count  to  Zero
                           #  If  PM10count  gets  error  value  set  to  zero.
                           if  PM10count  <  0  or  PM10count  ==  1114000.62:
                                   PM10count  =  0


                           #  If  PM25count  is  less  than  Zero  (Negative  Value)  set  PM25  Count  to  Zero
                           #If  PM25count  gets  error  value  set  to  zero
                           if  PM25count  <  0  or  PM25count  ==  1114000.62:
                                   PM25count  =  0


                           print("Measure  at  the  same  time  --")
                           print("PM1.0  time:  {},  Interval:  {},  Ratio:  {:.3f},  Count:  {},  Total  Interrupt:  {},
             Wrong  Interrupt:  {}".
                                   format(timestamp,       int(interval10),     r10,       int(PM10count),
             total_interrupt_count10,  wrong_level_count10))


                           print("PM2.5  time:  {},  Interval:  {},  Ratio:  {:.3f},  Count:  {},  Total  Interrupt:  {},
             Wrong  Interrupt:  {}".
                                   format(timestamp,       int(interval25),     r25,       int(PM25count),
             total_interrupt_count25,  wrong_level_count25))


                           print()


                           #  measure  PM1.0
                           s10.measureStart()
                           time.sleep(30)
                           s10.measureStop()


                           timestamp  =  datetime.now()
                           g10,  interval10,  r10,  PM10count,  total_interrupt_count10,  wrong_level_count10
             =  s10.read()


                           if  PM10count  <  0  or  PM10count  ==  1114000.62:
                                   PM10count  =  0


                           print("Measure  in  order  --")
                           print("PM1.0  time:  {},  Interval:  {},  Ratio:  {:.3f},  Count:  {},  Total  Interrupt:  {},
             Wrong      Interrupt:    {}".format(timestamp,     int(interval10),   r10,    int(PM10count),
             total_interrupt_count10,  wrong_level_count10))
                                                         -  317  -
   300   301   302   303   304   305   306   307   308   309   310