필터 지우기
필터 지우기

Live CAN message from Simulink to App Designer

조회 수: 6 (최근 30일)
Min
Min 2024년 6월 28일
댓글: Umar 2024년 7월 2일
Hi all,
I am having issue with both Simulink and App designer due to Arduino Hardware limitation.
So my new approach is to read live CAN message via Simulink and bring that data to App designer.
I was able to run the simulation but it is running as just 'start' not 'monitor and tune' by using this code
set_param(app.ModelName,'SimulationCommand','Start')
Is there a way to programatically run 'monitor and tune' so I can run simulink via App Designer on Arduino?
Thanks!
  댓글 수: 3
Min
Min 2024년 7월 1일
I am having an interesting error.
Warning:Non-scalar data in first argument to set_param is detected.
Only first handle in the matrix is processed.
simulink_root does not have a parameter named 'SimulationCommand'
Any reason why it isn't grabing the simulationcommand?
Thanks!
Min
Min 2024년 7월 1일
Another thing I found is that when I run it as "monitor and tune" the Simulink Model runs perfectly fine.
When I try to run the model as "Connect" it does not run but says
"Error:External Mode Open Protocol Connect command failed
Caused by:
Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command"
Not sure what is causing this.
Thanks!

댓글을 달려면 로그인하십시오.

채택된 답변

Umar
Umar 2024년 7월 1일
Hi Min, Let me tackle your comments one at a time. So, for the first one that you mentioned,
I am having an interesting error.
Warning:Non-scalar data in first argument to set_param is detected. Only first handle in the matrix is processed. simulink_root does not have a parameter named 'SimulationCommand'
Any reason why it isn't grabing the simulationcommand?
In my opinion, when you receive the warning "Non-scalar data in the first argument to set_param is detected," it indicates that the function is expecting scalar data but is receiving non-scalar data, such as a matrix or cell array. To address this issue, ensure that the input to set_param is a scalar value.
Now, regarding the 'SimulationCommand' parameter not being recognized, double-check the spelling and case sensitivity of the parameter name. Make sure that 'SimulationCommand' is the correct parameter name for the block you are trying to modify. Additionally, verify that the block you are targeting supports the 'SimulationCommand' parameter.
Problem number 2, Another thing I found is that when I run it as "monitor and tune" the Simulink Model runs perfectly fine. When I try to run the model as "Connect" it does not run but says "Error:External Mode Open Protocol Connect command failed Caused by: Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command" Not sure what is causing this.
In order to troubleshoot this problem, you may want to check the network configuration and ensure that there are no issues with connectivity. Additionally, it's important to verify that the target application is properly configured to accept connections from XCP. This may involve checking the settings within the target application and ensuring that it is set up to communicate with XCP without any restrictions or limitations.
Furthermore, it could be beneficial to review the system requirements for running the Simulink model in "Connect" mode. There may be specific hardware or software requirements that need to be met in order for the connection to be established successfully. In some cases, updating or reinstalling relevant drivers or software components may also help resolve communication issues between the target application and XCP.
Let me know if you further assistance.
  댓글 수: 2
Min
Min 2024년 7월 2일
Hi Umar,
I was able to resolve the issue with some external help.
Found out that I was calling a = arduino from the script which was causing the arduino to overlap with the simulink connection. This was one of the problems.
Also, I have to follow a this script to run as monitor and tune mode.
set_param(app.ModelName,'SimulationMode','external');
set_param(app.ModelName,'SimulationCommand','connect');
set_param(app.ModelName,'SimulationCommand','start');
Without calling it as external and have it run will impact the simulink to run in a different mode.
Thanks!
Umar
Umar 2024년 7월 2일
Glad to find out that your problem is resolved. Happy 4th of July.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by