Reputation: 1731
For a school project I need to create a Simulink model to simulate the behaviour of my prototype.
I made the following model (which is not finished yet), however, I'm new to Matlab and Simulink, and there are a few things I don't understand:
Warning: The block 'BLOCK NAME' is writing to the data store 'BLOCK NAME' but the block(s) 'BLOCK NAME' have already written to a portion or the entire region of
this memory at time 0.0
Model: http://pastebin.com/sMrKn2C2
Thank you.
Upvotes: 1
Views: 4764
Reputation: 10772
Solid lines represent signal/data flow; dot-dash lines represent Action signals (which control execution of other blocks). The different types are simply to help the reader understand what's going on in the model more quickly than would be the case if all lines were solid.
Only one of the If-Action subsystems are executed. (In your case this is the first one). However all three of the Data Store Write blocks are executed. The If-Action subsystems are conditionally executed and hence only execute when their appropriate If condition is true. However everything outside them gets executed at every time step. So the first Data Store Write writes 250, but that gets overwritten with 0 by the second one, which also gets overwritten with 0 by the third one. The warning you are getting is just telling you that multiple blocks are writing to the same memory store at each time step. Typically that is a bad thing.
To fix the above issue, and hence to get the correct output writing to the data store and displaying in the scope, do the following,
The Merge block passes through the last input that was updated, which will correspond to the last If-Action subsystem that was executed, which in turn will be the appropriate true If condition.
Upvotes: 4