<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.comp.python.simpy.user">
    <title>gmane.comp.python.simpy.user</title>
    <link>http://blog.gmane.org/gmane.comp.python.simpy.user</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1360"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1352"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1343"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1341"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1338"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1337"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1327"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1316"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1315"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1313"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1309"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1307"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1302"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1301"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1299"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1295"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1293"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1291"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1288"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.comp.python.simpy.user/1287"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1360">
    <title>Order and line stucture</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1360</link>
    <description>&lt;pre&gt;Hello, 

I am trying to simulate a production line, all the way from customer order to 
dispatch. This will allow me to load the factory with different types of work 
based on historic data. 

But a down side of this, I need to simulate the process of order creation. So 
first the customer places and order, that order has a number of lines and the 
line has a number of units. 

I have made a procedural source which can create the right number of number 
lines per order and units per line based on some variables.

But the problem I am facing is; the factory stores kits a parts for an entire 
order line (based on which parts they have), but then the builders pick 
individual units (based on the units which are kitted).

So I need to be able to manipulate an entire line at one stage, but at a later 
stage I need to work with individual units.

This seems like the sort of thing that some one might have done before 
(possibly using OO), so is there an example of this structure that I could 
follow?

class Source(Process):
    """ Source generates Orders randomly"""
           
    def generateorder(self):
        i = 1
        while True: #Infinte loop of orders based on the orde rate
            # Create orders with a unique name
            c = order(name = "order%02d"%(i,))
            i =i+1
            # Observe the number of orders placed
            orderTally.observe(i)
            # Call the create line
            activate(c,c.createline())
            # Delay based on the units per anumum and simulation lenght
            t = expovariate(1.0/(((50.0*39.0)/
(((gui.params.UnitsPA)/gui.params.AvgOrderSize)/gui.params.AvgLineSize))))
            yield hold,self,t

class order(Process):
    """Order is created"""

    def __init__(self,name):
        Process.__init__(self)
        self.name = name
        self.ordernumber = name

    def createline(self):
        if debug ==1 :
            print "%7.4f %s has been crated"%(now(),self.name)
        # Calculate the number of lines (based on average lines per order)
        NoOfLines = round((expovariate(1/gui.params.AvgOrderSize)),0)
        # Create the lines
        for i in range(int(NoOfLines)):
            c = line(name = "line%02d"%(i,), orderparent = self.ordernumber)
            i =i+1
            lineTally.observe(i)
            # Call the create unit
            activate(c,c.createunit())
            # Very short delay
            yield hold,self,0.0001
    
class line(Process):
    """ Line is create"""

    # init allows the passing of parent details and other parameters
    def __init__(self,name,orderparent):
        Process.__init__(self)
        self.orderparent = orderparent
        self.linenumber = name
        self.name = name

        #Calculate the size of the units using a random number between 0-1.
        sizevar = random.random()
        if sizevar &amp;lt; RateofSize1:
            self.unitsize = 1
        elif sizevar &amp;lt; (RateofSize1 + RateofSize2):
            self.unitsize = 2
        elif sizevar &amp;lt; (RateofSize1 + RateofSize2 + RateofSize3):
            self.unitsize = 3
        elif sizevar &amp;lt; (RateofSize1 + RateofSize2 + RateofSize3 + RateofSize4):
            self.unitsize = 4
        elif sizevar &amp;lt; (RateofSize1 + RateofSize2 + RateofSize3 + RateofSize4 
+ RateofSize5):
            self.unitsize = 5

    def createunit(self):

        # Calculate the number of units on the line based on the average units 
per line
        NoOfUnits = round((expovariate(1/gui.params.AvgLineSize)),0)
        for i in range(int(NoOfUnits)):
            c = unit(name = "Unit%02d"%(i,),
                     orderparent = self.orderparent,
                     lineparent = self.linenumber,
                     lineparentsize = NoOfUnits,
                     unitsize = self.unitsize)
            i =i+1
            unitTally.observe(i)
            # Call the 
            activate(c,c.QueueUnitForRelease())
            yield hold,self,0.0001


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>Chris</dc:creator>
    <dc:date>2012-05-23T14:08:01</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1352">
    <title>Lis tes messages avant qu'ils ne soient effacés!</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1352</link>
    <description>&lt;pre&gt;Lis ton message de Syn avant qu'il ne soit effacé!

