The resources in the simulation collection are more simplistic than what you want. In particular, there is no way to pass a particular resource between processes - they are always owned by the process that allocated them. [You could have one controller process that allocates the resource and controls the execution of A and B, but that seems too artificial.]<br>
<br>The simplest solution is to use sets to implement the queues (and enforce the limits yourself). The sets can contain any type of objects you want to pass around. In the examples, the furnace model(s) use sets - model-1 is a discrete-event simulation and might be closer to what you're doing. The harbor model example also uses sets and also shows more advances control constructs.<br>
<br>I'll reload 3.72 on one of my machines and send you a quick solution. I'll still having problems with V4.0 (and V4.0.1) and haven't gotten the simulation and inference collections ported yet.<br><br>Doug<br>
<br><div class="gmail_quote">On Mon, Jun 23, 2008 at 8:55 AM, Noel Welsh <<a href="mailto:noelwelsh@gmail.com">noelwelsh@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I am trying to define the following producer/consumer process using<br>
the simulation package:<br>
<br>
There is a queue of resources of type A.<br>
<br>
Process X takes an A and produces a B (which contains the A). The B<br>
is placed in a queue of fixed size<br>
<br>
Process Y takes a B, returns the A its queue and throws away the B.<br>
<br>
If any queue is empty a process that needs a resource of that type<br>
must wait. If any queue is full a process that creates a resource of<br>
that type must wait.<br>
<br>
I can't work out how to model this. If I model the As and Bs as<br>
resources, I have the problem that "It is an error to attempt to<br>
release more units than the process has allocated."<br>
(<a href="http://planet.plt-scheme.org/package-source/williams/simulation.plt/2/2/html/simulation-Z-H-8.html#node_sec_7.2.2" target="_blank">http://planet.plt-scheme.org/package-source/williams/simulation.plt/2/2/html/simulation-Z-H-8.html#node_sec_7.2.2</a>).<br>
Since X takes A and never releases them, and Y releases As but never<br>
takes them, this is a problem.<br>
<br>
If I schedule As and Bs as events how do I enforce the resource limits?<br>
<br>
This kind of simulation is simple in a message passing thread system<br>
but I don't see how it fits into the simulation package's model.<br>
<br>
Also: the documentation for the simulation package would benefit from<br>
an introductory section that lays out the model used by the package.<br>
<br>
Thanks,<br>
Noel<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</blockquote></div><br>