概述
下面是使用simulink过程中出现的警告及解决方法,特此记录。
1,警告: You have required continuous-time simulation of a system containing switches or nonlinear elements.
The ode23tb variable-step stiff solver with relative tolerance set to 1e-4 generally gives best accuracy and simulation performance.
For some highly nonlinear models it may be necessary to set the "Solver reset method" parameter to "Robust".
See "Improving Simulation Performance" chapter in Simscape Power Systems documentation for additional information on how to select an appropriate integration method.
To ignore Simscape Power Systems (Specialized Technology) warnings, select "Disable Simscape Power Systems ST warnings" in the Powergui Preferences tab.
解决办法:
修改powergui属性,由原来的continue改为
然后,编译通过。
2,
Output port 1 of 'industrial_frequency_charger/Mosfet1' is not connected.
Component:Simulink | Category:Blockwarning
Output port 1 of 'industrial_frequency_charger/Mosfet2' is not connected.
Component:Simulink | Category:Blockwarning
Output port 1 of 'industrial_frequency_charger/Mosfet3' is not connected.
Component:Simulink | Category:Blockwarning
Output port 1 of 'industrial_frequency_charger/Mosfet4' is not connected.
解决办法:
Mos的m脚悬空了,用Terminator接上就好了。
3,Data type mismatch.
Input port 1 of 'mppt_charger/S-Function2' expects a signal of data type 'double'. However, it is driven by a signal of data type 'boolean'.
解决办法:在s函数输入前增加数据类型转换模块即可。将输出类型设为double
4,
这是在s函数有两个输入端口的情况下出现的问题,运行就跳出这个错误。后来通过注释S函数代码,发现只要不访问s函数的输入,就不会有这个问题。所以,确定了是s函数输入的问题。后来,改为一个输入,也没有问题。最后,查看mdlInitializeSizes,发现有些人使用了ssSetInputPortRequiredContiguous,也有人没有使用,这个函数的含义也是模模糊糊,没人说得清。于是,注释了这个函数,发现可以工作了,具体为啥也不清楚,就先这样用吧。
5,编译s函数的c文件时,找不到编译器
解决办法:
首先,确认是否按照相应编译器。
其次,确认是否添加了编译器的路径。
可通过setenv('MW_MINGW64_LOC','C:TDM-GCC-64'),具体路径根据你的实际安装路径来填写。每次开启matlab都要添加一次。
6,PV array运行出错
An error occurred while running the simulation and the simulation was terminated
Caused by:
Simulink cannot solve the algebraic loop containing 'PV_mppt_charger/PV Array/Diode Rsh/Product5' at time 2.0E-6 using the TrustRegion-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues.
To rule out solver convergence as the cause of this error, either
a) switch to LineSearch-based algorithm using
set_param('PV_mppt_charger','AlgebraicLoopSolver','LineSearch')
b) reducing the VariableStepDiscrete solver RelTol parameter so that the solver takes smaller time steps.
If the error persists in spite of the above changes, then the model is likely ill-defined and requires modification.
根据提示提供的方法修改:
a),在command window输出set_param('PV_mppt_charger','AlgebraicLoopSolver','LineSearch') ,然后回车
b),将步长由原来的1e-7改为1e-9
上述方法中任一种都可运行。
7,使用trigger模块编译报错
The trigger input port of triggered subsystem or Model block 'PV_mppt_charger/Triggered Subsystem1' is involved in a loop. This causes the trigger signal at time t to be dependent on the output of the triggered subsystem or Model block at time t, resulting in an ambiguous execution order. You can use a Memory to break the loop.
解决办法:
在triggered subsystem的输出增加一个Memory模块
8,运行报错误“未定义与‘struct'类型的输入参数相对应的函数’getNumInputs”
原因:模型建在了中文目录下,换为英文目录错误就消失了,切记不要有中文字符,所有开发软件都一样,尽量不要用英文字符,避免不必要的麻烦。
9,自定义的s函数运行时间快了一倍。
原因:在同一个模型中,两个s函数模块都调用同一个s函数文件,导致相互影响,要注意这个问题。
最后
以上就是完美凉面为你收集整理的simulink编译警告的解决办法的全部内容,希望文章能够帮你解决simulink编译警告的解决办法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复