CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
SDSA_PARAMS Class Reference

Parameters file for SDSA program to run SDSA in batch mode. More...

#include <sdsa_params.h>

Inheritance diagram for SDSA_PARAMS:
IOFUN

Public Member Functions

void Clean ()
 cleans local variables
 
int Read (char *ParFile)
 reads parameters file
 
int Write (char *ParFile)
 writes parameters file
 

Public Attributes

double dH0
 lower bound of hight of flight taken into the analysis
 
double dH1
 upper bound of hight of flight taken into the analysis
 
double dDH
 step of hight of flight taken into the analysis
 
double dV0
 lower bound of airspeed taken into the analysis
 
double dV1
 upper bound of airspeed taken into the analysis
 
double dDV
 step of airspeed taken into the analysis
 
double dDA
 aileron deflection [deg] (for roll response characteristics, must be grater than 0)
 
int iSpeedType
 airspeed type (0-TAS, 1-CAS)
 
int iAero
 number of aerodynamic data (1/2)
 
int iLQR
 LQR flag (0-1)
 
int iPilot_h
 pilot in the loop in elevator channel - flag (0-1)
 
int iPilot_a
 pilot in the loop in aileron channel - flag (0-1)
 
int iPilot_r
 pilot in the loop in rudder channel - flag (0-1)
 
int iSAS_h
 SAS in elevator channel - flag (0-1)
 
int iSAS_a
 SAS in aileron channel - flag (0-1)
 
int iSAS_r
 SAS in rudder channel - flag (0-1)

 
int iAct_h
 Actuator model in elevator channel - flag (0-1)
 
int iAct_a
 Actuator model in aileron channel - flag (0-1)
 
int iAct_r
 Actuator model in rudder channel - flag (0-1)

 
char OutFile [256]
 pathname of output file
 

Additional Inherited Members

- Static Public Member Functions inherited from IOFUN
static void Win2Unix (char *s)
 conversion of directory separators - MS Windows to Unix
 
static void Unix2Win (char *s)
 conversion of directory separators - Unix to MS Windows
 
static int ReadComm (FILE *stream)
 Function to read of a comment till the end of line. It returns 0 or EOF if it is performed.
 
static void ReadDummy (FILE *stream)
 Function to read a comment line.
 
static int ReadPar (FILE *stream, const char *Format, void *Par)
 Function to read one variable. The type of variable depends on Format, compatible with stdio library.
 
static int ReadPar (FILE *stream, const char *Format, void *Par1, void *Par2)
 Function to read two variables. The type of variables depends on Format, compatible with stdio library.
 
static int ReadPar (FILE *stream, const char *Format, void *Par1, void *Par2, void *Par3)
 Function to read three variables. The type of variables depends on Format, compatible with stdio library.
 
static int ReadPar (FILE *stream, const char *Format, void *Par1, void *Par2, void *Par3, void *Par4)
 Function to read four variables. The type of variables depends on Format, compatible with stdio library.
 
static int ReadVect3 (FILE *stream, double *Par, double dScal=1.)
 Function to read double vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "dScal".
 
static int ReadVect3 (FILE *stream, float *Par, float fScal=1.)
 Function to read float vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "fScal".
 
static int ReadVect3 (FILE *stream, long *Par, long lScal=1)
 Function to read long vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "lScal".
 
static int ReadVect3 (FILE *stream, int *Par, int iScal=1)
 Function to read int vector "Par" of "3" dimension from FILE "stream". The read values are scaled by multiplier "iScal".
 
static int ReadVect (FILE *stream, double *Par, int n, double dScal=1.)
 Function to read double vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "dScal".
 
static int ReadVect (FILE *stream, float *Par, int n, float fScal=1.)
 Function to read float vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "fScal".
 
static int ReadVect (FILE *stream, long *Par, int n, long lScal=1)
 Function to read long vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "lScal".
 
static int ReadVect (FILE *stream, int *Par, int n, int iScal=1)
 Function to read int vector "Par" of "n" dimension from FILE "stream". The read values are scaled by multiplier "iScal".
 
static int ReadStr (FILE *stream, char *Par)
 Function to read the new line from FILE "stream" and to store it in table of char "Par". The starting and ending blanc charaters are clipped.
 
static void ReadStrL (FILE *stream, char *Par, int *len)
 Function to read the string (Par) from FILE "stream". It reads from current pointer of FILE to the end of line or EOF. Number of read characters is returned in "len".
 
