Dienstag, 8. März 2011

what is an S Function ?

- S-functions are compiled as MEX-files.
- MEX-files are dynamically linked into MATLAB when needed.
- S-functions can be used with the Real-Time Workshop.
- S Function can be implemented as either an M-file or a MEX file.
  • M-file S-Function  
  • MEX-File S-Function 
- S-Function Concept:
  • Direct feedthrough :  
  • Dynamically sized inputs 
  • Setting sample times and offset
- >>sfundemos
-  S-Funktion (system function) ist die Beschreibung eines Simulink-Blockes in Matlab oder Maschinen-Code, wobei der Maschinen-Code aus C erzeugt werden kann und in Form eines MEX-Files vorliegen muss.
- Die Einbindung in Simulink-Prozesse erfordert auf Seiten der S-Funktionen eine spezielle Syntax.

http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/c2f37a6ab13c11db


http://alpha.fh-friedberg.de/iem/fileadmin/user_upload/kampschulte/ms1/ms1_VL11_Grafikanimation.pdf

http://www.esat.kuleuven.be/psi/spraak/courses/esatexpress/download/sfunctions.pdf

http://www.chem.mtu.edu/~tbco/cm416/MatlabTutorialPart5.pdf

PSOC 5

PSOC 5
CY8C5588AXI-102
ARM Cortex M3
80 MHZ
128 KB
32 KB
62
100
http://www.cypress.com/?id=2233

Sonntag, 27. Februar 2011

Global to Local Coordinate Transformation Matrix

T = trans_matrix_beam3d(x0,y0,z0,x1,y1,z1,alpha)
Die Funktion berechnet den Global to Local koordinieren Transformationsmatrix.

Samstag, 26. Februar 2011

outrigger based rollover controller

Matlab & Coordinate Systems

coordinate transformation module

vehicle local coordinate system
kinematic unicycle state Model
[xi yi θi] Cartesian coordinate system
[vi ωi]  the states of linear velocity and the angular velocity

the model equations from the global coordinates to the local coordinates
The Global Coordinates and Local Coordinates for Cyclic Pursuit Strategy
coordinate transformation module --> an Embedded MATLAB function
http://marhes.ece.unm.edu/index.php/Ysong:Project514#Introduction

Implementation of coordinate transformation with rotation around multiple axes
http://alexandria.tue.nl/repository/books/626941.pdf


 Autonomous Vehicle Based on Simulink
http://www.springerlink.com/content/17817601t7836742/fulltext.pdf

Global and Local Coordinate Systems
Cartesian (X, Y, Z components)
Cylindrical (R, θ, Z components)
Spherical (R, θ, φ components)
Cylindrical (R, θ, Y components)
http://www.kxcad.net/ansys/ANSYS/ansyshelp/Hlp_G_MOD3_2.html

Global to Local Coordinate Transformation Matrix

http://www.mathworks.com/matlabcentral/fileexchange/9586-global-to-local-coordinate-transformation-matrix
modeling the vehicle environment


Road model
Test Track Design
Environment Model
global coordinate system of the environment
local coordinate system of the test track
transformation should be made to convert from one coordinate system to another.
Road model
1. coordinate transformation
2. transformation road properties
the global (x,y,z) and local (s,t) coordinate

Environment  module block diagram
1. Road: Vertical Profile ,Horizontal Profile ,Transformation
2. scenario:
3. Traffic Participants

Transformation between the 2 coordinates (local road coordinate (s,t) ,global coordinates(x,y))
Modeling the test track profile
- Matlab M-functions
- Simulink basic components
- Automatically generated S-functions
- Manually written S-function
We found that the automatically generated S-function is the most suitable method because of its low
execution time.

Building S-Functions Automatically
S-Function Builder is a Simulink block that builds an S-function
open_system('sfcndemo_mixedm.mdl');
edit(fullfile(matlabroot,'simulink','src','mixedm.c'))

http://metalab.uniten.edu.my/~farrukh/mywork/s_fun1.pdf 
How the S-Function Builder Builds an S-Function

Freitag, 25. Februar 2011

Converting .mat file to .xml file

Convert MAT file to XML file (.mat file contains a hierarchical structure).
The XML Toolbox converts MATLAB data structures of any level of nesting into an XML string.
xml_format()
xml_formatany()
xml_parse()
xml_parseany()
xml_load()
xml_save()

- converting .xml files to .mat files?
- How to convert XML data
- What Is an S-Function?
- S-function (system-function) , S-functions are compiled as MEX files using the mex utility

- When to Use an S-Function
- Creating new general purpose blocks
- Describing a system as a set of mathematical equations

Donnerstag, 24. Februar 2011

S-Function

The S-function demo library opens:
open_system([matlabroot,'/toolbox/simulink/simdemos/simfeatures/sfundemos.mdl']);

MATLAB S-Function Example:
1. Implement an S-function with an inherited sample time:
edit('msfcn_dsc.m');open_system('msfcndemo_sfundsc1.mdl');

2. Implement a continuous limited integrator where the output is bounded by lower and upper bounds and includes initial conditions.
edit('msfcn_limintm.m');open_system('msfcndemo_limintm.mdl');

3. Implement a multirate system
edit('msfcn_multirate.m');open_system('msfcndemo_multirate.mdl');

4. Implement an S-function that doubles its input
edit('msfcn_times_two.m');open_system('msfcndemo_timestwo.mdl');

5. Implement a unit delay
edit('msfcn_unit_delay.m');open_system('msfcndemo_sfundsc2.mdl');

6. Implement a variable pulse width generator by calling set_param from within a Level-2 MATLAB S-function. Also demonstrates how to use custom set and get methods for the block SimState.
edit('msfcn_varpulse.m');open_system('msfcndemo_varpulse.mdl');  

7. Implement a variable sample time block in which the first input is delayed by an amount of time determined by the second input.
edit('msfcn_vs.m');open_system('msfcndemo_vsfunc.mdl');  



 






Using S-function blocks in Simulink
http://www.chem.mtu.edu/~tbco/cm416/MatlabTutorialPart5.pdf