From e7e6bdf968afb17ddbbbdb88128ab0b97f47f7e2 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 22 Nov 2013 21:59:29 +0000 Subject: [PATCH] Better CP model defaults Improved defaults for CP model to derive CP and W' from bests data. --- src/CriticalPowerWindow.cpp | 33 ++++++++++++++++++++++++++++++++- src/CriticalPowerWindow.h | 3 ++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/CriticalPowerWindow.cpp b/src/CriticalPowerWindow.cpp index 0a58466c0..6f78b98f2 100644 --- a/src/CriticalPowerWindow.cpp +++ b/src/CriticalPowerWindow.cpp @@ -250,7 +250,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo connect(context, SIGNAL(configChanged()), cpintPlot, SLOT(configChanged())); // model updated? - connect(modelCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(modelParametersChanged())); + connect(modelCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(modelChanged())); connect(anI1SpinBox, SIGNAL(valueChanged(double)), this, SLOT(modelParametersChanged())); connect(anI2SpinBox, SIGNAL(valueChanged(double)), this, SLOT(modelParametersChanged())); connect(aeI1SpinBox, SIGNAL(valueChanged(double)), this, SLOT(modelParametersChanged())); @@ -271,6 +271,37 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo modelParametersChanged(); } +void +CriticalPowerWindow::modelChanged() +{ + // we changed from/to a 2 or 3 parameter model + // so lets set some semsible defaults, these are + // based on advice from our exercise physiologist friends + // for best results in predicting both W' and CP and providing + // a reasonable fit for durations < 2mins. + + switch (modelCombo->currentIndex()) { + + case 0 : // 2 param model + anI1SpinBox->setValue(180); + anI2SpinBox->setValue(3600); + aeI1SpinBox->setValue(1800); + aeI2SpinBox->setValue(3600); + break; + + case 1 : // 3 param model + + anI1SpinBox->setValue(1800); + anI2SpinBox->setValue(2400); + aeI1SpinBox->setValue(2400); + aeI2SpinBox->setValue(3600); + break; + } + + // update the plot. + modelParametersChanged(); +} + void CriticalPowerWindow::modelParametersChanged() { diff --git a/src/CriticalPowerWindow.h b/src/CriticalPowerWindow.h index 67de92659..f2f8576d7 100644 --- a/src/CriticalPowerWindow.h +++ b/src/CriticalPowerWindow.h @@ -157,7 +157,8 @@ class CriticalPowerWindow : public GcChartWindow void useThruToday(); void refreshRideSaved(); - void modelParametersChanged(); // we changed the model type or intervals + void modelParametersChanged(); // we changed the intervals + void modelChanged(); // we changed the model type private: void updateCpint(double minutes);