Pioneer
Loading...
Searching...
No Matches
PrecalcPath.h
Go to the documentation of this file.
1// Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3
4#pragma once
5
7 // initial ship and path params
8 double Stotal; // total path length, m
9 double V0; // velocity at start, m/s
10 double EV; // effective exhaust velocity, m/s
11 double F; // main (forward) thruster force , N
12 double acap; // acceleration limit (forward), m/m^2
13 double mass; // whole ship mass (including fuel equipment...) , kg
14 double fuel; // fuel mass, kg
15 double margin; // breaking reserve, koefficient
16
17 // current point params - defined after setTime or setDist
18 double m_S; // distance already travelled
19 double m_time; // current time
20 double m_V; // velocity at this point, m/s^2
21 double m_fuel; // remaining fuel at this point, kg
22 int m_state; // -1: deccelerating, 0: free flight, 1: accelerating
23
24 // whole path params - defined after constructor
25 double m_S1; // acceleration length
26 double m_S2; // deccleration length
27 double m_t1; // acceleration time
28 double m_t2; // decceleration time
29 double m_Vmax; // max velocity
30 double m_m1; // mass after acceleration
31
32 // also
33 double m_eps = 1; // presicion for iteration function, in result value units
34
35public:
37 double Stotal,
38 double V0,
39 double EV,
40 double F,
41 double acap,
42 double mass,
43 double fuel,
44 double margin);
45
46 // this function is available after the constructor
47 double getFullTime() const { return m_t1 + m_t2 + (Stotal - m_S1 - m_S2) / m_Vmax; }
48
49 // get current point params
50 double getEstimate() const { return getFullTime() - m_time; }
51 double getVel() const { return m_V; }
52 double getMass() const { return mass - fuel + m_fuel; }
53 double getDist() const { return m_S; }
54 double getVmax() const { return m_Vmax; }
55 int getState() const { return m_state; }
56
57 // set current point of path
58 // by ratio (0.0 .. 1.0) of path completion (in distance)
59 void setSRatio(double ratio) { setDist(Stotal * ratio); }
60 // by ratio (0.0 .. 1.0) of path completion (in time)
61 void setTRatio(double ratio) { setTime(getFullTime() * ratio); }
62 // by distance from start of path
63 void setDist(double S);
64 // by time from start
65 void setTime(double t);
66};
Definition PrecalcPath.h:6
double getDist() const
Definition PrecalcPath.h:53
double getFullTime() const
Definition PrecalcPath.h:47
void setTime(double t)
Definition PrecalcPath.cpp:335
double getVel() const
Definition PrecalcPath.h:51
double getEstimate() const
Definition PrecalcPath.h:50
void setDist(double S)
Definition PrecalcPath.cpp:306
void setSRatio(double ratio)
Definition PrecalcPath.h:59
void setTRatio(double ratio)
Definition PrecalcPath.h:61
int getState() const
Definition PrecalcPath.h:55
double getVmax() const
Definition PrecalcPath.h:54
double getMass() const
Definition PrecalcPath.h:52
Definition msvc_bug.cpp:29