Pour lire ton message, suis simplement ce lien:
http://eu1.badoo.com/0279183266/in/hbFeqxWJOkU/?lang_id=6&amp;amp;m=65&amp;amp;mid=4fbb0ff60000000000060000610b9a0b



Le lien ne fonctionnent pas dans ce message ? Copie le dans la barre d'adresse de ton navigateur.

Tu as reçu cet email suite à une requête de Syn auprès de notre système. S'il s'agit d'une erreur, ignore simplement cet email. La requête sera alors effacée du système.

Amuse-toi bien !
L'équipe Badoo

Vous avez reçu cet email de Badoo Trading Limited (adresse postale ci-dessous). 
http://eu1.badoo.com/impersonation.phtml?lang_id=6&amp;amp;mail_code=65&amp;amp;email=simpy-users%40lists.sourceforge.net&amp;amp;secret=&amp;amp;action=block&amp;amp;block_code=3b37f6&amp;amp;m=65&amp;amp;mid=4fbb0ff60000000000060000610b9a0b
Badoo Trading Limited est une Société à Responsabilité Limitée, enregistrée en Angleterre et Pays de Galles, sous le No. 7540255, bureaux enregistrés à l’adresse 12 Red Lion Square, London, WC1R 4QD.------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Badoo</dc:creator>
    <dc:date>2012-05-22T04:03:04</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1343">
    <title>Question about bus example in the simpy manual</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1343</link>
    <description>&lt;pre&gt;Hello,
I have been experimenting with the Bus breakdown example in the Simpy
manual and am really struggling to understand why when I create
multiple instances of Bus, the last instance seems to get "of
sequence" after the first repair.  I have modified the example code in
the manual very slightly just below the initialize() statement to
create two instances of Bus (Bus1 and Bus2).  Here is my code:

from SimPy.Simulation import *

class Bus(Process):

  def operate(self,repairduration,triplength):    # PEM
     tripleft = triplength
        # "tripleft" is the driving time to finish trip
        # if there are no further breakdowns
     while tripleft &amp;gt; 0:
        yield hold,self,tripleft      # try to finish the trip
            # if a breakdown intervenes
        if self.interrupted():
              print self.interruptCause.name, 'at %s' %now()
              tripleft=self.interruptLeft
                # update driving time to finish
                # the trip if no more breakdowns
              self.interruptReset()        # end self-interrupted state
                # update next breakdown time
              reactivate(br,delay=repairduration)
                # impose delay for repairs on self
              yield hold,self,repairduration
              print '%s repaired at %s' %(self.name, now())
        else:   # no breakdowns intervened, so bus finished trip
              break
     print 'Bus has arrived at %s' %now()

class Breakdown(Process):
   def __init__(self,myBus):
       Process.__init__(self,name='Breakdown '+myBus.name)
       self.bus=myBus

   def breakBus(self,interval):      # Process Execution Method
       while True:
          yield hold,self,interval   # driving time between breakdowns
          if self.bus.terminated(): break
            # signal "self.bus" to break itself down
          self.interrupt(self.bus)

initialize()
for i in range(1,3):
  b=Bus('Bus%s' %i)                   # create a Bus object "b" called "Bus"
  activate(b,b.operate(repairduration=20,triplength=1000))
      # create a Breakdown object "br" for bus "b", and
  br=Breakdown(b)
      # activate it with driving time between
      # breakdowns equal to 300
  activate(br,br.breakBus(300))

simulate(until=4000)
print 'SimPy: No more events at time %s' %now()



The above gives the following output:

