Example #1
0
        private void TimerTick(object sender, EventArgs e)
        {
            ActualVoltageTxt.Text = String.Format(string.Format("{0:0.00}", ChargerService.ActualVoltage));
            ActualCurrentTxt.Text = String.Format(string.Format("{0:0.00}", ChargerService.ActualCurrent));

            // Ensures that the user does not select a value less than the voltage of the pack
            if (!ChargerService.IsCommsOk)
            {
                Comms_Ok.ForeColor = Color.Red;
            }
            else
            {
                Comms_Ok.ForeColor = Color.Green;
            }
            if (!ChargerService.IsACOk)
            {
                AC_Ok.ForeColor = Color.Red;
            }
            else
            {
                AC_Ok.ForeColor = Color.Green;
            }
            if (!ChargerService.IsDCOk)
            {
                DC_Ok.ForeColor = Color.Red;
            }
            else
            {
                DC_Ok.ForeColor = Color.Green;
            }
            if (!ChargerService.IsTempOk)
            {
                Temp_Ok.ForeColor = Color.Red;
            }
            else
            {
                Temp_Ok.ForeColor = Color.Green;
            }
            if (!ChargerService.IsHardwareOk)
            {
                HW_Ok.ForeColor = Color.Red;
            }
            else
            {
                HW_Ok.ForeColor = Color.Green;
            }

            chargerStatusLabel.Text              = "Charger - " + CanReceivingNode.GetStatusText(ChargerService.State);
            chargerStatusLabel.ToolTipText       = ChargerService.StateMessage;
            chargerStatusLabel.BackColor         = CanReceivingNode.GetStatusColour(ChargerService.State);
            dischargerStripStatusLabel.Text      = "Contactor - " + CanReceivingNode.GetStatusText(ContactorService.Instance.State);
            dischargerStripStatusLabel.BackColor = CanReceivingNode.GetStatusColour(ContactorService.Instance.State);
            chargerStatusLabel.ToolTipText       = ContactorService.Instance.StateMessage;

            UpdateStartStopDetails();
        }
