Attribute Function sets output variables to zero on first use

2 visualizaciones (últimos 30 días)
David
David el 29 de Nov. de 2013
Comentada: farnaz el 1 de Jun. de 2014
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

Respuesta aceptada

Devdatt Lad
Devdatt Lad el 2 de Dic. de 2013
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.

Más respuestas (0)

Categorías

Más información sobre Discrete-Event Simulation en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by