Breakdown Bus1 at 300
Breakdown Bus2 at 300
Bus1 repaired at 320
Bus2 repaired at 320
Breakdown Bus1 at 600
Bus1 repaired at 620
Breakdown Bus2 at 620
Bus2 repaired at 640
Breakdown Bus1 at 900
Bus1 repaired at 920
Breakdown Bus2 at 920
Bus2 repaired at 940
Bus has arrived at 1060
Bus has arrived at 1060
SimPy: No more events at time 1240

Now, the question: at the t=600 point, why does Bus 1 get repaired
before Bus 2 breaks down?  I would have expected that both Buses would
break down and get repaired in "lock step."
Further, if I create four Buses, the first three fail and get repaired
in "lock step" as shown below; however, Bus 4 gets off sequence by 20
after the first repair. I cannot figure out why this happens and would
appreciate any insight that anyone might be able to provide. It always
happens to the last instance.

Breakdown Bus1 at 300
Breakdown Bus2 at 300
Breakdown Bus3 at 300
Breakdown Bus4 at 300
Bus1 repaired at 320
Bus2 repaired at 320
Bus3 repaired at 320
Bus4 repaired at 320
Breakdown Bus1 at 600
Breakdown Bus2 at 600
Breakdown Bus3 at 600
Bus1 repaired at 620
Bus2 repaired at 620
Bus3 repaired at 620
Breakdown Bus4 at 620
Bus4 repaired at 640
Breakdown Bus1 at 900
Breakdown Bus2 at 900
Breakdown Bus3 at 900
Bus1 repaired at 920
Bus2 repaired at 920
Bus3 repaired at 920
Breakdown Bus4 at 920
Bus4 repaired at 940
Bus has arrived at 1060
Bus has arrived at 1060
Bus has arrived at 1060
Bus has arrived at 1060
SimPy: No more events at time 1240


Thanks,
Seymour

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
&lt;/pre&gt;</description>
    <dc:creator>Seymour Morris</dc:creator>
    <dc:date>2012-05-16T21:40:15</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1341">
    <title>Python does not garbage-collect SimPy Simulationclasses</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1341</link>
    <description>&lt;pre&gt;Dear User-community

I have been using SimPy for over a year now in a forest machine simulation
project. It's complex simulations with a lot of data involved connected to
the spatial complexity of a forest. See
http://www.org.umu.se/umit/english/project-activities/discrete-event-forestry/
for
more info about the project.

Overall I like SimPy although we have problems with the one-PEM limitation
which unfortunately have resulted in close to unreadable code. But enough
about that.

Recently we had big simulation series with around 50 000 simulations.
Simply put, we ran out of memory. It turns out that all the 50 000
simulations are stored in memory and not garbage collected. And this is NOT
because we still have references to those simulations from our code. It
turns out that SimPy stores references to earlier simulations. Try running
the below/attached example and you will see what I mean.

I haven't time right now to look into the SimPy code to see what's wrong...
do you have any hints?

Best Regards

Linus Jundén
UMIT Research Lab
Umeå University
Sweden


from SimPy.Simulation  import *
print SimPy.__version__ #2.3.1


class A:
def __init__(self, number):
self.number=number
def __del__(self): #this method is called by the garbage collector
print "deletes B number %d from memory"%self.number



class testProcess(Process):
def __del__(self):
print "deletes testProcess1 instance"
def run(self):
while True:
yield hold, self, 10
class simTest(Simulation):
def __init__(self):
self.initialize()
self.p1=testProcess(name='test', sim=self)
self.activate(self.p1, self.p1.run())
self.simulate(until=100)
def __del__(self):
print "deletes simTest"


for i in range(10):
tmp=A(i)
print "that's how classes in python work, they are garbage collected and
deleted if not referenced to...."
print "let's look at how SimPy Simulation classes work..."

it=1000000 #big to be able to see impact in memory statistics
for i in range(it):
if i%(it*0.1)==0: print i, "all simulations still stored in memory... "
a=simTest()
print "obviously simpy stores references to all simulation instances
created..."
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Linus Jundén</dc:creator>
    <dc:date>2012-05-16T16:02:25</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1338">
    <title>1 queue, multiple resources: with equal probability for each resource to be utilized?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1338</link>
    <description>&lt;pre&gt;Hi again :)

