/* Copyright 2002 The MathWorks, Inc. */ /* $Revision: 1.2.4.1 $ */ /* * * --- THIS FILE GENERATED BY S-FUNCTION BUILDER: 2.0 --- * * This file is a wrapper S-function produced by the S-Function * Builder which only recognizes certain fields. Changes made * outside these fields will be lost the next time the block is * used to load, edit, and resave this file. This file will be overwritten * by the S-function Builder block. If you want to edit this file by hand, * you must change it only in the area defined as: * * %%%-SFUNWIZ_wrapper_XXXXX_Changes_BEGIN * Your Changes go here * %%%-SFUNWIZ_wrapper_XXXXXX_Changes_END * * For better compatibility with the Real-Time Workshop, the * "wrapper" S-function technique is used. This is discussed * in the Real-Time Workshop User's Manual in the Chapter titled, * "Wrapper S-functions". * * Created: Thu May 9 15:57:55 2002 */ /* * Include Files * */ #include "tmwtypes.h" /* %%%-SFUNWIZ_wrapper_includes_Changes_BEGIN --- EDIT HERE TO _END */ #include /* %%%-SFUNWIZ_wrapper_includes_Changes_END --- EDIT HERE TO _BEGIN */ #define u_width 3 #define y_width 3 /* * Create external references here. * */ /* %%%-SFUNWIZ_wrapper_externs_Changes_BEGIN --- EDIT HERE TO _END */ /* extern double func(double a); */ /* %%%-SFUNWIZ_wrapper_externs_Changes_END --- EDIT HERE TO _BEGIN */ /* * Output functions * */ void euler2dc_Outputs_wrapper(const real32_T *worke, real32_T *dircos) { /* %%%-SFUNWIZ_wrapper_Outputs_Changes_BEGIN --- EDIT HERE TO _END */ /* * Euler angles to direction cosine matrix conversion * * Given phi, theta, psi in an array, calculate the * 3x3 direction cosine matrix: * * | cos(psi)*cos(theta), sin(psi)*cos(theta), -sin(theta) | * | cos(psi)*sin(theta)*sin(phi)-sin(psi)*cos(phi), | * | sin(psi)*sin(theta)*sin(phi)+cos(psi)*cos(phi), | * | cos(theta)*sin(phi) | * | cos(psi)*sin(theta)*cos(phi)+sin(psi)*sin(phi), | * | sin(psi)*sin(theta)*cos(phi)-cos(psi)*sin(phi), | * | cos(theta)*cos(phi) | * */ float sphi = (float) sin(*worke ); float cphi = (float) cos(*worke++ ); float stht = (float) sin(*worke ); float ctht = (float) cos(*worke++ ); float spsi = (float) sin(*worke ); float cpsi = (float) cos(*worke ); /* * Walk down the column-major 3x3 * matrix and put in the results * specified in the comment above. */ *dircos++ = cpsi*ctht; /* 1,1 done */ *dircos = cpsi*stht; *(dircos+1) = *dircos; *dircos *= sphi; *dircos++ -= spsi*cphi; /* 2,1 done */ *dircos *= cphi; *dircos++ += spsi*sphi; /* 3,1 done */ *dircos++ = spsi*ctht; /* 1,2 done */ *dircos = spsi*stht; *(dircos+1) = *dircos; *dircos *= sphi; *dircos++ += cpsi*cphi; /* 2,2 done */ *dircos *= cphi; *dircos++ -= cpsi*sphi; /* 3,2 done */ *dircos++ = -stht; /* 1,3 done */ *dircos++ = ctht*sphi; /* 2,3 done */ *dircos = ctht*cphi; /* 3,3 done */ /* %%%-SFUNWIZ_wrapper_Outputs_Changes_END --- EDIT HERE TO _BEGIN */ } /* * Updates function * */ void euler2dc_Update_wrapper(const real32_T *worke, const real32_T *dircos ) { /* %%%-SFUNWIZ_wrapper_Update_Changes_BEGIN --- EDIT HERE TO _END */ /* %%%-SFUNWIZ_wrapper_Update_Changes_END --- EDIT HERE TO _BEGIN */ } /* * Derivatives function * */ void euler2dc_Derivatives_wrapper(const real32_T *worke, const real32_T *dircos, real_T *dx ) { /* %%%-SFUNWIZ_wrapper_Derivatives_Changes_BEGIN --- EDIT HERE TO _END */ /* %%%-SFUNWIZ_wrapper_Derivatives_Changes_END --- EDIT HERE TO _BEGIN */ }