Entities' attribute cumulative sum with reset
Mostra commenti meno recenti
Hi everyone,
Using Matlab Simulink, I am building a model in which I need to make the cumulative sum of attributes of different entities and at certain circumstances I need to reset the count of it. I am having some difficulties in make the reset of the counter.
To better explain my problem I built a simpler example model in which I need to make the cumulative sum of attributes and the reset of it. In this model at instant t=0, the model generates an entity with an attribute Attribute1 equal to 1 ( Attribute1=1). At each passage in the loop, the Attribute 1 is incremented by 1. The entity stays in loop until Attribute1=10. The ‘Atomic Subsystem’ block gets the Atributte1’s value and sums it cumulatively at each passage. When the entity’s Attribute1 achieves the value 10, the entity gets out of the loop and a signal is sent to an ‘Event-Based Entity Generator Block’ in order to generate a new entity and the all process repeats again. When a new entity is created I want reset the attribute counter. I tried to use the Unit Delay Resettable block but it modifies the cumulative sum result as you can see in Signal Scope1 graphic.
Could you help me solve this problem? If you have an alternative approach to achieve the same outcome, please let me know too. Thank you for your time.
The Unit Delay Resettable block parameters: http://www.imageupload.co.uk/images/2014/11/17/Unit_Delay_Resettable_block_parameters.png
The Signal Scope 1 (Reset signal): http://www.imageupload.co.uk/images/2014/11/17/Signal_Scope_1.png
Simulation time for the above Signal Scopes: 10

Risposte (0)
Categorie
Scopri di più su General Applications in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!