I intend to create a model of two resources sharing a common queue, where
if both resources are currently available, one of them will be selected at
random for the task (with a probability of 0.5). I have already set the
capacity parameter in Resource to 2, but how would I implement the random
selection of resource? Or does the Resource class inherently do that
already? I read up Resources in the SimPy manual but can't seem to find
anything about this.

Many thanks.

&lt;/pre&gt;</description>
    <dc:creator>Josephine Lim</dc:creator>
    <dc:date>2012-05-15T13:33:53</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1337">
    <title>Découvre le message de Syn...</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1337</link>
    <description>&lt;pre&gt;Un message de Syn t'attend...

L'expéditeur et le contenu seront visibles seulement par toi et tu peux le supprimer à tout moment. Tu peux aussi y répondre directement au travers du messenger. Pour découvrir le message, suis simplement ce lien:
http://eu1.badoo.com/0279183266/in/hbFeqxWJOkU/?lang_id=6&amp;amp;m=63&amp;amp;mid=4fb186c500000000000600000512165f

D'autres personnes à proximité qui sont sur Badoo
Mickael (Nantes, France)
July (Nantes, France)
Statler  Waldorf (Nantes, France)

http://eu1.badoo.com/0279183266/in/hbFeqxWJOkU/?lang_id=6&amp;amp;m=63&amp;amp;mid=4fb186c500000000000600000512165f

Le lien ne fonctionne pas dans ce message ? Copie le dans la barre d'adresse de ton navigateur.

Tu as reçu cet email suite à une requête de Syn auprès de notre système. S'il s'agit d'une erreur, ignore simplement cet email. La requête sera alors effacée du système.

Merci,
L'équipe Badoo

Vous avez reçu cet email de Badoo Trading Limited (adresse postale ci-dessous). 
http://eu1.badoo.com/impersonation.phtml?lang_id=6&amp;amp;mail_code=63&amp;amp;email=simpy-users%40lists.sourceforge.net&amp;amp;secret=&amp;amp;action=block&amp;amp;block_code=3b37f6&amp;amp;m=63&amp;amp;mid=4fb186c500000000000600000512165f
Badoo Trading Limited est une Société à Responsabilité Limitée, enregistrée en Angleterre et Pays de Galles, sous le No. 7540255, bureaux enregistrés à l’adresse 12 Red Lion Square, London, WC1R 4QD.------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Badoo</dc:creator>
    <dc:date>2012-05-14T22:27:19</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1327">
    <title>Different resource queue types,and sequential simulation with SimPy: Possible?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1327</link>
    <description>&lt;pre&gt;Hi,

I'm new to SimPy, and looked it up because I had intended to model two
types of queues, LIFO (last in first out) and SJF (shortest job first),
with it. However, after getting through the tutorials, I noticed to my
disappointment in the manual that there were only two possible values for
Resource qType = FIFO or explicit priority. Is there any way to set up a
LIFO or SJF model with this?

Also, would it be possible to enact a sequential simulation with SimPy, so
that the simulation runs until the relative statistical error found is
smaller than the minimum acceptable error, before stopping?

Or would I be better off looking for other simulation libraries?

Many thanks.

&lt;/pre&gt;</description>
    <dc:creator>Josephine Lim</dc:creator>
    <dc:date>2012-05-13T17:05:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1316">
    <title>Validation in Simpy</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1316</link>
    <description>&lt;pre&gt;Hello every one,

I'm new in Simpy, I'm trying to run several times a simulation model in order to 
estimate confidence intervals. However, I can't run my simulation model twice 
because an error appears with the estimation of "server.waitMon.timeAverage()":

During the first run there is no problem, but after that the following error 
appears:

print("Average waiting time %5.4f"%(server.waitMon.timeAverage()))
TypeError: a float is required

The whole main function is (comments and some variables are in Spanish...): 

def Votacion():
    maxTime = 1.0 *60   # minutes
    timeInSystem = 10.2 # minutes
    TiempoPromedio = 100*60/10000
    M=10000
    servidor = Resource(capacity = 17, name="Servidor",monitored=True)
    ## Model/Experiment ------------------------------

    #seed(99999) #Opcional si se quiere tener control sobre los numeros 