static void ClipString (char *string)
 Clipping of the "string" up to the first blanc character or comment "#" character.
 
static void ClipFileName (char *string)
 Clipping of the ending blanc characters of "string".
 
static bool CompareStrings (char *str1, char *str2)
 Compares two strings (str1 and str2). Returns true if they match, false otherwise.
 
static int file_exist (const char *name)
 Returns true (1) if file "name" does exist, 0 otherwise.
 
static const char * filename_name (const char *name)
 Returns pointer to filename without path.
 
static const char * filename_ext (const char *buf)
 Returns pointer to filename extension.
 
static char * filename_setext (char *buf, int buflen, const char *ext)
 set/change filename extension
 
static int filename_dir (char *name)
 returns the length of the path in (path)name
 
static const char * filename_date (const char *name)
 Returns pointer to the string that contains the date of last file modification/creation.
 
static FILE * fopen (const char *filename, const char *mode)
 Cross-platform function to fopen function that supports UTF-8 encoded name.
 
static int stat (const char *f, struct stat *b)
 Cross-platform function to stat() a file using a UTF-8 encoded name or value.
 
static size_t strlcpy (char *d, const char *s, size_t bufsize)
 The implementation of nonstandard strlcpy function.
 
static int nLines (FILE *stream)
 Returns number of lines of text file from current pointer to EOF.
 
static int nColumns (FILE *stream, char Par[][32])
 Returns number of columns of text file (number of strings in the first line). Names of columns are stored in Par array.
 
static int isstrblank (char *cc, int iLen)
 Checks if string (cc) is blank (1/0)
 
static void ReadVect3 (FILE *stream, VECTOR_3D *Vec, double dScal=1.)
 Function to read VECTOR_3D Vec components from FILE "stream". The read values are scaled by multiplier "dScal".
 
static int readln (FILE *ff, char *value_x)
 Pascal style "readln" function to read string.
 
static int readln (FILE *ff, int *value_x)
 Pascal style "readln" function to read int.
 
static int readln (FILE *ff, long *value_x)
 Pascal style "readln" function to read long.
 
static int readln (FILE *ff, float *value_x)
 Pascal style "readln" function to read float.
 
static int readln (FILE *ff, double *value_x)
 Pascal style "readln" function to read double.
 
static int readln (FILE *ff, long double *value_x)
 Pascal style "readln" function to read long double.
 
static int readln (FILE *ff)
 Pascal style "readln" function to read comment.
 
static int readln (FILE *ff, VECTOR_3D *vec)
 Pascal style "readln" function to read VECTOR_3D components.
 
static int read (FILE *ff, char *value_x)
 Pascal style "read" function to read string.
 
static int read (FILE *ff, int *value_x)
 Pascal style "read" function to read int.
 
static int read (FILE *ff, long *value_x)
 Pascal style "read" function to read long.
 
static int read (FILE *ff, float *value_x)
 Pascal style "read" function to read float.
 
static int read (FILE *ff, double *value_x)
 Pascal style "read" function to read double.
 
static int read (FILE *ff, long double *value_x)
 Pascal style "read" function to read long double.
 
static int read (FILE *ff, VECTOR_3D *vec)
 Pascal style "read" function to read VECTOR_3D components.
 

Detailed Description

Parameters file for SDSA program to run SDSA in batch mode.

Syntax of the batch mode: SDSA [title] [data pathname] [run_Type] [sdsa_params filename] [iGUI] title - string: info about the analysed aircraft displayed in the status bar of the main SDSA window
data pathname - string: the name of folder that containing the data
runType - number: starting option:
0 - no selected,
1 - stability analysis,
2 - simulation,
3 - FCS definition,
4 - performance
sdsa_params filename - name of the configuration file - this parameter forces exit from SDSA after stability computation
iGUi - number: (option not active yet - GUI always present)
0 - no GUI
1 - GUI is displayed

Definition at line 41 of file sdsa_params.h.

Constructor & Destructor Documentation

◆ SDSA_PARAMS()

SDSA_PARAMS::SDSA_PARAMS ( void )

Definition at line 21 of file sdsa_params.cpp.

21{ Clean(); }
void Clean()
cleans local variables

◆ ~SDSA_PARAMS()

SDSA_PARAMS::~SDSA_PARAMS ( void )

Definition at line 23 of file sdsa_params.cpp.

23{}

Member Function Documentation

◆ Clean()

