pub struct FlightPlanningBuilder { /* private fields */ }Expand description
Flight planning factory, which is used to build a flight planning.
Implementations§
Source§impl FlightPlanningBuilder
impl FlightPlanningBuilder
Sourcepub fn new() -> FlightPlanningBuilder
pub fn new() -> FlightPlanningBuilder
Creates a new builder.
Sourcepub fn build(&self, route: &Route) -> Result<FlightPlanning, Error>
pub fn build(&self, route: &Route) -> Result<FlightPlanning, Error>
Builds a flight planning for the specified route.
Sourcepub fn aircraft(&mut self, aircraft: Aircraft) -> &mut Self
pub fn aircraft(&mut self, aircraft: Aircraft) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 161)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}Sourcepub fn mass(&mut self, mass: Vec<Mass>) -> &mut Self
pub fn mass(&mut self, mass: Vec<Mass>) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (lines 162-169)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}Sourcepub fn policy(&mut self, policy: FuelPolicy) -> &mut Self
pub fn policy(&mut self, policy: FuelPolicy) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 170)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}Sourcepub fn taxi(&mut self, taxi: Fuel) -> &mut Self
pub fn taxi(&mut self, taxi: Fuel) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 171)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}Sourcepub fn reserve(&mut self, reserve: Reserve) -> &mut Self
pub fn reserve(&mut self, reserve: Reserve) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 172)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}Sourcepub fn perf(&mut self, perf: Performance) -> &mut Self
pub fn perf(&mut self, perf: Performance) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 173)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}pub fn climb_perf(&mut self, perf: ClimbDescentPerformance) -> &mut Self
pub fn descent_perf(&mut self, perf: ClimbDescentPerformance) -> &mut Self
Sourcepub fn takeoff_perf(&mut self, perf: TakeoffLandingPerformance) -> &mut Self
pub fn takeoff_perf(&mut self, perf: TakeoffLandingPerformance) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 174)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}pub fn takeoff_factors(&mut self, factors: AlteringFactors) -> &mut Self
Sourcepub fn origin_rwycc(&mut self, rwycc: RunwayConditionCode) -> &mut Self
pub fn origin_rwycc(&mut self, rwycc: RunwayConditionCode) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 176)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}pub fn origin_wind(&mut self, wind: Wind) -> &mut Self
Sourcepub fn origin_temperature(&mut self, temperature: Temperature) -> &mut Self
pub fn origin_temperature(&mut self, temperature: Temperature) -> &mut Self
Examples found in repository?
examples/flightplanner.rs (line 177)
38fn main() -> Result<()> {
39 // Performance setting with 65% load in cruise. This is the performance
40 // profile of a Cessna C172 with an TAE125-02-114 Diesel engine.
41 let perf = Performance::from_fn(
42 |vd| {
43 let tas = if *vd >= VerticalDistance::Altitude(10000) {
44 Speed::kt(114.0)
45 } else if *vd >= VerticalDistance::Altitude(8000) {
46 Speed::kt(112.0)
47 } else if *vd >= VerticalDistance::Altitude(6000) {
48 Speed::kt(110.0)
49 } else if *vd >= VerticalDistance::Altitude(4000) {
50 Speed::kt(109.0)
51 } else {
52 Speed::kt(107.0)
53 };
54
55 let ff = FuelFlow::PerHour(diesel!(Volume::l(21.0)));
56
57 (tas, ff)
58 },
59 // The data end at 10000 ft so we don't need to create the Performance
60 // with more values.
61 VerticalDistance::Altitude(10000),
62 );
63
64 let takeoff_perf = TakeoffLandingPerformance::builder(vec![
65 (
66 VerticalDistance::PressureAltitude(0),
67 Temperature::c(0.0),
68 Length::ft(845.0),
69 Length::ft(1510.0),
70 ),
71 (
72 VerticalDistance::PressureAltitude(0),
73 Temperature::c(10.0),
74 Length::ft(910.0),
75 Length::ft(1625.0),
76 ),
77 (
78 VerticalDistance::PressureAltitude(0),
79 Temperature::c(20.0),
80 Length::ft(980.0),
81 Length::ft(1745.0),
82 ),
83 (
84 VerticalDistance::PressureAltitude(0),
85 Temperature::c(30.0),
86 Length::ft(1055.0),
87 Length::ft(1875.0),
88 ),
89 (
90 VerticalDistance::PressureAltitude(0),
91 Temperature::c(40.0),
92 Length::ft(1135.0),
93 Length::ft(2015.0),
94 ),
95 ])
96 .factors(vec![
97 // Decrease distances 10% for each 9 knots headwind. For operation
98 // with tail winds up to 10 knots, increase distances by 10% for
99 // each 2 knots.
100 AlteringFactor::DecreaseHeadwind(FactorOfEffect::Rate {
101 numerator: 0.1,
102 denominator: Speed::kt(9.0),
103 }),
104 AlteringFactor::IncreaseTailwind(FactorOfEffect::Rate {
105 numerator: 0.1,
106 denominator: Speed::kt(2.0),
107 }),
108 // For operation on dry, grass runway, increase distances by 15% of
109 // the "ground roll" figure.
110 AlteringFactor::IncreaseRWYCC(HashMap::from([
111 ((None, Some(RunwaySurface::Grass)), 0.15), // we'll add 15% on any grass
112 ])),
113 ])
114 .build();
115
116 let aircraft = Aircraft::builder()
117 .registration("N12345".to_string())
118 .stations(vec![
119 Station::new(Length::m(0.94), Some(String::from("front seats"))),
120 Station::new(Length::m(1.85), Some(String::from("back seats"))),
121 Station::new(
122 Length::m(2.41),
123 Some(String::from("first cargo compartment")),
124 ),
125 Station::new(
126 Length::m(3.12),
127 Some(String::from("second cargo compartment")),
128 ),
129 ])
130 .empty_mass(Mass::kg(807.0))
131 .empty_balance(Length::m(1.0))
132 .fuel_type(FuelType::Diesel)
133 .tanks(vec![FuelTank::new(Volume::l(168.8), Length::m(1.22))])
134 .cg_envelope(vec![
135 CGLimit::new(Mass::kg(0.0), Length::m(0.89)),
136 CGLimit::new(Mass::kg(885.0), Length::m(0.89)),
137 CGLimit::new(Mass::kg(1111.0), Length::m(1.02)),
138 CGLimit::new(Mass::kg(1111.0), Length::m(1.20)),
139 CGLimit::new(Mass::kg(0.0), Length::m(1.20)),
140 ])
141 .build()
142 .expect("all required aircraft parameter should be configured");
143
144 let mut fms = FMS::new();
145
146 // read the ARINC database
147 let ed_nd = NavigationData::try_from_arinc424(ARINC_424_RECORDS)?;
148
149 fms.modify_nd(|nd| nd.append(ed_nd))?;
150
151 // decode a route from EDDH to EDHF with winds at 20 kt from 290° and
152 // cruising speed of 107 kt and an altitude of 2500 ft. Takeoff runway in
153 // EDDH is runway 33 and landing runway in EDHF is 20.
154 fms.decode("29020KT N0107 A0250 EDDH33 N2 N1 DCT EDHF20".to_string())?;
155
156 // Now we can enter some data into the flight planning to get a fuel planning
157 // and mass & balance calculation.
158 let mut builder = FlightPlanning::builder();
159
160 builder
161 .aircraft(aircraft)
162 .mass(vec![
163 // we're in the front
164 Mass::kg(80.0),
165 // and no mass on the other stations
166 Mass::kg(0.0),
167 Mass::kg(0.0),
168 Mass::kg(0.0),
169 ])
170 .policy(FuelPolicy::ManualFuel(diesel!(Volume::l(80.0))))
171 .taxi(diesel!(Volume::l(10.0)))
172 .reserve(Reserve::Manual(Duration::s(1800))) // 30 min
173 .perf(perf)
174 .takeoff_perf(takeoff_perf)
175 // we use the route's wind so no need to specify it here
176 .origin_rwycc(RunwayConditionCode::Six)
177 .origin_temperature(Temperature::c(20.0));
178
179 fms.set_flight_planning(builder)?;
180
181 println!("{}", fms.print(40));
182
183 Ok(())
184}pub fn landing_perf(&mut self, perf: TakeoffLandingPerformance) -> &mut Self
pub fn landing_factors(&mut self, factors: AlteringFactors) -> &mut Self
pub fn destination_rwycc(&mut self, rwycc: RunwayConditionCode) -> &mut Self
pub fn destination_wind(&mut self, wind: Wind) -> &mut Self
pub fn destination_temperature(&mut self, temperature: Temperature) -> &mut Self
Trait Implementations§
Source§impl Clone for FlightPlanningBuilder
impl Clone for FlightPlanningBuilder
Source§fn clone(&self) -> FlightPlanningBuilder
fn clone(&self) -> FlightPlanningBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FlightPlanningBuilder
impl Debug for FlightPlanningBuilder
Source§impl Default for FlightPlanningBuilder
impl Default for FlightPlanningBuilder
Source§fn default() -> FlightPlanningBuilder
fn default() -> FlightPlanningBuilder
Returns the “default value” for a type. Read more
Source§impl PartialEq for FlightPlanningBuilder
impl PartialEq for FlightPlanningBuilder
impl StructuralPartialEq for FlightPlanningBuilder
Auto Trait Implementations§
impl Freeze for FlightPlanningBuilder
impl RefUnwindSafe for FlightPlanningBuilder
impl Send for FlightPlanningBuilder
impl Sync for FlightPlanningBuilder
impl Unpin for FlightPlanningBuilder
impl UnsafeUnpin for FlightPlanningBuilder
impl UnwindSafe for FlightPlanningBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more