Professional Documents
Culture Documents
I. INTRODUCTION
Abstract
This work was supported by the European Commission within the FP7
project Efficient Systems and Propulsion for Small Aircraft ESPOSA,
contract No. ACP1-GA- 2011-284859-ESPOSA.
J. Vejlupek is a PhD candidate at the Brno University of Technology
Faculty of Mechanical Engineering. His current research focuses on Hardware
in the Loop simulation, Rapid Control Prototyping and Rapid Code
Generation for embedded applications. (e-mail: vejlupek@fme.vutbr.cz)
M. Jasansk is with the UNIS, a.s. company, Division of Aerospace and
Advanced Control. (e-mail: mjasansky@unis.cz)
V. Lambersk is a PhD candidate at the Brno University of Technology
Faculty of Mechanical Engineering. His current research focuses on Rapid
Code Generation for embedded applications.
R. Grepl is a Associate Professor at the Brno University of Technology
Faculty of Mechanical Engineering.
ISBN: 978-1-61804-231-6
52
III. SW IMPLEMENTATION
Software for the 32-bit PIC microcontroller is created using
the Rapid-Control-Prototyping and Rapid-Code-Generation
techniques enabled by MATLAB-Simulink Embedded Coder
together with Kerhuel Toolbox. This set of tools allows us to
generate the C code (including microcontroller setup and
peripheral handling) for the microcontroller directly from
MATLAB Simulink. This is very convenient way especially
for the development phase, when the model of the engine is
being often modified during the development phase.
Nevertheless, some functionality had to be coded manually in
C code, as the Kerhuel Toolbox does not enable all the
functionality needed.
This section describes the requirements in more technical
details and explains how they have been implemented and
fulfilled.
A. System settings
The core of the EVA_PIC32 board is a 32-bit PIC
microcontroller pic32mx320f128h clocked with external
10MHz crystal and scaled up to 80MIPS. Main execution loop
time step is set to 0.01s (100Hz), all the functions (if enabled)
are executed at this rate. Actual functionality is determined by
the state-machine implemented using Stateflow (MATLAB
Simulink Blockset). State machine is in detail described
bellow in section D. Overall system performance is
summarized in section E.
length of the data (0-8), and the CAN ID is added before the
actual message. As the CAN ID could range from 0 to 2031
(11-bit identifier), it has to be represented by two bytes:
CAN_ID High, and CAN_ID Low. Furthermore the CAN_ID
is aligned by bit-shift by 5 bits to the left, before it is split.
This is due to convention used by the third-party UART-toCAN converter which is used inside the TPR_CPSP_SIM
simulator.
D3
D4
Service
Code
Message
Code
211
102
150
HEX
04
FA
00
D3
00
66
96
UART
48 52 70
65
Node ID
250
CAN_ID
Low
CAN_ID
High
DEC
48 48 68 51 48 48 54 54 57 54
termination character
D1
Data
Type
Data length
CAN_ID = 2000
13
54
e f = t ps T f 100 (1)
0.1
0.08
max x64 error
max x8 error
max x1 error
0.08% limit
0.04
0.02
1000
4000
3000
2000
frequency [Hz]
5000
6000
determines the output of the jet engine, and it is the only input
to the TP100 / TS100 simulator model.
D. System modes of operation
As mentioned before, there are two modes of operation:
tester mode, and simulator mode. Beside this, some other
events need to be considered, such as STOP button and
1
32-bit timer is not available, due to the fact that for OC and IC
peripherals are available only two 16-bit timers: T2 and T3. These would be
ISBN: 978-1-61804-231-6
(2)
0.06
(1)
both consumed to form one 32-bit timer, but T3 is used for OC3, which
provides the control signal for ESC.
55
request for the R17, which stores the settings of the collective.
Model runs continuously as long as the fuel valve is open,
or until the STOP button is pressed, or the mode of operation
is changed (tester / simulator modes). When the model
execution is stopped, the model is disabled and all the outputs
are set to default values. After that the state machine switches
to the default state and waits for the next run.
E. System performance
To measure the system performance in the terms of the
microcontroller load, busy flag method is used: At the
beginning of each computational step selected digital output
pin is set high, and after all the functions have been handled, it
is set low. This will give us 100Hz square wave signal (with
0.01s time step), where the duty cycle represents the actual
work load of the microcontroller. However, this method does
not consider all the interrupt routines, but they are considered
to have a minor effect on the result. More significant than the
interrupt routines is the serial communication.
Measured workloads:
Tester mode:
8%
TS100 simulator mode:
30 %
TP100 simulator mode:
28 %
Code was compiled using Microchip C30 compiler;
following are the memory usage statistics:
RAM used:
6254 bytes
(38%)
Flash used:
70500 bytes (49%)
IV. CONCLUSION
Software for the EVA_PIC32 board described in this paper
was created as a cooperative project between University of
technology Brno and UNIS company. Results are used by
UNIS and their customer (PBS) during the unit manufacturing
and assembly process of the ECUs and the Tx100 engines.
Presented work describes how the methods of Rapid-CodeGeneration were used in the development process of the HIL
simulator subsystem. It shows, that not all of the required
functionality could be created using RCG methods (i.e.:
interrupt routines). However RCG is still a substantial asset as
it enables very clear arrangement of the source code in the
MATLAB Simulink, ease of implementation of the changes,
and also ease of implementation of the algorithms created in
MATLAB Simulink. Some of the unimplemented features
could be taken as an inspiration for developers as an idea on
what to improve.
REFERENCES
[1]
[2]
[3]
56
[4]
[5]
[6]
[7]
[8]
[9]
Bin Lu, Xin Wu, Figueroa H., Monti A., "A Low-Cost Real-Time
Hardware-in-the-Loop Testing Approach of Power Electronics
Controls," Industrial Electronics, IEEE Transactions on , vol.54, no.2,
pp.919,931, April 2007
National Instruments NI Power Electronics RCP and HIL System
http://sine.ni.com/nips/cds/view/p/lang/cs/nid/211217
dSPACE
HIL
Simulation
Systems
http://www.dspace.com/en/pub/home/products/systems/ecutest.cfm
Grepl R., Real-Time Control Prototyping in MATLAB/Simulink:
review of tools for research and education in mechatronics, IEEE
International Conference on Mechatronics (ICM 2011-13-15 April,
2011, Istanbul), 2011
Lambersk V., Grepl R. Benchmarking Various Rapid Control
Prototyping Targets Supported in Matlab/Simulink Development
Environment, 10th International Conference Mechatronics, (September,
2013, Brno) 2013
CANaerospace - the Airborne CAN Interface Standard
http://www.stockflightsystems.com/canaerospace.html
ISBN: 978-1-61804-231-6
57