generados
    initialize()
    g = Generador4()
    activate(g,g.generar(M,timeInSystem,TiempoPromedio,servidor),at=0)
    simulate(until=maxTime)
    #---------------------------------------------------------------------------
-
    print("Tiempo promedio de espera %5.4f"%(servidor.waitMon.timeAverage()))
    print("Tamaño promedio de la cola de espera %5.4f"%
(servidor.waitMon.mean()))
    return(servidor.waitMon.timeAverage(),servidor.waitMon.mean())

And I'm just trying to run it several times. Could any body help me to fix 
problem?

Thank you.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Julian</dc:creator>
    <dc:date>2012-05-03T18:04:51</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1315">
    <title>Made with Simpy</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1315</link>
    <description>&lt;pre&gt;I have created a simulation of software teams using SimPy:

Intro:   http://ugile.com/siminfo
Live simulation: http://localhost:8083/sim  &amp;lt;http://localhost:8083/sim&amp;gt;
Some charts generated from the simulations: http://ugile.com/simcharts

I had a great time working with SimPy. Most of what I wanted to get done
was straightforward and worked as expected.

Thanks Simpy!

&lt;/pre&gt;</description>
    <dc:creator>Sagi Smolarski</dc:creator>
    <dc:date>2012-05-01T11:51:24</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1313">
    <title>Obtaining the execution trace of a preempted task?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1313</link>
    <description>&lt;pre&gt;Let's say I have two tasks, T1 (low priority) and T2 (high priority). Each
task needs to execute for 10 seconds on the same resource. Consider the
following example scenario involving T1 and T2:

T1 arrives at time 0.
T2 arrives at time 5, preempting T1
T2 finishes at time 15, and T1 resumes execution
T1 finishes at time 20.
Let's refer to the above data as an "execution trace."

For this simple case, if we know the arrival and completion times of each
task, it's pretty trivial to "reverse engineer" the precise times when each
task was waiting or executing. However, if T1 is a low priority task, and
T1 is preempted by lots of tasks, the problem gets more ugly.

I'm looking for a "hook" in SimPy that gives me a list of the times when T1
was waiting, executing, or suspended.
Is there an easy way to obtain such an execution trace for tasks in SimPy?

This is an other way to look at the question: is there a way to obtain a
history of when a task T1 was in the waitQ or activeQ of a resource?

Yet an other way to look at the question: is it possible to define an event
that is triggered whenever a task's status switches from the waitQ to
activeQ or vice versa?
(On each change from/to activeQ, I would print a timestamp of when the task
was preempted or resumed execution.)

Thanks,
Forrest

&lt;/pre&gt;</description>
    <dc:creator>Forrest Iandola</dc:creator>
    <dc:date>2012-04-26T19:18:47</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1309">
    <title>Yield in helper function for Process Execution</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1309</link>
    <description>&lt;pre&gt;Hi Forrest, you cannot nest generators the way you are trying to in Python.

The correct syntax would be something like this:

*for i in self.helperFunction(): yield i*

...instead of just calling   *self.helperFunction() *

Hope it helps.

&lt;/pre&gt;</description>
    <dc:creator>Sagi Smolarski</dc:creator>
    <dc:date>2012-04-22T09:11:14</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1307">
    <title>Yield in helper function for Process Execution Method?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1307</link>
    <description>&lt;pre&gt;Hi,

I am implementing a PEM that is intricate and requires quite a few lines of
code. I was hoping to break up the PEM logic into a few different functions
within the Process. To explain my question, I've included a couple of
simple processes below.

## Model components -------------------------------
class Process1(Process): # does a "hold" in a helper function for 10 time
units
    def run(self):
        self.helperFunction()
        yield hold,self,0 # boiler-plate. every PEM needs a yield statement.
        print "Instance of Process1 completed at: %s"%self.sim.now()

    def helperFunction(self): # This doesn't actually make the run()
function block!!!
        yield hold,self,10

