Entity generation in SimEvents

4 ビュー (過去 30 日間)
summyia qamar
summyia qamar 2018 年 2 月 27 日
回答済み: Krishna Akella 2018 年 12 月 10 日
I want to generate 5 entities at the start of simulation and then single entity with fixed interval (idea of having initial inventory and then production at continuous rate) . I know how to generate multiple entities at the start of simulation but don't know how to continue generation of single entity with regular interval in rest of simulation time. can anyone guide me please as I'm a learner of SimEvents.
  2 件のコメント
Striker121
Striker121 2018 年 3 月 1 日
編集済み: Striker121 2018 年 3 月 1 日
Something like the following should work:
In the entity generator block parameters, replace the variables "TotalNumberEntitiesToGenerate" and "IntervalToOutputEntitiesAt" as appropriate
summyia qamar
summyia qamar 2018 年 3 月 4 日
yes it worked..can you please explain me what is "isempty"? I dont understant the use of "persistant" and "isempty" in syntax. you can write your answer in answer section so that I can Accept it as correct

サインインしてコメントする。

回答 (1 件)

Krishna Akella
Krishna Akella 2018 年 12 月 10 日
Hi Summyia,
A persistent variable persists its value between function calls. 'isempty(SEQ)' returns 1 if SEQ is an empty array and 0 otherwise.
persistent SEQ; % SEQ should retain its value between different calls to this method
persistent idx; % idx should retain its value between different calls to this method
if isempty(SEQ) % Check if SEQ is empty
SEQ = zeros(1, TotalNumberEntitiesToGenerate); % Initialize the value of SEQ
...
Hope that clarifies!
- Krishna

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by