Accumulator for Event-based model...

조회 수: 4 (최근 30일)
Kevin Noll
Kevin Noll 2013년 2월 19일
In Simevents I am generating entities and adding an attribute with a varying numeric value. At a later point in my model I would like to accumulate the values of this attribute.
I have attempted to use a discrete-time (and continuous) integrator/accumulator. This does not accomplish the goal because the output of GetAttribute does not go to zero if entities are blocked and so the accumulator continues to add the last value until a new value appears after the system is unblocked.
I also attempted to use a simple Add block with a feedback loop. This doesn't work due to the cyclic nature of feedback. I attempted to add unit delays and/or signal latches per the examples given in the documentation, but the model will not compile saying that there is a loop. Even the example given in the documentation (ex_signal_cycle_latch) fails with the same error.
Am I missing some basic configuration issue? Does anyone have any suggestions on how to accomplish this?

채택된 답변

Devdatt Lad
Devdatt Lad 2013년 2월 19일
I assume the feedback accumulator you describe is an Add block whose output is fed back via a Memory block to itself. Try placing this accumulator inside an Atomic Subsystem and set the Memory sample time to be -1 (inherited). When this Atomic Subsystem is connected to the Get Attribute block it will run only when a new entity arrives at the Get Attribute. The documentation example (ex_signal_cycle_delay) shows how such a configuration can be used.
simeventsdocex('ex_signal_cycle_delay')
  댓글 수: 1
Kevin Noll
Kevin Noll 2013년 2월 20일
I'm not sure what I did different but it worked this time.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete-Event Simulation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by