设计简介
摘 要
随着现代汽车的日益发展,汽车电子设备不断增加,进而带来汽车综合控制系统中大量的控制信号需实时交换的问题,传统线束已远远不能满足这种要求,汽车局域网应运而生。本文从研究汽车局域网入手,主要研究了国内外汽车控制器局域网的发展与现状,对当今国际汽车行业中应用最广的CAN总线原理和应用进行了深入研究与吸收。并在研究中设计了采用CAN总线控制的门锁控制系统,制定了一套相应的可靠运行的协议。通过试验验证,本研究门锁控制系统只需要两根信号线就可以实现数据的传输,使得传输线束大大简化,可靠性得到了提高,有效节约了线束安装空间和系统成本。为提高汽车使用的便利性和行车的安全性,现代汽车越来越多地安装中控锁。当驾驶员锁住其身边的车门时,其他车门也同时锁住。驾驶员可通过门锁开关同时打开所有车门,也可单独打开某个车门。当行车速度达到一定时,各个车门能自行锁上,防止乘员误操作车门把手而导致车门打开。除在驾驶员身边车门以外,还在其他门设置单独的弹簧锁开关,可独立地控制一个车门的打开和锁住。dSPACE是基于MATLAB/Simulink仿真系统开发的软硬件实时控制工作平台,利用它可缩短系统的开发时间,节约开发费用。
本文利用该系统开发基于CAN通信的中央门锁控制系统。可以作为CAN总线在汽车上应用的有益探索,为下一步实现多个模块基于CAN总线的通讯,及在实验室实现混和动力汽车发动机、ABS、电机、电池系统等控制模块之间的通讯提供思路。
关键词: dSPACE;CAN;汽车中控门锁;控制系统;通信程序
ABSTRACT
Along with the development of modern automobile, automobile electronic equipment increases gradually, Then bring a large number of controlling signals among automobiles comprehensive control system need real-time exchange problem, Traditional harness cannot satisfy this requirement, Auto LAN come into being.
This paper start studying from the car LAN, The main research is development situation of car controller LAN at domestic and exotic, Deeply study and absorb application principle of CAN bus which is widely used today's international automobile industry, And in the study, Design the CAN bus door locks control system, a set of reliable operating agreement has been developed. Through the experiment testifying, This door lock system only need two signal lines can realize the data communication, Making communication wire harness greatly simplify, improving reliability, efficiently save harness installation space and system cost. In order to improve the car’s security of the convenience of driving, more and more hyundai cars install central lock. When driver lock the doors adjacent to him, other side door also lock. The driver can open all the doors through the door lock switch, also can open a lonely door. When driving speed reaches a certain value, all the doors lock by itself, prevent passenger error operating the door handle, cause the door open. In addition to the driver side door , Setting single latch switch in other door, Can independently control A door open and lock. DSPACE is based on MATLAB/SIMULINK simulation system, is development platform of software and hardware real-time control, Use it can shorten System development time, Saving development costs.
By using this system development central door locks control system Based on CAN communication. Can serve as the useful exploration that used can bus in car, For the next step implement multiple module communications based on CAN bus, And provide thoughts in the laboratory for HEV engine, ABS, motor and battery systems control module communications.
Key words: dSPACE;CAN;Car central locks;Control system;Communication program
目 录
摘要 I
ABSTRACT II
第1章 绪论 1
1.1 前言 1
1.2 课题研究背景 1
1.3 国内外研究现状及发展动态 2
1.4 本文主要研究内容 3
第2章 CAN总线的原理和dSPACE介绍 4
2.1 CAN的性能特点 4
2.2 CAN协议 4
2.3 CAN协议网络分层模型 5
2.4 CAN协议的报文传送及其帧结构 6
2.4.1 逻辑电平定义 6
2.4.2 CAN报文的帧类型 7
2.4.3 CAN报文的帧格式 9
2.5 位定时与位同步 10
2.6 总线访问及仲裁技术 12
2.7 CAN总线的通信错误及其处理 12
2.7.1 错误类型 12
2.7.2 错误状态界定 13
2.8 MATLAB/Simulink介绍 14
2.9 dSPACE实时系统软件 14
2.9.1 RTW(Real-Time Workshop) 14
2.9.2 代码生成和下载软件RTI 14
2.9.3 ControlDesk综合实验和测试环境软件 15
2.10 本章小结 15
第3章 dSPACE中CAN模块通讯实现 16
3.1 dSPACE的CAN模块 16
3.1.1 CAN网 16
3.1.2 dSPACE系统 17
3.2 CAN总线通讯程序开发 17
3.2.1 系统开发流程 17
3.2.2 基于dSPACE的信号生成电路 18
3.2.3 MicroAutobox硬件接口的连接 19
3.2.4 MATLAB/Simulink建模 19
3.2.5 C代码的生成、编译、连接和下载 21
3.2.6基于ControlDesk通讯程序测试 21
3.3 本章小结 22
第4章 CAN总线系统的节点设计 23
4.1 CAN协议支持器件 23
4.2 CAN总线节点的硬件设计 26
4.3 CAN总线节点的软件设计 27
4.3.1 初始化 27
4.3.2 发送 29
4.3.3 接收 31
4.4 本章小结 32
第5章基于dSPACE的控制系统设计 33
5.1 系统总体结构 33
5.2 dSPACE硬件部分及外围电路 34
5.2.1 dSPACE硬件接口电路 34
5.2.2 基于dSPACE的模拟车速信号电路 34
5.3实时仿真系统Matlab/Simulink模型建立 34
5.4 汽车中央门锁半实物仿真系统实验 36
5.5 本章小结 37
结论 38
参考文献 39
致谢 41
附录 42
附录A CAN节点程序代码 42