태양열전지를 이용한 자동커튼장치와 경보기

Download Report

Transcript 태양열전지를 이용한 자동커튼장치와 경보기

실험 구성 (DC모터 속도제어)
-Matlab xPC Target 이용
경희대학교
Robotics.khu.ac.kr
Robotics Lab.
실험구성
Robotics.khu.ac.kr
실험환경
Host PC
Target PC
Serial Port
PCI-6602
PWM 신호
Encorder Data
DC 12V
Switching Power Supply
Dc모터 제어모듈
Moter
Encorder
2
Robotics Lab.
실험구성
Robotics.khu.ac.kr
DC 모터
3
Robotics Lab.
실험구성
Robotics.khu.ac.kr
Encorder
A상, B상 : 1회전시 500 펄스 출력
A상과 B상 모두 사용 => 4체배 => 1회전시 2000 펄스 출력
4
Robotics Lab.
실험구성
Robotics.khu.ac.kr
DC모터 제어모듈
<정회전>
*정회전/역회전을 가능하게 해주는 H브리지회로 내장
(L298 사용)
*2개의 모터를 동시에 제어 가능
*PWM신호에 의한 속도제어 가능
<역회전>
5
Robotics Lab.
실험구성
Robotics.khu.ac.kr
Switching Power Supply
6
Robotics Lab.
실험구성
Robotics.khu.ac.kr
PCI-6602 (National Instrument)
* PCI컴퓨터 또는 PXI Compact PCI 컴퓨터용 타이밍 및 디지털 I/O 모듈
* 8개의 32비트 카운터/타이머
* 32개의 TTL/CMOS 호환 디지털 I/O 라인 제공
* 다양한 카운터/타이머 작업 가능
(엔코더 위치 측정, 이벤트 세기, 주기 측정, 펄스 폭 측정, 펄스 생성, 주파
수 측정, 펄스 열 생성 등)
7
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
What Is xPC Target?
xPC Target is a solution for prototyping, testing, and deploying real-time
systems using standard PC hardware. It is an environment that uses a target
PC, separate from a host PC, for running real-time applications.
xPC Target lets you add I/O blocks to your model and then use the host PC with Real-Time
Workshop®, Real-Time Workshop Embedded Coder (optional), Stateflow Coder (optional),
and a C/C++ compiler to create executable code. The executable code is downloaded from
the host PC to the target PC running the xPC Target real-time kernel. After downloading the
executable code, you can run and test your target application in real time.
8
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
• Hardware requirements
— The xPC Target software requires a host PC, target PC, and, for I/O, the target PC must also
have I/O boards supported by xPC Target. However, the target PC can be a desktop PC, industrial
PC, PC/104, PC/104+, or CompactPCI computer.
• Software requirements
— The xPC Target software requires either a Microsoft Visual C/C++ compiler (Version 6.0 or 7.1)
or an Open Watcom C/C++ compiler (Version 1.3). In addition, xPC Target requires MATLAB,
Simulink, and Real-Time Workshop.
9
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
<Host PC Requirements>
*Software Requirements for the Host PC
10
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
<Host PC Requirements>
*Hardware Requirements for the Host PC
11
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
<Target PC Requirements>
*Softdware Requirements for the Target PC
12
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
<Target PC Requirements>
*Harddware Requirements for the Target PC
13
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
xPC Target Explorer
• Configure the host PC for xPC Target
• Add and configure target PCs for xPC Target, up to 64 target PCs
• Create boot disks for particular target PCs
• Connect the target PCs for your xPC Target system to the host PC
• Download a prebuilt target application, DLM, to a target PC
• Start and stop the application that has been downloaded to the target
• Add scopes of type host, target, and file to the downloaded target application
• Monitor signals
• Add signals to xPC Target scopes and remove them
• Start and stop scopes
• Adjust parameter values for the signals while the target application is running
14
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
Configuring the xPC Target Host PC
(1) MATLAB Command Window : xpcexpl
(2) Click Compiler(s) Configuration node.
(3) Enter the path (or browse) to the compiler
for Compiler Path.
ex) C:\Program Files\Microsoft Visual Studio
(4) Click Apply to apply the changes.
15
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
Serial Communication
Before you can create and run a target application, you need to set up the connection between your
host and target computers. You can use either serialor network communication.
• Null modem cable — Connect the host and target computers with the null modem cable supplied by
The MathWorks with the xPC Target software. You can use either the COM1 or COM2 port.
• I/O boards — If you use I/O boards on the target PC, you need to install the boards correctly.
Null Model Cable Wiring
* the wiring for this cable for a 9-pin DB9 connector.
•A null modem cable that you can use to connect the
host and target computers for serial communications.
16
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
Serial Communication
(1) From the Host target communication list, select RS232
(1)
.
(2) From the Host port list, select either COM1 or COM2 for
the connection on the host PC. xPC Target determines the COM
port you use on the target PC automatically.
(3) From the Baud rate list, select the baud rate for the serial
connection between the host PC and this target PC.
(2)
(3)
17
Robotics Lab.
xPC-Target
Robotics.khu.ac.kr
Target Boot Disk
(1) At the MATLAB Command Window : xpcexplr
(2) select a target PC Configuration node.
(3) From the Target boot mode list, select a boot disk mode.
(4) Click the Create Bootdisk button.
(5) Insert a formatted 3.5-inch floppy disk into the host PC disk
drive, and then click OK.
(6) When the 3.5-inch disk drive stops, remove the 3.5-inch disk.
(7) Insert the boot disk into your target PC disk drive and
reboot that PC.
18
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Simulink Model
Reference Value
(velocity)
PWM Generator
PID Controller
Encorder Data Process
19
Robotics Lab.
Simulink
Robotics.khu.ac.kr
PWM Generation
Prameter setting
20
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Encorder Data
Prameter setting
21
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Target Scope
Prameter setting
22
Robotics Lab.
Simulink
Robotics.khu.ac.kr
PID Controller
Prameter setting
23
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Configuration Parameters
24
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Configuration Parameters
25
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Configuration Parameters
26
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Configuration Parameters
27
Robotics Lab.
Simulink
Robotics.khu.ac.kr
Build Model
(2)
(1)
(3) Command Window
28
Robotics Lab.
Simulink
Robotics.khu.ac.kr
xPC-Target Start/Stop
실행
*Start : +tg
*Stop : -tg
29