class Process2(Process): # does a "hold" in the PEM for 10 time units
    def run(self):
        yield hold,self,10
        print "Instance of Process2 completed at: %s"%self.sim.now()

## Model and Experiment ---------------------------
s1=Simulation()
s1.initialize()
proc1 = Process1(sim=s1)
s1.activate(proc1, proc1.run())
s1.simulate(until=100)

s2=Simulation()
s2.initialize()
proc2 = Process2(sim=s2)
s2.activate(proc2, proc2.run())
s2.simulate(until=100)

When I run an instance of Process2 in a simulation, it prints "Instance of
Process2 completed at: 10." No problems here.

However, when I run an instance of Process1 in a simulation, it prints
"Instance of Process1 completed at: 0." Clearly, when I do a "hold" for 10
time units in a helper function, the run() PEM function doesn't actually
block for 10 seconds.

So, with this in mind... Is there a way to have the PEM call a helper
function that does a "hold," such that the PEM blocks until the hold
completes?

P.S. This question has probably come up before, but I wasn't sure what
keywords to use when searching the Simpy-Users archives.

Thanks,
Forrest


&lt;/pre&gt;</description>
    <dc:creator>Forrest Iandola</dc:creator>
    <dc:date>2012-04-21T22:09:23</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1302">
    <title>Uniqueness of task names; event names?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1302</link>
    <description>&lt;pre&gt;Using the objected-oriented API, does each SimPy Task need to have a unique
name?

For example, could anything go wrong if I do the following?
self.t1 = Task(name="don't need a name", sim=self.sim)
self.t2 = Task(name="don't need a name", sim=self.sim)
self.t3= Task(name="don't need a name", sim=self.sim)

Also, does it matter if event names are unique? Could anything go wrong
with the following setup?
self.e1 = SimEvent(name="don't need a name", sim=self.sim)
self.e2 = SimEvent(name="don't need a name", sim=self.sim)

Thanks,
Forrest

&lt;/pre&gt;</description>
    <dc:creator>Forrest Iandola</dc:creator>
    <dc:date>2012-04-19T21:31:11</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1301">
    <title>Signals when Level reach a certain amount</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1301</link>
    <description>&lt;pre&gt;Hello,

I have a SimPy model of various vehicle operations, which includes a depot
for parts and fuel.

I would like to send a signal when any particular level reaches a threshold
(to request a refill). I would like to avoid a 'waituntil' in order to keep
runtime low. What is a way to accomplish this, if one exists?

Thank you!

James
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>James Arruda</dc:creator>
    <dc:date>2012-04-18T15:34:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1299">
    <title>Holding can only be done within the PEM context. How to overcome this?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1299</link>
    <description>&lt;pre&gt;My objective is to simulate not only the network communication between
several agents but also, to have the agents processing the messages and
react according to the information within those messages.

Ok a simple example would be, to simulate the packet exchange and
processing for the Spanning Tree Protocol in a Switch Mesh Network.


&lt;/pre&gt;</description>
    <dc:creator>Carlos Ferreira</dc:creator>
    <dc:date>2012-04-17T20:22:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1295">
    <title>How to yield an event periodically into schedulewithout wait in SimPy?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1295</link>
    <description>&lt;pre&gt;Hi Tony and all,

I am learning SimPy. Currently I need to call a method periodically until
the simulation ends.

I wrote it like:

import SimPy.Simulation as Simpy

class mod(Simpy.Process):
    def do(self):
        print(Simpy.now(), "Do!")
        yield Simpy.hold, self, 5.0

class trigger(Simpy.Process):
    def ACTIONS(self):
        while True:
            for i in self.target.do():
                yield i
            yield Simpy.hold, self, 1.0

    def set_target(self, tar):
        self.target = tar


Simpy.initialize()
obj = mod()
tri = trigger()
tri.set_target(obj)
tri.start(at=0.0)
Simpy.simulate(until=100.0)

Due to the statements in the while True:,it should yield the target.do() by
every 1.0 time unit. Therefore the output should be:

0.0 Do!
1.0 Do!
2.0 Do!
......

