From 9e741e296da440a36153816b22b22827078fada2 Mon Sep 17 00:00:00 2001 From: oz Date: Mon, 26 Sep 2022 11:12:48 -0700 Subject: [PATCH 1/3] start of custom fuel --- B78XH-wasm/FuelSystem.cpp | 36 +++++++++++++++++++++++ B78XH-wasm/FuelSystem.h | 61 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 B78XH-wasm/FuelSystem.cpp create mode 100644 B78XH-wasm/FuelSystem.h diff --git a/B78XH-wasm/FuelSystem.cpp b/B78XH-wasm/FuelSystem.cpp new file mode 100644 index 0000000..dc0d07c --- /dev/null +++ b/B78XH-wasm/FuelSystem.cpp @@ -0,0 +1,36 @@ +// B78XH-wasm +// Copyright (C) 2022 Heavy Division +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +#pragma once +#include "FuelSystem.h" + +auto FuelSystem::getCenterTankFuel() -> double { + return centerTankFuel; +} + +auto FuelSystem::getLeftTankFuel() -> double { + return leftTankFuel; +} + +auto FuelSystem::getRightTankFuel() -> double { + return rightTankFuel; +} + +// updating all the tank quantities etc might go here +auto FuelSystem::update(double deltaTime) -> void { + // factors affecting: engine power, whether jettison nozzles on, etc +} diff --git a/B78XH-wasm/FuelSystem.h b/B78XH-wasm/FuelSystem.h new file mode 100644 index 0000000..ed67a3b --- /dev/null +++ b/B78XH-wasm/FuelSystem.h @@ -0,0 +1,61 @@ +// B78XH-wasm +// Copyright (C) 2022 Heavy Division +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + + +/// Fuel system notes +/// +/// capacities and quantities are in gallons (volume) - since density can +/// actually vary, I presume volume capacity is the limiting factor. No matter +/// how much the fuel weighs, can only squeeze so much volume of fuel into the +/// tanks. leaves open the possibility of simulating fuel density later. For now +/// density is fixed, default unit imperial (gallons/lbs) +/// +/// All variants have the same fuel tanks apparently - same capacity! +/// So then I wondered why the -8 has lower range than a -9 since lighter +/// plane + less fuel should mean more range +/// answer: https://www.quora.com/How-does-the-Boeing-787-9-manage-to-have-a-greater-range-than-the-787-8-even-though-fuel-capacity-is-almost-identical + +#pragma once + +#include "Updateable.h" + +class FuelSystem final : public Updateable { + // todo: expose fuel flow rates, other parameters, etc + public: + auto update(double deltaTime) -> void override; + + auto getLeftTankFuel() -> double; + auto getRightTankFuel() -> double; + auto getCenterTankFuel() -> double; + private: + static constexpr double LEFT_RIGHT_MAIN_TANK_CAPACITY_GALLONS = 5520; + static constexpr double CENTER_TANK_CAPACITY_GALLONS = 22340; + static constexpr double LEFT_RIGHT_SURGE_TANK_CAPACITY_GALLONS = 996.5; + + static constexpr double FUEL_DENSITY_LBS_PER_GALLON = 6.7; + + double leftTankFuel; + double rightTankFuel; + double centerTankFuel; + + // todo: better way to represent refuel speed. want 3 speeds instant, fast, and real like i've seen other mods. For now can use 0/1/2 or wtv + bool refueling; + int refuelSpeed; + + // are there default lvars for this? not sure + bool leftJettisonNozzleOn; + bool rightJettisonNozzleOn; +}; \ No newline at end of file From 7f608a97cc54077c03bc3a9f7bb0dcdc32fb31d3 Mon Sep 17 00:00:00 2001 From: oz Date: Tue, 27 Sep 2022 00:04:49 -0700 Subject: [PATCH 2/3] reopened in VS, should show up in solution explorer now --- B78XH-wasm/{FuelSystem.cpp => FuelSys.cpp} | 0 B78XH-wasm/{FuelSystem.h => FuelSys.h} | 48 +++++++++++----------- 2 files changed, 24 insertions(+), 24 deletions(-) rename B78XH-wasm/{FuelSystem.cpp => FuelSys.cpp} (100%) rename B78XH-wasm/{FuelSystem.h => FuelSys.h} (64%) diff --git a/B78XH-wasm/FuelSystem.cpp b/B78XH-wasm/FuelSys.cpp similarity index 100% rename from B78XH-wasm/FuelSystem.cpp rename to B78XH-wasm/FuelSys.cpp diff --git a/B78XH-wasm/FuelSystem.h b/B78XH-wasm/FuelSys.h similarity index 64% rename from B78XH-wasm/FuelSystem.h rename to B78XH-wasm/FuelSys.h index ed67a3b..95b1b75 100644 --- a/B78XH-wasm/FuelSystem.h +++ b/B78XH-wasm/FuelSys.h @@ -34,28 +34,28 @@ class FuelSystem final : public Updateable { // todo: expose fuel flow rates, other parameters, etc - public: - auto update(double deltaTime) -> void override; - - auto getLeftTankFuel() -> double; - auto getRightTankFuel() -> double; - auto getCenterTankFuel() -> double; - private: - static constexpr double LEFT_RIGHT_MAIN_TANK_CAPACITY_GALLONS = 5520; - static constexpr double CENTER_TANK_CAPACITY_GALLONS = 22340; - static constexpr double LEFT_RIGHT_SURGE_TANK_CAPACITY_GALLONS = 996.5; - - static constexpr double FUEL_DENSITY_LBS_PER_GALLON = 6.7; - - double leftTankFuel; - double rightTankFuel; - double centerTankFuel; - - // todo: better way to represent refuel speed. want 3 speeds instant, fast, and real like i've seen other mods. For now can use 0/1/2 or wtv - bool refueling; - int refuelSpeed; - - // are there default lvars for this? not sure - bool leftJettisonNozzleOn; - bool rightJettisonNozzleOn; +public: + auto update(double deltaTime) -> void override; + + auto getLeftTankFuel() -> double; + auto getRightTankFuel() -> double; + auto getCenterTankFuel() -> double; +private: + static constexpr double LEFT_RIGHT_MAIN_TANK_CAPACITY_GALLONS = 5520; + static constexpr double CENTER_TANK_CAPACITY_GALLONS = 22340; + static constexpr double LEFT_RIGHT_SURGE_TANK_CAPACITY_GALLONS = 996.5; + + static constexpr double FUEL_DENSITY_LBS_PER_GALLON = 6.7; + + double leftTankFuel; + double rightTankFuel; + double centerTankFuel; + + // todo: better way to represent refuel speed. want 3 speeds instant, fast, and real like i've seen other mods. For now can use 0/1/2 or wtv + bool refueling; + int refuelSpeed; + + // are there default lvars for this? not sure + bool leftJettisonNozzleOn; + bool rightJettisonNozzleOn; }; \ No newline at end of file From 679a8d1c0edb2316790fd8c4689038817bbbce44 Mon Sep 17 00:00:00 2001 From: oz Date: Sat, 22 Oct 2022 00:49:42 -0700 Subject: [PATCH 3/3] files created for FQIS and associated equipment --- B78XH-wasm/B78XH-wasm.vcxproj | 31 +++++++- B78XH-wasm/B78XH-wasm.vcxproj.filters | 87 +++++++++++++++++++++- B78XH-wasm/CCS.h | 2 + B78XH-wasm/CenterFuelSensorGroupA.cpp | 1 + B78XH-wasm/CenterFuelSensorGroupA.h | 14 ++++ B78XH-wasm/CenterFuelSensorGroupB.cpp | 1 + B78XH-wasm/CenterFuelSensorGroupB.h | 12 +++ B78XH-wasm/FQDCCenter.cpp | 5 ++ B78XH-wasm/FQDCCenter.h | 13 ++++ B78XH-wasm/FQDCSide.cpp | 5 ++ B78XH-wasm/FQDCSide.h | 19 +++++ B78XH-wasm/FQIS.cpp | 18 +++++ B78XH-wasm/FQIS.h | 18 +++++ B78XH-wasm/FQMS.cpp | 1 + B78XH-wasm/FQMS.h | 8 ++ B78XH-wasm/FuelCompensatorSensor.cpp | 6 ++ B78XH-wasm/FuelCompensatorSensor.h | 8 ++ B78XH-wasm/FuelDensitySensor.cpp | 6 ++ B78XH-wasm/FuelDensitySensor.h | 8 ++ B78XH-wasm/FuelHeightSensor.cpp | 5 ++ B78XH-wasm/FuelHeightSensor.h | 10 +++ B78XH-wasm/FuelHeightTemperatureSensor.cpp | 9 +++ B78XH-wasm/FuelHeightTemperatureSensor.h | 9 +++ B78XH-wasm/FuelSys.cpp | 36 --------- B78XH-wasm/FuelSys.h | 61 --------------- B78XH-wasm/MainFuelSensorGroupA.cpp | 1 + B78XH-wasm/MainFuelSensorGroupA.h | 19 +++++ B78XH-wasm/MainFuelSensorGroupB.cpp | 1 + B78XH-wasm/MainFuelSensorGroupB.h | 19 +++++ B78XH-wasm/PrincipalCharacteristics.h | 19 +++++ 30 files changed, 352 insertions(+), 100 deletions(-) create mode 100644 B78XH-wasm/CenterFuelSensorGroupA.cpp create mode 100644 B78XH-wasm/CenterFuelSensorGroupA.h create mode 100644 B78XH-wasm/CenterFuelSensorGroupB.cpp create mode 100644 B78XH-wasm/CenterFuelSensorGroupB.h create mode 100644 B78XH-wasm/FQDCCenter.cpp create mode 100644 B78XH-wasm/FQDCCenter.h create mode 100644 B78XH-wasm/FQDCSide.cpp create mode 100644 B78XH-wasm/FQDCSide.h create mode 100644 B78XH-wasm/FQIS.cpp create mode 100644 B78XH-wasm/FQIS.h create mode 100644 B78XH-wasm/FQMS.cpp create mode 100644 B78XH-wasm/FQMS.h create mode 100644 B78XH-wasm/FuelCompensatorSensor.cpp create mode 100644 B78XH-wasm/FuelCompensatorSensor.h create mode 100644 B78XH-wasm/FuelDensitySensor.cpp create mode 100644 B78XH-wasm/FuelDensitySensor.h create mode 100644 B78XH-wasm/FuelHeightSensor.cpp create mode 100644 B78XH-wasm/FuelHeightSensor.h create mode 100644 B78XH-wasm/FuelHeightTemperatureSensor.cpp create mode 100644 B78XH-wasm/FuelHeightTemperatureSensor.h delete mode 100644 B78XH-wasm/FuelSys.cpp delete mode 100644 B78XH-wasm/FuelSys.h create mode 100644 B78XH-wasm/MainFuelSensorGroupA.cpp create mode 100644 B78XH-wasm/MainFuelSensorGroupA.h create mode 100644 B78XH-wasm/MainFuelSensorGroupB.cpp create mode 100644 B78XH-wasm/MainFuelSensorGroupB.h create mode 100644 B78XH-wasm/PrincipalCharacteristics.h diff --git a/B78XH-wasm/B78XH-wasm.vcxproj b/B78XH-wasm/B78XH-wasm.vcxproj index b05ce8f..5b8b611 100644 --- a/B78XH-wasm/B78XH-wasm.vcxproj +++ b/B78XH-wasm/B78XH-wasm.vcxproj @@ -40,6 +40,7 @@ + @@ -51,7 +52,7 @@ true .wasm $(MSFS_IncludePath) - ..\..\..\..\WebstormProjects\B78XH-su9-stable\SimObjects\Airplanes\Asobo_B787_10\panel + ..\..\..\AppData\Roaming\Microsoft Flight Simulator\Packages\Community\B78XH-main\SimObjects\Airplanes\Asobo_B787_10\panel false @@ -149,14 +150,26 @@ + + + + + + + + + + + + @@ -261,6 +274,8 @@ + + @@ -271,6 +286,14 @@ + + + + + + + + @@ -284,6 +307,8 @@ + + @@ -294,7 +319,9 @@ + + @@ -365,4 +392,4 @@ - \ No newline at end of file + diff --git a/B78XH-wasm/B78XH-wasm.vcxproj.filters b/B78XH-wasm/B78XH-wasm.vcxproj.filters index 47c084d..2f3c022 100644 --- a/B78XH-wasm/B78XH-wasm.vcxproj.filters +++ b/B78XH-wasm/B78XH-wasm.vcxproj.filters @@ -285,6 +285,42 @@ Source Files\Equipment\AircraftEquipment\Bases + + Source Files\Systems\Fuel + + + Source Files\Equipment\AircraftEquipment\Fuel + + + Source Files\Systems\Fuel + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel + @@ -697,6 +733,46 @@ Source Files\Equipment\AircraftEquipment\Bases + + + Source Files\Tools\staticdata + + + Source Files\Systems\Fuel + + + Source Files\Equipment\AircraftEquipment\Fuel + + + Source Files\Systems\Fuel + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\Sensors + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel\SensorGroups + + + Source Files\Equipment\AircraftEquipment\Fuel + @@ -879,6 +955,15 @@ {a4046750-4ccb-4bf9-9402-6f841a78c254} + + {d940d724-092b-47d5-b599-891e8fbe0ea9} + + + {1bb92db7-bef7-4646-803d-1d344a31ae3b} + + + {da86a793-f4e6-449d-bf50-898554ede86f} + @@ -889,4 +974,4 @@ - \ No newline at end of file + diff --git a/B78XH-wasm/CCS.h b/B78XH-wasm/CCS.h index f4673d4..6539c5b 100644 --- a/B78XH-wasm/CCS.h +++ b/B78XH-wasm/CCS.h @@ -17,6 +17,7 @@ #pragma once #include "ERS.h" +#include "FQIS.h" #include "LVars.h" /* @@ -31,6 +32,7 @@ class CCS { auto reset() -> void; private: ERS ers; + FQIS fqis; LVars lvars; auto updateLVars() -> void; auto updateERS(double deltaTime) -> void; diff --git a/B78XH-wasm/CenterFuelSensorGroupA.cpp b/B78XH-wasm/CenterFuelSensorGroupA.cpp new file mode 100644 index 0000000..0070a6f --- /dev/null +++ b/B78XH-wasm/CenterFuelSensorGroupA.cpp @@ -0,0 +1 @@ +#include "CenterFuelSensorGroupA.h" diff --git a/B78XH-wasm/CenterFuelSensorGroupA.h b/B78XH-wasm/CenterFuelSensorGroupA.h new file mode 100644 index 0000000..d76940f --- /dev/null +++ b/B78XH-wasm/CenterFuelSensorGroupA.h @@ -0,0 +1,14 @@ +#pragma once +#include "FuelCompensatorSensor.h" +#include "FuelHeightSensor.h" +#include "FuelHeightTemperatureSensor.h" + +class CenterFuelSensorGroupA +{ + private: + FuelHeightSensor fhs1; + FuelHeightSensor fhs2; + FuelHeightTemperatureSensor fhts; + FuelCompensatorSensor fcs; +}; + diff --git a/B78XH-wasm/CenterFuelSensorGroupB.cpp b/B78XH-wasm/CenterFuelSensorGroupB.cpp new file mode 100644 index 0000000..04c68ec --- /dev/null +++ b/B78XH-wasm/CenterFuelSensorGroupB.cpp @@ -0,0 +1 @@ +#include "CenterFuelSensorGroupB.h" diff --git a/B78XH-wasm/CenterFuelSensorGroupB.h b/B78XH-wasm/CenterFuelSensorGroupB.h new file mode 100644 index 0000000..f2567cf --- /dev/null +++ b/B78XH-wasm/CenterFuelSensorGroupB.h @@ -0,0 +1,12 @@ +#pragma once +#include "FuelCompensatorSensor.h" +#include "FuelHeightSensor.h" + +class CenterFuelSensorGroupB +{ + private: + FuelHeightSensor fhs1; + FuelHeightSensor fhs2; + FuelCompensatorSensor fcs; +}; + diff --git a/B78XH-wasm/FQDCCenter.cpp b/B78XH-wasm/FQDCCenter.cpp new file mode 100644 index 0000000..bac952d --- /dev/null +++ b/B78XH-wasm/FQDCCenter.cpp @@ -0,0 +1,5 @@ +#include "FQDCCenter.h" + +double FQDCCenter::getSensorData() { + return 0; +} diff --git a/B78XH-wasm/FQDCCenter.h b/B78XH-wasm/FQDCCenter.h new file mode 100644 index 0000000..30c691c --- /dev/null +++ b/B78XH-wasm/FQDCCenter.h @@ -0,0 +1,13 @@ +#pragma once +#include "CenterFuelSensorGroupA.h" +#include "CenterFuelSensorGroupB.h" +class FQDCCenter +{ + public: + // TODO: see FQDC side comments + auto getSensorData() -> double; + private: + CenterFuelSensorGroupA sensorGroupA; + CenterFuelSensorGroupB sensorGroupB; +}; + diff --git a/B78XH-wasm/FQDCSide.cpp b/B78XH-wasm/FQDCSide.cpp new file mode 100644 index 0000000..af92be6 --- /dev/null +++ b/B78XH-wasm/FQDCSide.cpp @@ -0,0 +1,5 @@ +#include "FQDCSide.h" + +double FQDCSide::getSensorData() { + return 0; +} diff --git a/B78XH-wasm/FQDCSide.h b/B78XH-wasm/FQDCSide.h new file mode 100644 index 0000000..89bc720 --- /dev/null +++ b/B78XH-wasm/FQDCSide.h @@ -0,0 +1,19 @@ +// fuel quantity data concentrators. there are 3 of them, one for each tank +// + +#pragma once +#include "MainFuelSensorGroupA.h" +#include "MainFuelSensorGroupB.h" +class FQDCSide +{ + public: + // TODO: define functions for retrieval of data. The "main" sensor groups (left and right) also have a sensor for + // the center tank, so it's not directly 1-to-1 + // for now this is double but eventually will be something more complex, probably a struct + // can just get the corresponding (l/c/r) fuel tank to start with ig? + auto getSensorData() -> double; + private: + MainFuelSensorGroupA sensorGroupA; + MainFuelSensorGroupB sensorGroupB; +}; + diff --git a/B78XH-wasm/FQIS.cpp b/B78XH-wasm/FQIS.cpp new file mode 100644 index 0000000..9144fab --- /dev/null +++ b/B78XH-wasm/FQIS.cpp @@ -0,0 +1,18 @@ +#include "FQIS.h" + +auto FQIS::getCenterTankFuelWeight() -> double { + // TODO: return actual fuel weight + // simple impl based on default simvars: get fuel level in each tank * fuel density. or even simpler just get fuel weight simvars + // advanced custom impl: calculate fuel level from height sensors, fuel density from density sensors, and use that to calculate + return 0; +} + +auto FQIS::getLeftTankFuelWeight() -> double { + // TODO: return actual fuel weight + return 0; +} + +auto FQIS::getRightTankFuelWeight() -> double { + // TODO: return actual fuel weight + return 0; +} diff --git a/B78XH-wasm/FQIS.h b/B78XH-wasm/FQIS.h new file mode 100644 index 0000000..350a8f1 --- /dev/null +++ b/B78XH-wasm/FQIS.h @@ -0,0 +1,18 @@ +// fuel quantity indicating system + +#pragma once +#include "FQDCSide.h" +#include "FQDCCenter.h" + +class FQIS +{ + public: + auto getCenterTankFuelWeight() -> double; + auto getLeftTankFuelWeight() -> double; + auto getRightTankFuelWeight() -> double; + private: + FQDCSide fqdcLeft; + FQDCCenter fqdcCenter; + FQDCSide fqdcRight; +}; + diff --git a/B78XH-wasm/FQMS.cpp b/B78XH-wasm/FQMS.cpp new file mode 100644 index 0000000..3735f01 --- /dev/null +++ b/B78XH-wasm/FQMS.cpp @@ -0,0 +1 @@ +#include "FQMS.h" diff --git a/B78XH-wasm/FQMS.h b/B78XH-wasm/FQMS.h new file mode 100644 index 0000000..c78348e --- /dev/null +++ b/B78XH-wasm/FQMS.h @@ -0,0 +1,8 @@ +// fuel quantity management system +// calculates fuel weight per tank and total, and monitors for faults + +#pragma once +class FQMS +{ +}; + diff --git a/B78XH-wasm/FuelCompensatorSensor.cpp b/B78XH-wasm/FuelCompensatorSensor.cpp new file mode 100644 index 0000000..e770564 --- /dev/null +++ b/B78XH-wasm/FuelCompensatorSensor.cpp @@ -0,0 +1,6 @@ +#include "FuelCompensatorSensor.h" + +double FuelCompensatorSensor::getFuelDensity() { + // TODO: return fuel density simvar + return 0; +} diff --git a/B78XH-wasm/FuelCompensatorSensor.h b/B78XH-wasm/FuelCompensatorSensor.h new file mode 100644 index 0000000..db2fd82 --- /dev/null +++ b/B78XH-wasm/FuelCompensatorSensor.h @@ -0,0 +1,8 @@ +#pragma once +#include "Operable.h" +class FuelCompensatorSensor : public Operable +{ + public: + auto getFuelDensity() -> double; +}; + diff --git a/B78XH-wasm/FuelDensitySensor.cpp b/B78XH-wasm/FuelDensitySensor.cpp new file mode 100644 index 0000000..c5c5619 --- /dev/null +++ b/B78XH-wasm/FuelDensitySensor.cpp @@ -0,0 +1,6 @@ +#include "FuelDensitySensor.h" + +double FuelDensitySensor::getFuelDensity() { + // TODO: return simvar for fuel density + return 0; +} diff --git a/B78XH-wasm/FuelDensitySensor.h b/B78XH-wasm/FuelDensitySensor.h new file mode 100644 index 0000000..e543598 --- /dev/null +++ b/B78XH-wasm/FuelDensitySensor.h @@ -0,0 +1,8 @@ +#pragma once +#include "Operable.h" +class FuelDensitySensor : public Operable +{ + public: + auto getFuelDensity() -> double; +}; + diff --git a/B78XH-wasm/FuelHeightSensor.cpp b/B78XH-wasm/FuelHeightSensor.cpp new file mode 100644 index 0000000..a3bac2a --- /dev/null +++ b/B78XH-wasm/FuelHeightSensor.cpp @@ -0,0 +1,5 @@ +#include "FuelHeightSensor.h" + +double FuelHeightSensor::getFuelHeight() { + return 0; +} diff --git a/B78XH-wasm/FuelHeightSensor.h b/B78XH-wasm/FuelHeightSensor.h new file mode 100644 index 0000000..6365d9e --- /dev/null +++ b/B78XH-wasm/FuelHeightSensor.h @@ -0,0 +1,10 @@ +// fuel height sensor - supplies capacitance signal corresponding to fuel height at a specific location in the tank + +#pragma once +#include "Operable.h" +class FuelHeightSensor final : public Operable +{ + public: + auto getFuelHeight() -> double; +}; + diff --git a/B78XH-wasm/FuelHeightTemperatureSensor.cpp b/B78XH-wasm/FuelHeightTemperatureSensor.cpp new file mode 100644 index 0000000..680ae0d --- /dev/null +++ b/B78XH-wasm/FuelHeightTemperatureSensor.cpp @@ -0,0 +1,9 @@ +#include "FuelHeightTemperatureSensor.h" + +double FuelHeightTemperatureSensor::getFuelHeight() { + return 0; +} + +double FuelHeightTemperatureSensor::getFuelTemperature() { + return 0; +} diff --git a/B78XH-wasm/FuelHeightTemperatureSensor.h b/B78XH-wasm/FuelHeightTemperatureSensor.h new file mode 100644 index 0000000..3ec349a --- /dev/null +++ b/B78XH-wasm/FuelHeightTemperatureSensor.h @@ -0,0 +1,9 @@ +#pragma once +#include "Operable.h" +class FuelHeightTemperatureSensor : public Operable +{ + public: + auto getFuelHeight() -> double; + auto getFuelTemperature() -> double; +}; + diff --git a/B78XH-wasm/FuelSys.cpp b/B78XH-wasm/FuelSys.cpp deleted file mode 100644 index dc0d07c..0000000 --- a/B78XH-wasm/FuelSys.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// B78XH-wasm -// Copyright (C) 2022 Heavy Division -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - - -#pragma once -#include "FuelSystem.h" - -auto FuelSystem::getCenterTankFuel() -> double { - return centerTankFuel; -} - -auto FuelSystem::getLeftTankFuel() -> double { - return leftTankFuel; -} - -auto FuelSystem::getRightTankFuel() -> double { - return rightTankFuel; -} - -// updating all the tank quantities etc might go here -auto FuelSystem::update(double deltaTime) -> void { - // factors affecting: engine power, whether jettison nozzles on, etc -} diff --git a/B78XH-wasm/FuelSys.h b/B78XH-wasm/FuelSys.h deleted file mode 100644 index 95b1b75..0000000 --- a/B78XH-wasm/FuelSys.h +++ /dev/null @@ -1,61 +0,0 @@ -// B78XH-wasm -// Copyright (C) 2022 Heavy Division -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - - -/// Fuel system notes -/// -/// capacities and quantities are in gallons (volume) - since density can -/// actually vary, I presume volume capacity is the limiting factor. No matter -/// how much the fuel weighs, can only squeeze so much volume of fuel into the -/// tanks. leaves open the possibility of simulating fuel density later. For now -/// density is fixed, default unit imperial (gallons/lbs) -/// -/// All variants have the same fuel tanks apparently - same capacity! -/// So then I wondered why the -8 has lower range than a -9 since lighter -/// plane + less fuel should mean more range -/// answer: https://www.quora.com/How-does-the-Boeing-787-9-manage-to-have-a-greater-range-than-the-787-8-even-though-fuel-capacity-is-almost-identical - -#pragma once - -#include "Updateable.h" - -class FuelSystem final : public Updateable { - // todo: expose fuel flow rates, other parameters, etc -public: - auto update(double deltaTime) -> void override; - - auto getLeftTankFuel() -> double; - auto getRightTankFuel() -> double; - auto getCenterTankFuel() -> double; -private: - static constexpr double LEFT_RIGHT_MAIN_TANK_CAPACITY_GALLONS = 5520; - static constexpr double CENTER_TANK_CAPACITY_GALLONS = 22340; - static constexpr double LEFT_RIGHT_SURGE_TANK_CAPACITY_GALLONS = 996.5; - - static constexpr double FUEL_DENSITY_LBS_PER_GALLON = 6.7; - - double leftTankFuel; - double rightTankFuel; - double centerTankFuel; - - // todo: better way to represent refuel speed. want 3 speeds instant, fast, and real like i've seen other mods. For now can use 0/1/2 or wtv - bool refueling; - int refuelSpeed; - - // are there default lvars for this? not sure - bool leftJettisonNozzleOn; - bool rightJettisonNozzleOn; -}; \ No newline at end of file diff --git a/B78XH-wasm/MainFuelSensorGroupA.cpp b/B78XH-wasm/MainFuelSensorGroupA.cpp new file mode 100644 index 0000000..9ea7d5b --- /dev/null +++ b/B78XH-wasm/MainFuelSensorGroupA.cpp @@ -0,0 +1 @@ +#include "MainFuelSensorGroupA.h" diff --git a/B78XH-wasm/MainFuelSensorGroupA.h b/B78XH-wasm/MainFuelSensorGroupA.h new file mode 100644 index 0000000..f6bb05b --- /dev/null +++ b/B78XH-wasm/MainFuelSensorGroupA.h @@ -0,0 +1,19 @@ +#pragma once +#include "FuelCompensatorSensor.h" +#include "FuelHeightSensor.h" +#include "FuelHeightTemperatureSensor.h" + +class MainFuelSensorGroupA +{ + private: + FuelHeightSensor fhs1; + FuelHeightSensor fhs2; + FuelHeightSensor fhs3; + FuelHeightSensor fhs4; + FuelHeightSensor fhs5; + FuelHeightSensor fhs6; + FuelHeightTemperatureSensor fhts; + FuelHeightSensor centerFhs; + FuelCompensatorSensor fcs; +}; + diff --git a/B78XH-wasm/MainFuelSensorGroupB.cpp b/B78XH-wasm/MainFuelSensorGroupB.cpp new file mode 100644 index 0000000..628aacd --- /dev/null +++ b/B78XH-wasm/MainFuelSensorGroupB.cpp @@ -0,0 +1 @@ +#include "MainFuelSensorGroupB.h" diff --git a/B78XH-wasm/MainFuelSensorGroupB.h b/B78XH-wasm/MainFuelSensorGroupB.h new file mode 100644 index 0000000..e0b7497 --- /dev/null +++ b/B78XH-wasm/MainFuelSensorGroupB.h @@ -0,0 +1,19 @@ +#pragma once +#include "FuelDensitySensor.h" +#include "FuelHeightSensor.h" +#include "FuelHeightTemperatureSensor.h" + +class MainFuelSensorGroupB +{ + private: + FuelHeightSensor fhs1; + FuelHeightSensor fhs2; + FuelHeightSensor fhs3; + FuelHeightSensor fhs4; + FuelHeightSensor fhs5; + FuelHeightSensor fhs6; + FuelHeightSensor fhs7; + FuelHeightSensor centerFhs; + FuelDensitySensor fds; +}; + diff --git a/B78XH-wasm/PrincipalCharacteristics.h b/B78XH-wasm/PrincipalCharacteristics.h new file mode 100644 index 0000000..a7629fa --- /dev/null +++ b/B78XH-wasm/PrincipalCharacteristics.h @@ -0,0 +1,19 @@ +// Defines values from the "Principal Characteristics" table from page 9 of B787 syst document + +#pragma once + +const struct PrincipalCharacteristics { + // max weights + inline static double maxTaxiWeightPounds = 537000; + inline static double maxTakeoffWeightPounds = 535000; + inline static double maxLandingWeightPounds = 445000; + inline static double maxZeroFuelWeightPounds = 425200; + + // max thrust, same value for genx or trent + inline static double maxThrustPounds = 76000; + + // passenger capacity + inline static int threeClassPassengerCapacity = 295; + inline static int twoClassPassengerCapacity = 356; + inline static int economyPassengerCapacity = 440; +};