22 Apr 2012 10:07
Re: Periodic tasks in Simpy?
Forrest Iandola <iandola1 <at> illinois.edu>
2012-04-22 08:07:36 GMT
2012-04-22 08:07:36 GMT
One quick follow-up question:
In a recent email thread, Stefan advised "Don’t call a process’ PEM from within another process."
In the pseudo-code below, I do call a PEM from within an other process. It works properly based on some unit testing and visualization. Why is it a bad idea to call a PEM from within another process?
Thanks,
Forrest
--
Forrest Iandola
Department of Computer Science
University of Illinois at Urbana-Champaign
http://www.forrestiandola.com
In a recent email thread, Stefan advised "Don’t call a process’ PEM from within another process."
In the pseudo-code below, I do call a PEM from within an other process. It works properly based on some unit testing and visualization. Why is it a bad idea to call a PEM from within another process?
Thanks,
Forrest
On Thu, Apr 19, 2012 at 2:27 PM, Forrest Iandola <iandola1 <at> illinois.edu> wrote:
Stefan, Tony,
Thanks! This is exactly what I was looking for.
In the case where the period is smaller than the deadline, it's possible for multiple invocations of a task to run simultaneously. The following pseudo-code outlines how I handled this:
Invocation(Process):
def run(self, ...):
# implement the behavior of the task here
Task(Process):
def run(self):
while 1:
myInvocation = new Invocation(sim=self, ...)
myInvocation.activate(myInvocation, myInvocation.run(...))
yield hold, self, period # e.g. period could be 10
Sorry for the slow reply--I just got around to redesigning my code to handle periodic tasks. :)
ForrestOn Sat, Apr 7, 2012 at 3:33 AM, Stefan Scherfke <stefan <at> sofa-rockers.org> wrote:of course
Am 2012-04-06 um 21:33 schrieb Tony Vignaux:
> if that "yield hold, self, 10" is in a loop.
>
> ====
>
> Tony Vignaux
>
>
>
>
>
> On Fri, Apr 6, 2012 at 8:57 PM, Stefan Scherfke <stefan <at> sofa-rockers.org> wrote:
> Hi Forrest,
>
> an example would be useful. If your process’ PEM does e.g., a "yield hold, self, 10", than it’s imho like a periodic task that is activated every 10 time steps.
>
> Cheers,
> Stefan
>
>
>
> Am 2012-04-06 um 01:03 schrieb Forrest Iandola:
>
> > Hi,
> >
> > I'm using SimPy to simulate distributed control systems that have periodic tasks. Some tasks may have a periods smaller than their deadlines, so there may be multiple instances of a task in the system.
> >
> > I've read a fair amount of the SimPy documentation, and I searched simpy.sourceforge.net for the word "periodic." So far, I haven't found any information on built-in support for periodic tasks in SimPy. Can anyone suggest some such functionality in SimPy?
> >
> > Alternatively, I think it would be straightforward to periodically feed a particular task into my simulation. I'm just trying to keep my code as clean as possible, so I want to use built-in functionality where possible.
> >
> > Let me know if this question makes sense. If it sounds too abstract, I can give a concrete example.
> >
> > Thanks,
> > Forrest
> >
> >
> > --
> > Forrest Iandola
> > Department of Computer Science
> > University of Illinois at Urbana-Champaign
> > http://www.forrestiandola.com
> > ------------------------------------------------------------------------------
> > 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 <at> lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/simpy-users
>
>
> ------------------------------------------------------------------------------
> 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 <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simpy-users
>
------------------------------------------------------------------------------
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 <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simpy-users
--
Forrest Iandola
Department of Computer Science
University of Illinois at Urbana-Champaign
http://www.forrestiandola.com
--
Forrest Iandola
Department of Computer Science
University of Illinois at Urbana-Champaign
http://www.forrestiandola.com
------------------------------------------------------------------------------ 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 <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/simpy-users

RSS Feed