Home

Hilink User Manual for version 1.7

image

Contents

1. Q 4 096 V Figure 26 Analog Output Block usage The maximum voltage interpolation error is 4 096 8192 500 0000 uV in unipolar conversion mode and the maximum voltage interpolation error is 4 096 4096 1000 0000 4V in bipolar conversion mode These errors are negligibly small in most practical applications and are inherent in all digital to analog converters 3 8 Frequency Output Block This block connects selected frequency output channel from the Simulink model to the real time control board The block parameters are as shown in Figure 27 Sample time is the sample time of the block Com port is the serial communication port number Frequency output channel is the specific frequency output channel selectable among FO F1 Period frequency is the conversion mode of the selected frequency output channel Suppose a signal v is connected to the FO input of the Frequency Output Block and the block is used in a Simulink model as shown in Figure The value of the input signal v is sent to the real time control board and converted to a square wave with period 7 and frequency f 1 7 by the output compare 20 Sink Block Parameters FO Frequency Output mask Frequency output Parameters Sample time T Com port 1 Frequency output channel Period frequency Figure 27 Frequency Output Block parameters module to form the output signal u The period 7 of the signal u is rel
2. Encoder input channel EO Angular linear angular Encoder resolution n Figure 22 Encoder Input Block parameters sree n RTCB__ Matlab Simulink position 0 y 7 a O E0_A b O e E0_B gt E0 mu x O E0_X Figure 23 Encoder Input Block usage The maximum position quantization error is 27 4 n 7 2 n rad in angular conversion mode and the maximum position quantization error is 0 01 4 n 1 400 n m in linear conversion mode These errors are negligibly small in most practical applications if a high resolution encoder is used and are inherent in all incremental encoders 3 7 Analog Output Block This block connects selected analog output channel from the Simulink model to the real time control board The block parameters are as shown in Figure Sample time is the sample time of the block Com port is the serial communication port number Analog output channel is the specific analog output channel selectable among B0 B1 Unipolar bipolar is the conversion mode of the selected analog output channel Suppose a signal v is connected to the BO input of the Analog Output Block and the block is used in a Simulink model as shown in Figure The value of the input signal v is sent to the real time control 18 Sink Block Parameters BO Analog Output mask Analog output Parameters Sample time T Com port 1 Analog output channel BO
3. Unipolar bipolar unipolar Figure 24 Analog Output Block parameters board and converted to its analog representation by the digital to analog converter to form the output signal u The signal u is related to the signal v through 4 096 v gt 4 096 ux v 0 lt v lt 4 096 11 0 v lt 0 with unipolar conversion mode and the signal u is related to the signal v through 4 096 v gt 4 096 u 4 v 2 4 096 2 4 096 lt v lt 4 096 12 0 v lt 4 096 with bipolar conversion mode Matlab Simulink RTCB V gt BO gt BO o u Figure 25 Analog Output Block usage Negative voltage levels can not be directly obtainable from the analog output channels The simple level converter shown in Figure 26 can be used to obtain negative voltage levels It is easy to see that the level converter output u is related to its input x through 4 096 x gt 4 096 u 2g 4 096 0 lt 2x lt 4 096 13 4 096 x lt 0 19 Thus the signal u is related to the signal v through 4 096 v gt 4 096 ux w 4 096 0 lt v lt 4 096 14 4 096 v lt 0 with unipolar conversion mode and the signal u is related to the signal v through 4 096 v gt 4 096 ure v 4 096 lt v lt 4 096 15 4 096 v lt 4 096 with bipolar conversion mode 10 k 4 096 V O Matlab Simulink i RTCB 10k 4 096 Vo BUN o v B0 BO e ag LA
4. Enter gt T 1 2048 as the sampling time and gt S inf as the stop time at the Matlab Command Window Build the model by clicking on Tools Real Time Workshop Build Model or by pressing Ctrl B Click on Connect to target button to connect the board to the model and then click on Start real time code button gt to run the model Compare the signals in the model with those on the oscilloscope and signal generator to verify proper operation of the board Change the model parameters or external signal attributes and observe the corresponding changes to familiarize yourself with the operation of the hardware and software Click on Stop real time code button m to stop the model or click on Disconnect from target button to disconnect the model from the board The purpose of this example is to illustrate the basic capabilities of the HILINK platform and verify proper operation of the hardware and software with DO GO EO HO 1 2 3s Open the Simulink model test2 mdl and setup the board as shown in Figure with the external connections Enter gt T 1 2048 as the sampling time and gt S inf as the stop time at the Matlab Command Window Build the model by clicking on Tools Real Time Workshop Build Model or by pressing Ctrl B 29 File Edit view Simulation Format Tools Help DiS Ua amp 28 2 gt 7 Scope co Display lode
5. The sample time T in the Simulink blocks is related to the sampling rate f as T 33 F 33 With n 4 and no 4 for example the maximum achievable sampling rate is f 1280 Hz The recommended sampling rate and sample time are f 1024 Hz and T 1 1024 976 5625 us respectively The maximum achievable sampling rate is about 650 Hz when all 8 inputs and 8 outputs of the platform are used This is usually more than adequate for most real time hardware in the loop control system implementations 3 14 Data Types The outputs of the Analog Input Block Capture Input Block Encoder Input Block and the inputs of the Analog Output Block Frequency Output Block and Pulse Output Block are represented by doubles in Matlab Simulink The output of the Digital Input Block and the input of the Digital Output Block are represented by integers in Matlab Simulink 28 4 USAGE Several illustrative examples are given below to demonstrate the usage and capabilities of the HILINK platform The Simulink models used in these examples are provided with the platform and they can be used as templates for constructing other models 4 1 Basic Inputs and Outputs The purpose of this example is to illustrate the basic capabilities of the HILINK platform and verify proper operation of the hardware and software with AO BO CO FO 1 Open the Simulink model testl mdl and setup the board as shown in Figure with the external connections
6. Sample time T Com port 1 Digital output channel Output lines FF O g O 96 O 95 O g4 O 93 O g2 O gl O g0 Figure 29 Digital Output Block parameters The digital input lines are multiplexed with the analog inputs and digital output lines The analog inputs have precedence over the digital inputs and the digital inputs have precedence over the digital outputs The function of each input output line Ai DO_di GO_gi for i 1 7 is shown in Table B where d is the binary value read from the line in Simulink g is the binary value written to the line in Simulink c is the binary input to the line when it is an input line h is the binary output from the line when it is an output line and a is an analog input to the line when it is an input line The line condition is determined by the value given inside the square brackets and x indicates that the corresponding input output lines may be left unconnected To avoid potential damage to the board do not apply a digital input signal to a digital output line and do not apply an analog input signal to a digital input or output line 22 SOTO analog input fea 0 x aad 0 o falar a a p 0 a aes 0 a ee 0 a aaa Pa a analog input la o pd 0 a Table 3 Function of each input output line s ala Suppose a signal v is connected to the Digital Output Block in a Simulink model and some d
7. Sample time T Com port 1 Pulse output channel HO Normal shifted normal Fundamental frequency 7 f Figure 31 Pulse Output Block parameters output signal u The duty cycle 6 of the signal u is related to the signal v through 1 vel On v O lt v lt l 19 0 v lt 0 with normal conversion mode and the duty cycle 6 of the signal u is related to the signal v through 1 v gt i Oe v 2 1 2 l lt v lt 41 20 0 v lt 1 with shifted conversion mode The width w is related to 6 through w T 21 J where f is the fundamental frequency of the pulse width modulator and r 1 f is its period The frequency f is in the range 117 92 x 10 262144 449 8291 lt f lt 117 92 x 10 1024 115156 25 Hz When both pulse outputs are used their fundamental frequencies must be the same Matlab Simulink RTCB frequency f duty cycle 6 l V HO gt HO e o u Figure 32 Pulse Output Block usage 24 The maximum frequency interpolation error is f 117 92 x 10 4 k f 29 48 x 10 k Hz where k 117 92 x 10 4 f 29 48 x 10 f in both modes and the duty cycle resolution is llog2 117 92 x 10 4 f log 29 48 x 10 f bits 16 bits when f 449 8291 Hz and 8 bits when f 115156 25 Hz in both modes These errors are negligibly small in most practical applications if a low fundamental frequency is used and are inherent i
8. CON2 provides access to each encoder input channel For convenience GND and VDD are also provided with each channel The pinout of CON2 is shown in Figure 7 where E0_A E0_B E1_A E1_B are the quadrature inputs and EO_X E1_X are the index inputs The position of each encoder input is converted to its digital representation by the quadrature decoder module The scan rate of the encoder module is 117 92 x 10 512 230 3125 kHz The resolution of A Q y aszmahHaztanaged aoe 2 Oe man gt HWRV0fP HA HUD 0oos sso so Figure 7 Encoder inputs connector CON2 the encoder module is 16 bit The index inputs of the encoders are multiplexed with the corresponding capture inputs The capture inputs reset the corresponding encoder outputs 2 7 Analog Outputs The board has 2 analog output channels BO B1 Each analog output is a 0 5 V range analog signal The connector CON3 provides access to each analog output channel For convenience GND is also provided with each channel The pinout of CON3 is shown in Figure GND mi el GND BO Figure 8 Analog outputs connector CON3 The value of each analog output is converted from its digital representation by the digital to analog converter The settling time of the digital to analog converter is 4 5 us The resolution of the digital to analog converter is 12 bit The analog outputs are not multiplexed with other inputs or outputs 2 8 Frequency Outputs The board
9. H bridges The board contains 2 H bridges to boost the pulse outputs The H bridge outputs PO P1 are 0 Vs V range pulse width modulated digital signals where Vg is the power supply voltage Each H bridge is a complementary MOSFET bridge with 5 A drive capability The H bridge outputs are available through the connector CON6 The pinout of CON6 is shown in Figure 13 where PO_A PO_B and P1_A P1_B are the outputs of the H bridges COTO 12945 O Onn H A AA A Figure 13 H bridge outputs connector CON6 2 13 Serial Communication The board is connected to the host computer through a crossover null modem cable using a standard DE 9 also refereed to as DB 9 type male connector The board can be connected to the host computer through COM1 with address 0 x 03F8 0 x 03FF COM2 with address 0 x 02F8 0 x 02FF COM3 with address 0 x 03E8 0 x 03EF or COM4 with address 0 x 02E8 0 x 02EF The board can also be connected to the host computer through a user specified COM port with custom address The serial communication is handled by the UART unit The serial port signal levels are in compliance with the established industry standards 2 14 Power on Indicator and Reset The board contains a green LED labeled as PW to indicate power is on The board also contains a push button labeled as MR to reset the board 10 3 SOFTWARE The real time control board is supplied with the associated software for a seamle
10. Input Block usage channel selectable among EO0 El Angular linear is the conversion mode of the selected encoder input channel Encoder resolution is the number of pulses per revolution 27 rad for angular mode and number of pulses per centimeter for linear mode Suppose an encoder with angular position 0 or linear position y is connected to the encoder input EO of the real time control board and the Encoder Input Block is used in a Simulink model as shown in Figure 23 The position of the encoder is decoded into its digital representation by the quadrature encoder module and sent to Matlab Simulink to form the output signal v The signal v is related to the angular position 0 through 327671 2 n 0 gt 327671 2 n vee 9 327687 2 n lt 0 lt 327671 2 m 9 327687 2 n 9 lt 327681 2 n with angular conversion mode where n is the resolution number of pulses per revolution of the encoder and the signal v is related to the linear position y through 32767 400 n y gt 32767 400 n ved y 32768 400 n lt y lt 32767 400 n 10 32768 400 n y lt 32768 400 n with linear conversion mode where n is the resolution number of pulses per centimeter of the encoder The initial read encoder position is zero and a high level on the index signal x resets the read encoder position to zero 17 Source Block Parameters EO Encoder Input mask Encoder input Parameters Sample time T Com port 1
11. do Figure 20 Digital Input Block parameters may be left unconnected To avoid potential damage to the board do not apply a digital input signal to a digital output line and do not apply an analog input signal to a digital input or output line Suppose some digital inputs c s are connected to the digital input lines of the real time control board when they are configured as inputs and the Digital Input Block is used in a Simulink model as shown in Figure 21 The data at the digital input lines is read by the digital input port and sent to Matlab Simulink to form the output signal v The signal v is related to the data at the digital inputs through v 128 d7 64 d 32 d5 16 d4 8 d3 4d2 2 d 1 do 8 and each d is either 0 or 1 determined by c and h according to Table 2 3 6 Encoder Input Block This block connects selected encoder input channel from the real time control board to the Simulink model The block parameters are as shown in Figure Sample time is the sample time of the block Com port is the serial communication port number Encoder input channel is the specific encoder input 16 OJO analog input lala d 0 o alar ES A ESA ESLA EJ Ja PT 0 o aja EAR aa 0 alar EALA aJa 0 o ala Pv aa aog imp fiaa 0 9 Talapd Table 2 Function of each input output line RTCB Matlab Simulink DO mu Figure 21 Digital
12. has 2 frequency output channels FO F1 Each frequency output is a 0 5 V range digital signal The connector CON4 provides access to each frequency output channel For convenience GND is also provided with each channel The pinout of CON4 is shown in Figure 9 GND F1 H1 GND F0 H0 e Figure 9 Frequency outputs connector CON4 The period of each frequency output is synthesized from its digital representation by the output compare module The accuracy of the output compare module is 1024 117 92 x 10 8 6839 us The resolution of the output compare module is 16 bit The frequency outputs are multiplexed with the corresponding pulse outputs The pulse outputs have precedence over the frequency outputs 2 9 Digital Outputs The board has 1 digital output channel GO with 8 digital output lines G0_g0 G0_g7 Each digital output is within 0 5 V range digital signal The connector CON1 provides access to each digital output line For convenience GND and VDD are also provided with each line The pinout of CON1 is shown in Figure OT NOM THO LY op ap op ap eee oo S G G O GO oO DODOUDODOYU AA A SS PI O Y NAM YT OO fr 333303377 ooo cqooo9c o AAARARARAAAAA Ss Se PS SS eS SS ee S AN co St ad OO LAA AAA 00000090090 GND 0 0 0 0 0 0 0 O VDD e e e e e e Figure 10 Digital outputs connector CON1 The 8 bit data is written to the digital output lines by the digital output port as g7g
13. wok ca kisah a a dow a a STS de d 6 2 7 A alos Outputs s e ee dk Ge ee EA Af Sey ai BE a 7 1 INTRODUCTION The HILINK platform offers a seamless interface between physical plants and Matlab Simulink for im plementation of hardware in the loop real time control systems It is fully integrated into Matlab Simulink and has a broad range of inputs and outputs The platform is a complete and low cost real time control system development package for both educational and industrial applications The HILINK platform consists of the real time control board hardware and the associated Matlab interface software The hardware of the HILINK platform has 8 x 12 bit analog inputs 2 x 16 bit capture inputs 2 x 16 bit encoder inputs 1 x 8 bit digital input 2 x 12 bit analog outputs 2 x 16 bit frequency outputs 2 x 16 bit pulse outputs and 1 x 8 bit digital output The board also contains 2 H bridges with 5 A capability to drive external heavy loads Some inputs and outputs are multiplexed to simplify the hardware The board is interfaced to the host computer that runs Matlab through a serial port The software of the HILINK platform is fully integrated into Matlab Simulink Real Time Windows Target and comes with Simulink library blocks associated with each hardware input and output The library contains Analog Input Block Capture Input Block Encoder Input Block Digital Input Block Analog Output Block Frequency Output Block Digital Output Bloc
14. 5 10 Ho TV peak 2 V IA oS TO 20 He 1 V peak 2 V offset sine wave offset sine wave RTCB ce a e co Fo e ao gt ZN e ___ Bee square wave GND GND square wave Figure 36 Setup for test1 mdl 4 Click on Connect to target button to connect the board to the model and then click on Start real time code button gt to run the model 5 Compare the signals in the model with those on the oscilloscope and signal generator to verify proper operation of the board 6 Change the model parameters or external signal attributes and observe the corresponding changes to familiarize yourself with the operation of the hardware and software 7 Click on Stop real time code button m to stop the model or click on Disconnect from target button to disconnect the model from the board The real time execution of the model can be terminated by clicking either on Stop real time code button m or by clicking on Disconnect from target button E If the real time execution is terminated by clicking on Stop real time code button m the model can be modified rebuild and rerun by following the above steps again If however the real time execution is terminated by clicking on Disconnect from target button dl the board must be reset before reruning the model even without any modification since the code is still running on the real time board with the last received values Note that it is not ne
15. 6g5g4 g3g2g1g0 The digital output lines are multiplexed with the corresponding analog inputs and digital inputs The analog inputs have precedence over the digital inputs and the digital inputs have precedence over the digital outputs 2 10 Pulse Outputs The board has 2 pulse output channels HO H1 Each pulse output is a 0 5 V range digital signal The connector CON4 provides access to each pulse output channel For convenience GND is also provided with each channel The pinout of CON4 is shown in Figure The duty cycle of each pulse output is synthesized from its digital representation by the pulse width modulator The maximum frequency of the pulse output module is 117 92 x 10 1024 115 1563 kHz The resolution of the pulse width modulator module is 16 bit The pulse outputs are multiplexed with the corresponding frequency outputs The pulse outputs have precedence over the frequency outputs GND F1 H1 e GND F0 H0 e Figure 11 Pulse outputs connector CON4 2 11 Lowpass Filters The board contains 2 lowpass filters to filter the pulse outputs The filter outputs LO L1 are 0 5 V range analog signals Each filter is a simple RC lowpass filter with the cutoff frequency 159 1549 Hz The lowpass filter outputs are available through the connector CON5 For convenience GND is also provided with each output The pinout of CONS is shown in Figure GND mel GND LO Figure 12 Lowpass filter outputs connector CONS 2 12
16. HILINK REAL TIME HARDWARE IN THE LOOP CONTROL PLATFORM FOR MATLAB SIMULINK User Manual release 1 5 May 1 2011 Disclaimer The developers of the HILINK platform hardware and software have used their best efforts in the development The developers make no warranty of any kind expressed or implied with regard to the developed hardware and software The developers shall not be liable in any event for incidental or consequential damages in connection with or arising out of the performance or use of this hardware and software The hardware and software are provided as is and their users assume all risks and responsibility when using them The hardware software and this document are subject to change without notice Brand names or product names are trademarks or registered trademarks of their respective owners Copyright The HILINK platform hardware and software contains proprietary information protected by copyright All rights reserved No parts of the hardware software and this document may be reproduced ported copied distributed or translated in any form or by any means in whole or in part without the prior written consent of Zeltom LLC 2010 by Zeltom LLC 47001 Harbour Pointe Ct Belleville MI 48111 USA CONTENTS 1 INTRODUCTIO Specification Requirementh s e wit e a i a e ee ena a a k a E a E ee 2 2 2 Power Supply 2 3 Analog Input 2 5 Digital Input 2 6 Encoder Inputs lt isa
17. O Capture Input mask Capture input Parameters Sample time T Com port 1 Capture input channel CO Period frequency period Figure 18 Capture Input Block parameters Suppose a square wave u with period 7 and frequency f 1 7 is connected to the capture input CO of the real time control board and the Capture Input Block is used in a Simulink model as shown in 14 Figure The period of the input signal u is converted to its digital representation by the input capture module and sent to Matlab Simulink to form the output signal v The signal v is related to the period 7 of the signal u through 569 0963 x 1073 r gt 569 0963 x 1073 vee T 34 7354 x 1076 lt 7 lt 569 0963 x 1073 6 34 7354 x 107 r lt 34 7354 x 1076 with period conversion mode and the signal v is related to the frequency f of the signal u through 28789 0625 f gt 28789 0625 vee f 1 7572 lt f lt 28789 0625 7 1 7572 f 21 7572 with frequency conversion mode od RTCB Matlab Simulink period 7 frequency f Figure 19 Capture Input Block usage The maximum period quantization error is 1024 117 92 x 10 8 6839 us in period conversion mode and the maximum frequency quantization error is f 117 92 x 10 1024 k f 115156 25 k Hz where k 117 92 x 10 1024 f 115156 25 f in frequency conversion mode These errors are negligibly small in most practical appli
18. al port or an expansion slot for a serial card e Serial crossover null modem cable e Matlab R2007b or later with Simulink Real Time Workshop and Real Time Windows Target e HILINK hardware real time control board 1 4 or later e HILINK software 1 4 or later e Power supply regulated 6 15 V and at least 0 15 A without any load 1 3 Absolute Maximum Ratings e Power supply voltage minimum 3 V maximum 16 V e Each analog digital capture and encoder input minimum 0 3 V maximum 5 3 V e Each analog digital frequency and pulse output minimum 25 mA maximum 25 mA e Each filtered pulse output minimum 25 mA maximum 25 mA e Each H bridge output minimum 5 A maximum 5 A e Total current from into all inputs and outputs except power supply voltage regulator and H bridges minimum 200 mA maximum 200 mA e Voltage regulator output maximum 0 5 A total e Operating ambient temperature minimum 10 C maximum 50 C 2 HARDWARE The real time control board is based on a dsPIC30F2012 digital signal controller It has a total number of 8 x 16 bit inputs and 8 x 16 bit outputs capability The inputs and outputs can be selected among the inputs and outputs listed above The board is interfaced to the main computer that runs Matlab through a serial port Two pulse width modulation driven H bridges with 5 A drive capability are included on the board to drive external actuators or loads The functional block diagram
19. ated to the signal v through 569 0963 x 107 v gt 569 0963 x 1073 Tee v 34 7354 x 1076 lt v lt 569 0963 x 107 16 34 7354 x 107 v lt 34 7354 x 10 with period conversion mode and the frequency f of the signal u is related to the signal v through 28789 0625 v gt 28789 0625 fee v 1 7572 lt v lt 28789 0625 17 1 7572 v lt 1 7572 with frequency conversion mode Matlab Simulink i RTCB iod period T frequency f V FO FO 0o u Figure 28 Frequency Output Block usage The maximum period interpolation error is 1024 117 92 x 10 8 6839 us in period conversion mode and the maximum frequency interpolation error is v 117 92 x 10 1024 k v 115156 25 k Hz where k 117 92 x 10 1024 v 115156 25 v in frequency conversion mode These errors are negligibly small in most practical applications and are inherent in all output compare modules 3 9 Digital Output Block This block connects selected digital output lines from the Simulink model to the real time control board The block parameters are as shown in Figure Sample time is the sample time of the block 21 Com port is the serial communication port number Digital output channel is the specific digital output channel fixed at GO Output lines are the specific digital output lines selectable among g0 g7 using the check boxes Sink Block Parameters GO Digital Output mask Digital output Parameters
20. b is your HILINK installation directory Rebuild your model whenever you make any changes in the parameters of the custom blocks in your model even when Matlab does not warn you to do so Do not excessively load any output of the board and do not apply any input that takes values outside the operating range of the board Some inputs and outputs are multiplexed and can not be used together Refer to hardware and software sections to determine the multiplexed inputs and outputs and their priority Refer to the data sheets of components used on the board for their absolute maximum ratings and safe operating areas 35
21. capture module The accuracy of the input capture module is 1024 117 92 x 10 8 6839 us The resolution of the input capture module is 16 bit The capture inputs are multiplexed with the corresponding index inputs of the encoders The capture inputs reset the corresponding encoder outputs A Q y aszmahHaztanaged aoe 2 Oe man raBodo gt ando coo Figure 5 Capture inputs connector CON2 2 5 Digital Inputs The board has 1 digital input channel DO with 8 digital input lines DO_d0 D0_d7 Each digital input must be within 0 5 V range digital signal The connector CON provides access to each digital input line For convenience GND and VDD are also provided with each line The pinout of CON1 is shown in Figure 6 e A0 D0_d0 G0_g0 e Al D0_d1 G0_g1 e A2 D0 d2 G0_22 e A3 D0_d3 G0_ 3 e A4 D0 d4 G0 g4 e A5 D0_d5 G0 g5 e AG D0_d6 G0_g6 e A7 D0_47 G0 g7 GND VDD Figure 6 Digital inputs connector CON1 The 8 bit data is read from the digital input lines by the digital input port as d7d6d5d4 d3d2d1d0 The digital input lines are multiplexed with the corresponding analog inputs and digital outputs The analog inputs have precedence over the digital inputs and the digital inputs have precedence over the digital outputs 2 6 Encoder Inputs The board has 2 encoder input channels EO E1 Each encoder input must be within 0 5 V range digital signal The connector
22. cations and are inherent in all input capture modules 3 5 Digital Input Block This block connects selected digital input lines from the real time control board to the Simulink model The block parameters are as shown in Figure 20 Sample time is the sample time of the block Com port is the serial communication port number Digital input channel is the specific digital input channel fixed at DO Input lines are the specific digital input lines selectable among d0 d7 using the check boxes The digital input lines are multiplexed with the analog inputs and digital output lines The analog inputs have precedence over the digital inputs and the digital inputs have precedence over the digital outputs The function of each input output line Ai DO_di GO_gi for i 1 7 is shown in Table 2 where d is the binary value read from the line in Simulink g is the binary value written to the line in Simulink c is the binary input to the line when it is an input line h is the binary output from the line when it is an output line and a is an analog input to the line when it is an input line The line condition is determined by the value given inside the square brackets and x indicates that the corresponding input output lines 15 Source Block Parameters DO Digital Input mask Digital input Parameters Sample time T Com port 1 Digital input channel Input lines 00 O d7 O de O d5 O d4 O a3 O d2 Oda O
23. cess to the on board 5 V 0 25 A voltage regulator output is also provided for external light power supply requirements Figure 2 Component layout of the board 2 1 Microcontroller The real time control board employs a dsPIC30F2012 digital signal controller for central control The dsPIC30F2012 is a high performance 16 bit digital signal controller with 12 kB flash program memory and 1 kB SRAM data memory It has also 3 x 16 bit timers counters 2 x 16 bit input capture 2 x 16 bit output compare 1 x SPI module 1 x IC module 1 x UART module 1 x 12 bit analog to digital converter 21 interrupt sources with 3 external interrupts high current sink source I O pins programmable low voltage detection programmable brown out reset power on reset power up timer oscillator start up timer watchdog timer fail safe clock monitor operation in circuit serial programming selectable power management modes and 7 37 MHz internal RC oscillator with PLL The microcontroller is set up to run from its internal oscillator at 7 37 x 10 x 16 117 92 MHz 2 2 Power Supply The board requires a 6 15 V at least 0 15 A without any external load regulated DC power supply to operate The recommended power supply for the board is a 12 V well regulated DC power supply with 5 A drive capability The power supply is connected to the board through the connector CONO The pinout of CONO is shown in Figure 3 where VPS is the positive terminal and GND is
24. cessary to connect all the external inputs and outputs in these examples 30 7 test2 SEE File Edit view Simulation Format Tools Help Di ees teele T Display Pulse Generator Scope Sine Wave 100 from signal generator to oscilloscope 1Hz 0 5V pe DO do G0 g0 gt 32 Hz 0 5 V square wave GND GND square wave RTCB f 1 t ill a E Hust TAN 1024 resolution GND GND pwm wave Figure 37 Setup for test2 mdl 4 2 Filtering a Square Wave The purpose of this example is to illustrate some basic features of the HILINK platform with a simple open loop system A square wave is filtered with a second order bandpass filter to obtain a sinusoidal wave when the frequency of the square wave coincides with the resonance frequency of the bandpass filter This example also illustrates the use of a scope and mux in a model 1 Open the Simulink model test3 mdl and setup the board as shown in Figure with the external connection Enter gt T 1 2048 as the sampling time and gt gt S inf as the stop time at the Matlab Command Window Build the model by clicking on Tools Real Time Workshop Build Model or by pressing Ctrl B Click on Connect to target button to connect the board to the model and then click on Start real time code button gt to run the model Vary the frequency of the square wave between 10 Hz and 30 Hz and observe the output of the fil
25. erter shown in Figure can be used to convert negative voltage levels It is easy to see that the level converter output x is related to its input u through 5 u gt 5 x x u 2 5 2 5 lt u lt 5 3 0 u lt d Thus the signal v is related to the signal u through 5 u gt 5 v 4 u 2 5 2 5 lt u lt 5 4 0 u lt 5 with unipolar conversion mode and the signal v is related to the signal u through 5 u gt 5 vx u 5 lt u lt 5 5 5 u lt 5 with bipolar conversion mode The maximum voltage quantization error is 5 8192 610 3516 uV in unipolar conversion mode and the maximum voltage quantization error is 5 4096 1220 7031 uV in bipolar conversion mode These errors are negligibly small in most practical applications and are inherent in all analog to digital converters 13 5 V i RTCB Matlab Simulink 10k p 0 AQ RES AO v Y VA x 5 VOW 10 k 10k Figure 17 Analog Input Block usage 3 4 Capture Input Block This block connects selected capture input channel from the real time control board to the Simulink model The block parameters are as shown in Figure Sample time is the sample time of the block Com port is the serial communication port number Capture input channel is the specific capture input channel selectable among C0 C1 Period frequency is the conversion mode of the selected capture input channel e Source Block Parameters C
26. igital outputs of the real time control board when they are configured as outputs are used as shown in Figure The signal v is sent to the real time control board and is written by the digital output port to form the data at the digital output lines The data at the digital outputs is related to signal v through 128 97 6496 3295 1694 893 4g92 291 19 v amp 0 x OOFF 18 and each h is either 0 or 1 determined by g and c according to Table B Matlab Simulink RTCB G0_g7 O hz v GO G0_g0 e o ho Figure 30 Digital Output Block usage 3 10 Pulse Output Block This block connects selected pulse output channel from the Simulink model to the real time control board The block parameters are as shown in Figure Sample time is the sample time of the block Com port is the serial communication port number Pulse output channel is the specific pulse output channel selectable among HO H1 Normal shifted is the conversion mode of the selected pulse output channel Fundamental frequency is the carrier frequency of the pulse output Suppose a signal v is connected to the HO input of the Pulse Output Block and the block is used in a Simulink model as shown in Figure The input signal v is sent to the real time control board and converted to a pulse signal with width w and duty cycle 6 by the pulse width modulator to form the 23 Sink Block Parameters HO Pulse Output mask Pulse output Parameters
27. k and Pulse Output Block The platform achieves real time operation with sampling rates up to 3 8 kHz The HILINK platform has been developed to extend and optimize the real time operation of Matlab Simulink and Real Time Windows Target The developed platform is uniquely integrated into Matlab to achieve real time operation in Matlab under Windows The salient features of the HILINK platform make it ideal for implementation of hardware in the loop real time control systems in both educational and industrial applications 1 1 Specifications e Power supply 6 15 V minimum 0 15 A regulated e Interface 115200 baud 8 bit data no parity 1 stop bit e Analog inputs AO A7 0 5 V analog 12 bit resolution e Capture inputs CO C1 0 5 V digital 16 bit resolution e Digital inputs DO_d0 D0_d7 0 5 V digital 8 lines e Encoder inputs EO E1 0 5 V digital 16 bit resolution e Frequency outputs FO F1 0 5 V digital 16 bit resolution e Analog outputs BO B1 0 5 V analog 12 bit resolution e Digital outputs G0_g0 G0_g7 0 5 V digital 8 lines e Pulse outputs HO H1 0 5 V digital 16 bit resolution e Filtered pulse outputs LO L1 0 5 V analog e H bridge outputs PO P1 0 supply voltage V digital 5 A e Voltage regulator output VDD 5 V 0 25 A regulated power supply e Ground GND 0 V e Sampling rate up to 3 8 kHz 1 2 Requirements e PC with Windows XP or later and an available seri
28. n all pulse width modulators 3 11 Filtered Pulse Outputs The board contains 2 lowpass filters to filter the pulse outputs The filter outputs LO L1 are 0 5 V range analog signals and can be used as alternatives to the digital to analog converter outputs Each filter used is a simple first order RC lowpass filter with the cutoff frequency 159 1549 Hz Suppose a signal v is connected to the input of the Pulse Output Block in a Simulink model as shown in Figure When the maximum frequency of the signal v is less than the cutoff frequency of the lowpass filter and the cutoff frequency of the lowpass filter is much less than the fundamental frequency of the pulse output the output of the lowpass filter is related to the duty cycle of its input as x 05 22 Thus the signal x is related to the signal v through 5 UD sra v 0O lt vu lt 5D 23 0 v lt 0 with normal conversion mode and the signal x is related to the signal v through 5 v gt 5 ra 4 v 2 5 2 5 lt v lt 5 24 0 v lt 5 with shifted conversion mode Matlab Simulink RTCB frequency f duty cycle 6 gt me gt HO US LO 10k 100 n Figure 33 Lowpass filter output usage 25 Negative voltage levels can be obtained using the level converter shown in Figure The output of the level converter is related to its input as 5 LAO z 2x2 5 O lt zx lt 5 25 5 x lt 0 and it is related to the duty cycle
29. n the scope As the value of the slider gain increases from 0 5 to 1 5 the output of the math function becomes more and more distorted Click on Stop real time code button m to stop the model K test4 Fie Edit view Simulation Format Tools Help D HS 5B gt 7 Sine Wave Slider Math Gain Function 100 to oscilloscope RTCB ony tl 10 Hz 0 368 2 7183 V complex periodic wave Figure 39 Setup for test4 mdl 4 4 Switching Voltage Regulator The purpose of this example is to illustrate some basic features of the HILINK platform with a simple closed loop system A switch mode power supply with 3 V regulated output is realized using one leg of the one of the H bridges The output voltage is monitored and the duty cycle of the pulse output is varied accordingly to regulate the output voltage 1 Open the Simulink model test5 mdl and setup the board as shown in Figure with the external connections Enter gt T 1 2048 as the sampling time and gt S inf as the stop time at the Matlab Command Window Build the model by clicking on Tools Real Time Workshop Build Model or by pressing Ctrl B 33 4 Click on Connect to target button to connect the board to the model and then click on Start real time code button gt to run the model 5 Vary the supply voltage of the board between 7 V and 12 V and observe the regulated output voltage on the sc
30. of the board is shown in Figure 1 where A0 A7 are the analog inputs BO B1 are the analog outputs CO C1 are the capture inputs D0 d0 D0_d7 are the digital inputs E0 El are the encoder inputs FO F1 are the frequency outputs GO_g0 G0_g7 are the digital outputs and HO H1 are the pulse outputs ADC represents the analog to digital converter DAC represents the digital to analog converter ICM represents the input capture module OCM represents the output compare module DIP represents the digital input port DOP represents the digital output port QEM represents the quadrature encoder module and PWM represents the pulse width modulator FLs are the lowpass filters with outputs LO L1 and HBs are the H bridges with outputs PO P1 and uC is the central microcontroller UART is the universal asynchronous receiver transmitter unit and PC is the host computer PC AO UART a ADC DAC Pa AT FL 10 co al FO C ICM OCM F1 FL L1 uC D0 d0 gt G0_g0 gt DIP Le pop HB gt P0 D0d7 El G0_g7 HB P1 E0 L HO El QEM PWM a Figure 1 Functional block diagram of the board The layout of the board is shown in Figure 2 The inputs and outputs are connected to the board through standard pin header type connectors The pins of all connectors are clearly indicated on the board for convenience Ac
31. of the lowpass filter input as zr 20 1 5 26 Thus the signal z is related to the signal v through 5 v gt 5 ZR 2vu 5 O lt u lt 45 27 5 v lt 0 with normal conversion mode and the signal z is related to the signal v through 5 v gt 5 z7 v 5 lt v lt 5 28 5 v lt 5 with shifted conversion mode 10 k VW 5 V O 10 k 5 VO N oz LO e O ee x O 5 V Figure 34 Lowpass filter output usage The distortion contributed from the fundamental component on the output of the lowpass filter is 4 r5 4 1 10 x 103100 x 10 927 f 20 7 y 1 0 0027 f V and on the output of the level converter is 4 710 1 10 x 103100 x 10 927 f 40 7 y 1 0 0027 f V These errors are negligibly small in most practical applications if a sufficiently high fundamental frequency is used This kind of distortion is inherent in all pulse width modulator type digital to analog converters 3 12 H bridge Outputs The board contains 2 H bridges to boost the pulse outputs The H bridge outputs PO P1 are 0 Vs V range pulse width modulated power signals where Vg is the power supply voltage If the loads of the 26 H bridges are sufficiently lowpass filtering these outputs can be used as alternatives to linear amplifiers applied to the digital to analog converter outputs Suppose a signal v is connected to the input of the Pulse Output Block in a Simulink model as shown in Figure The l
32. og Input Block This block connects selected analog input channel from the real time control board to the Simulink model The block parameters are as shown in Figure Sample time is the sample time of the block Com port is the serial communication port number Analog input channel is the specific analog input channel selectable among A0 A7 Unipolar bipolar is the conversion mode of the selected analog input channel Source Block Parameters AO Analog Input mask Analog input Parameters Sample time T Com port 1 Analog input channel 40 Unipolar bipolar unipolar Figure 15 Analog Input Block parameters Suppose an analog signal u is connected to the analog input AO of the real time control board and the Analog Input Block is used in a Simulink model as shown in Figure 16 The value of the input signal u is converted to its digital representation by the analog to digital converter and sent to Matlab Simulink 12 to form the output signal v The signal v is related to the signal u through 9 Ud v 4 u 0 lt uc lt 5 1 0 u lt O0 with unipolar conversion mode and the signal v is related to the signal u through 5 u gt 5 UR 2u 5 0O lt uc lt o 2 5 u lt 0O with bipolar conversion mode RTCB Matlab Simulink Figure 16 Analog Input Block usage Negative voltage levels should not be directly applied to the analog input channels The simple level conv
33. ope 6 As the supply voltage increases the duty cycle of voltage applied to the external circuit decreases to regulate the output voltage 7 Click on Stop real time code button m to stop the model tests File Edit view Simulation Format Tools Help O As ts BESO Integrator 100 10 kQ 1 mH gt t A0 PO_A gt 20007 1000 F 100 Figure 40 Setup for testS mdl 4 5 General Guidelines The HILINK real time control platform has a broad range of inputs and outputs for implementing hardware in the loop real time control systems using the graphical interface of Matlab Simulink Its seamless interface between physical plants and Matlab Simulink makes the HILINK platform ideal for implementation of such systems in both educational and industrial applications The following general guidelines should be observed for an effective use of the HILINK platform 34 Refer to the above examples for setting up the configuration parameters under Simulation gt Simulation Configuration for your model Refer to Matlab help files for setting up the configuration parameters under Tools External Mode Control Panel for your model Refer to Real Time Windows Target help files for setting up the Scope parameters for external data collection Confine all your project files to the HILINK installation directory and make sure that the current directory of Matla
34. owpass equivalent of the voltage across the H bridge load Z is related to the duty cycle of its input as x 26 1 Vs 29 Thus the lowpass equivalent of the signal x is related to the signal v through Vs v gt Vs DAN 2v Vs 0 lt u lt Vs 30 Vsz v lt 0 with normal conversion mode and the lowpass equivalent of the signal x is related to the signal v through Vs v gt V5 TSL v Vs lt v lt Vs 31 Vs v lt Vs with shifted conversion mode Matlab Simulink RTCB P0_A O v HO gt gt Zz P0_B_ o duty cycle 6 Figure 35 H bridge output usage The distortion contributed from the first and higher order harmonics of the switching waveform on the output of the H bridge is negligibly small in most practical applications if the load is sufficiently lowpass filtering This kind of distortion is inherent in all switching amplifiers 3 13 Sampling Rate With the HILINK platform it is possible to implement hardware in the loop real time control systems with sampling rates up to 3 8 kHz The actual value of the maximum sampling rate depends on the number of input and output channels used as well as the performance of the host computer The maximum achievable sampling rate can be determined using _ 11520 2max ni no 1 f 32 27 where n lt 8 is the number of input channels used and no lt 8 is the number of output channels used
35. ss interface between the board hardware and Matlab This software enables Matlab Simulink Real Time Windows Target to communicate with the control board in real time The software is tightly integrated into Matlab Simulink and comes with Simulink blocks associated with each hardware input and output 3 1 Installation The software comes with an installer for an easy installation process The software requires a PC running Windows XP or later and Matlab R2007b or later with Simulink Real Time Workshop and Real Time Windows Target To install the software double click on hilink exe that comes with the platform and follow the on screen instructions 3 2 Block Library The real time control board comes with library blocks fully integrated into Matlab Simulink Real Time Windows Target The library contains 4 input and 4 output blocks namely Analog Input Block Capture Input Block Digital Input Block Encoder Input Block Analog Output Block Frequency Output Block Digital Output Block and Pulse Output Block A snapshot of the block library is shown in Figure Library hilink SEE File Edit view Dees a e gt l eli eE 100 Locked Figure 14 HILINK block library The main function of each block is summarized in Table and each individual block is described in detail below All inputs and outputs of these blocks are in SI units for convenience 11 Table 1 HILINK blocks functions 3 3 Anal
36. ter on the scope 31 6 When the frequency of the square wave is 20 Hz the output of the transfer function block on the scope is a sinusoidal wave 7 Click on Stop real time code button m to stop the model 7 test3 File Edit view Simulation Format Tools Help D cas r Banla s T E gt Y fs External j AE denis Transfer Fen 100 from signal generator 10 30 Hz 0 4 V T A0 p tcp square wave Figure 38 Setup for test3 mdl 4 3 Generating a Nonstandard Wave The purpose of this example is to illustrate some basic features of the HILINK platform with a simple open loop system A nonstandard periodic wave is generated by passing a sinusoidal wave with variable amplitude through an exponential nonlinearity This example also illustrates the use of a slider gain and scope in a model 1 Open the Simulink model test4 mdl and setup the board as shown in Figure with the external connection 2 Enter gt T 1 2048 as the sampling time and gt gt S inf as the stop time at the Matlab Command Window 3 Build the model by clicking on Tools Real Time Workshop Build Model or by pressing Ctrl B 4 Click on Connect to target button to connect the board to the model and then click on Start real time code button gt to run the model 32 Vary the value of the slider gain between 0 5 and 1 5 and observe the output of the board on the oscilloscope and o
37. the negative ground terminal of the power supply GND VPS Figure 3 Power supply connector CONO 2 3 Analog Inputs The board has 8 analog input channels AO A7 Each analog input must be within 0 5 V range analog signal The connector CON1 provides access to each analog input channel For convenience GND and VDD are also provided with each channel The pinout of CON1 is shown in Figure e e A0 D0_d0 G0_g0 e e Al D0_d1 G0_g1 e A2 D0_d2 G0_ 2 e A3 D0_d3 G0_ 3 e A4 D0_d4 G0_ 4 e A5 D0_d5 G0 g5 AG D0_d6 G0_g6 e A7 D0_d7 G0_ 7 GND VDD Figure 4 Analog inputs connector CON1 The value of each analog input is converted to its digital representation by the analog to digital converter The sampling frequency of the analog to digital converter is 117 92 x 10 4096 28 7891 kHz The resolution of the analog to digital converter is 12 bit The analog inputs are multiplexed with the corresponding digital inputs and digital outputs The analog inputs have precedence over the digital inputs and digital outputs 2 4 Capture Inputs The board has 2 capture input channels CO C1 Each capture input must be within 0 5 V range digital signal The connector CON2 provides access to each capture input channel For convenience GND is also provided with each channel The pinout of CON2 is shown in Figure The period of each capture input is converted to its digital representation by the input

Download Pdf Manuals

image

Related Search

Related Contents

品名 YS-K7ー2C・K 住宅用火災・ガス・C。警報器  GIMP 2.2 Benutzerhandbuch  取扱説明書(10.9 MB)  Sunbeam Bedding SFH107-SFH108UM User's Manual  Se protéger des champs électromagnétiques  Nachtrag für Zeus Touch Software  

Copyright © All rights reserved.
Failed to retrieve file