string DoBatteryCalcs(float _loadRate, LoadbankModel _lbank, float _etv)
        {
            string outputStringFromCalcs = "";
            float  lowestVoltageNeeded   = _loadRate * _lbank.Resistance;
            double minimumCellCount;
            float  cellETV = (float)GlobalData.selectedBatteryString.GetBlockType().EtvVoltage;

            minimumCellCount = Math.Round(lowestVoltageNeeded / cellETV, 0, MidpointRounding.AwayFromZero);
            int    stringCount  = GlobalData.selectedBatteryString.GetStringCount();
            int    cellsCanLose = stringCount - (int)minimumCellCount;
            string cellName     = GlobalData.selectedBatteryString.GetBlockType().CellName;
            float  currentAtETV = AchievableCurrentAtETV(_lbank, _etv);

            if (cellsCanLose > 0)
            {
                outputStringFromCalcs =
                    "Max current available of " + Math.Round(currentAtETV, 2) + "A available at ETV of " + _etv + "V .\n" +
                    "Lowest voltage required to get load of " + _loadRate + "A is " + Math.Round(lowestVoltageNeeded, 2) + "V\n\n" +
                    "Able to link out " + cellsCanLose + " blocks before load is unattainable.";
            }
            else
            {
                if (_loadRate > currentAtETV)
                {
                    outputStringFromCalcs =
                        "Max current available of " + Math.Round(currentAtETV, 2) + "A available at ETV of " + _etv + "V .\n" +
                        "Lowest voltage required to get load of " + _loadRate + "A is " + Math.Round(lowestVoltageNeeded, 2) + "V\n\n" +
                        "!! Required Load Rate is Larger than Achievable Current at ETV !!";
                }
                else
                {
                    outputStringFromCalcs =
                        "Max current available of " + Math.Round(currentAtETV, 2) + "A available at ETV of " + _etv + "V .\n" +
                        "Lowest voltage required to get load of " + outputStringFromCalcs + "A is " + Math.Round(lowestVoltageNeeded, 2) + "V\n\n";
                    if (lowestVoltageNeeded < _etv)
                    {
                        outputStringFromCalcs += " voltage required for this load is lower than ETV";
                    }
                    else
                    {
                        outputStringFromCalcs += "Can achieve current without linking any cells out.";
                    }
                }
            }

            return(outputStringFromCalcs);
        }
 float AchievableCurrentAtETV(LoadbankModel lb, float vETV)
 {
     Console.WriteLine("etv : " + vETV + " , resistance :" + lb.Resistance);
     return(vETV / lb.Resistance);
 }
        // do the calcs and pop to screen
        private void showAchievableButton_Click(object sender, EventArgs e)
        {
            OutputResultsLabel.Text = " - - - - - ";
            if (GlobalData.selectedBatteryString != null)
            {
                string outputString = "not updated";
                // use the string data for more info
                // validate theres a voltage and loadbank selected
                float         etv;
                LoadbankModel bankSelected = loadBankDropDown.SelectedItem as LoadbankModel;

                if (bankSelected != null && float.TryParse(etvTextBox.Text, out etv))
                {
                    float loadRateRequired;
                    // SO - VALID BANK, VALID ETV AND CHECKING LOADRATE
                    if (float.TryParse(LoadRateTextbox.Text, out loadRateRequired) == false)
                    {
                        MessageBox.Show("Check required current is in numerical format ie 00.00");
                    }

                    // NOW CHECK TO SEE IF THE VOLTAGE TOLLERANCES ARE WITHIN LIMITS
                    else if (bankSelected.MaxInputVoltage < etv || bankSelected.MinInputVoltage > etv)
                    {
                        Console.WriteLine("VOLTAGE TOLLERANGE OUT");
                        if (bankSelected.MaxInputVoltage < etv)
                        {
                            outputString = "ETV Voltage Exceeds maximum voltage for " + bankSelected.Name + ".";
                        }
                        else if (bankSelected.MinInputVoltage > etv)
                        {
                            outputString = "ETV voltage is less than minimum voltage for " + bankSelected.Name + ".";
                        }
                    }
                    else
                    {
                        outputString = DoBatteryCalcs(loadRateRequired, bankSelected, etv);
                    }



                    // show the message
                    OutputResultsLabel.Text = outputString;
                }
            }
            else
            {
                // validate theres a voltage and loadbank selected
                float  etv;
                string outputString = "";

                LoadbankModel bankSelected = loadBankDropDown.SelectedItem as LoadbankModel;
                if (bankSelected != null && float.TryParse(etvTextBox.Text, out etv))
                {
                    if (etv == 0)
                    {
                        outputString = "No String Specified : \nETV Voltage cannot be 0!";
                    }
                    else
                    {
                        if (etv > bankSelected.MaxInputVoltage || etv < bankSelected.MinInputVoltage && etv > 0)
                        {
                            if (etv > bankSelected.MaxInputVoltage)
                            {
                                outputString = "ETV Voltage Exceeds maximum voltage for " + bankSelected.Name + ".";
                            }

                            if (etv < bankSelected.MinInputVoltage)
                            {
                                outputString = "ETV voltage is less than minimum voltage for " + bankSelected.Name + ".";
                            }
                        }
                        else
                        {
                            outputString = "No String Specified : \nmax current achievable @  ETV = " + Math.Round((AchievableCurrentAtETV(bankSelected, etv)), 2) + "A";
                        }
                    }
                }
                else
                {
                    outputString = "Invalid Entries Please double check!";
                }
                // show the message
                OutputResultsLabel.Text = outputString;
            }
        }