User Tools

Site Tools


python:ept

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

python:ept [Thursday, 16 November 2006 : 11:00:45] (current)
Line 1: Line 1:
 +Here, a python script is shown to determine the mean EPT and its coefficient of variation of a multiple machine workstation. The script uses chi models [[cookbook:​EPT:​MMModel]].chi and [[cookbook:​EPT:​MMEPT]].chi. It determines the ept for different settings of tf (average time to failure during processing),​ tr (average time to repair) and ra (arrival rates). The scripts starts MMModel for each setting. MMModel writes all arrivals and departures of lots in events_ra_tf.txt. Next, the events are sorted on time using the linux function sort, creating a file named events_sorted_ra_tf.txt. Then, the sorted file is opened and an end mark is added to the end of the file. Finally, MMEPT is called to calculate the average EPT and its coefficient of variation. ​
  
 +
 +<code python>
 +#​!/​usr/​bin/​env python2
 +
 +import os
 +
 +def removeFile(fname):​
 +     if os.path.exists(fname):​
 +         ​os.unlink(fname)
 +
 +eptFile = '​ept.txt'​
 +
 +removeFile(eptFile)
 +
 +for tf in [0.8,​8.0,​16.0]:​
 +     for ra in [1.0,​1.4,​1.8]:​
 +         tr = tf/4.0
 +         ta = 1./ra
 +
 +         ​eventsFile = '​events/​events_%s_%s.txt'​ % (ra,tf)
 +         ​sortedEvents = '​events/​events_sort_%s_%s.txt'​ % (ra,tf)
 +
 +         #​removeFile(eventsFile)
 +         ​removeFile(sortedEvents)
 +         cmd = '​startmodel MMModel 200000 0 %s 0.8 0.5 %s %s' % (ta, tf, tr)
 +         ​os.system('​%s > %s' % (cmd, eventsFile))
 +
 +         ​os.system('​sort -n -o %s %s' % (sortedEvents,​ eventsFile))
 +
 +         ​events = open(sortedEvents,​ '​a'​)
 +         ​events.write('​1.0 ​  "​Q"​\n'​)
 +         ​events.close()
 +
 +         cmd = '​startmodel MMEPT < %s >> %s' % (sortedEvents,​ eptFile)
 +         ​os.system(cmd)
 +</​code>​
python/ept.txt · Last modified: Thursday, 16 November 2006 : 11:00:45 (external edit)