But in fact, it yield the target.do() by every 6.0 time unit (the yield holds
to wait until thetarget.do() finishes):

0.0 Do!
6.0 Do!
12.0 Do!

I wonder that how can I yield the target function periodically into the
schedule, without waiting until it finishes executing?

Thank you!



Skyler
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Skyler Sun</dc:creator>
    <dc:date>2012-04-17T04:34:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1293">
    <title>Simpy Cheatsheets</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1293</link>
    <description>&lt;pre&gt;Hi

Thanks to Steven Kennedy the cheat sheets have been updated.

The new versions are up on the Web site:
http://simpy.sourceforge.net/SimPy_Manual/Cheatsheets.html
and in the HG repo.

Cheers
  Karen

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
&lt;/pre&gt;</description>
    <dc:creator>Karen</dc:creator>
    <dc:date>2012-04-13T06:59:12</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1291">
    <title>SimEvents Example</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1291</link>
    <description>&lt;pre&gt;

After looking through the documentation on SimEvents I still had to do a little bit of experimentation to figure out exactly how they worked.  Here is a modified version of an existing example that I think solidifies some unclear points (although I admit this information exists in bits in pieces across the site and former SimPy-User posts):

1)  A single signal will stockpile if it is received while no processes are waiting (waitevent) or queuing (queueevent), meaning that the next process to wait or queue will reactivate immediately.2)  Not more than one signal will stockpile.3)  How to use eventName.waits and eventName.queues to test for empty sequences.  This is useful for the case where you do not want to issue a signal if no processes are waiting or queuing.
#---------------------------------------------------------------from SimPy.Simulation import *
class Wait_Or_Queue(Process):    def waitup(self,myEvent):      # PEM illustrating "waitevent"                                   # wait for "myEvent" to occur        print "Waiter created at time", now()        yield hold, self, 1        print "Begin wait for event1 at time", now()        yield waitevent, self, myEvent        print "Finish wait for event1 at time", now()        
    def queueup(self, myEvent):    # PEM illustrating "queueevent"                                   # queue up for "myEvent" to occur        print "Queuer created at time", now()        print "Begin queueing for event2 at time", now()        yield queueevent, self, myEvent        print "Finish queueing for event2 at time", now()
class Signaller(Process):
    def sendSignals(self):        print "Signaller created at time", now()        print "first event1 signal sent at time", now()        print "second event1 signal sent at time", now()        event1.signal()        event1.signal()        yield hold, self, 5        print "first event2 signal sent at time", now()        print "second event2 signal sent at time", now()        event2.signal()        event2.signal()        yield hold, self, 5        if event1.waits:            print "Non-Empty event1 waiting list at time", now()        if event2.queues:            print "Non-Empty event2 queue at time", now()        print "third event1 signal sent at time", now()        event1.signal()        yield hold, self, 5        print "third event2 signal sent at time", now()        event2.signal()        yield hold, self, 1        if not event1.waits:            print "Empty event1 waiting list at time", now()        if not event2.queues:            print "Empty event2 queue at time", now()        
initialize()
# Now create each SimEvent and give it a nameevent1 = SimEvent('Event-1')event2 = SimEvent('Event-2')
s1 = Signaller()activate (s1,s1.sendSignals())
w1 = Wait_Or_Queue('W-1')activate (w1, w1.waitup(event1))
q1 = Wait_Or_Queue('Q-1')activate(q1, q1.queueup(event2), at=6)
w2 = Wait_Or_Queue('W-2')activate (w2, w2.waitup(event1), at=8)
q2 = Wait_Or_Queue('Q-2')activate(q2, q2.queueup(event2), at=8)
simulate(until=20)
# Output ----------------------------------------
Signaller created at time 0first event1 signal sent at time 0second event1 signal sent at time 0Waiter created at time 0Begin wait for event1 at time 1Finish wait for event1 at time 1first event2 signal sent at time 5second event2 signal sent at time 5Queuer created at time 6Begin queueing for event2 at time 6Finish queueing for event2 at time 6Waiter created at time 8Queuer created at time 8Begin queueing for event2 at time 8Begin wait for event1 at time 9Non-Empty event1 waiting list at time 10Non-Empty event2 queue at time 10third event1 signal sent at time 10Finish wait for event1 at time 10third event2 signal sent at time 15Finish queueing for event2 at time 15Empty event1 waiting list at time 16Empty event2 queue at time 16
- Mark       ------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Mark M</dc:creator>
    <dc:date>2012-04-12T19:44:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1288">
    <title>wiring a simpy simulation to a streaming web server</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1288</link>
    <description>&lt;pre&gt;Hi, I'm trying to feed the output of a real time simulation to a browser
