Presentation is loading. Please wait.

Presentation is loading. Please wait.

Integration of OCP and SIMULINK

Similar presentations


Presentation on theme: "Integration of OCP and SIMULINK"— Presentation transcript:

1 Integration of OCP and SIMULINK
7-8 August 2001 Gary Balas Raktim Bhattacharya, Praveen Vijayaraghavan, Yohannes Ketema Aerospace Engineering and Mechanics University of Minnesota Andrew Packard Alpay Kaya, Zachary Jarvis-Wloszek, Mechanical Engineering UC Berkeley

2 F-16 Flight Control with OCP
Creating OCP components Version 1.0 Using SIM2OCP to create F-16 flight control components Suggestion for added OCP functionality Basic idea Advantages/Disadvantages Scope for improvement

3 Creating OCP Components: (Version 1.0)

4 Creating OCP Components (Version 1.0)
Version 1.0 came with SIM2OCP tool Converts SIMULINK skeleton models to OCP components Easy to design OCP component skeletons Source code generated takes care of I/O interface Internal behavior still needs to be hand coded Code generates Visual C++ project file Very easy to build component data base library Generates C++ objects for signals and their I/O Also generates ProcessP1Main.cpp,…, ProcessPnMain.cpp Unclear how to link ProcessPnMain.cpp with main OCP component code

5 Creating OCP Components (Version 1.0: contd)
SIMULINK process drives the simulation System synchronization is maintained by SIMULINK SIMULINK streams out control signal Gateway to OCP process is a SIMULINK mex file OCP component generates system derivative Inter-process communication handled by OCP signal manager Y(t) : To Integrator OCP Component in C++ F-16 Model I/O through OCP signal manager MATLAB/SIMULINK Flight Controller U(t) : From Controller

6 Creating OCP Components (Version 1.0: contd)
OCP Component in C++ F-16 Model I/O through OCP signal manager Outer loop controller LPV longitudinal axis Vc , , p HTC Way-point Generator y x Integrator Sensor switch Classical lateral axis Joystick Inner loop controller Flight controller implemented in MATLAB/SIMULINK

7 Creating OCP Components (Version 1.0: contd)
Currently SIMULINK synchronizes OCP components OCP components still restricted to pure C++ code Systems designed in SIMULINK require conversion to C++ By hand MATLAB code generator Server 3 Server 1

8 Using SIM2OCP to create F-16 flight control components …

9 Using SIM2OCP to create F-16 flight control components …
Create SIMULINK diagram for signal flow

10 Creating OCP components (contd.)
Start SIM2OCP …

11 Creating OCP components (contd.)
Create vector signals and define their elements …

12 Creating OCP components (contd.)
F16_States: signal of width 16

13 Creating OCP components (contd.)
Connect components using signals created ….

14 Creating OCP components (contd.)
Decompose SIMULINK subsystems into OCP processes …

15 Creating OCP components (contd.)
Create software configuration states …

16 Creating OCP components (contd.)
Click on Finish to generate ComponentInfo.txt

17 Creating OCP components (contd.)
Generate code using perl genocp.pl ComponentInfo.txt Didn’t work the first time, had to call Brian.

18 Creating OCP components (contd.)
Code generator generates Visual C++ project file / GNU makefile Code compiles without any problem Library ComponentDatabase_Debug.lib is created Code generator also generates main process code ProcessP1Main.cpp – F-16 Model ProcessP2Main.cpp – LPV Controller ProcessP3Main.cpp – Sensor Model Unresolved Issues … No information on how to compile ProcessP1Main.cpp, etc. Brian had to create Visual C++ project files for each of the processes Files had to be moved from one directory to another manually Path problems related to location of libraries and header files hampers auto-code generation of VC++ project files.

19 Creating OCP components (contd.)
Unresolved Issues cont’d … How is the controller scheduled? How does the controller interact with other component in terms of time slices? Is the controller responsible for all its static/dynamic memory management, state information, etc? I.e. Can the controller request 100 GB of address space independently? Methods for testing the timing/memory footprint of the individual components? Bottom line … a lot has been done … though more work is needed to bring OCP within reach of control engineers

20 Suggestion for added OCP functionality

21 Suggestion for added OCP functionality
Alternative approach to Component creation …

22 Suggestion for added OCP functionality
Basically the same idea as SIMULINK, graph representing connections, algebraic relationships 1 2 3 4 5 1 2 3 4 5 get_param(…,…) can extract blocks and connectivity

23 Suggestion for added OCP functionality
Component #3 Component #1 Component #2 MATLAB Engine MATLAB Engine MATLAB Engine Sequence defined by SIMULINK OCP Data transfer through DDE/ActiveX/Pipes Simulation Manager Scheduling graph and relationships MATLAB Engine MATLAB Engine Component #4 Component #5

24 Suggestion for added OCP functionality
Library of C++ objects for systems in F-16 flight control example Easy to create OCP components from these objects The following C++ objects are available F-16 Model 12 state full nonlinear High and Low fidelity aerodynamic data Linear System Class Linear Parameter Varying System Class First Order Actuator Class Numerical Integration Class Runge-Kutta fourth order

25 Suggestion for added OCP functionality
Alternative approach to MATLAB/OCP interaction Design sub-systems in SIMULINK Use MATLAB engine from C++ code to access SIMULINK ActiveX, Dynamic Data Exchange (Windows) Inter-process Communication based on pipes (Unix) MATLAB is accessed as a function call (currently a MATLAB process needs to be running) The synchronization that is currently being done by SIMULINK would then need to be done by the OCP OCP responsibility would be similar to the Giotto scheduler (UC Berkeley). Problem is Giotto is time triggered.

26 Suggestion for added OCP functionality
Advantages: Easy to generalize OCP components Internal code can be MATLAB based. Full block support of SIMULINK can be utilized. Differs from RTW by taking advantage of full functionality of SIMULINK, perhaps at the expense of computation speed. Sub-system can be designed in SIMULINK More accessible to control practitioners OCP implementation details are totally transparent Less prone to programming errors Disadvantage: 10 times slower than equivalent C code Alternative : Use RTW

27 Scope for improvement of OCP

28 OCP Version 1.0 : Scope for improvement
Easy to run examples Less CS flavored examples C++ language and template requires understanding of object oriented design. Make computer science background not essential More interaction between control engineers using OCP and Boeing OCP developers. Better commented examples More comments in the code to explain the inner workings


Download ppt "Integration of OCP and SIMULINK"

Similar presentations


Ads by Google