public static ExerciseSet Create(ContractionType type) { switch (type) { case ContractionType.Dynamic: return(new DynamicExerciseSet { Reps = 1 }); case ContractionType.Isometric: return(new IsometricExerciseSet { Duration = TimeSpan.FromSeconds(1) }); default: throw new ArgumentException($"Invalid contraction type: {type}"); } }
//Calculations done for each Sample public virtual void DataSampleCalculations() { powerArray.Add(FeedbackPower); totalTimeSeconds = Convert.ToDouble((DateTime.Now - StartTime).TotalMilliseconds) / 1000; timeArray.Add(totalTimeSeconds); cadenceArray.Add(FeedbackSpeed); angleArray.Add(FeedbackAngle1); EcceSpeedArray.Add(FeedbackSpeed); EcceSpeedArray.Add(FeedbackSpeed); ConcSpeedArray.Add(FeedbackSpeed); ConcSpeedArray.Add(FeedbackSpeed); if (FeedbackTorque >= 0) { EcceTorque = FeedbackTorque; ConcTorque = 0; } else { EcceTorque = 0; ConcTorque = -FeedbackTorque; } //if (FeedbackTorque > 0 && FeedbackAngle1 >= 0 && FeedbackAngle1 <= 180) //{ // EcceTorqueBack = FeedbackTorque; // ConcTorqueBack = 0; // EcceTorque = 0; // ConcTorque = 0; //} //else if (FeedbackTorque > 0 && FeedbackAngle1 > 180 && FeedbackAngle1 < 360) //{ // EcceTorqueBack = 0; // ConcTorqueBack = 0; // EcceTorque = FeedbackTorque; // ConcTorque = 0; //} //else if (FeedbackTorque < 0 && FeedbackAngle1 >= 0 && FeedbackAngle1 <= 180) //{ // EcceTorqueBack = 0; // ConcTorqueBack = 0; // EcceTorque = 0; // ConcTorque = FeedbackTorque; //} //else if (FeedbackTorque < 0 && FeedbackAngle1 > 180 && FeedbackAngle1 < 360) //{ // EcceTorqueBack = 0; // ConcTorqueBack = FeedbackTorque; // EcceTorque = 0; // ConcTorque = 0; //} //else //{ // EcceTorqueBack = 0; // ConcTorqueBack = 0; // EcceTorque = 0; // ConcTorque = 0; ; //} #region If Direction is Forwards if (FeedbackTorque >= 0) //Eccentric { if (Math.Abs(FeedbackTorque) >= MaxEcceTorque) MaxEcceTorque = FeedbackTorque; CoreContractionFlag = ContractionType.Eccentric; if (CapturePowerFlag) CaptureAvgEcceTorqueArray.Add(FeedbackTorque); AvgEcceTorqueArray.Add(FeedbackTorque); AvgConcTorqueArray.Add(0); } else if (FeedbackTorque < 0) //Concentric { if (Math.Abs(FeedbackTorque) >= MaxConcTorque) MaxConcTorque = Math.Abs(FeedbackTorque); CoreContractionFlag = ContractionType.Concentric; if (CapturePowerFlag) CaptureAvgConcTorqueArray.Add(Math.Abs(FeedbackTorque)); AvgConcTorqueArray.Add(Math.Abs(FeedbackTorque)); AvgEcceTorqueArray.Add(0); } if (FeedbackTorque < 0) //Concentic Power { ForwardsConcentricPowerArray.Add(FeedbackPower); } #endregion #region Cycle Calculations if (FeedbackAngle1 >= 0 && FeedbackAngle1 <= 20) CounterTrigger = true; else if (FeedbackAngle1 >= 340 && FeedbackAngle1 <= 360) { if (CounterTrigger == true) { CounterTrigger = false; CycleCounter++; } } #endregion #region Energy Burned Calculations //Calculate Calories Burned incCalories = FeedbackPower * ((double)SampleElapsedTime / 1000) / 1000; //incremental Energy in kJ TotalEnergyBurned = TotalEnergyBurned + incCalories; #endregion }