Azzera filtri
Azzera filtri

Real time, Matlab, SpeedGoat, Simulink, read write data, Solution?

14 visualizzazioni (ultimi 30 giorni)
Hi,I'm using Simulink connected to speedgoat in a real time status. The simulink model includes a user defined block in which along with the main code, there are commands open, close fprintf, fscanf, in order to write/read some numerical data. The model is built correctly, but when the start application button is clicked the following error pops up "external mode open protocol start command failed". So, is there any other way by which we can enjoy write and read data while connected to speedgoat online. Mathwork expers, do you know how to solve this issue?
  4 Commenti
Bonyadi Arezoo
Bonyadi Arezoo il 14 Lug 2022
There is no problem in the code generation process and C++ code can be generated correctly. Nevertheless, when the speedgoat is supposed to work, the connection is lost because I have used fopen, fprintf, suchlike commands to store and read data. The speedgoat does not support them. So, how to use similink while connected to speedgoat and we want to read/write data online? No one could solve this problem yet? It seems a high level of knowledge of Matlab and simulink is needed for addressing this issue.
Bonyadi Arezoo
Bonyadi Arezoo il 14 Lug 2022
Dear Walter, Let's make the issue simple and easy to understand. Assume that there is a simulink model where there is a user defined block. In this block an array is built, e.g. A=zeros(5,1), Now we want to store this array somewhere and whenever we needed it, it can be read, modified and then stored. An example of modification: A= A+1; So, as a whole the block is something like this,
% Initialization A=zeros(5,1); Store A If t==3 Read A A=A+1; Store A end
This is while our simulink model is connected to a speedgoat machine and the machine is supposed to work online.

Accedi per commentare.

Risposta accettata

Fangjun Jiang
Fangjun Jiang il 14 Lug 2022
Modificato: Fangjun Jiang il 14 Lug 2022
To store runtime data like "A" in your example, use "Data Store Memory" block in your Simulink model. Use "Data Store Read" and "Data Store Write" block to read and write the data.
To log data for offline use, use "To Workspace" block or utilize signal logging.
  7 Commenti
Fangjun Jiang
Fangjun Jiang il 14 Lug 2022
Data Store Memory block does not support variable size signal. See doc
You could declare the maximum size and fill the un-used with zeros.
Bonyadi Arezoo
Bonyadi Arezoo il 15 Lug 2022
Dear Jiang, Thanks to your advice, My issue was solved completely.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Simulink Functions in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by