judo ~
/
Assignment2
yolo
Fork of Assignment2 by
Diff: PaceHeart.cpp
- Revision:
- 6:9b8fee13549c
- Parent:
- 5:45d58f8a5912
--- a/PaceHeart.cpp Mon Nov 14 21:36:01 2016 +0000 +++ b/PaceHeart.cpp Mon Nov 14 22:47:00 2016 +0000 @@ -11,8 +11,8 @@ p_pacingMode = 0; int p_hysteresis = 0; int p_hysteresisInterval = 300; - int lowrateInterval = 1000; - int uprateInterval = 500; //upper rate limit + double p_lowrateInterval = 1000.0; + double p_uprateInterval = 500.0; //upper rate limit //Ventricle double p_vPaceAmp = 3500.0; double p_vPaceWidth = 0.4; @@ -26,18 +26,18 @@ PaceHeart::PaceHeart(int mode){ p_pacingState = 0; p_pacingMode = mode; - int lowrateInterval = 1000; //30-50->5 50-90->1 90-175->5 ppm - int uprateInterval = 500; //upper rate limit 50-175->5 ppm - int maxSensorRate = 500; //50-175->5 ppm + double p_lowrateInterval = 1000.0; //30-50->5 50-90->1 90-175->5 ppm + double p_uprateInterval = 2000.0; //upper rate limit 50-175->5 ppm + double p_maxSensorRate = 2000.0; //50-175->5 ppm //Ventricle double p_vPaceAmp = 3750.0; //3750 can change to 0, 1250, 2500, 3750, 5000 double p_vPaceWidth = 0.4; //0.05->no change 0.1-1.9 0.1 int p_activityThresh = 4; //1-7 print out string with level ie. Med - int p_reactionTime = 30; //10-50->10 + int p_reactionTime = 30; //10-50->10 seconds int p_responseFactor = 8; //1-16->1 - int p_recoveryTime = 5; //2-16->1 + int p_recoveryTime = 5; //2-16->1 minutes } int PaceHeart::get_p_pacingState() { @@ -65,22 +65,67 @@ p_hysteresisInterval = x; return; } -int PaceHeart::get_lowrateInterval() +double PaceHeart::get_p_lowrateInterval() { - return lowrateInterval; + return p_lowrateInterval; } -void PaceHeart::set_lowrateInterval(int x) +void PaceHeart::set_p_lowrateInterval(double x) { - lowrateInterval = x; + if (p_pacingmode == 1) { + + if (x >= 500 && x < 833.33) { + p_lowrateInterval = x+83.33; + } + else if (x >= 833.33 && x < 1000) { + p_lowrateInterval = x+16.67; + } + else if (x >= 1000 && x < 1500) { + p_lowrateInterval = x-16.67; + } + else if (x >= 1500 && x < 2916.67) { + p_lowrateInterval = x-83.33; + } + } + else { + p_lowrateInterval = x; + } return; } -int PaceHeart::get_uprateInterval() +double PaceHeart::get_p_uprateInterval() { - return uprateInterval; + return p_uprateInterval; } -void PaceHeart::set_uprateInterval(int x) +void PaceHeart::set_p_uprateInterval(double x) { - uprateInterval = x; + if (p_pacingmode == 1) { + if (x >= 833.33 && x < 2000) { + p_uprateInterval = x+83.33; + } + else if (x >= 2000 && x <= 2916.67) { + p_uprateInterval = x-83.33; + } + } + else { + p_uprateInterval = x; + } + return; +} +double PaceHeart::get_p_maxSensorRate(){ + return +} +void PaceHeart::set_p_maxSensorRate(double x) +{ + if (p_pacingmode == 1) { + if (x >= 833.33 && x < 2000) { + p_maxSensorRate = x+83.33; + } + else if (x >= 2000 && x <= 2916.67) { + p_maxSensorRate = x-83.33; + } + } + else { + p_maxSensorRate = x; + } return; } //Ventricle @@ -201,38 +246,38 @@ pace(mode); return; } -int PaceHeart::get_activityThresh() +int PaceHeart::get_p_activityThresh() { return p_activityThresh; } -int PaceHeart::get_reactionTime() +int PaceHeart::get_p_reactionTime() { return p_reactionTime; } -int PaceHeart::get_responseFactor() +int PaceHeart::get_p_responseFactor() { return p_responseFactor; } -int PaceHeart::get_recoveryTime() +int PaceHeart::get_p_recoveryTime() { return p_recoveryTime; } -void PaceHeart::set_activityThresh(int x) +void PaceHeart::set_p_activityThresh(int x) { p_activityThresh=x; return; } -void PaceHeart::set_reactionTime(int x) +void PaceHeart::set_p_reactionTime(int x) { p_reactionTime=x; return; } -void PaceHeart::set_responseFactor(int x) +void PaceHeart::set_p_responseFactor(int x) { p_responseFactor=x; return; } -void PaceHeart::set_recoveryTime(int x) +void PaceHeart::set_p_recoveryTime(int x) { p_recoveryTime=x; return;