Added gender
This commit is contained in:
@@ -11,38 +11,57 @@ namespace ErgometerApplication
|
|||||||
private int weight;
|
private int weight;
|
||||||
private int length;
|
private int length;
|
||||||
private int age;
|
private int age;
|
||||||
|
private char gender;
|
||||||
|
|
||||||
private enum state {WARMUP, WORKLOAD1, WORKLOAD2, WORKLOAD3, WORKLOAD4, COOLINGDOWN};
|
private enum state {WARMUP, WORKLOAD, COOLINGDOWN};
|
||||||
private state currentstate;
|
private state currentstate;
|
||||||
private int stateStarted;
|
private int stateStarted;
|
||||||
|
|
||||||
public ErgometerTest(int weight, int length , int age)
|
public ErgometerTest(int weight, int length , int age, char gender)
|
||||||
{
|
{
|
||||||
this.weight = weight;
|
this.weight = weight;
|
||||||
this.length = length;
|
this.length = length;
|
||||||
this.age = age;
|
this.age = age;
|
||||||
this.currentstate = state.WARMUP;
|
this.gender = gender;
|
||||||
|
currentstate = state.WARMUP;
|
||||||
stateStarted = 0;
|
stateStarted = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double CalculateMaximumHeartRate()
|
|
||||||
{
|
|
||||||
return 208 - (0.7 * age);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void timerTick()
|
public void timerTick()
|
||||||
{
|
{
|
||||||
if(currentstate == state.WARMUP)
|
switch(currentstate)
|
||||||
{
|
{
|
||||||
if (MainClient.Metingen.Last().Seconds > 30)
|
case state.WARMUP:
|
||||||
{
|
if (MainClient.Metingen.Last().Seconds > 30)
|
||||||
List<ErgometerLibrary.Meting> last10 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 10, 10);
|
{
|
||||||
int max = FindMaxValue(MainClient.Metingen, x => x.HeartBeat);
|
List<ErgometerLibrary.Meting> last10 = MainClient.Metingen.GetRange(MainClient.Metingen.Count - 10, 10);
|
||||||
int min = FindMaxValue(MainClient.Metingen, x => x.HeartBeat);
|
int max = FindMaxValue(MainClient.Metingen, x => x.HeartBeat);
|
||||||
};
|
int min = FindMaxValue(MainClient.Metingen, x => x.HeartBeat);
|
||||||
|
if(max - min > 20) //Hartslag niet stabiel
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentstate = state.WORKLOAD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case state.WORKLOAD:
|
||||||
|
break;
|
||||||
|
case state.COOLINGDOWN:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// HELPER FUNCTIONS //
|
||||||
|
|
||||||
|
private double CalculateMaximumHeartRate()
|
||||||
|
{
|
||||||
|
return 208 - (0.7 * age);
|
||||||
|
}
|
||||||
|
|
||||||
public int FindMaxValue<T>(List<T> list, Converter<T, int> projection)
|
public int FindMaxValue<T>(List<T> list, Converter<T, int> projection)
|
||||||
{
|
{
|
||||||
if (list.Count == 0)
|
if (list.Count == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user