Attribute Function sets output variables to zero on first use

조회 수: 2 (최근 30일)
David
David 2013년 11월 29일
댓글: farnaz 2014년 6월 1일
I seem to be having trouble with the AttributeFunction in SimEvents. On first execution, it always sets the output attributes to zero. At first I thought this was something specific to my model, but then I modified the supplied demo 'doc_outsw_attr' to use AttributeFunction block instead of SetAttribute and simplified it to set the Zone attribute to 1 in all cases. This version crashed because the subsequent Output Switch requires a valid number from 1-3 and the Zone attribute was set to zero.
I verified this while stepping through the simulation. For some reason, the first entity through the AttributeFunction gets zero assigned to its output attribute.
Can anyone explain this or identify a fix for it?
Best regards, David
UPDATE: I have more information. It looks like the setting of the output attributes is delayed by one entity in all cases. For the first one, this translates to zero, but the second one is getting the first one's calculation and the third is getting the second one's calculation.
I am getting a race condition warning: Warning: Race condition detected between 'testing/Attribute Function' and 'testing/Attribute Function/__DMLF__SA__'. The former block initiates function calls during entity advancement, but the latter block responds to such function calls after the entity has arrived. This may cause the latter block to process the entity using outdated signal values. To avoid this, between the two blocks, please insert a Single Server block with a service time of 0. You can disable this diagnostic by setting 'Response to function call delayed relative to entities' diagnostic to 'none' in the SimEvents Diagnostics tab of the Configuration Parameters dialog.
I don't know how to handle this suggestion because this is within the AF block itself and I do not have access to this part of the model. I find it hard to believe that this operates this way. After all, this is basic SimEvents package.
Any advice?
Best regards, David

채택된 답변

Devdatt Lad
Devdatt Lad 2013년 12월 2일
Looks like the Attribute Function block in this model has gotten corrupted somehow. Can you pull in a new instance from the library browser and copy your code into it? If that doesn't work, please contact Tech Support with this.

추가 답변 (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