0
votes

I have the following problem:

Matlab/Simulink gives me the warning:

Warning: The block 'Data Store Write1' is writing to the data store 'Data Store' but the block(s) 'Data Store Write2' have already written to a portion or the entire region of this memory at time t

This is because of my model looking like this:

enter image description here

Inside the Stateflow chart the code is:

[hasChanged(In)] {Out = In;}

So my question is: Is there an option or something else the Data Store Write blocks are write only on change?

Annotations:

  • The value "Out" is changed in the Stateflow Chart sometimes, but not in every step, and I need this "feedback" stored in Data Store. So I can read/link on the value of Data Store.

  • I need to change the value from outside with the constant block.

1
Maybe I am simplifying your problem, but it just sounds like you need some kind of change detection / latch which can be done with basic Simulink blocks (Relational Operator, Memory...)pmb
I don't understand your problem. What's the aim of this model?amw
@amw You can't see the "aim" of this model, because it's a minimal example. With "go" I want to trigger a state inside the StateFlow chart. The state can be triggered by the StateFlow chart, too. To see if the state has changed I need it as an output of the StateFlow chart.Phab
@Phab I would do the self triggering with internal stateflow-events. If you want it as a loop in simulink, why do you use the same DataStore?amw
@amw using DataStores is the only way (I found so far) I have access (read and write) to it with dSpace ControlDesk.Phab

1 Answers

1
votes

The most satisfying solution I found, was to build an own 'write-only-on-change" block and add it to the library:

These three pictures show the structure of the block from outer to inner:

enter image description here

enter image description here

enter image description here

The subsystem is triggered on rising signals from the change detection block. Also I added a mask to specify where to save the signal (data store/bus name).

enter image description here