private double GetPPD(TimeSpan frameTime, TimeSpan eftByDownloadTime, TimeSpan eftByFrameTime, SlotStatus status, BonusCalculationType calculateBonus) { if (CurrentProtein.IsUnknown) { return(0); } // Issue 125 if (calculateBonus.Equals(BonusCalculationType.DownloadTime)) { // Issue 183 if (status.Equals(SlotStatus.RunningAsync) || status.Equals(SlotStatus.RunningNoFrameTimes)) { return(ProductionCalculator.GetPPD(frameTime, CurrentProtein, eftByFrameTime)); } return(ProductionCalculator.GetPPD(frameTime, CurrentProtein, eftByDownloadTime)); } if (calculateBonus.Equals(BonusCalculationType.FrameTime)) { return(ProductionCalculator.GetPPD(frameTime, CurrentProtein, eftByFrameTime)); } return(ProductionCalculator.GetPPD(frameTime, CurrentProtein)); }
/// <summary> /// Handles the Client Status Returned by Log Parsing and then determines what values to feed the DetermineStatus routine. /// </summary> private void HandleReturnedStatus(SlotStatus returnedStatus, SlotModel slot) { var statusData = new LegacyClientStatusData { ClientName = Settings.Name, SlotType = slot.UnitInfoModel.UnitInfoData.SlotType, UnitRetrievalTime = slot.UnitInfoModel.UnitInfoData.UnitRetrievalTime, UtcOffsetIsZero = Settings.UtcOffsetIsZero, UtcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now), ClientTimeOffset = Settings.ClientTimeOffset, TimeOfLastUnitStart = slot.TimeOfLastUnitStart, TimeOfLastFrameProgress = slot.TimeOfLastFrameProgress, CurrentStatus = slot.Status, ReturnedStatus = returnedStatus, FrameTime = slot.UnitInfoModel.GetRawTime(Prefs.Get <PpdCalculationType>(Preference.PpdCalculation)), BenchmarkAverageFrameTime = GetBenchmarkAverageFrameTimeOrDefault(slot.UnitInfo), TimeOfLastFrame = slot.UnitInfoModel.UnitInfoData.CurrentFrame == null ? TimeSpan.Zero : slot.UnitInfoModel.UnitInfoData.CurrentFrame.TimeOfFrame, UnitStartTimeStamp = slot.UnitInfoModel.UnitInfoData.UnitStartTimeStamp, AllowRunningAsync = Prefs.Get <bool>(Preference.AllowRunningAsync) }; SlotStatus computedStatus = LegacyClientStatus.GetSlotStatus(statusData, Logger); // If the returned status is EuePause and current status is not if (computedStatus.Equals(SlotStatus.EuePause) && statusData.CurrentStatus.Equals(SlotStatus.EuePause) == false) { if (Prefs.Get <bool>(Preference.EmailReportingEnabled) && Prefs.Get <bool>(Preference.ReportEuePause)) { SendEuePauseEmail(statusData.ClientName); } } // If the returned status is Hung and current status is not if (computedStatus.Equals(SlotStatus.Hung) && statusData.CurrentStatus.Equals(SlotStatus.Hung) == false) { if (Prefs.Get <bool>(Preference.EmailReportingEnabled) && Prefs.Get <bool>(Preference.ReportHung)) { SendHungEmail(statusData.ClientName); } } slot.Status = computedStatus; }
public void ShowPPDTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType bonusCalculationType) { // test the level if (!logger.IsDebugEnabled) { return; } if (CurrentProtein.IsUnknown) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Protein is unknown... 0 PPD."); return; } // Issue 125 if (bonusCalculationType == BonusCalculationType.DownloadTime) { // Issue 183 if (status.Equals(SlotStatus.RunningAsync) || status.Equals(SlotStatus.RunningNoFrameTimes)) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Download Time."); } } else if (bonusCalculationType == BonusCalculationType.FrameTime) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD."); } TimeSpan frameTime = GetFrameTime(calculationType); var values = ProductionCalculator.GetProductionValues(frameTime, CurrentProtein, GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime)); logger.DebugFormat(" - {0}", UnitInfoData.ToProjectString()); logger.Debug(values.ToMultiLineString()); }
private double GetPPD(TimeSpan frameTime, TimeSpan eftByDownloadTime, TimeSpan eftByFrameTime, SlotStatus status, BonusCalculationType calculateBonus) { if (CurrentProtein.IsUnknown()) { return 0; } // Issue 125 if (calculateBonus.Equals(BonusCalculationType.DownloadTime)) { // Issue 183 if (status.Equals(SlotStatus.RunningAsync) || status.Equals(SlotStatus.RunningNoFrameTimes)) { return CurrentProtein.GetPPD(frameTime, eftByFrameTime, true); } return CurrentProtein.GetPPD(frameTime, eftByDownloadTime, true); } if (calculateBonus.Equals(BonusCalculationType.FrameTime)) { return CurrentProtein.GetPPD(frameTime, eftByFrameTime, true); } return CurrentProtein.GetPPD(frameTime); }
public void ShowPPDTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType calculateBonus) { // test the level if (!logger.IsDebugEnabled) return; if (CurrentProtein.IsUnknown()) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Protein is unknown... 0 PPD."); return; } // Issue 125 if (calculateBonus.Equals(BonusCalculationType.DownloadTime)) { // Issue 183 if (status.Equals(SlotStatus.RunningAsync) || status.Equals(SlotStatus.RunningNoFrameTimes)) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Download Time."); } } else if (calculateBonus.Equals(BonusCalculationType.FrameTime)) { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time."); } else { logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD."); } TimeSpan frameTime = GetFrameTime(calculationType); var values = CurrentProtein.GetProductionValues(frameTime, GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime), calculateBonus.IsEnabled()); logger.Debug(values.ToMultiLineString()); }