\( \def\bold#1{\bf #1} \newcommand{\d}{\mathrm{d}} \) BTP: Manual and Source Code Documentation

Power Uphill

bike mass [kg]
body mass [kg]
altitude gain [m]
climb length [km]
gradient [%]
time [s]
speed [km/h]
power [W]
power/mass [W/kg]
climbrate [m/min]

average power on climb stage

BTP  3.0
Routing/ClimbAnalysis/PowerCalculation
poweranalysis.h
1 #ifndef POWERANALYSIS_H
2 #define POWERANALYSIS_H
3 
4 #include "track.h"
5 #include "MathExt.h"
6 #include <QtWidgets/QLabel>
7 #include <QtWidgets/QLineEdit>
8 #include <QtWidgets/QPushButton>
9 #include <QtWidgets/QCheckBox>
10 #include <QtWidgets/QMessageBox>
11 #include <QtWidgets/QLayout>
12 #include <QtWidgets/QSlider>
13 #include "plot2D.h"
14 #include "btp3setups.h"
15 #include <QtWidgets/QPlainTextEdit>
16 
18 class Inputs : public QWidget{
19  Q_OBJECT
20 public:
22  Inputs(QString labeltext,double min, double max, double* v);
23 public slots:
24  void refresh();
25 private slots:
26  void slidertoedit();
27  void sliderpreview(int i);
28  void checkedit(QString newedit);
29 signals:
30  void changed();
31 private:
32  QLabel* label;
33  QSlider* slider;
34  double smin, smax,*v;
35  QLineEdit* edit;
36 };
37 
39 class WindLabel : public QWidget{
40  Q_OBJECT
41 public:
42  WindLabel(double *ws, double *wd);
43  void set_para(double *ws, double *wd);
44  void paintEvent(QPaintEvent *);
45  void resizeEvent(QResizeEvent *);
46  void mouseReleaseEvent(QMouseEvent *event);
47 signals:
48  void clicked();
49 public slots:
50  void refresh();
51 private:
52  void refresh_pixmap();
53  QPixmap pm;
54  double* ws, *wd;
55 };
56 
58 
76 class PowerAnalysis:public QWidget{
77  Q_OBJECT
78 public:
79  PowerAnalysis();
81  ~PowerAnalysis();
82  void init();
86  void calc_track(Track* t);
88  void calc_track(Track* t,double* timed, double* time, int count);
89  int isready();
90  double** get_vdata();
91  double** get_Pdata();
92  int get_datacount();
93  double get_t(double d);
94  double get_v(double d);
95  double get_P();
96  double get_v();
97  double get_P(double d);
98  double get_v(double dmin, double dmax);
101  double get_P(double dmin, double dmax);
102 signals:
103  void recalced();
104 private slots:
105  void set_default_refresh();
106  void draw_Pv();
107  void draw_cwAv();
108  void update_Pvl(double v);
109  void update_cwAl(double v);
110  void show_slopespeed_table();
111  double bft_to_mpros();
112  void recalc();
113 
126  void toggle_fightwind();
128 
135  void toggle_timestamp();
136 private:
138  double vmax(double slope, double direction);
140  double veff(double v, double direction);
142  double rho(double h);
144  double T(double h);
146  double P(double v);
148  double P(double v,double slope, double direction, double rho0);
150  double cwA(double v);
151  double vwind;
152  void track_to_data(Track* t);
153  void calc_power();
154  //user interface content
156  QCheckBox fwcb;
157  Inputs* ip[15];
163  QLabel Pvl,cwAvl;
164  QPushButton bdefault;
165  QPushButton brecalc;
166  QPushButton btoggletimestamp;
167  double* plotdata[2];
168  ProfilSettings pfs;
169  QPlainTextEdit textbox;
170 
182  double* d[9],ds,Ebrake,Eout,*Pdata[2],*vdata[2];
183  int count;
185 };
186 
187 #endif // POWERANALYSIS_H
double get_P()
return average power
void track_to_data(Track *t)
extracs calculation data
double ** get_vdata()
returns data array pointer
double ** get_Pdata()
returns data array pointer
void slidertoedit()
apply slider value to edit and v
double vwind
wind velocity
double * plotdata[2]
container to collect plotting data
plot2D Pv
user defined power output
double rho(double h)
physics: air pressure dependend from height (barometric formula)
void update_cwAl(double v)
update info label
int get_datacount()
returns data array length
void checkedit(QString newedit)
check if user input is a float
double cwA(double v)
velocity depend cwA value, parametrised with fermi function
void update_Pvl(double v)
update info label
void set_default_refresh()
reset PowerAnalysisSetting s
setting for poweranalysis
Definition: DataTyps.h:6
double * v
define data range
Definition: poweranalysis.h:34
plot2D cwAv
user defined cwA value
double get_v()
return average velocity
void recalced()
informs about finished calculation
void sliderpreview(int i)
set edit text from slider value
combined input widget to serve text edit and slider at once
Definition: poweranalysis.h:18
void draw_Pv()
draw P(v) distriubtion
double vmax(double slope, double direction)
physics: calculate the resulting velocity from P(v) at specific slope
define wind strength and direction by clicking a wind rose picture
Definition: poweranalysis.h:39
setting for 2D plot
Definition: DataTyps.h:196
official representation of Track in BTP3
Definition: track.h:14
double bft_to_mpros()
wind speed in m/s from beaufort
double * d[9]
plotting 2D-Data sets as the height profile of a track or poweranalysis data
Definition: plot2D.h:20
double T(double h)
physics: temperature from height with 0.7 K/100m temperature decrease
void set_default(PowerAnalysisSetting *s)
apply default setting to the PowerAnalysisSetting s
void toggle_timestamp()
makes poweranalysis ignoring or subordinate time stamp
void refresh()
set edit text to v-value
double P(double v)
velocity depend output power, parametrised with fermi function
QLabel cwAvl
plot2d info area
WindLabel * wl
wind visualization
QCheckBox fwcb
fight wind checkbox
Inputs * ip[15]
user interface
Inputs(QString labeltext, double min, double max, double *v)
create widget with data range [min,max] and data reference v
void calc_power()
execute the calculation
double get_t(double d)
interpolate time in data
power calculation for height-distance datasets
Definition: poweranalysis.h:76
void draw_cwAv()
draw cwA(v) distriubtion
bool timeexisting
is time data existing?
int count
data array length
int isready()
returns whether data is loaded
PowerAnalysisSetting * s
assigned settings to be used
PowerAnalysisSetting s0
intrinsic settings
void calc_track(Track *t)
calc power from P(v) distribution
void toggle_fightwind()
switch wind handling in fightwind of PowerAnalysisSetting
double veff(double v, double direction)
physics: total air speed from movement speed v and wind
plot2D Pt
calculated power-time distriubtion