At 11:33 AM 11/21/2003 -0800, [EMAIL PROTECTED] wrote:
I am currently looking for a way to implement a high level queue.  By
this I am looking to have a queue that exists in the top level model
but can be accessed in a lower level model, e.g. in submodel A, tokens
can enter a queue and in submodel B, tokens can enter the same queue,
e.g. for accessing a shared resource such as a LAN.  Is there a way to
reference a queue or some other way to implement this?

Are you saying you don't want the submodels to have connections to the queue?

If actors communicate outside the structure of the model of
computation, then you are on your own.  You can implement this
in Java by, for example, having a common base class for the
actors with a static data structure representing instances
of the resource you want to share.

However, I would caution against this approach.  Since the
ordering of events will be outside the model of computation,
the computation will likely be nondeterministic, which means
your execution will not be repeatable, and also that you won't
be able to infer much from an execution (it happened to execute
this way this time...).

A better approach would probably be to have a mechanism for
actors to communicate without connections, but within the
model of computation.  We are currently developing a "wireless"
domain that is based on DE that does this.  The basic mechanism
is to subclass TypedIOPort to create a specialized WirelessPort
that has as a parameter the name of the "channel" through
which communication will occur.  You could do something similar,
creating a ResourceIOPort with a parameter that identifies
the shared resource (the queue).

I would be happy to help in developing this, but I don't
really have much time these days...


Another thing I will be looking to implement is adding extra
paramenters to each event.  For example at the moment my poisson event
creator emits a stream of doubles, could I implement it that it emits
an array instead and that the other actors, e.g. queues, comparators
can accept these tokens and maybe act on a particular element of the
array, e.g. array[0], without having to make changes to these actors,
and then write the modified value back to array[0]?  If this is not
possible could I emit a stream of incrementing doubles that I can use
as reference numbers to the events and have a list of parameters that
would be associated with each reference number that could then be
accessed and modified?

As I mentioned before I am looking to model a HTTP request and I need
to associate information such as the size of the page, the number of
images, etc. with each request, which will then be used to determine
what way the system responds.


Why not just make your event a record token?  Then you can
have named fields of arbitrary type and manipulate them
independently.

Edward


------------ Edward A. Lee, Professor 518 Cory Hall, UC Berkeley, Berkeley, CA 94720 phone: 510-642-0455, fax: 510-642-2739 [EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal


---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]

Reply via email to