Thread Subject: [SIMVENTS] question on entity generation/termination

Subject: [SIMVENTS] question on entity generation/termination

From: littleric.nelson@gmail.com

Date: 30 Aug, 2008 08:47:56

Message: 1 of 7

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

Subject: [SIMVENTS] question on entity generation/termination

From: Devdatt Lad

Date: 2 Sep, 2008 13:35:31

Message: 2 of 7

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.nelson@gmail.com> wrote in message
news:cb1853da-f9ef-4e76-898d-9d25948fdefc@q26g2000prq.googlegroups.com...
> 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

Subject: question on entity generation/termination

From: Eric

Date: 9 Sep, 2008 07:56:04

Message: 3 of 7

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=A0pm, "Devdatt Lad" <d...@mathworks.com> 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 you=
r
> model. This state can now be accessed by different parts of your model fo=
r
> 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 ev=
ent
> (new entity generation). You can use SimEvent's Signal-Based Event to
> Function-Call Event (SBE2FCE) block in the event translation library to d=
o
> this. In the mask parameters, specify that you wish to delay the generate=
d
> function call and that the delay value will be obtained from a signal por=
t.
> Now connect the Event Based Random Number Generator to this block's "t" p=
ort
> 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 fut=
ure
> time. The future time is drawn from the event based random number generat=
or
> 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-Ba=
sed
> 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 o=
f
> event-based generator, an entity will be generated.
>
> At the other end of the model, you can use the Discrete Event Subsystem t=
o
> change the state as:
>
> Data Store Read --> Bias (+1) --> Data Store Write
>
> Hope this gets you started.
>
> --
> Devdatt Lad
> The MathWorks, Inc.
>
> <littleric.nel...@gmail.com> wrote in message
>
> news:cb1853da-f9ef-4e76-898d-9d25948fdefc@q26g2000prq.googlegroups.com...
>
>
>
> > 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 =3D N -1, otherwise, N =3D 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 -

Subject: question on entity generation/termination

From: Devdatt Lad

Date: 9 Sep, 2008 12:28:45

Message: 4 of 7

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.nelson@gmail.com> wrote in message
news:6c61745b-8b7c-4d62-a9b9-8ff8e879e7b4@v39g2000pro.googlegroups.com...
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...@mathworks.com> 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...@gmail.com> wrote in message
>
> news:cb1853da-f9ef-4e76-898d-9d25948fdefc@q26g2000prq.googlegroups.com...
>
>
>
> > 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 -

Subject: question on entity generation/termination

From: Eric

Date: 10 Sep, 2008 00:38:04

