文章目录

  • 1. 搭建模型
  • 2. 启动 Debug 调试器
    • 2.1 点击运行
    • 2.2 step into 一步步进行分析
    • 2.3 第一次点击 stepinto
    • 2.4 不断点击 stepinto,得到Outputs中的全部内容如下
    • 2.5 对Outpus中的内容进行分析
      • 2.5.1 警告不用管
      • 2.5.2 0-1秒
      • 2.5.3 1-9秒
      • 2.5.4 9-10秒
  • 3. 总结分析

1. 搭建模型

2. 启动 Debug 调试器

2.1 点击运行

左栏Simulation Loop: simulate(TestDebugSimulink) 高亮显示
ID = 0
右栏Outputs:输出:

%----------------------------------------------------------------%
[TM = 0                      ] simulate(TestDebugSimulink)
(sldebug @0):

2.2 step into 一步步进行分析

2.3 第一次点击 stepinto

左栏Simulation Loop: initializationPhase 高亮显示
ID = 1
右栏Outputs:输出:

%----------------------------------------------------------------%
[TM = 0                      ] initializationPhase
(sldebug @1):

由此可以看出:

  1. Outputs中输出的(sldebug @X):为左栏中的 ID号
  2. initializationPhase应为左栏中的Method

因此,不断地点击StepInto,在Outputs中得到内容如下

2.4 不断点击 stepinto,得到Outputs中的全部内容如下

警告: The behavior of the Simulink Debugger has been modified in R2012b. See release notes for details.
警告: 'Signal storage reuse' is enabled for this model. Block I/O values displayed in the debugger may not be correct.In order to preserve block output signal values, consider disabling the 'Signal storage reuse' option in the 'All Parameters' tab of the Configuration Parameters dialog警告: 'Block reduction optimization' is enabled for this model. Some non-virtual blocks may not execute due to optimization.To be able to execute all non-virtual blocks consider disabling the 'Block reduction optimization' option in the 'All Parameters' tab of the Configuration Parameters dialog%----------------------------------------------------------------%
[TM = 0                      ] simulate(TestDebugSimulink)
(sldebug @0):
%----------------------------------------------------------------%
[TM = 0                      ] initializationPhase
(sldebug @1):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.SetupRunTimeResources
(sldebug @2):
%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.SetupRunTimeResources 'TestDebugSimulink/x'
(sldebug @3):
Data of 0:0 Constant block 'TestDebugSimulink/x':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.SetupRunTimeResources 'TestDebugSimulink/y'
(sldebug @4):
Data of 0:1 Constant block 'TestDebugSimulink/y':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] 0:2 Sum.SetupRunTimeResources 'TestDebugSimulink/S1'
(sldebug @5):
Data of 0:2 Sum block 'TestDebugSimulink/S1':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.SetupRunTimeResources 'TestDebugSimulink/Display'
(sldebug @6):
Data of 0:3 Display block 'TestDebugSimulink/Display':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.InitializeConditions
(sldebug @7):
%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.Start 'TestDebugSimulink/x'
(sldebug @8):
Data of 0:0 Constant block 'TestDebugSimulink/x':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.Start 'TestDebugSimulink/y'
(sldebug @9):
Data of 0:1 Constant block 'TestDebugSimulink/y':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.Start 'TestDebugSimulink/Display'
(sldebug @10):
Data of 0:3 Display block 'TestDebugSimulink/Display':
No data to display
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Enable
(sldebug @11):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.InvariantConstants
(sldebug @12):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.ParameterChangeEvent
(sldebug @13):
%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.Outputs.Major 'TestDebugSimulink/x'
(sldebug @14):
Data of 0:0 Constant block 'TestDebugSimulink/x':
Y1     = [1]
%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.Outputs.Major 'TestDebugSimulink/y'
(sldebug @15):
Data of 0:1 Constant block 'TestDebugSimulink/y':
Y1     = [1]
%----------------------------------------------------------------%
[TM = 0                      ] 0:2 Sum.Outputs.Major 'TestDebugSimulink/S1'
(sldebug @16):
Data of 0:2 Sum block 'TestDebugSimulink/S1':
U1     = [1]
U2     = [1]
Y1     = [2]
%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.Outputs.Major 'TestDebugSimulink/Display'
(sldebug @17):
Data of 0:3 Display block 'TestDebugSimulink/Display':
U1     = [2]
%----------------------------------------------------------------%
[TM = 0                      ] simulationPhase
(sldebug @18):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.ParameterChangeEvent
(sldebug @19):
%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.Outputs.Major 'TestDebugSimulink/x'
(sldebug @20):
Data of 0:0 Constant block 'TestDebugSimulink/x':
Y1     = [1]
%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.Outputs.Major 'TestDebugSimulink/y'
(sldebug @21):
Data of 0:1 Constant block 'TestDebugSimulink/y':
Y1     = [1]
%----------------------------------------------------------------%
[TM = 0                      ] 0:2 Sum.Outputs.Major 'TestDebugSimulink/S1'
(sldebug @22):
Data of 0:2 Sum block 'TestDebugSimulink/S1':
U1     = [1]
U2     = [1]
Y1     = [2]
%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.Outputs.Major 'TestDebugSimulink/Display'
(sldebug @23):
Data of 0:3 Display block 'TestDebugSimulink/Display':
U1     = [2]
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 1                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 1                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 2                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 2                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 3                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 3                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 4                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 4                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 5                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 5                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 6                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 6                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 7                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 7                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 8                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 8                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 9                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 9                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 10                     ] terminationPhase
(sldebug @26):
%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.CleanupRunTimeResources
(sldebug @27):
%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.Terminate
(sldebug @28):
%----------------------------------------------------------------%
[TM = 10                     ] 0:0 Constant.CleanupRunTimeResources 'TestDebugSimulink/x'
(sldebug @29):
%----------------------------------------------------------------%
[TM = 10                     ] 0:1 Constant.CleanupRunTimeResources 'TestDebugSimulink/y'
(sldebug @30):
%----------------------------------------------------------------%
[TM = 10                     ] 0:2 Sum.CleanupRunTimeResources 'TestDebugSimulink/S1'
(sldebug @31):
%----------------------------------------------------------------%
[TM = 10                     ] 0:3 Display.CleanupRunTimeResources 'TestDebugSimulink/Display'
(sldebug @32):
%----------------------------------------------------------------%
[TM = 10                     ] simulate(TestDebugSimulink)
(sldebug @0):