void SDSA_PARAMS::Clean ( void )

cleans local variables

Definition at line 25 of file sdsa_params.cpp.

26{
27 dH0 = dH1 = dDH = 0.0;
28 dV0 = dV1 = dDV = 0.0;
29 dDA = 0.0;
30 iSpeedType = 0;
31 iAero = 0;
32
33 iLQR = 0;
34 iPilot_h = 0;
35 iPilot_a = 0;
36 iPilot_r = 0;
37 iSAS_h = 0;
38 iSAS_a = 0;
39 iSAS_r = 0;
40 iAct_h = 0;
41 iAct_a = 0;
42 iAct_r = 0;
43
44 memset( OutFile, 0 , 256 );
45}
double dDH
step of hight of flight taken into the analysis
Definition sdsa_params.h:47
int iSAS_r
SAS in rudder channel - flag (0-1)
Definition sdsa_params.h:61
double dV1
upper bound of airspeed taken into the analysis
Definition sdsa_params.h:49
int iAct_r
Actuator model in rudder channel - flag (0-1)
Definition sdsa_params.h:64
int iPilot_a
pilot in the loop in aileron channel - flag (0-1)
Definition sdsa_params.h:57
int iAct_h
Actuator model in elevator channel - flag (0-1)
Definition sdsa_params.h:62
int iLQR
LQR flag (0-1)
Definition sdsa_params.h:55
int iAct_a
Actuator model in aileron channel - flag (0-1)
Definition sdsa_params.h:63
int iAero
number of aerodynamic data (1/2)
Definition sdsa_params.h:53
double dDA
aileron deflection [deg] (for roll response characteristics, must be grater than 0)
Definition sdsa_params.h:51
int iSAS_h
SAS in elevator channel - flag (0-1)
Definition sdsa_params.h:59
char OutFile[256]
pathname of output file
Definition sdsa_params.h:66
int iSAS_a
SAS in aileron channel - flag (0-1)
Definition sdsa_params.h:60
double dH1
upper bound of hight of flight taken into the analysis
Definition sdsa_params.h:46
double dDV
step of airspeed taken into the analysis
Definition sdsa_params.h:50
int iPilot_h
pilot in the loop in elevator channel - flag (0-1)
Definition sdsa_params.h:56
int iPilot_r
pilot in the loop in rudder channel - flag (0-1)
Definition sdsa_params.h:58
int iSpeedType
airspeed type (0-TAS, 1-CAS)
Definition sdsa_params.h:52
double dV0
lower bound of airspeed taken into the analysis
Definition sdsa_params.h:48
double dH0
lower bound of hight of flight taken into the analysis
Definition sdsa_params.h:45

◆ Read()

int SDSA_PARAMS::Read ( char * ParFile)

reads parameters file

Definition at line 47 of file sdsa_params.cpp.

48{
49 FILE *File;
50 File = fopen( ParFile, "r" );
51 if( File == NULL )
52 {
53 fprintf( stderr, "SDSA params file open error (%s)\n", ParFile );
54 return (-1);
55 }
56
57 ReadPar( File, "%lf %lf %lf", &dH0, &dH1, &dDH );
58 ReadPar( File, "%lf %lf %lf", &dV0, &dV1, &dDV );
59 ReadPar( File, "%lf", &dDA );
60 ReadPar( File, "%d", &iSpeedType );
61 ReadPar( File, "%d", &iAero );
62 ReadPar( File, "%d", &iLQR );
63 ReadPar( File, "%d %d %d", &iPilot_h, &iPilot_a, &iPilot_r );
64 ReadPar( File, "%d %d %d", &iSAS_h, &iSAS_a, &iSAS_r );
65 ReadPar( File, "%d %d %d", &iAct_h, &iAct_a, &iAct_r );
66 ReadStr( File, OutFile );
67
68 fclose( File );
69
71
72 return (0);
73}
static FILE * fopen(const char *filename, const char *mode)
Cross-platform function to fopen function that supports UTF-8 encoded name.
Definition iofun.cpp:358
static void ClipFileName(char *string)
Clipping of the ending blanc characters of "string".
Definition iofun.cpp:250
static int ReadStr(FILE *stream, char *Par)
Function to read the new line from FILE "stream" and to store it in table of char "Par"....
Definition iofun.cpp:163
static int ReadPar(FILE *stream, const char *Format, void *Par)
Function to read one variable. The type of variable depends on Format, compatible with stdio library.
Definition iofun.cpp:67