Message: 5 of 7

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=A0pm, "Devdatt Lad" <d...@mathworks.com> 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 paramete=
r
> 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 num=
ber
> 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...@gmail.com> wrote in message
>
> news:6c61745b-8b7c-4d62-a9b9-8ff8e879e7b4@v39g2000pro.googlegroups.com...
> 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...@mathworks.com> wrote:
>
>
>
> > Eric,
>
> > From your description, I gather that you are looking for two capabiliti=
es
> > 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 generatin=
g a
> > new inter-generation time for the next entity.
>
> > You can use Simulink's Data Store Memory block to maintain state N in y=
our
> > 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 dete=
ct
> > 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 genera=
ted
> > 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 bloc=
k
> > (state value) to this block's "vc" port.
>
> > What this means is the following. When the signal connected to the bloc=
k'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 fr=
om
> > an
> > exponential distribution and a function call will be generated after th=
is
> > 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...@gmail.com> wrote in message
>
> >news:cb1853da-f9ef-4e76-898d-9d25948fdefc@q26g2000prq.googlegroups.com..=
.
>
> > > 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 Chin=
a
> > > (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 =3D N -1, otherwise, N =3D 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 -

Subject: question on entity generation/termination

From: Devdatt Lad

Date: 10 Sep, 2008 12:51:54

Message: 6 of 7

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@gmail.com> wrote in message
news:358f5808-2c3d-44cd-b6f1-b5b028bd18d4@a18g2000pra.googlegroups.com...
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...@mathworks.com> 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...@gmail.com> wrote in message
>
> news:6c61745b-8b7c-4d62-a9b9-8ff8e879e7b4@v39g2000pro.googlegroups.com...
> 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...@mathworks.com> 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...@gmail.com> wrote in message
>
> >news:cb1853da-f9ef-4e76-898d-9d25948fdefc@q26g2000prq.googlegroups.com...
>
> > > 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 -

Subject: question on entity generation/termination

From: Eric

Date: 23 Sep, 2008 11:14:52

Message: 7 of 7

Hi, Devdatt

Thank you for your helpful reply!

the r.v. can be generated then with respect to the change of system
state. In my case
1. The change of the state will trigger the "event based entitye
generator", and a entity will then be generated
2. The generated eneity will enter a queueing system
3. The random variable generated with the new state is the "service
time" for the generated entity

For this case, I am concerned with the command sequence. My
expectation is with the following sequence.

                                 |-----> a new entity generated --->
go into a FCFS queue ---> go into a server with Ti
state change
call----|
|
                                 |-----> service time generate for
this new entity Ti-------------------->|

How to guarantee this to be executed corrected?

If we connect the "state change call" to the "event based entity
generator (EBEG)" & the "Embeded Matlab Function Block for random time
(EMFBRT)". Then the EBEG block is connected to a "Single Server" block
after a FCFS queue, and the Single Server Block has "service time from
port t". Port t is connected to the EMFBRT.

Could this model follow the above sequence ?
How could we check the sequence?

Thank you!

Best Regards,
Eric


On Sep 10, 8:51=A0pm, "Devdatt Lad" <d...@mathworks.com> wrote:
> 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 MAT=
LAB
> and the RAND or RANDN functions to do this. The input to your EML block c=
an
> 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 sta=
te
> N changes (which is when you want to change the distribution).
>
> -Devdatt
>
> "Eric" <littleric.nel...@gmail.com> wrote in message
>
> news:358f5808-2c3d-44cd-b6f1-b5b028bd18d4@a18g2000pra.googlegroups.com...
> 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...@mathworks.com> wrote:
>
>
>
> > Hi Eric,
>
> > What I understand from your question is that the *initial state N* of t=
he
> > system is a function of one of the parameters of the event-based random
> > number generator block, and you wish to reference the particular parame=
ter
> > when computing the initial state.
>
> > The best way to do this is to use a MATLAB variable in the base workspa=
ce
> > 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 rando=
m
> > number dialog, as well as your custom mask parameter.
>
> > Let me know if my interpretation of your question was incorrect.
>
> > -Devdatt
> > ------------------
>
> > "Eric" <littleric.nel...@gmail.com> wrote in message
>
> >news:6c61745b-8b7c-4d62-a9b9-8ff8e879e7b4@v39g2000pro.googlegroups.com..=
.
> > 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...@mathworks.com> 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 generat=
ing
> > > 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 mode=
l
> > > 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 delaye=
d
> > > 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 bl=
ock
> > > (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 call=
s
> > > at
> > > its input. This means that whenever a function call occurs at the inp=
ut
> > > of
> > > event-based generator, an entity will be generated.
>
> > > At the other end of the model, you can use the Discrete Event Subsyst=
em
> > > 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...@gmail.com> wrote in message
>
> > >news:cb1853da-f9ef-4e76-898d-9d25948fdefc@q26g2000prq.googlegroups.com=
...
>
> > > > 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 Ch=
ina
> > > > (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 =3D N -1, otherwise, N =3D 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, a=
nd
> > > > now I quite wonder whether this CAN be modeled with SIMEVENTS or no=
t,
> > > > 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 -- Hide quoted text -
>
> - Show quoted text -

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com