Skip to content

Commit

Permalink
Rotor effects: Add more realistic aerodynamic effects for helicopters
Browse files Browse the repository at this point in the history
This commit performs a first pass at implementing more realistic helicopter
physics particularly at low speeds due to rotor effects:

- Improved heading changes when pitch/banking, ported from @metiscus fork
- In-Ground-Effect (IGE): thrust boost when close to ground
- Transverse Flow Effect: roll,bank effects between 5-25 knots
- ETL: thrust penalty below 24knots, roll-bank effects
- Torque: heading changes at lower speeds + higher collective

The effects make landings more realistic and challenging.
  • Loading branch information
hsanjuan committed Aug 13, 2023
1 parent 2ed2ca4 commit dfab159
Show file tree
Hide file tree
Showing 17 changed files with 334 additions and 76 deletions.
3 changes: 3 additions & 0 deletions data/aircrafts/as350.3d
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ belly_height 1.7
# Length in meters
length 10.92

# Rotor diameter in meters
rotor_diameter 10.8966

# Gear (down position) to belly height in meters
gear_height 0.35

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/b47.3d
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ belly_height 0.5
# Length in meters
length 9.63

# Rotor diameter in meters
rotor_diameter 9.4742

# Gear (down position) to belly height in meters
gear_height 0.0

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/ec145.3d
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ belly_height 1.55
# Length, in meters
length 13.03

# Rotor diameter in meters
rotor_diameter 11

# Gear (down position) to belly height, in meters
gear_height 0.44

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/hh60.3d
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ belly_height 2.2
# Length in meters
length 19.81

# Rotor diameter in meters
rotor_diameter 16.4592

# Gear (down position) to belly height in meters
gear_height 0.5

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/hh65.3d
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ belly_height 2.38
# Length in meters
length 13.54

# Rotor diameter in meters
rotor_diameter 11.938

# Gear (down position) to belly height in meters
gear_height 0.35

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/ka27.3d
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ belly_height 2.35
# Length in meters
length 10.49

# Rotor diameter in meters
rotor_diameter 16.637

# Gear (down position) to belly height in meters
gear_height 0.3

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/s64.3d
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ belly_height 3.55
# Length in meters
length 21.41

# Rotor diameter in meters
rotor_diameter 21.9456

# Gear (down position) to belly height in meters
gear_height 0.45

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/uh1d.3d
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ belly_height 1.7
# Length in meters
length 12.75

# Rotor diameter in meters
rotor_diameter 14.7828

# Gear (down position) to belly height in meters
gear_height 0.3

Expand Down
3 changes: 3 additions & 0 deletions data/aircrafts/v22.3d
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ belly_height 2.8
# Length in meters
length 17.47

# Rotor diameter in meters
rotor_diameter 11.5824

# Wingspan in meters
wingspan 15.24

Expand Down
11 changes: 11 additions & 0 deletions src/cmdset.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,17 @@ void SARCmdSet(SAR_CMD_PROTOTYPE)
got_match = True;
}
}
/* Rotor diameter */
else if(!strcasecmp(parm, "rotor_diameter"))
{
sar_object_aircraft_struct *obj_aircraft_ptr =
SAR_OBJ_GET_AIRCRAFT(obj_ptr);
if(obj_aircraft_ptr != NULL)
{
obj_aircraft_ptr->rotor_diameter = (float)ATOF(val);
got_match = True;
}
}
/* Gear height */
else if(!strcasecmp(parm, "gear_height"))
{
Expand Down
6 changes: 6 additions & 0 deletions src/obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,9 @@ typedef struct {
/* Wingspan of aircraft in meters */
float wingspan;

/* Rotor diameter in meters */
float rotor_diameter;

/* Height of landing gear in meters */
float gear_height;

Expand Down Expand Up @@ -961,6 +964,9 @@ typedef struct {
*/
float center_to_ground_height;

/* Rate of heading change due to torque (radians/cycle) */
float torque_velocity;


/* Moveable parts */
sar_obj_part_struct **part;
Expand Down
13 changes: 13 additions & 0 deletions src/objio.c
Original file line number Diff line number Diff line change
Expand Up @@ -3243,6 +3243,19 @@ static void SARObjLoadLine(
if(aircraft != NULL)
aircraft->wingspan = wingspan;
}
else if(!strcasecmp(parm, "rotor_diameter"))
{
/* Arguments:
*
* <wingspan>
*/
float rotor_diameter = 0.0f;

arg = GET_ARG_F(arg, &rotor_diameter);

if(aircraft != NULL)
aircraft->rotor_diameter = rotor_diameter;
}
/* Landing Gear Height */
else if(!strcasecmp(parm, "gear_height"))
{
Expand Down
12 changes: 12 additions & 0 deletions src/sfm.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@
*/
#define SFMDefaultGravity 9.80665


/*
* Effective transactional lift speed value in m/s.
*/
#define SFMETLSpeed 12.35 // 24 knots

/*
* Transverse Flow Effect (TF) values in m/s.
*/
#define SFMTFStart 2.57 // 5 knots
#define SFMTFEnd 12.86 // 25 knots

/*
* Core structure:
*/
Expand Down
4 changes: 4 additions & 0 deletions src/sfmmodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ SFMBoolean SFMModelChangeValues(
{
model->wingspan = value->wingspan;
}
if(flags & SFMFlagRotorDiameter)
{
model->rotor_diameter = value->rotor_diameter;
}
if(flags & SFMFlagGearState)
{
model->gear_state = value->gear_state;
Expand Down
9 changes: 6 additions & 3 deletions src/sfmmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
#define SFMFlagStopped ((SFMFlags)1 << 41)
#define SFMFlagLength ((SFMFlags)1 << 42)
#define SFMFlagWingspan ((SFMFlags)1 << 43)
#define SFMFlagRotorDiameter ((SFMFlags)1 << 44)

/*
* Flight model types:
Expand Down Expand Up @@ -128,7 +129,7 @@ typedef struct {
*/
SFMFlags flags;

int type; /* One of SFMFlightModel*. */
int type; /* One of SFMFlightModel*. */
SFMPositionStruct position; /* Meters. */
SFMDirectionStruct direction; /* Radians. */
SFMPositionStruct velocity_vector; /* Meters/cycle. */
Expand All @@ -146,8 +147,9 @@ typedef struct {
SFMPositionStruct accel_responsiveness;
double ground_elevation_msl; /* Meters. */
double service_ceiling; /* Meters. */
double length; /* Meters */
double length; /* Meters */
double wingspan; /* Meters */
double rotor_diameter; /* Meters */
double belly_height; /* Undercarrage to center, meters. */
SFMBoolean gear_state; /* True when down. */
int gear_type; /* One of SFMGearType*. */
Expand All @@ -165,11 +167,12 @@ typedef struct {
* ground height,
* in meters.
*/
double torque_velocity; /* Radians/cycle internal */
double heading_control_coeff; /* -1.0 to 1.0. */
double pitch_control_coeff; /* -1.0 to 1.0. */
double bank_control_coeff; /* -1.0 to 1.0. */
double elevator_trim_coeff; /* -1.0 to 1.0. */
double throttle_coeff; /* 0.0 to 1.0. */
double throttle_coeff; /* 0.0 to 1.0. */
SFMBoolean after_burner_state;
double after_burner_power_coeff; /* Times engine power. */
double engine_power; /* In kg * m / cycle^2. */
Expand Down
Loading

0 comments on commit dfab159

Please sign in to comment.