◆ Write()

int SDSA_PARAMS::Write ( char * ParFile)

writes parameters file

Definition at line 75 of file sdsa_params.cpp.

76{
77 FILE *File;
78 File = fopen( ParFile, "w" );
79 if( File == NULL )
80 {
81 fprintf( stderr, "SDSA params file open error to writing (%s)\n", ParFile );
82 return (-1);
83 }
84
85 fprintf( File, "# SDSA batch mode configuration file\n");
86 fprintf( File, "%6.2f %6.2f %6.2f # altitude range: mni, max, step\n", dH0, dH1, dDH );
87 fprintf( File, "%6.2f %6.2f %6.2f # airspeed range: mni, max, step\n", dV0, dV1, dDV );
88 fprintf( File, "%6.2f \t\t# aileron deflection angle\n", dDA );
89 fprintf( File, "%d \t\t# airspeed type: 0-TAS, 1-CAS\n", iSpeedType );
90 fprintf( File, "%d \t\t# aero data set (0,1)\n", iAero );
91 fprintf( File, "%d \t\t# LQR flag (0,1)\n", iLQR );
92 fprintf( File, "%d %d %d \t\t# Pilot in the loop (H,A,V)\n", iPilot_h, iPilot_a, iPilot_r );
93 fprintf( File, "%d %d %d \t\t# SAS in the loop (H,A,V)\n", iSAS_h, iSAS_a, iSAS_r );
94 fprintf( File, "%d %d %d \t\t# actuators in the loop (H,A,V)\n", iAct_h, iAct_a, iAct_r );
95 fprintf( File, "%s # output file\n", OutFile );
96
97 fclose( File );
98
99 return (0);
100}

Member Data Documentation

◆ dDA

double SDSA_PARAMS::dDA

aileron deflection [deg] (for roll response characteristics, must be grater than 0)

Definition at line 51 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ dDH

double SDSA_PARAMS::dDH

step of hight of flight taken into the analysis

Definition at line 47 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ dDV

double SDSA_PARAMS::dDV

step of airspeed taken into the analysis

Definition at line 50 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ dH0

double SDSA_PARAMS::dH0

lower bound of hight of flight taken into the analysis

Definition at line 45 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ dH1

double SDSA_PARAMS::dH1

upper bound of hight of flight taken into the analysis

Definition at line 46 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ dV0

double SDSA_PARAMS::dV0

lower bound of airspeed taken into the analysis

Definition at line 48 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ dV1

double SDSA_PARAMS::dV1

upper bound of airspeed taken into the analysis

Definition at line 49 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iAct_a

int SDSA_PARAMS::iAct_a

Actuator model in aileron channel - flag (0-1)

Definition at line 63 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iAct_h

int SDSA_PARAMS::iAct_h

Actuator model in elevator channel - flag (0-1)

Definition at line 62 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iAct_r

int SDSA_PARAMS::iAct_r

Actuator model in rudder channel - flag (0-1)

Definition at line 64 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iAero

int SDSA_PARAMS::iAero

number of aerodynamic data (1/2)

Definition at line 53 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iLQR

int SDSA_PARAMS::iLQR

LQR flag (0-1)

Definition at line 55 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iPilot_a

int SDSA_PARAMS::iPilot_a

pilot in the loop in aileron channel - flag (0-1)

Definition at line 57 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iPilot_h

int SDSA_PARAMS::iPilot_h

pilot in the loop in elevator channel - flag (0-1)

Definition at line 56 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iPilot_r

int SDSA_PARAMS::iPilot_r

pilot in the loop in rudder channel - flag (0-1)

Definition at line 58 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iSAS_a

int SDSA_PARAMS::iSAS_a

SAS in aileron channel - flag (0-1)

Definition at line 60 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iSAS_h

int SDSA_PARAMS::iSAS_h

SAS in elevator channel - flag (0-1)

Definition at line 59 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iSAS_r

int SDSA_PARAMS::iSAS_r

SAS in rudder channel - flag (0-1)

Definition at line 61 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ iSpeedType

int SDSA_PARAMS::iSpeedType

airspeed type (0-TAS, 1-CAS)

Definition at line 52 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().

◆ OutFile

char SDSA_PARAMS::OutFile[256]

pathname of output file

Definition at line 66 of file sdsa_params.h.

Referenced by Clean(), Read(), and Write().


The documentation for this class was generated from the following files: