Re: question on entity generation/termination
- From: "Devdatt Lad" <dlad@xxxxxxxxxxxxx>
- Date: Wed, 10 Sep 2008 08:51:54 -0400
Hi Eric,
If you wish to drawn a random number from a completely new distributions
(different distribution parameters) each time, then you will not be able to
use the event based random number generator block. Try using Embedded MATLAB
and the RAND or RANDN functions to do this. The input to your EML block can
be the distribution parameters, and using those you can generate random
numbers.
There is a side-effect to doing this. The EML block is a time-based block
and will execute at the base rate of the model by default. However, the
signal-based event to function-call event block which is connected to the
EML block is an event-based block. Thus, it requires random numbers only
when events are occuring on it. This means that many random numbers will be
"skipped". To avoid this add a function-call input to your EML block, so
that it will execute only when function calls occur. The documentation of
the EML block can show you how to do this.
Design your model, so that this function-call will occur whenever the state
N changes (which is when you want to change the distribution).
-Devdatt
"Eric" <littleric.nelson@xxxxxxxxx> wrote in message
news:358f5808-2c3d-44cd-b6f1-b5b028bd18d4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, Devdatt
Thanks for your timely reply!
My questions is: The parameter of the event-based random number
generator is not constant, but a variable.
It is related to the "state Ni" but not only to the initial state N0.
This means the distribution parameter is changing with the system
state.
I tried to follow example of the "Queuing System with Discouraged
Arrivals:" There is a subsystem of "Interarrival Time Distribution\n
with Discouraged Rate" to deal with the feedback.
I tried, but there is an entity generated at time 0. Actually I did
not select "generate entity at simualtion start". I am curious about
the sequence...
Thank you!
Regards,
Eric
On Sep 9, 8:28 pm, "Devdatt Lad" <d...@xxxxxxxxxxxxx> wrote:
Hi Eric,
What I understand from your question is that the *initial state N* of the
system is a function of one of the parameters of the event-based random
number generator block, and you wish to reference the particular parameter
when computing the initial state.
The best way to do this is to use a MATLAB variable in the base workspace
and set its value to be the parameter value of the event-based random
number
generator block. Now you can use this MATLAB variable both in the random
number dialog, as well as your custom mask parameter.
Let me know if my interpretation of your question was incorrect.
-Devdatt
------------------
"Eric" <littleric.nel...@xxxxxxxxx> wrote in message
news:6c61745b-8b7c-4d62-a9b9-8ff8e879e7b4@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi, Devdatt
Thank you for your detailed explaination.
I started with your approach, and it works better than I ever tried.
There is still a question.
The Event Based Random Number Generator block's parameter is related
to the state of the system. How could I cite this parameter in the
mask parameter? Thank you!
Regards,
Eric
On Sep 2, 9:35 pm, "Devdatt Lad" <d...@xxxxxxxxxxxxx> wrote:
Eric,
From your description, I gather that you are looking for two
capabilities
from SimEvents.
1. The ability to maintain a pervasive state N in your model.
2. The ability to detect changes in this state and respond by generating
a
new inter-generation time for the next entity.
You can use Simulink's Data Store Memory block to maintain state N in
your
model. This state can now be accessed by different parts of your model
for
read or write purposes using the Data Store Read and Data Store Write
blocks.
As for (2), another way to state this requirement is to be able to
detect
one signal event (change in state N), and respond with another delayed
event
(new entity generation). You can use SimEvent's Signal-Based Event to
Function-Call Event (SBE2FCE) block in the event translation library to
do
this. In the mask parameters, specify that you wish to delay the
generated
function call and that the delay value will be obtained from a signal
port.
Now connect the Event Based Random Number Generator to this block's "t"
port
and set the distribution to exponential. Connect a Data Store Read block
(state value) to this block's "vc" port.
What this means is the following. When the signal connected to the
block's
"vc" port changes in value, a function call will be scheduled at some
future
time. The future time is drawn from the event based random number
generator
block. Thus, whenever the state N changes, a new value will be drawn
from
an
exponential distribution and a function call will be generated after
this
time interval.
Connect the output function call port of the SBE2FCE block to an
Event-Based
Entity Generator which is set to generate entities upon function calls
at
its input. This means that whenever a function call occurs at the input
of
event-based generator, an entity will be generated.
At the other end of the model, you can use the Discrete Event Subsystem
to
change the state as:
Data Store Read --> Bias (+1) --> Data Store Write
Hope this gets you started.
--
Devdatt Lad
The MathWorks, Inc.
<littleric.nel...@xxxxxxxxx> wrote in message
news:cb1853da-f9ef-4e76-898d-9d25948fdefc@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Dear All,
I am trying to model a queueing system (QS) with feedback with the
help of SIMEVENTS.
It is quite convenient for a QS modeling with SIMEVENTS without
feedback. Also the examples like the "Markov Modulated Poisson
Process" and the "QS with discouraged arrivals" can model some
specific cases with feedback. However, they are not suitable for
mine.
My situation is like this:
*The inter-arrival time of the entities are models with a Markov China
(birth-death process), denoted with the state N
*for each generated entity, it has two pathes, one to sink and one to
feedback. If it goes to sink, then N = N -1, otherwise, N = N+1
*Whenever the state N changes, a new random inter-arrival time
(Exponential Distributed) will be generated to schedule the next
enitey geneation time.
I feel great difficulties to model this situation with SIMEVENTS, and
now I quite wonder whether this CAN be modeled with SIMEVENTS or not,
which is an issue of the capability of this toolbox
Looking to your suggestions/comments!
Best,
Eric- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
.
- Follow-Ups:
- References:
- Re: [SIMVENTS] question on entity generation/termination
- From: Devdatt Lad
- Re: question on entity generation/termination
- From: Eric
- Re: question on entity generation/termination
- From: Devdatt Lad
- Re: question on entity generation/termination
- From: Eric
- Re: [SIMVENTS] question on entity generation/termination
- Prev by Date: Re: Help! Inline function
- Next by Date: mxarray into non-mxarray
- Previous by thread: Re: question on entity generation/termination
- Next by thread: Re: question on entity generation/termination
- Index(es):
Relevant Pages
|