Example #2
0
        private void TimerTick(object sender, EventArgs e)
        {
            Battery battery = BatteryChargeService.Instance.BatteryService.BatteryData;

            SOCText.Text                   = (battery.SOCPercentage * 100).ToString() + "%";
            BatteryPackMaTxt.Text          = battery.BatteryCurrent.ToString();
            BatteryPackMvTxt.Text          = battery.BatteryVoltage.ToString();
            BatteryCellMinMvTxt.Text       = battery.MinCellVoltage.ToString();
            BatteryCellMaxMvTxt.Text       = battery.MaxCellVoltage.ToString();
            BatteryMinCTxt.Text            = (battery.MinCellTemp / 10).ToString();
            BatteryMaxCTxt.Text            = (battery.MaxCellTemp / 10).ToString();
            BatteryBalancePositiveTxt.Text = battery.BalanceVoltageThresholdRising.ToString();
            BatteryBalanceNegativeTxt.Text = battery.BalanceVoltageThresholdFalling.ToString();

            ActualVoltageTxt.Text = String.Format(string.Format("{0:0.00}", BatteryChargeService.Instance.ChargerActualVoltage));
            ActualCurrentTxt.Text = String.Format(string.Format("{0:0.00}", BatteryChargeService.Instance.ChargerActualCurrent));

            // Ensures that the user does not select a value less than the voltage of the pack
            double estimatedBatteryVoltage = battery.EstimatePackVoltageFromCMUs / 1000;

            if (battery.BatteryVoltage / 1000 > estimatedBatteryVoltage)
            {
                estimatedBatteryVoltage = battery.BatteryVoltage / 1000;
            }
            if (BatteryChargeService.Instance.ChargerActualVoltage > estimatedBatteryVoltage)
            {
                estimatedBatteryVoltage = BatteryChargeService.Instance.ChargerActualVoltage;
            }

            double roundedUpVoltage = Math.Ceiling(estimatedBatteryVoltage);

            if (roundedUpVoltage > 0 && float.Parse(RequestedChargeVoltage.Value.ToString()) < roundedUpVoltage)
            {
                RequestedChargeVoltage.Value = (decimal)roundedUpVoltage;
            }

            RequestedChargeVoltage.Minimum = (decimal)roundedUpVoltage;

            if (!BatteryChargeService.Instance.IsCommsOk)
            {
                Comms_Ok.ForeColor = Color.Red;
            }
            else
            {
                Comms_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsACOk)
            {
                AC_Ok.ForeColor = Color.Red;
            }
            else
            {
                AC_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsDCOk)
            {
                DC_Ok.ForeColor = Color.Red;
            }
            else
            {
                DC_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsTempOk)
            {
                Temp_Ok.ForeColor = Color.Red;
            }
            else
            {
                Temp_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsHardwareOk)
            {
                HW_Ok.ForeColor = Color.Red;
            }
            else
            {
                HW_Ok.ForeColor = Color.Green;
            }

            batteryStatusLabel.Text              = "Battery - " + CanReceivingNode.GetStatusText(BatteryChargeService.Instance.BatteryState);
            batteryStatusLabel.ToolTipText       = BatteryChargeService.Instance.BatteryStateMessage;
            batteryStatusLabel.BackColor         = CanReceivingNode.GetStatusColour(BatteryChargeService.Instance.BatteryState);
            chargerStatusLabel.Text              = "Charger - " + CanReceivingNode.GetStatusText(BatteryChargeService.Instance.ChargerState);
            chargerStatusLabel.ToolTipText       = BatteryChargeService.Instance.ChargerStateMessage;
            chargerStatusLabel.BackColor         = CanReceivingNode.GetStatusColour(BatteryChargeService.Instance.ChargerState);
            dischargerStripStatusLabel.Text      = "Discharger - " + CanReceivingNode.GetStatusText(BatteryDischargeService.Instance.DischargerState);
            dischargerStripStatusLabel.BackColor = CanReceivingNode.GetStatusColour(BatteryDischargeService.Instance.DischargerState);
            chargerStatusLabel.ToolTipText       = BatteryDischargeService.Instance.DischargerStateMessage;

            UpdateStartStopDetails();
        }
        private void TimerTick(object sender, EventArgs e)
        {
            Battery battery = BatteryChargeService.Instance.BatteryService.BatteryData;

            SOCText.Text                   = (battery.SOCPercentage * 100).ToString() + "%";
            BatteryPackMaTxt.Text          = battery.BatteryCurrent.ToString();
            BatteryPackMvTxt.Text          = battery.BatteryVoltage.ToString();
            BatteryCellMinMvTxt.Text       = battery.MinCellVoltage.ToString();
            BatteryCellMaxMvTxt.Text       = battery.MaxCellVoltage.ToString();
            BatteryMinCTxt.Text            = (battery.MinCellTemp / 10).ToString();
            BatteryMaxCTxt.Text            = (battery.MaxCellTemp / 10).ToString();
            BatteryBalancePositiveTxt.Text = battery.BalanceVoltageThresholdRising.ToString();
            BatteryBalanceNegativeTxt.Text = battery.BalanceVoltageThresholdFalling.ToString();

            ActualVoltageTxt.Text = String.Format(string.Format("{0:0.00}", BatteryChargeService.Instance.ChargerActualVoltage));
            ActualCurrentTxt.Text = String.Format(string.Format("{0:0.00}", BatteryChargeService.Instance.ChargerActualCurrent));

            if (!BatteryChargeService.Instance.IsCommsOk)
            {
                Comms_Ok.ForeColor = Color.Red;
            }
            else
            {
                Comms_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsACOk)
            {
                AC_Ok.ForeColor = Color.Red;
            }
            else
            {
                AC_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsDCOk)
            {
                DC_Ok.ForeColor = Color.Red;
            }
            else
            {
                DC_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsTempOk)
            {
                Temp_Ok.ForeColor = Color.Red;
            }
            else
            {
                Temp_Ok.ForeColor = Color.Green;
            }
            if (!BatteryChargeService.Instance.IsHardwareOk)
            {
                HW_Ok.ForeColor = Color.Red;
            }
            else
            {
                HW_Ok.ForeColor = Color.Green;
            }

            batteryStatusLabel.Text              = "Battery - " + CanReceivingNode.GetStatusText(BatteryChargeService.Instance.BatteryState);
            batteryStatusLabel.ToolTipText       = BatteryChargeService.Instance.BatteryStateMessage;
            batteryStatusLabel.BackColor         = CanReceivingNode.GetStatusColour(BatteryChargeService.Instance.BatteryState);
            chargerStatusLabel.Text              = "Charger - " + CanReceivingNode.GetStatusText(BatteryChargeService.Instance.ChargerState);
            chargerStatusLabel.ToolTipText       = BatteryChargeService.Instance.ChargerStateMessage;
            chargerStatusLabel.BackColor         = CanReceivingNode.GetStatusColour(BatteryChargeService.Instance.ChargerState);
            dischargerStripStatusLabel.Text      = "Discharger - " + CanReceivingNode.GetStatusText(BatteryDischargeService.Instance.DischargerState);
            dischargerStripStatusLabel.BackColor = CanReceivingNode.GetStatusColour(BatteryDischargeService.Instance.DischargerState);
            chargerStatusLabel.ToolTipText       = BatteryDischargeService.Instance.DischargerStateMessage;

            if (BatteryChargeService.Instance.IsCharging)
            {
                preCharge = false;
            }

            UpdateStartStopDetails();
        }