Oh I should show you what the constructor for a fully populated B17 looks like.
public B17_D()
{
state.parent = this;
//=========================================================
// setup aircraft metrics
state.WingArea = 1420;
state.WingSpan = 103.75;
state.WingIncidence = 2;
state.cbar = 13.69;
state.vXYZrp = new Simulation.MathUtils.Vector3(22.5 * 12, 0, 0);
state.vXYZep = new Simulation.MathUtils.Vector3(11 * 12, -2 * 12, 3.5 * 12);
state.vXYZvrp = new Simulation.MathUtils.Vector3(0, 0, 0);
state.Derive();
//=========================================================
// setup mass balance
state.MassBalance.Load(400000, 250000, 600000, 0, 0, 0, 36100, 22, 0, -0.5);
//=========================================================
// add ground reactions
state.landing_gear.Add(new Gear("LEFT_MAIN", Gear.ContactType.ctBOGEY, 30000, 3000, 0.5, 0.02, 0.8, 0, true, new Vector3(20.9, -10, -8.5), Gear.BrakeGroup.bgLeft, 0.0666666, 0.2, 0));
state.landing_gear.Add(new Gear("RIGHT_MAIN", Gear.ContactType.ctBOGEY, 30000, 3000, 0.5, 0.02, 0.8, 0, true, new Vector3(20.9, 10, -8.5), Gear.BrakeGroup.bgRight, 0.0666666, 0.2, 1));
state.landing_gear.Add(new Gear("TAIL", Gear.ContactType.ctBOGEY, 30000, 3000, 0.5, 0.02, 0.8, 5, true, new Vector3(52.5, 0, -4.75), Gear.BrakeGroup.bgNone, 0.0666666, 0.2, 2));
state.landing_gear.Add(new Gear("LEFT_WING", Gear.ContactType.ctSTRUCTURE, 65500, 13100, 0.5, 0.8, 0.8, 0, true, new Vector3(24, -51.9, 1.9), Gear.BrakeGroup.bgNone, 0.0666666, 0.2, 3));
state.landing_gear.Add(new Gear("RIGHT_WING", Gear.ContactType.ctSTRUCTURE, 65500, 13100, 0.5, 0.8, 0.8, 0, true, new Vector3(24, 51.9, 1.9), Gear.BrakeGroup.bgNone, 0.0666666, 0.2, 4));
//=========================================================
// Create all four engines and add a propeller to each
for (int i = 0; i < 4; i++)
{
engines[i] = new R_1820_97(state);
engines[i].EngineNumber = i;
engines[i].thruster = new HS139_V();
switch (i)
{
case 0:
engines[i].thruster.vXYZn = new Simulation.MathUtils.Vector3(10.1, -21.6, -0.4);
engines[i].vXYZn = new Simulation.MathUtils.Vector3(10.1, -21.6, -0.4);
engines[i].FuelFeeds.Add(0);
engines[i].FuelFeeds.Add(1);
engines[i].FuelFeeds.Add(2);
engines[i].FuelFeeds.Add(3);
engines[i].FuelFeeds.Add(4);
engines[i].FuelFeeds.Add(8);
break;
case 1:
engines[i].thruster.vXYZn = new Simulation.MathUtils.Vector3(8.6, -10.0, -0.7);
engines[i].vXYZn = new Simulation.MathUtils.Vector3(8.6, -10.0, -0.7);
engines[i].FuelFeeds.Add(5);
engines[i].FuelFeeds.Add(6);
engines[i].FuelFeeds.Add(7);
engines[i].FuelFeeds.Add(9);
engines[i].FuelFeeds.Add(10);
break;
case 2:
engines[i].thruster.vXYZn = new Simulation.MathUtils.Vector3(8.6, 10.0, -0.7);
engines[i].vXYZn = new Simulation.MathUtils.Vector3(8.6, 10.0, -0.7);
engines[i].FuelFeeds.Add(11);
engines[i].FuelFeeds.Add(17);
engines[i].FuelFeeds.Add(18);
engines[i].FuelFeeds.Add(19);
engines[i].FuelFeeds.Add(21);
break;
case 3:
engines[i].thruster.vXYZn = new Simulation.MathUtils.Vector3(10.1, 21.6, -0.4);
engines[i].vXYZn = new Simulation.MathUtils.Vector3(10.1, 21.6, -0.4);
engines[i].FuelFeeds.Add(12);
engines[i].FuelFeeds.Add(13);
engines[i].FuelFeeds.Add(14);
engines[i].FuelFeeds.Add(15);
engines[i].FuelFeeds.Add(16);
engines[i].FuelFeeds.Add(20);
break;
}
engines[i].thruster.Init();
}
//====================================================
// Create state variables for all engines
state.throttle_pos = new double[4];
state.mixture_pos = new double[4];
state.prop_advance = new double[4];
for (int i = 0; i < 4; i++)
{
state.throttle_pos[i] = 0;
state.mixture_pos[i] = 0;
state.prop_advance[i] = 0;
}
//====================================================
// Add all the fuel tanks
state.fueltanks.Add(new Systems.Tank("Left outboard 1", 24.7 * 12, -45.8 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left outboard 2", 24.7 * 12, -43.8 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left outboard 3", 24.7 * 12, -41.9 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left outboard 4", 24.7 * 12, -40.0 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left outboard 5", 24.7 * 12, -35.8 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left inboard 6", 24.7 * 12, -33.9 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left inboard 7", 24.7 * 12, -32.0 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left inboard 8", 24.7 * 12, -30.1 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left outboard engine 9", 22.4 * 12, -25.8 * 12, 12, 2581, 2581, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left inboard engine 10", 22.4 * 12, -14.3 * 12, 12, 1293, 1293, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Left inboard feeder 11", 25.0 * 12, -14.3 * 12, 12, 1287, 1287, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right inboard feeder 12", 25.0 * 12, 14.3 * 12, 12, 1287, 1287, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right outboard 13", 24.7 * 12, 45.8 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right outboard 14", 24.7 * 12, 43.8 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right outboard 15", 24.7 * 12, 41.9 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right outboard 16", 24.7 * 12, 40.0 * 12, 2 * 12, 328, 328, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right outboard 17", 24.7 * 12, 35.8 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right inboard 18", 24.7 * 12, 33.9 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right inboard 19", 24.7 * 12, 32.0 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right inboard 20", 24.7 * 12, 30.1 * 12, 2 * 12, 410, 410, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right outboard engine 21", 22.4 * 12, 25.8 * 12, 12, 2581, 2581, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
state.fueltanks.Add(new Systems.Tank("Right inboard engine 22", 22.4 * 12, 14.3 * 12, 12, 1293, 1293, 32, Tank.TankType.ttFUEL, null, Tank.GrainType.gtUNKNOWN, 0, 0, 0));
}