2.5 对Outpus中的内容进行分析

2.5.1 警告不用管

警告: The behavior of the Simulink Debugger has been modified in R2012b. See release notes for details.
警告: 'Signal storage reuse' is enabled for this model. Block I/O values displayed in the debugger may not be correct.In order to preserve block output signal values, consider disabling the 'Signal storage reuse' option in the 'All Parameters' tab of the Configuration Parameters dialog警告: 'Block reduction optimization' is enabled for this model. Some non-virtual blocks may not execute due to optimization.To be able to execute all non-virtual blocks consider disabling the 'Block reduction optimization' option in the 'All Parameters' tab of the Configuration Parameters dialog

2.5.2 0-1秒

%----------------------------------------------------------------%
[TM = 0                      ] simulate(TestDebugSimulink)
(sldebug @0):
// 开始仿真%----------------------------------------------------------------%
[TM = 0                      ] initializationPhase
(sldebug @1):
// Phase 的初始化%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.SetupRunTimeResources
(sldebug @2):
// 进行"TestDebugSimulink"文件模型仿真的资源加载%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.SetupRunTimeResources 'TestDebugSimulink/x'
(sldebug @3):
Data of 0:0 Constant block 'TestDebugSimulink/x':
No data to display
// 模型中名为(第一个data)`x`的 Constant block 的资源加载,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.SetupRunTimeResources 'TestDebugSimulink/y'
(sldebug @4):
Data of 0:1 Constant block 'TestDebugSimulink/y':
No data to display
// 模型中名为(第二个data)`y`的 Constant block 的资源加载,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] 0:2 Sum.SetupRunTimeResources 'TestDebugSimulink/S1'
(sldebug @5):
Data of 0:2 Sum block 'TestDebugSimulink/S1':
No data to display
// 模型中名为(第三个data)`S1`的 Sum block 的资源加载,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.SetupRunTimeResources 'TestDebugSimulink/Display'
(sldebug @6):
Data of 0:3 Display block 'TestDebugSimulink/Display':
No data to display
// 模型中名为(第四个data)`Display`的 Display block 的资源加载,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.InitializeConditions
(sldebug @7):
// 初始化模型条件%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.Start 'TestDebugSimulink/x'
(sldebug @8):
Data of 0:0 Constant block 'TestDebugSimulink/x':
No data to display
// 开始模型中名为(第一个data)`x`的 Constant block,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.Start 'TestDebugSimulink/y'
(sldebug @9):
Data of 0:1 Constant block 'TestDebugSimulink/y':
No data to display
// 开始模型中名为(第二个data)`y`的 Constant block,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.Start 'TestDebugSimulink/Display'
(sldebug @10):
Data of 0:3 Display block 'TestDebugSimulink/Display':
No data to display
// 开始模型中名为(第四个data)`y`的 Display block,且不需要显示%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Enable
(sldebug @11):
// 模型使能%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.InvariantConstants
(sldebug @12):
// 输出模型中的 InvariantConstants%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.ParameterChangeEvent
(sldebug @13):
// 输出模型中的 ParameterChangeEvent%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.Outputs.Major 'TestDebugSimulink/x'
(sldebug @14):
Data of 0:0 Constant block 'TestDebugSimulink/x':
Y1     = [1]
// 命名为 x 的 Constant block 输出 1 %----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.Outputs.Major 'TestDebugSimulink/y'
(sldebug @15):
Data of 0:1 Constant block 'TestDebugSimulink/y':
Y1     = [1]
// 命名为 y 的 Constant block 输出 1%----------------------------------------------------------------%
[TM = 0                      ] 0:2 Sum.Outputs.Major 'TestDebugSimulink/S1'
(sldebug @16):
Data of 0:2 Sum block 'TestDebugSimulink/S1':
U1     = [1]
U2     = [1]
Y1     = [2]
// 命名为 S1 的 Sum block 两个输入相加,输出 2%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.Outputs.Major 'TestDebugSimulink/Display'
(sldebug @17):
Data of 0:3 Display block 'TestDebugSimulink/Display':
U1     = [2]
// 命名为 Display 的 Display block 输入为 2// 开始重复一次上述步骤
%----------------------------------------------------------------%
[TM = 0                      ] simulationPhase
(sldebug @18):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.ParameterChangeEvent
(sldebug @19):
%----------------------------------------------------------------%
[TM = 0                      ] 0:0 Constant.Outputs.Major 'TestDebugSimulink/x'
(sldebug @20):
Data of 0:0 Constant block 'TestDebugSimulink/x':
Y1     = [1]
%----------------------------------------------------------------%
[TM = 0                      ] 0:1 Constant.Outputs.Major 'TestDebugSimulink/y'
(sldebug @21):
Data of 0:1 Constant block 'TestDebugSimulink/y':
Y1     = [1]
%----------------------------------------------------------------%
[TM = 0                      ] 0:2 Sum.Outputs.Major 'TestDebugSimulink/S1'
(sldebug @22):
Data of 0:2 Sum block 'TestDebugSimulink/S1':
U1     = [1]
U2     = [1]
Y1     = [2]
%----------------------------------------------------------------%
[TM = 0                      ] 0:3 Display.Outputs.Major 'TestDebugSimulink/Display'
(sldebug @23):
Data of 0:3 Display block 'TestDebugSimulink/Display':
U1     = [2]
// 结束重复一次上述步骤不断地输出,更新。
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 0                      ] TestDebugSimulink.Update
(sldebug @25):

2.5.3 1-9秒

不断地输出,更新。

%----------------------------------------------------------------%
[TM = 1                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 1                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 2                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 2                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 3                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 3                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 4                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 4                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 5                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 5                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 6                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 6                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 7                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 7                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 8                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 8                      ] TestDebugSimulink.Update
(sldebug @25):
%----------------------------------------------------------------%
[TM = 9                      ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 9                      ] TestDebugSimulink.Update
(sldebug @25):

2.5.4 9-10秒

%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.Outputs.Major
(sldebug @24):
%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.Update
(sldebug @25): %----------------------------------------------------------------%
[TM = 10                     ] terminationPhase
(sldebug @26):
// 结束 Phase%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.CleanupRunTimeResources
(sldebug @27):
// 清除资源%----------------------------------------------------------------%
[TM = 10                     ] TestDebugSimulink.Terminate
(sldebug @28):
// 结束%----------------------------------------------------------------%
[TM = 10                     ] 0:0 Constant.CleanupRunTimeResources 'TestDebugSimulink/x'
(sldebug @29):
// 清除 x%----------------------------------------------------------------%
[TM = 10                     ] 0:1 Constant.CleanupRunTimeResources 'TestDebugSimulink/y'
(sldebug @30):
// 清除 y%----------------------------------------------------------------%
[TM = 10                     ] 0:2 Sum.CleanupRunTimeResources 'TestDebugSimulink/S1'
(sldebug @31):
// 清除 S1%----------------------------------------------------------------%
[TM = 10                     ] 0:3 Display.CleanupRunTimeResources 'TestDebugSimulink/Display'
(sldebug @32):
// 清除 Display
%----------------------------------------------------------------%
[TM = 10                     ] simulate(TestDebugSimulink)
(sldebug @0):
// 等待下一次仿真开始

