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

14 次查看(过去 30 天)
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 个评论
Bonyadi Arezoo
Bonyadi Arezoo 2022-7-14
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 2022-7-14
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.

请先登录,再进行评论。

采纳的回答

Fangjun Jiang
Fangjun Jiang 2022-7-14
编辑:Fangjun Jiang 2022-7-14
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 个评论
Fangjun Jiang
Fangjun Jiang 2022-7-14
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by