View Single Post
  #1  
Old 07-02-2016, 01:18 PM
Eugene Eugene is offline
Member
 
Join Date: Jun 2016
Posts: 6
Timer for experiment

Hi Jeff,

I'm using Vizard to run an experiment. I used viz.tick() to register a startTime for an action e.g. turn ON the power of a system. I added a delay for the simulation to complete the process. Recently, I added viz.pause and viz.play to my program so that I could pause the simulation at any time to ask questions. However, I realized that viz.tick() is still running even when I pause the simulation. As my progress bar update is based on viz.tick() it did not pause as I expected.

Is there ways to stop viz.tick() when I pause the program or would you recommends I use other methods to register my time.

Thank you.

def displayProcessTime():

global RemainingTime
global StartTime
global EstimatedTime
global Time

print 'displayProcessTime function'

if 'SHUTDOWN' not in instrList[currentStep[0]][0]:
StartTime = viz.tick()
EstimatedTime = StartTime + int(timing[instrument][1])
#RemainingTime = EstimatedTime - viz.tick()
else:
StartTime = viz.tick()
EstimatedTime = StartTime + int(timing[instrument][2])
#RemainingTime = EstimatedTime - viz.tick()

.....

while viz.tick() <= EstimatedTime:
print 'SSRMS PB'
yield viztask.waitTime(0.5)
UpdateProgressBar()
myBar.set(ProgressBarLevel)
Reply With Quote