3. 总结分析

Simulink 仿真主要步骤:

  1. 准备开始工作
  2. 仿真过程
  3. 重复仿真过程
  4. 不断地更新、输出
  5. 准备结束工作
  6. 结束仿真

Simulink_Debug的使用相关推荐

最新文章

  1. 四次面试:程序员越来越悲催了
  2. html文档中的元数据,javascript – 如何使用pdf.js从pdf文档中获取元数据
  3. sharepoint权限操作(记录以备忘)
  4. 直击「神策 2021 数据驱动大会」五大论坛,精彩不断
  5. 平遥摄影展:卡农•布斯克茨和他的「一天的结束」
  6. KAFKA 最新版 单机安装、配置、部署(linux环境)
  7. PAT1003. 我要通过!
  8. java 生成复杂的word_Java 动态生成复杂 Word
  9. cad螺纹lisp_AutoCADLISP基本知识及函数
  10. SVN合并分支到主干(简单易懂)
  11. Java数组对象排序
  12. RC振荡电路 双三极管多谐振荡器
  13. 2.12 变形工具的使用 [Ps教程]
  14. 升级安卓6.0.1后wifi出现的已连接 但无法访问互联网的问题
  15. 浏览器兼容video视频播放的多种方法
  16. 好听的摇滚_好听的摇滚歌曲有哪些 十大最好听中国摇滚歌曲
  17. 未能启动apache服务器,教你apache服务无法启动一直失败怎么办
  18. python适用的操作系统是_python 操作系统和进程
  19. python搭建简易的https服务器
  20. JavaScript---网络编程(8)-DHTML技术演示(1)

热门文章

  1. 爬虫-12-发送带参数的请求
  2. centos 中查找文件、目录、内容
  3. NPOI操作word文档
  4. 【sql进阶】查询每天、每个设备的第一条数据
  5. javac编译多个java文件以及-cp、-classpath、-sourcepath
  6. Java中的自增操作符与中间缓存变量机制
  7. UIActionSheet 多项弹出框
  8. vmware 克隆centos 6.4网卡不识别
  9. 保存查看翻译:Thrift: Scalable Cross-Language Services Implementation中文翻译(Thrift:Œ可扩展的跨语言服务实现)...
  10. Cocos2d-x win7 + vs2010 配置图文详解(转)