13.07.2015 Views

An Integrated, Modular Simulation System for Education ... - Cal Poly

An Integrated, Modular Simulation System for Education ... - Cal Poly

An Integrated, Modular Simulation System for Education ... - Cal Poly

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Standard Atmosphere Simulink S-function/* S-function std_atms** File : std_atms.c** This C-file S-function estimates the values <strong>for</strong> temperature, pressure,* speed of sound, and density from sea level to 35.0 km. Original* function written as a AERO 215 assignment.** Inputs: Geometric altitude in meters.* Sea level pressure: std = P0=1.013 X 10^5 Nm^2* Temperature at Sea level: std = T0=288 K** Outputs: rho* speed of sound* temperature* pressure** Douglas Hiranaka* <strong>Cal</strong> <strong>Poly</strong> San Luis Obispo* San Luis Obispo, CA** See simulink/src/sfuntmpl.doc** Copyright (c) 1990-1998 by The MathWorks, Inc. All Rights Reserved.* $Revision: 1.3 $* Created 1/28/95 Fortran code* Last Modified: 1/4/99 DH converted to c, added hard constant* values at the transitions and converted function to S-function.*/#define S_FUNCTION_NAME std_atms#define S_FUNCTION_LEVEL 2#include #include #include "simstruc.h"/*========================================================================** Number of S-function parameters and macros to access from the simstruct **========================================================================*/#define NUM_PARAMS (2)#define SEA_LEVEL_TEMPERATURE_PARAM (ssGetSFcnParam(S,0))#define SEA_LEVEL_PRESSURE_PARAM (ssGetSFcnParam(S,1))/*==================================================** Macro to access the S-function parameter values **==================================================*/#define BASE_PRESS ((real_T) mxGetPr(SEA_LEVEL_PRESSURE_PARAM)[0])#define BASE_TEMP ((real_T) mxGetPr(SEA_LEVEL_TEMPERATURE_PARAM)[0])#define LapseRate1 -0.006489#define LapseRate2 0.003#define Y 1.4#define R 287.05156

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!