Borrar filtros
Borrar filtros

SIMULINK BUG, or Am I missing something in DATA STORE MEMORY block?

13 visualizaciones (últimos 30 días)
Eleazar
Eleazar el 22 de Mayo de 2013
I have a Simulink model with the following problem:
At the top-level I have one data store memory block A, with one respective read and write block. And even though after the reading, the value travels thru a S-Function at the same level, 3 different Switch-Case Action Subsystems each one with different S-Functions, returns to top-level, and passes thru a Merge block, the writing of the new value is correct.
Now, inside just 1 of the 3 Switch-Case Action Subsystems I have another data store memory block B, also with one respective read and write block inside the subsystem too, same level. After the reading, the value travels thru the S-Function, together with the value from memory block A.
The value for block A is always correct. However, there is no reading from block B.
I already tried:
1-Changing the data type, in the memory block and the S-Function.
2-Double check in sample time.
3-Different initial value.
4-Set ports connected to Merge block as SS_REUSABLE_AND_GLOBAL.
5-Diffent computers (x32 and x64).
6-Put B at the same top-level with A.
7-The same problem still exists in a smaller model too.
But still not reading from block B. Is there something missing?
Anyone please. I am stuck with this for a week.
Thanks.
-Ele

Respuestas (2)

Nirmal Gunaseelan
Nirmal Gunaseelan el 22 de Mayo de 2013
Looks to me like an access issue. How about you make B as a global data store? This is just to make sure that your conditionally executed subsystem has and provides access to B outside itself.
  4 comentarios
Eleazar
Eleazar el 30 de Mayo de 2013
Well, I realized the problem is not about block execution order. Funny is that, in the initial run of the model, there is no reading from block B. But if I run the model a second time, it works perfectly.
I think there is an issue with how many S-fcn's can open same .txt file at the same time. 2 S-fcn's writing in the file work fine, but one more even just reading it maybe cannot if the file is empty. But as I said, in the second run, with some data in the file, the model runs fine.
I think that is why the data store memory block B is not updated from the output of the s-fcn. A third pointer to the same .txt file is not working. Btw, the s-fcn's are in C language.
This is just my guess. Maybe I am wrong.
Kaustubha Govind
Kaustubha Govind el 30 de Mayo de 2013
Eleazar: Would it be simpler if you try to debug this by modifying your S-function to not perform file read/write access (because that may be a C-language related issue)? This might help you determine if it is really a file I/O issue or a Simulink issue.

Iniciar sesión para comentar.


Muruganandham Subramanian
Muruganandham Subramanian el 30 de Mayo de 2013
How you are reading the value for DSR B (data store read)?? from workspace?? Is DSR B depends on DSR A output?, If it depends, check DSR memory used inside the subsytem, passing right value to DSR B ?
  1 comentario
Eleazar
Eleazar el 31 de Mayo de 2013
Values of DSR B are only in the Simulink model, and there is nothing from or to the workspace.
The original model is big, so I created a much reduced toy-model out of it, just to reproduce the problem. Just a few block and 2 DSM blocks. There is 1 .txt file accessed by the 3 S-fnc's (in C lang.), and ech S-fnc in a Switch-Case Action Subsystem. The S-fnc's are used to read and update a pointer to the .txt file, and i/o to the .txt file too. The pointer is stored in the DSM B.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink Functions 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