【贝加莱PLC基础教学】Q&A_Simulink生成AutomationStudio代码常见问题

目 录

问题1:不允许修改安装区域

问题2:bur_grt问题

问题3:无法构建到引用的AS配置中

问题4:Simulink编译无报错已完成但是AS里面没有生成对应Task


问题1:不允许修改安装区域

您的当前工作文件夹是: D:\Software_Setup\Matlab2022b_Software\bin Simulink 不允许您修改 MATLAB 安装区域。 请更改为 MATLAB 安装区域之外的 工作文件夹,然后重新尝试前面的命令。

组件:Simulink | 类别:Block diagram 错误

解决方案:

在matlab中将路径修改,不要到包含matlab.exe的文件夹中即可。


问题2:bur_grt问题

在 after_make 钩子期间对 bur_grt_make_rtw_hook 的调用生成以下错误: 函数 UNZIP 找不到文件 ''pack_zip\mlrFiles.zip''。 编译过程将因此终止。

原因:

  • 函数 UNZIP 找不到文件 ''pack_zip\mlrFiles.zip''。 

组件:Simulink | 类别:Block diagram 错误

解决方案:

在Simulink中按Ctrl+E打开参数配置窗口,将bur_grt.tlc修改为ert.tlc或者grt.tlc。


问题3:无法构建到引用的AS配置中

问题4:Simulink编译无报错已完成但是AS里面没有生成对应Task

编译了 0 个模型,共 1 个模型(0 个模型已经是最新的)
编译持续时间: 0h 0m 28.578s
在 entry 钩子期间对 bur_grt_make_rtw_hook 的调用生成以下错误:
 AutomationStudioTargetForSimulink:InspectPhysicalSettings - Please refresh the following settings in the B&R Config Block: Configuration Name, Automation Studio Project Path. Additional information: It is not possible to build into a referenced Automation Studio Configuration.

编译过程将因此终止。
原因:
AutomationStudioTargetForSimulink:InspectPhysicalSettings - Please refresh the following settings in the B&R Config Block: Configuration Name, Automation Studio Project Path. Additional information: It is not possible to build into a referenced Automation Studio Configuration. 
组件:Simulink | 类别:Block diagram 错误

或者

### 正在启动 T_SMLK01 的编译过程

没有为 'T_SMLK01'指定代码生成目标。

建议的操作

指定目标

打开

将 '生成代码前检查模型' 设置为 '关闭'

打开

组件:Simulink | 类别:Block diagram 警告

警告: The following error occurred while generating the support files for compiling the generated code: The selected compiler 'IBIS-AMI MinGW64 | gmake (64-bit Windows)' was not found. For options, see Compatible Windows Compilers - MATLAB & Simulink. While the code has successfully generated, no makefile or other build support files will be generated. For more information on the error that occurred, please refer to 'make_exception.mat' in the build folder.

### 已成功完成 T_SMLK01 的代码生成

编译过程已成功完成

 编译摘要

编译的顶层模型目标: 模型 操作 重新编译原因 ================================ T_SMLK01 代码已生成。 代码生成信息文件不存在。 编译了 1 个模型,共 1 个模型(0 个模型已经是最新的) 编译持续时间: 0h 0m 9.5988s

解决方案:

重点检查AutomationStudio的文件路径,确认路径中都是英文字符或者数字或者_(类似c语言变量命名规则)且不能以数字开头。

比如错误路径(AS文件运行没有问题,但是Simulink导入有问题):E:\AutomationStudioProjects\231014x\E1014_ARsim_HMI

另外如果确认路径比如:E:\AutomationStudioProjects\T231028\T_Simulink01这样无明显问题,这时候记得去该项目的Physical文件夹的对应Config.pkg文件中找是否配置有问题(如下图,其中Config配置是从其他项目导入,导致Config路径有问题导致失败):

只需确保项目路径和Config路径正确即可,最好是自己新建一个进行尝试。


问题5:Matlab当前文件路径不可写

编译的顶层模型目标: 模型 操作 重新编译原因 ============================ T_SMLK01 失败 代码生成信息文件不存在。 编译了 0 个模型,共 1 个模型(0 个模型已经是最新的) 编译持续时间: 0h 0m 5.8106s

Unable to create files for Model Advisor under the current working directory: 'E:\AutomationStudioProjects\T231028\Test231030'. Please change the current directory so that it is writable.

解决方案:

不要用ert和EmbeddedCoder(可能会强制修改文件夹属性),直接用GRT模式(就是Simulink的BRConfig选择GRT,Ctrl+E里面是bur_grt) 和SimulinkCoder即可。

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值