via a web server in a streaming manner.

For example, this simple timer simulation:

timer.py:
1:  from SimPy.SimulationRT import *
2:
3:  class Timer(Process):
4:     def tick(self):
5:         while True:
6:             yield hold, self, 1.0
7:             print '&amp;lt;div&amp;gt;time is: %.2f&amp;lt;/div&amp;gt;'%self.sim.now()
8:
9:  class TimerSim(SimulationRT):
10:     def run(self):
11:        self.initialize()
12:        self.timer = Timer(name="timer", sim=self)
13:        self.activate(self.timer, self.timer.tick())
14:        self.simulate(until=50.0, real_time=True)
16:
17: def generate():
18:     TimerSim().run()

.. where I should be able to push the time to the browser instead of the
"print" statement in line 7.

on the server side, I could use a server which supports streaming like
CherryPy:

1: def sim(self):
2:   cherrypy.response.headers['Content-Type'] = 'text/html'
3:   import timer
4:   def content_generator(): # content generator which yields results
5:       timer.generate()
6:   return content_generator()
7: sim._cp_config = {'response.stream': True}

I guess I could run the simulation in a different process, and set up some
kind of inter-process communication between the web server and the
simulation server, but I wonder if there is a way to wire things up in a
more straightforward manner, without jumping through those hoops. I assume
this is a fairly generic problem.

Thanks in advance.

&lt;/pre&gt;</description>
    <dc:creator>Sagi Smolarski</dc:creator>
    <dc:date>2012-04-11T19:20:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1287">
    <title>Holding can only be done within the PEM context. Howto overcome this?</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1287</link>
    <description>&lt;pre&gt;Hello all!

I'm trying to implement a simple Network Simulator (message passing between
agents) and I'm having trouble with the event system of SimPy. Since i can
only hold the Process's by using the yield method within the Process PEM
function, I'm having trouble in creating a Socket example, where an Agent
waits for a Message Receiving.

Can someone help me with this? I'v searched in several advanced SimPy usage
examples but I was unable to find an example to follow.


Thanks for any assistance!

&lt;/pre&gt;</description>
    <dc:creator>Carlos Ferreira</dc:creator>
    <dc:date>2012-04-09T16:34:41</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.comp.python.simpy.user/1285">
    <title>OO API - .sim parameter with __init__() method</title>
    <link>http://comments.gmane.org/gmane.comp.python.simpy.user/1285</link>
    <description>&lt;pre&gt;
Hey,

I am having difficulty using the object oriented API with processes containing an __init__() method.
The only reference I see in the documentation is the line:
Example 2, with an __init__ method (snippet):class Car(Process):def __init__(self,name):Process.__init__(self,name=name, sim=self.sim)aSim = Simulation() aSim.initialize() c=Car(name=”Mine”, whichSim=aSim)
which didn't appear to work.  I am currently receiving the error:
FatalSimerror: 'SimPy: activate: Process a_process not in activating Simulation instance'

Can someone provide a simple working example of how the above code should be written so that the car appears in the correct simulation instance?
- Mark       ------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2_______________________________________________
Simpy-users mailing list
Simpy-users&amp;lt; at &amp;gt;lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
&lt;/pre&gt;</description>
    <dc:creator>Mark M</dc:creator>
    <dc:date>2012-04-08T17:24:47</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.python.simpy.user">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.python.simpy.user</link>
  </textinput>
</rdf:RDF>

