diff --git a/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb index 9ba282733cfb77ae93da9ee042e0c99db0c4bd58..ac9fae92269b890cbf072b913a463c1753f9dc97 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/Alternator.vb @@ -14,45 +14,43 @@ Namespace Electrics Me.rpm = rpm Me.Efficiency = eff - End Sub - End Class - + 'Model based on CombinedALTS_V02_Editable.xlsx Public Class Alternator Implements IAlternator + Private signals As ICombinedAlternatorSignals - + 'D6 Public Property AlternatorName As String Implements IAlternator.AlternatorName + 'G6 Public Property PulleyRatio As Single Implements IAlternator.PulleyRatio - + 'C10-D15 Public Property InputTable2000 As New List(Of AltUserInput) Implements IAlternator.InputTable2000 + 'F10-G15 Public Property InputTable4000 As New List(Of AltUserInput) Implements IAlternator.InputTable4000 + 'I10-J15 Public Property InputTable6000 As New List(Of AltUserInput) Implements IAlternator.InputTable6000 + 'M10-N15 Public Property RangeTable As New List(Of Table4Row) Implements IAlternator.RangeTable - - Private signals As ICombinedAlternatorSignals - - - Public Sub Clone(other As IAlternator) Implements IAlternator.Clone - - - - End Sub + 'S9 + Public ReadOnly Property SpindleSpeed As Double Implements IAlternator.SpindleSpeed + Get + Return signals.CrankRPM * PulleyRatio + End Get + End Property + 'S10 Public ReadOnly Property Efficiency As Double Implements IAlternator.Efficiency - Get 'First build RangeTable, table 4 - InitialiseRangeTable() CalculateRangeTable() 'Calculate ( Interpolate ) Efficiency - Dim range As List(Of AltUserInput) = RangeTable.Select(Function(s) New AltUserInput(s.RPM, s.Efficiency)).ToList() Dim v As Single = Alternator.Iterpolate(range, Convert.ToSingle(SpindleSpeed)) @@ -61,15 +59,9 @@ Namespace Electrics End Get - - - End Property - Public ReadOnly Property SpindleSpeed As Double Implements IAlternator.SpindleSpeed - Get - Return signals.CrankRPM * PulleyRatio - End Get End Property + 'Constructors Sub New() @@ -95,12 +87,10 @@ Namespace Electrics CreateRangeTable() - 'InitialiseRangeTable() End Sub - Public Shared Function Iterpolate(values As List(Of AltUserInput), x As Single) As Single Dim lowestX As Single = values.Min(Function(m) m.Amps) @@ -139,7 +129,6 @@ Namespace Electrics End Function - Private Sub CalculateRangeTable() 'M10=Row0-Rpm - N10=Row0-Eff @@ -214,7 +203,6 @@ Namespace Electrics End Sub - Private Sub InitialiseRangeTable() RangeTable(0).RPM = 0 : RangeTable(0).Efficiency = 0 @@ -227,7 +215,6 @@ Namespace Electrics End Sub - Private Sub CreateRangeTable() @@ -256,13 +243,13 @@ Namespace Electrics targetTable.Add(New AltUserInput(0, D14)) 'Row1 - targetTable.Add(New AltUserInput(10, inputs(10))) + targetTable.Add(New AltUserInput(inputs.OrderBy(Function(x) x.Key).First.Key, inputs.OrderBy(Function(x) x.Key).First.Value)) 'Row2 - targetTable.Add(New AltUserInput(40, inputs(40))) + targetTable.Add(New AltUserInput(inputs.OrderBy(Function(x) x.Key).Skip(1).First.Key, inputs.OrderBy(Function(x) x.Key).Skip(1).First.Value)) 'Row3 - targetTable.Add(New AltUserInput(60, inputs(60))) + targetTable.Add(New AltUserInput(inputs.OrderBy(Function(x) x.Key).Skip(2).First.Key, inputs.OrderBy(Function(x) x.Key).Skip(2).First.Value)) C11 = targetTable(1).Amps : C12 = targetTable(2).Amps : C13 = targetTable(3).Amps D11 = targetTable(1).Eff : D12 = targetTable(2).Eff : D13 = targetTable(3).Eff @@ -291,8 +278,6 @@ Namespace Electrics End Sub - - Public Function IsEqualTo(other As IAlternator) As Boolean Implements IAlternator.IsEqualTo If Me.AlternatorName <> other.AlternatorName Then Return False @@ -313,12 +298,8 @@ Namespace Electrics End Function - - End Class - - End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb index c579fb70f6ecd32bfa78c51d426702747c88d0f3..d08c4b2581a3ce05be987ac9c2d852811ee32721 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/CombinedAlternator.vb @@ -8,7 +8,6 @@ Imports System.Text Imports System.IO Imports DocumentFormat.OpenXml Imports DocumentFormat.OpenXml.Spreadsheet - Imports Newtonsoft.Json Imports VectoAuxiliaries Imports System.Globalization @@ -17,405 +16,403 @@ Imports System.Globalization Namespace Electrics Public Class CombinedAlternator - Implements IAlternatorMap, ICombinedAlternator + Implements IAlternatorMap, ICombinedAlternator + + Private map As New List(Of ICombinedAlternatorMapRow) + Public Property Alternators As New List(Of IAlternator) Implements ICombinedAlternator.Alternators + Private OriginalAlternators As New List(Of IAlternator) + Private FilePath As String + Private altSignals As ICombinedAlternatorSignals - Private map As New List(Of ICombinedAlternatorMapRow) - Public Property Alternators As New List(Of IAlternator) Implements ICombinedAlternator.Alternators - Private OriginalAlternators As New List(Of IAlternator) - Private FilePath As String - Private altSignals As ICombinedAlternatorSignals + 'Interface Implementation + Public Function GetEfficiency(ByVal CrankRPM As Single, ByVal Amps As Single) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency + altSignals.CrankRPM = CrankRPM + altSignals.CurrentDemandAmps = Amps / Alternators.Count - 'Interface Implementation - Public Function GetEfficiency(ByVal CrankRPM As Single, ByVal Amps As Single) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency + Return New AlternatorMapValues(Convert.ToSingle(Alternators.Average(Function(a) a.Efficiency) / 100)) - altSignals.CrankRPM = CrankRPM - altSignals.CurrentDemandAmps = Amps / Alternators.Count - Return New AlternatorMapValues( Convert.ToSingle(Alternators.Average(Function(a) a.Efficiency) / 100)) + End Function + Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise + 'From the map we construct this CombinedAlternator object and original CombinedAlternator Object - End Function - Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise + Alternators.Clear() + OriginalAlternators.Clear() - 'From the map we construct this CombinedAlternator object and original CombinedAlternator Object - Alternators.Clear() - OriginalAlternators.Clear() + For Each alt As IEnumerable(Of ICombinedAlternatorMapRow) In map.GroupBy(Function(g) g.AlternatorName) + Dim altName As String = alt.First().AlternatorName + Dim pulleyRatio As Single = alt.First().PulleyRatio - For Each alt As IEnumerable(Of ICombinedAlternatorMapRow) In map.GroupBy(Function(g) g.AlternatorName) - Dim altName As String = alt.First().AlternatorName - Dim pulleyRatio As Single = alt.First().PulleyRatio + Dim alternator As IAlternator = New Alternator(altSignals, alt.ToList()) + Alternators.Add(alternator) - Dim alternator As IAlternator = New Alternator(altSignals, alt.ToList()) - Alternators.Add(alternator) + Next + Return True - Next + End Function - Return True + 'Constructors + Public Sub New(filePath As String) - End Function + Dim feedback As String = String.Empty - 'Constructors - Public Sub New(filePath As String) + If Not FilePathUtils.ValidateFilePath(filePath, ".aalt", feedback) Then + Throw New ArgumentException(String.Format("Combined Alternator requires a valid .AALT filename. : {0}", feedback)) + Else + Me.FilePath = filePath + End If - Dim feedback As String = String.Empty - If Not FilePathUtils.ValidateFilePath(filePath, ".aalt", feedback) Then - Throw New ArgumentException(String.Format("Combined Alternator requires a valid .AALT filename. : {0}", feedback)) - Else - Me.FilePath = filePath - End If + Me.altSignals = New CombinedAlternatorSignals() - Me.altSignals = New CombinedAlternatorSignals() + 'IF file exists then read it otherwise create a default. + If File.Exists(filePath) AndAlso InitialiseMap(filePath) Then + Initialise() + Else - 'IF file exists then read it otherwise create a default. + 'Create Default Map + CreateDefaultMap() + Initialise() - If File.Exists(filePath) AndAlso InitialiseMap(filePath) Then - Initialise() - Else + End If - 'Create Default Map - CreateDefaultMap() - Initialise() + End Sub - End If + 'Helpers + Private Sub CreateDefaultMap() - End Sub + map.Clear() - 'Helpers - Private Sub CreateDefaultMap() + map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 10, 50, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 40, 50, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 60, 50, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 10, 70, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 40, 70, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 60, 70, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 10, 60, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 40, 60, 3)) + map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 60, 60, 3)) + map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 10, 80, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 40, 80, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 60, 80, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 10, 40, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 40, 40, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 60, 40, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 10, 60, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 40, 60, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 60, 60, 2.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 2000, 10, 95, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 2000, 40, 50, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 2000, 60, 90, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 4000, 10, 99, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 4000, 40, 1, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 4000, 60, 55, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 6000, 10, 94, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 6000, 40, 86, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt3", 6000, 60, 13, 3.5)) + map.Add(New CombinedAlternatorMapRow("Alt4", 2000, 10, 55, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 2000, 40, 45, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 2000, 60, 67, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 4000, 10, 77, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 4000, 40, 39, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 4000, 60, 23, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 6000, 10, 34, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 6000, 40, 67, 2)) + map.Add(New CombinedAlternatorMapRow("Alt4", 6000, 60, 35, 2)) - map.Clear() - map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 10, 50, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 40, 50, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 2000, 60, 50, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 10, 70, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 40, 70, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 4000, 60, 70, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 10, 60, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 40, 60, 3)) - map.Add(New CombinedAlternatorMapRow("Alt1", 6000, 60, 60, 3)) - map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 10, 80, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 40, 80, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 2000, 60, 80, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 10, 40, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 40, 40, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 4000, 60, 40, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 10, 60, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 40, 60, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt2", 6000, 60, 60, 2.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 2000, 10, 95, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 2000, 40, 50, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 2000, 60, 90, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 4000, 10, 99, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 4000, 40, 1, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 4000, 60, 55, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 6000, 10, 94, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 6000, 40, 86, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt3", 6000, 60, 13, 3.5)) - map.Add(New CombinedAlternatorMapRow("Alt4", 2000, 10, 55, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 2000, 40, 45, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 2000, 60, 67, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 4000, 10, 77, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 4000, 40, 39, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 4000, 60, 23, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 6000, 10, 34, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 6000, 40, 67, 2)) - map.Add(New CombinedAlternatorMapRow("Alt4", 6000, 60, 35, 2)) + End Sub + 'Grid Management + Private Function AddNewAlternator(list As List(Of ICombinedAlternatorMapRow), ByRef feeback As String) As Boolean - End Sub + Dim returnValue As Boolean = True - 'Grid Management - Private Function AddNewAlternator(list As List(Of ICombinedAlternatorMapRow), ByRef feeback As String) As Boolean + Dim altName As String = list.First().AlternatorName + Dim pulleyRatio As Single = list.First().PulleyRatio - Dim returnValue As Boolean = True + 'Check alt does not already exist in list + If Alternators.Where(Function(w) w.AlternatorName = altName).Count > 0 Then + feeback = "This alternator already exists in in the list, operation not completed." + Return False + End If - Dim altName As String = list.First().AlternatorName - Dim pulleyRatio As Single = list.First().PulleyRatio + Dim alternator As IAlternator = New Alternator(altSignals, list.ToList()) - 'Check alt does not already exist in list - If Alternators.Where(Function(w) w.AlternatorName = altName).Count > 0 Then - feeback = "This alternator already exists in in the list, operation not completed." - Return False - End If + Alternators.Add(alternator) - Dim alternator As IAlternator = New Alternator(altSignals, list.ToList()) - Alternators.Add(alternator) + Return returnValue + End Function + Public Function AddAlternator(rows As List(Of ICombinedAlternatorMapRow), ByRef feedback As String) As Boolean - Return returnValue + If Not AddNewAlternator(rows, feedback) Then + feedback = String.Format("Unable to add new alternator : {0}", feedback) + Return False + End If - End Function - Public Function AddAlternator(rows As List(Of ICombinedAlternatorMapRow), ByRef feedback As String) As Boolean + Return True - If Not AddNewAlternator(rows, feedback) Then - feedback = String.Format("Unable to add new alternator : {0}", feedback) - Return False - End If + End Function + Public Function DeleteAlternator(alternatorName As String, ByRef feedback As String) As Boolean - Return True + 'Is this the last alternator, if so deny the user the right to remove it. + If Alternators.Count < 2 Then + feedback = "There must be at least one alternator remaining, operation aborted." + Return False + End If - End Function - Public Function DeleteAlternator(alternatorName As String, ByRef feedback As String) As Boolean + If Alternators.Where(Function(w) w.AlternatorName = alternatorName).Count = 0 Then + feedback = "This alternator does not exist" + Return False + End If - 'Is this the last alternator, if so deny the user the right to remove it. - If Alternators.Count<2 then - feedback="There must be at least one alternator remaining, operation aborted." - Return false - End If + Dim altToRemove As IAlternator = Alternators.First(Function(w) w.AlternatorName = alternatorName) + Dim numAlternators As Integer = Alternators.Count - If Alternators.Where(Function(w) w.AlternatorName = alternatorName).Count = 0 Then - feedback = "This alternator does not exist" - Return False - End If + Alternators.Remove(altToRemove) - Dim altToRemove As IAlternator = Alternators.First(Function(w) w.AlternatorName = alternatorName) - Dim numAlternators As Integer = Alternators.Count + If Alternators.Count = numAlternators - 1 Then + Return True + Else + feedback = String.Format("The alternator {0} could not be removed : {1}", alternatorName, feedback) + Return False + End If - Alternators.Remove(altToRemove) + End Function + 'Public Function UpdateAlternator( gridIndex As Integer, rows As List(Of ICombinedAlternatorMapRow), ByRef feedback As String) As Boolean - If Alternators.Count = numAlternators - 1 Then - Return True - Else - feedback = String.Format("The alternator {0} could not be removed : {1}", alternatorName, feedback) - Return False - End If + ' Dim altName As String = rows.First.AlternatorName + ' Dim altToUpd As IAlternator = Alternators.First(Function(w) w.AlternatorName = altName) - End Function - 'Public Function UpdateAlternator( gridIndex As Integer, rows As List(Of ICombinedAlternatorMapRow), ByRef feedback As String) As Boolean + ' If Not DeleteAlternator(altName, feedback) Then + ' feedback = feedback + ' Return False - ' Dim altName As String = rows.First.AlternatorName - ' Dim altToUpd As IAlternator = Alternators.First(Function(w) w.AlternatorName = altName) + ' End If - ' If Not DeleteAlternator(altName, feedback) Then - ' feedback = feedback - ' Return False + ' 'Re.create alternator. - ' End If + ' Dim replacementAlt As New Alternator(altSignals, rows) + ' Alternators.Add(replacementAlt) - ' 'Re.create alternator. + ' Return True - ' Dim replacementAlt As New Alternator(altSignals, rows) - ' Alternators.Add(replacementAlt) - ' Return True + 'End Function + 'Persistance Functions + Public Function Save(aaltPath As String) As Boolean - 'End Function - 'Persistance Functions - Public Function Save(aaltPath As String) As Boolean + Dim returnValue As Boolean = True + Dim sb As New StringBuilder() + Dim row As Integer = 0 + Dim amps, eff As Single + 'write headers + sb.AppendLine("[AlternatorName],[RPM],[Amps],[Efficiency],[PulleyRatio]") - Dim returnValue As Boolean = True - Dim sb As New StringBuilder() - Dim row As Integer = 0 - Dim amps, eff As Single + 'write details + For Each alt As IAlternator In Alternators.OrderBy(Function(o) o.AlternatorName) - 'write headers - sb.AppendLine("[AlternatorName],[RPM],[Amps],[Efficiency],[PulleyRatio]") - 'write details - For Each alt As IAlternator In Alternators.OrderBy( Function(o) o.AlternatorName) + '2000 - IE Alt1,2000,10,50,3 + For row = 1 To 3 + amps = alt.InputTable2000(row).Amps : eff = alt.InputTable2000(row).Eff + sb.Append(alt.AlternatorName + ",2000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")) + sb.AppendLine("") + Next + '4000 - IE Alt1,2000,10,50,3 + For row = 1 To 3 + amps = alt.InputTable4000(row).Amps : eff = alt.InputTable4000(row).Eff + sb.Append(alt.AlternatorName + ",4000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")) + sb.AppendLine("") + Next - '2000 - IE Alt1,2000,10,50,3 - For row = 1 To 3 - amps = alt.InputTable2000(row).Amps : eff = alt.InputTable2000(row).Eff - sb.Append(alt.AlternatorName + ",2000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")) - sb.AppendLine("") - Next + '4000 - IE Alt1,2000,10,50,3 + For row = 1 To 3 + amps = alt.InputTable4000(row).Amps : eff = alt.InputTable6000(row).Eff + sb.Append(alt.AlternatorName + ",6000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")) + sb.AppendLine("") + Next - '4000 - IE Alt1,2000,10,50,3 - For row = 1 To 3 - amps = alt.InputTable4000(row).Amps : eff = alt.InputTable4000(row).Eff - sb.Append(alt.AlternatorName + ",4000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")) - sb.AppendLine("") - Next - '4000 - IE Alt1,2000,10,50,3 - For row = 1 To 3 - amps = alt.InputTable4000(row).Amps : eff = alt.InputTable6000(row).Eff - sb.Append(alt.AlternatorName + ",6000," + amps.ToString("0.000") + "," + eff.ToString("0.000") + "," + alt.PulleyRatio.ToString("0.000")) - sb.AppendLine("") - Next + Next + 'Add Model Source + sb.AppendLine("[MODELSOURCE]") + sb.Append(Me.ToString()) - Next + ' Write the stream cotnents to a new file named "AllTxtFiles.txt" + Using outfile As New StreamWriter(aaltPath) + outfile.Write(sb.ToString()) + End Using - 'Add Model Source - sb.AppendLine("[MODELSOURCE]") - sb.Append( Me.ToString()) + Return returnValue - ' Write the stream cotnents to a new file named "AllTxtFiles.txt" - Using outfile As New StreamWriter(aaltPath) - outfile.Write(sb.ToString()) - End Using + End Function + Private Function Load() As Boolean - Return returnValue + If Not InitialiseMap(FilePath) Then Return False -End Function - Private Function Load() As Boolean - If Not InitialiseMap(FilePath) Then Return False + Return True + End Function - Return True + 'Initialises the map, only valid when loadingUI for first time in edit mode or always in operational mode. + Private Function InitialiseMap(filePath As String) As Boolean - End Function + Dim returnValue As Boolean = False + Dim elements As String() - 'Initialises the map, only valid when loadingUI for first time in edit mode or always in operational mode. - Private Function InitialiseMap(filePath As String) As Boolean + If File.Exists(filePath) Then + Using sr As StreamReader = New StreamReader(filePath) + 'get array og lines fron csv + Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), StringSplitOptions.RemoveEmptyEntries) - Dim returnValue As Boolean = False - Dim elements As String() + 'Must have at least 2 entries in map to make it usable [dont forget the header row] + If (lines.Count() < 10) Then + Throw New ArgumentException("Insufficient rows in csv to build a usable map") + End If - If File.Exists(filePath) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array og lines fron csv - Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), StringSplitOptions.RemoveEmptyEntries) + map = New List(Of ICombinedAlternatorMapRow) - 'Must have at least 2 entries in map to make it usable [dont forget the header row] - If (lines.Count() < 10) Then - Throw New ArgumentException("Insufficient rows in csv to build a usable map") - End If + Dim firstline As Boolean = True - map = New List(Of ICombinedAlternatorMapRow) + For Each line As String In lines + If Not firstline Then - Dim firstline As Boolean = True + 'Advanced Alternator Source Check. + If line.Contains("[MODELSOURCE") Then Exit For - For Each line As String In lines - If Not firstline Then + 'split the line + elements = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) + '3 entries per line required + If (elements.Length <> 5) Then + Throw New ArgumentException("Incorrect number of values in csv file") + End If + 'add values to map - 'Advanced Alternator Source Check. - If line.Contains("[MODELSOURCE") Then Exit For + map.Add(New CombinedAlternatorMapRow(elements(0), CType(elements(1), Single), CType(elements(2), Single), CType(elements(3), Single), CType(elements(4), Single))) - 'split the line - elements = line.Split( New Char() {","C} , StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 5) Then - Throw New ArgumentException("Incorrect number of values in csv file") - End If - 'add values to map + Else + firstline = False + End If + Next line + End Using + Return True + Else + Throw New ArgumentException("Supplied input file does not exist") + End If - map.Add(New CombinedAlternatorMapRow(elements(0), CType(elements(1),Single), CType(elements(2),Single), CType( elements(3),Single), CType(elements(4),single))) + Return returnValue - Else - firstline = False - End If - Next line - End Using - Return True - Else - Throw New ArgumentException("Supplied input file does not exist") - End If - Return returnValue + End Function + 'Can be used to send messages to Vecto. + Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) Implements IAuxiliaryEvent.AuxiliaryEvent - End Function + 'This is used to generate a diagnostics output which enables the user to + 'Determine if they beleive the resulting map is what is expected + 'Basically it is a check against the model/Spreadsheet + Public Overrides Function ToString() As String - 'Can be used to send messages to Vecto. - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) Implements IAuxiliaryEvent.AuxiliaryEvent + Dim sb As New StringBuilder() + Dim a1, a2, a3, e1, e2, e3 As String - 'This is used to generate a diagnostics output which enables the user to - 'Determine if they beleive the resulting map is what is expected - 'Basically it is a check against the model/Spreadsheet - Public Overrides Function ToString() As String - Dim sb As New StringBuilder() - Dim a1, a2, a3, e1, e2, e3 As String + For Each alt As Alternator In Alternators.OrderBy(Function(o) o.AlternatorName) + sb.AppendLine("") + sb.AppendFormat("** {0} ** , PulleyRatio {1}", alt.AlternatorName, alt.PulleyRatio) + sb.AppendLine("") + sb.AppendLine("******************************************************************") + sb.AppendLine("") + Dim i As Integer = 1 + sb.AppendLine("Table 1 (2000)" + vbTab + "Table 2 (4000)" + vbTab + "Table 3 (6000)") + sb.AppendLine("Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab) + sb.AppendLine("") + For i = 0 To 5 - For Each alt As Alternator In Alternators.OrderBy( Function(o) o.AlternatorName) - sb.AppendLine("") - sb.AppendFormat("** {0} ** , PulleyRatio {1}", alt.AlternatorName, alt.PulleyRatio) - sb.AppendLine("") - sb.AppendLine("******************************************************************") - sb.AppendLine("") + a1 = alt.InputTable2000(i).Amps.ToString("0") + e1 = alt.InputTable2000(i).Eff.ToString("0.000") + a2 = alt.InputTable4000(i).Amps.ToString("0") + e2 = alt.InputTable4000(i).Eff.ToString("0.000") + a3 = alt.InputTable6000(i).Amps.ToString("0") + e3 = alt.InputTable6000(i).Eff.ToString("0.000") + sb.AppendLine(a1 + vbTab + e1 + vbTab + a2 + vbTab + e2 + vbTab + a3 + vbTab + e3 + vbTab) - Dim i As Integer = 1 - sb.AppendLine("Table 1 (2000)" + vbTab + "Table 2 (4000)" + vbTab + "Table 3 (6000)") - sb.AppendLine("Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab + "Amps" + vbTab + "Eff" + vbTab) - sb.AppendLine("") - For i = 0 To 5 + Next - a1 = alt.InputTable2000(i).Amps.ToString("0") - e1 = alt.InputTable2000(i).Eff.ToString("0.000") - a2 = alt.InputTable4000(i).Amps.ToString("0") - e2 = alt.InputTable4000(i).Eff.ToString("0.000") - a3 = alt.InputTable6000(i).Amps.ToString("0") - e3 = alt.InputTable6000(i).Eff.ToString("0.000") - sb.AppendLine(a1 + vbTab + e1 + vbTab + a2 + vbTab + e2 + vbTab + a3 + vbTab + e3 + vbTab) - Next + Next + sb.AppendLine("") + sb.AppendLine("********* COMBINED EFFICIENCY VALUES **************") + sb.AppendLine("") + sb.AppendLine(vbTab + "RPM VALUES") + sb.AppendLine("AMPS" + vbTab + "500" + vbTab + "1500" + vbTab + "2500" + vbTab + "3500" + vbTab + "4500" + vbTab + "5500" + vbTab + "6500" + vbTab + "7500") + For a As Single = 1 To Alternators.Count * 50 - Next + sb.Append(a.ToString("0") + vbTab) + For Each r As Single In {500, 1500, 2500, 3500, 4500, 5500, 6500, 7500} - sb.AppendLine("") - sb.AppendLine("********* COMBINED EFFICIENCY VALUES **************") - sb.AppendLine("") - sb.AppendLine(vbTab + "RPM VALUES") - sb.AppendLine("AMPS" + vbTab + "500" + vbTab + "1500" + vbTab + "2500" + vbTab + "3500" + vbTab + "4500" + vbTab + "5500" + vbTab + "6500" + vbTab + "7500") - For a As Single = 1 To Alternators.Count * 50 + Dim eff As Single = GetEfficiency(r, a).Efficiency - sb.Append(a.ToString("0") + vbTab) - For Each r As Single In {500, 1500, 2500, 3500, 4500, 5500, 6500, 7500} + sb.Append(eff.ToString("0.000") + vbTab) - Dim eff As Single = GetEfficiency(r, a).Efficiency + Next + sb.AppendLine("") - sb.Append(eff.ToString("0.000") + vbTab) + Next - Next - sb.AppendLine("") - Next + Return sb.ToString() + End Function - Return sb.ToString() - End Function + 'Equality + Public Function IsEqualTo(other As ICombinedAlternator) As Boolean Implements ICombinedAlternator.IsEqualTo - - 'Equality - Public Function IsEqualTo(other As ICombinedAlternator) As Boolean Implements ICombinedAlternator.IsEqualTo - - 'Count Check. - If Me.Alternators.Count <> other.Alternators.Count then Return False - - For Each alt As IAlternator In Me.Alternators + 'Count Check. + If Me.Alternators.Count <> other.Alternators.Count Then Return False - 'Can we find the same alternatorName in other - If other.Alternators.Where( Function(f) f.AlternatorName=alt.AlternatorName).Count()<>1 then Return False + For Each alt As IAlternator In Me.Alternators - 'get the alternator to compare and compare it. - If Not alt.IsEqualTo( other.Alternators.first( Function(f) f.AlternatorName=alt.AlternatorName) ) then Return false + 'Can we find the same alternatorName in other + If other.Alternators.Where(Function(f) f.AlternatorName = alt.AlternatorName).Count() <> 1 Then Return False + 'get the alternator to compare and compare it. + If Not alt.IsEqualTo(other.Alternators.first(Function(f) f.AlternatorName = alt.AlternatorName)) Then Return False - Next + Next - Return true + Return True - End Function + End Function - End Class + End Class End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb b/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb index 035d8e9694b2367ef3f028b14129c35ec0a32272..6fc9487b728243d2e3c6c684d9b0479c079eb287 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IAlternator.vb @@ -2,31 +2,38 @@ Namespace Electrics 'Used By Combined Alternator. + 'Model based on CombinedALTS_V02_Editable.xlsx Public Interface IAlternator - - - Property AlternatorName As String - Property PulleyRatio As single + 'D6 + Property AlternatorName As String - Readonly property SpindleSpeed As Double + 'G6 + Property PulleyRatio As Single - ReadOnly Property Efficiency As Double + 'S9 + ReadOnly Property SpindleSpeed As Double - Property InputTable2000 AS List(Of AltUserInput) - Property InputTable4000 AS List(Of AltUserInput) - Property InputTable6000 AS List(Of AltUserInput) - Property RangeTable AS List(Of Table4Row) + 'S10 + ReadOnly Property Efficiency As Double + 'C10-D15 + Property InputTable2000 As List(Of AltUserInput) - 'Clone values - Sub Clone( other As IAlternator) + 'F10-G15 + Property InputTable4000 As List(Of AltUserInput) - 'Test Equality - Function IsEqualTo(other As IAlternator) As Boolean + 'I10-J15 + Property InputTable6000 As List(Of AltUserInput) + 'M10-N15 + Property RangeTable As List(Of Table4Row) - end interface + 'Test Equality + Function IsEqualTo(other As IAlternator) As Boolean + + + End Interface End Namespace diff --git a/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb b/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb index 191c7b61468dd73614b28981d27a150e86df6df3..561c9e6648268dafff70f6dd7c42302084b627aa 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/SSMTechList.vb @@ -352,7 +352,7 @@ Public Class SSMTechList Private Sub SetDefaults() - Dim techLine1 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine1 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine1 .Category = "Cooling" .BenefitName = "Separate air distribution ducts" @@ -372,7 +372,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine2 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine2 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine2 .Category = "Heating" .BenefitName = "Adjustable auxiliary heater" @@ -392,7 +392,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine3 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine3 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine3 .Category = "Heating" .BenefitName = "Adjustable coolant thermostat" @@ -412,7 +412,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine4 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine4 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine4 .Category = "Heating" .BenefitName = "Engine waste gas heat exchanger" @@ -432,7 +432,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine5 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine5 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine5 .Category = "Heating" .BenefitName = "Heat pump systems" @@ -452,7 +452,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine6 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine6 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine6 .Category = "Insulation" .BenefitName = "Double-glazing" @@ -472,7 +472,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine7 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine7 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine7 .Category = "Insulation" .BenefitName = "Tinted windows" @@ -492,7 +492,7 @@ Public Class SSMTechList .Units = "fraction" End With - Dim techLine8 As ITechListBenefitLine = New TechListBenefitLine() + Dim techLine8 As ITechListBenefitLine = New TechListBenefitLine(_ssmInputs) With techLine8 .Category = "Ventilation" .BenefitName = "Fan control strategy (serial/parallel)" diff --git a/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.Designer.vb b/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.Designer.vb index ee5dce21ab1f2e82718a6fcde0b3c61f0b155993..bac2b1d88bf98d0ad52573c9ce31c110885fdfc4 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.Designer.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.Designer.vb @@ -24,34 +24,25 @@ Partial Class frmCombinedAlternators Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Me.txt2K10Efficiency = New System.Windows.Forms.TextBox() - Me.txt2K60Efficiency = New System.Windows.Forms.TextBox() - Me.txt2K40Efficiency = New System.Windows.Forms.TextBox() + Me.txt2KMaxEfficiency = New System.Windows.Forms.TextBox() + Me.txt2KMax2Efficiency = New System.Windows.Forms.TextBox() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.txtPulleyRatio = New System.Windows.Forms.TextBox() Me.Label7 = New System.Windows.Forms.Label() Me.grpTable2000PRM = New System.Windows.Forms.GroupBox() - Me.Label8 = New System.Windows.Forms.Label() - Me.Label10 = New System.Windows.Forms.Label() - Me.Label9 = New System.Windows.Forms.Label() Me.grpTable4000PRM = New System.Windows.Forms.GroupBox() - Me.txt4K60Efficiency = New System.Windows.Forms.TextBox() + Me.txt4KMaxEfficiency = New System.Windows.Forms.TextBox() Me.txt4K10Efficiency = New System.Windows.Forms.TextBox() - Me.txt4K40Efficiency = New System.Windows.Forms.TextBox() + Me.txt4KMax2Efficiency = New System.Windows.Forms.TextBox() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() - Me.Label5 = New System.Windows.Forms.Label() - Me.Label6 = New System.Windows.Forms.Label() - Me.Label11 = New System.Windows.Forms.Label() Me.grpTable6000PRM = New System.Windows.Forms.GroupBox() - Me.txt6K60Efficiency = New System.Windows.Forms.TextBox() + Me.txt6KMaxEfficiency = New System.Windows.Forms.TextBox() Me.txt6K10Efficiency = New System.Windows.Forms.TextBox() - Me.txt6K40Efficiency = New System.Windows.Forms.TextBox() + Me.txt6KMax2Efficiency = New System.Windows.Forms.TextBox() Me.Label12 = New System.Windows.Forms.Label() Me.Label13 = New System.Windows.Forms.Label() - Me.Label14 = New System.Windows.Forms.Label() - Me.Label15 = New System.Windows.Forms.Label() - Me.Label16 = New System.Windows.Forms.Label() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.tabInputs = New System.Windows.Forms.TabPage() Me.txtAlternatorName = New System.Windows.Forms.TextBox() @@ -67,45 +58,60 @@ Partial Class frmCombinedAlternators Me.btnSave = New System.Windows.Forms.Button() Me.btnCancel = New System.Windows.Forms.Button() Me.ErrorProvider1 = New System.Windows.Forms.ErrorProvider(Me.components) - Me.grpTable2000PRM.SuspendLayout - Me.grpTable4000PRM.SuspendLayout - Me.grpTable6000PRM.SuspendLayout - Me.TabControl1.SuspendLayout - Me.tabInputs.SuspendLayout - CType(Me.gvAlternators,System.ComponentModel.ISupportInitialize).BeginInit - Me.tabDiagnostics.SuspendLayout - CType(Me.ErrorProvider1,System.ComponentModel.ISupportInitialize).BeginInit - Me.SuspendLayout + Me.txt2K10Amps = New System.Windows.Forms.TextBox() + Me.txt2KMax2Amps = New System.Windows.Forms.TextBox() + Me.txt2KMaxAmps = New System.Windows.Forms.TextBox() + Me.Label5 = New System.Windows.Forms.Label() + Me.Label6 = New System.Windows.Forms.Label() + Me.Label8 = New System.Windows.Forms.Label() + Me.Label9 = New System.Windows.Forms.Label() + Me.Label10 = New System.Windows.Forms.Label() + Me.Label11 = New System.Windows.Forms.Label() + Me.txt4K10Amps = New System.Windows.Forms.TextBox() + Me.txt6K10Amps = New System.Windows.Forms.TextBox() + Me.txt4KMax2Amps = New System.Windows.Forms.TextBox() + Me.txt4KMaxAmps = New System.Windows.Forms.TextBox() + Me.txt6KMax2Amps = New System.Windows.Forms.TextBox() + Me.txt6KMaxAmps = New System.Windows.Forms.TextBox() + Me.grpTable2000PRM.SuspendLayout() + Me.grpTable4000PRM.SuspendLayout() + Me.grpTable6000PRM.SuspendLayout() + Me.TabControl1.SuspendLayout() + Me.tabInputs.SuspendLayout() + CType(Me.gvAlternators, System.ComponentModel.ISupportInitialize).BeginInit() + Me.tabDiagnostics.SuspendLayout() + CType(Me.ErrorProvider1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() ' 'txt2K10Efficiency ' Me.txt2K10Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt2K10Efficiency.Location = New System.Drawing.Point(78, 57) + Me.txt2K10Efficiency.Location = New System.Drawing.Point(110, 57) Me.txt2K10Efficiency.Name = "txt2K10Efficiency" Me.txt2K10Efficiency.Size = New System.Drawing.Size(50, 20) Me.txt2K10Efficiency.TabIndex = 40 ' - 'txt2K60Efficiency + 'txt2KMaxEfficiency ' - Me.txt2K60Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt2K60Efficiency.Location = New System.Drawing.Point(78, 117) - Me.txt2K60Efficiency.Name = "txt2K60Efficiency" - Me.txt2K60Efficiency.Size = New System.Drawing.Size(50, 20) - Me.txt2K60Efficiency.TabIndex = 60 + Me.txt2KMaxEfficiency.ForeColor = System.Drawing.Color.Black + Me.txt2KMaxEfficiency.Location = New System.Drawing.Point(110, 115) + Me.txt2KMaxEfficiency.Name = "txt2KMaxEfficiency" + Me.txt2KMaxEfficiency.Size = New System.Drawing.Size(50, 20) + Me.txt2KMaxEfficiency.TabIndex = 60 ' - 'txt2K40Efficiency + 'txt2KMax2Efficiency ' - Me.txt2K40Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt2K40Efficiency.Location = New System.Drawing.Point(78, 85) - Me.txt2K40Efficiency.Name = "txt2K40Efficiency" - Me.txt2K40Efficiency.Size = New System.Drawing.Size(50, 20) - Me.txt2K40Efficiency.TabIndex = 50 + Me.txt2KMax2Efficiency.ForeColor = System.Drawing.Color.Black + Me.txt2KMax2Efficiency.Location = New System.Drawing.Point(110, 85) + Me.txt2KMax2Efficiency.Name = "txt2KMax2Efficiency" + Me.txt2KMax2Efficiency.Size = New System.Drawing.Size(50, 20) + Me.txt2KMax2Efficiency.TabIndex = 50 ' 'Label1 ' - Me.Label1.AutoSize = true + Me.Label1.AutoSize = True Me.Label1.ForeColor = System.Drawing.Color.Black - Me.Label1.Location = New System.Drawing.Point(24, 30) + Me.Label1.Location = New System.Drawing.Point(56, 30) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(33, 13) Me.Label1.TabIndex = 8 @@ -113,9 +119,9 @@ Partial Class frmCombinedAlternators ' 'Label2 ' - Me.Label2.AutoSize = true + Me.Label2.AutoSize = True Me.Label2.ForeColor = System.Drawing.Color.Black - Me.Label2.Location = New System.Drawing.Point(75, 30) + Me.Label2.Location = New System.Drawing.Point(107, 30) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(53, 13) Me.Label2.TabIndex = 9 @@ -123,15 +129,15 @@ Partial Class frmCombinedAlternators ' 'txtPulleyRatio ' - Me.txtPulleyRatio.Location = New System.Drawing.Point(504, 25) + Me.txtPulleyRatio.Location = New System.Drawing.Point(606, 22) Me.txtPulleyRatio.Name = "txtPulleyRatio" Me.txtPulleyRatio.Size = New System.Drawing.Size(68, 20) Me.txtPulleyRatio.TabIndex = 30 ' 'Label7 ' - Me.Label7.AutoSize = true - Me.Label7.Location = New System.Drawing.Point(432, 25) + Me.Label7.AutoSize = True + Me.Label7.Location = New System.Drawing.Point(527, 25) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(57, 13) Me.Label7.TabIndex = 27 @@ -140,101 +146,75 @@ Partial Class frmCombinedAlternators ' 'grpTable2000PRM ' - Me.grpTable2000PRM.Controls.Add(Me.txt2K60Efficiency) + Me.grpTable2000PRM.Controls.Add(Me.Label6) + Me.grpTable2000PRM.Controls.Add(Me.Label5) + Me.grpTable2000PRM.Controls.Add(Me.txt2KMaxAmps) + Me.grpTable2000PRM.Controls.Add(Me.txt2KMax2Amps) + Me.grpTable2000PRM.Controls.Add(Me.txt2K10Amps) + Me.grpTable2000PRM.Controls.Add(Me.txt2KMaxEfficiency) Me.grpTable2000PRM.Controls.Add(Me.txt2K10Efficiency) - Me.grpTable2000PRM.Controls.Add(Me.txt2K40Efficiency) + Me.grpTable2000PRM.Controls.Add(Me.txt2KMax2Efficiency) Me.grpTable2000PRM.Controls.Add(Me.Label1) Me.grpTable2000PRM.Controls.Add(Me.Label2) - Me.grpTable2000PRM.Controls.Add(Me.Label8) - Me.grpTable2000PRM.Controls.Add(Me.Label10) - Me.grpTable2000PRM.Controls.Add(Me.Label9) Me.grpTable2000PRM.FlatStyle = System.Windows.Forms.FlatStyle.Popup Me.grpTable2000PRM.ForeColor = System.Drawing.SystemColors.MenuHighlight - Me.grpTable2000PRM.Location = New System.Drawing.Point(35, 62) + Me.grpTable2000PRM.Location = New System.Drawing.Point(38, 102) Me.grpTable2000PRM.Name = "grpTable2000PRM" - Me.grpTable2000PRM.Size = New System.Drawing.Size(162, 166) + Me.grpTable2000PRM.Size = New System.Drawing.Size(181, 166) Me.grpTable2000PRM.TabIndex = 28 - Me.grpTable2000PRM.TabStop = false + Me.grpTable2000PRM.TabStop = False Me.grpTable2000PRM.Text = " [ 2000 RPM ]" ' - 'Label8 - ' - Me.Label8.AutoSize = true - Me.Label8.ForeColor = System.Drawing.Color.Black - Me.Label8.Location = New System.Drawing.Point(40, 60) - Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(19, 13) - Me.Label8.TabIndex = 29 - Me.Label8.Text = "10" - ' - 'Label10 - ' - Me.Label10.AutoSize = true - Me.Label10.ForeColor = System.Drawing.Color.Black - Me.Label10.Location = New System.Drawing.Point(40, 115) - Me.Label10.Name = "Label10" - Me.Label10.Size = New System.Drawing.Size(19, 13) - Me.Label10.TabIndex = 30 - Me.Label10.Text = "60" - ' - 'Label9 - ' - Me.Label9.AutoSize = true - Me.Label9.ForeColor = System.Drawing.Color.Black - Me.Label9.Location = New System.Drawing.Point(40, 88) - Me.Label9.Name = "Label9" - Me.Label9.Size = New System.Drawing.Size(19, 13) - Me.Label9.TabIndex = 30 - Me.Label9.Text = "40" - ' 'grpTable4000PRM ' - Me.grpTable4000PRM.Controls.Add(Me.txt4K60Efficiency) + Me.grpTable4000PRM.Controls.Add(Me.txt4KMaxAmps) + Me.grpTable4000PRM.Controls.Add(Me.txt4KMax2Amps) + Me.grpTable4000PRM.Controls.Add(Me.txt4K10Amps) + Me.grpTable4000PRM.Controls.Add(Me.Label8) + Me.grpTable4000PRM.Controls.Add(Me.Label9) + Me.grpTable4000PRM.Controls.Add(Me.txt4KMaxEfficiency) Me.grpTable4000PRM.Controls.Add(Me.txt4K10Efficiency) - Me.grpTable4000PRM.Controls.Add(Me.txt4K40Efficiency) + Me.grpTable4000PRM.Controls.Add(Me.txt4KMax2Efficiency) Me.grpTable4000PRM.Controls.Add(Me.Label3) Me.grpTable4000PRM.Controls.Add(Me.Label4) - Me.grpTable4000PRM.Controls.Add(Me.Label5) - Me.grpTable4000PRM.Controls.Add(Me.Label6) - Me.grpTable4000PRM.Controls.Add(Me.Label11) Me.grpTable4000PRM.FlatStyle = System.Windows.Forms.FlatStyle.Popup Me.grpTable4000PRM.ForeColor = System.Drawing.SystemColors.MenuHighlight - Me.grpTable4000PRM.Location = New System.Drawing.Point(214, 62) + Me.grpTable4000PRM.Location = New System.Drawing.Point(264, 102) Me.grpTable4000PRM.Name = "grpTable4000PRM" - Me.grpTable4000PRM.Size = New System.Drawing.Size(162, 166) + Me.grpTable4000PRM.Size = New System.Drawing.Size(183, 166) Me.grpTable4000PRM.TabIndex = 31 - Me.grpTable4000PRM.TabStop = false + Me.grpTable4000PRM.TabStop = False Me.grpTable4000PRM.Text = " [ 4000 RPM ]" ' - 'txt4K60Efficiency + 'txt4KMaxEfficiency ' - Me.txt4K60Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt4K60Efficiency.Location = New System.Drawing.Point(78, 117) - Me.txt4K60Efficiency.Name = "txt4K60Efficiency" - Me.txt4K60Efficiency.Size = New System.Drawing.Size(50, 20) - Me.txt4K60Efficiency.TabIndex = 90 + Me.txt4KMaxEfficiency.ForeColor = System.Drawing.Color.Black + Me.txt4KMaxEfficiency.Location = New System.Drawing.Point(111, 113) + Me.txt4KMaxEfficiency.Name = "txt4KMaxEfficiency" + Me.txt4KMaxEfficiency.Size = New System.Drawing.Size(50, 20) + Me.txt4KMaxEfficiency.TabIndex = 90 ' 'txt4K10Efficiency ' Me.txt4K10Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt4K10Efficiency.Location = New System.Drawing.Point(78, 57) + Me.txt4K10Efficiency.Location = New System.Drawing.Point(111, 57) Me.txt4K10Efficiency.Name = "txt4K10Efficiency" Me.txt4K10Efficiency.Size = New System.Drawing.Size(50, 20) Me.txt4K10Efficiency.TabIndex = 70 ' - 'txt4K40Efficiency + 'txt4KMax2Efficiency ' - Me.txt4K40Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt4K40Efficiency.Location = New System.Drawing.Point(78, 85) - Me.txt4K40Efficiency.Name = "txt4K40Efficiency" - Me.txt4K40Efficiency.Size = New System.Drawing.Size(50, 20) - Me.txt4K40Efficiency.TabIndex = 80 + Me.txt4KMax2Efficiency.ForeColor = System.Drawing.Color.Black + Me.txt4KMax2Efficiency.Location = New System.Drawing.Point(111, 85) + Me.txt4KMax2Efficiency.Name = "txt4KMax2Efficiency" + Me.txt4KMax2Efficiency.Size = New System.Drawing.Size(50, 20) + Me.txt4KMax2Efficiency.TabIndex = 80 ' 'Label3 ' - Me.Label3.AutoSize = true + Me.Label3.AutoSize = True Me.Label3.ForeColor = System.Drawing.Color.Black - Me.Label3.Location = New System.Drawing.Point(24, 30) + Me.Label3.Location = New System.Drawing.Point(57, 30) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(33, 13) Me.Label3.TabIndex = 8 @@ -242,92 +222,64 @@ Partial Class frmCombinedAlternators ' 'Label4 ' - Me.Label4.AutoSize = true + Me.Label4.AutoSize = True Me.Label4.ForeColor = System.Drawing.Color.Black - Me.Label4.Location = New System.Drawing.Point(75, 30) + Me.Label4.Location = New System.Drawing.Point(108, 30) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(53, 13) Me.Label4.TabIndex = 9 Me.Label4.Text = "Efficiency" ' - 'Label5 - ' - Me.Label5.AutoSize = true - Me.Label5.ForeColor = System.Drawing.Color.Black - Me.Label5.Location = New System.Drawing.Point(40, 60) - Me.Label5.Name = "Label5" - Me.Label5.Size = New System.Drawing.Size(19, 13) - Me.Label5.TabIndex = 29 - Me.Label5.Text = "10" - ' - 'Label6 - ' - Me.Label6.AutoSize = true - Me.Label6.ForeColor = System.Drawing.Color.Black - Me.Label6.Location = New System.Drawing.Point(40, 115) - Me.Label6.Name = "Label6" - Me.Label6.Size = New System.Drawing.Size(19, 13) - Me.Label6.TabIndex = 30 - Me.Label6.Text = "60" - ' - 'Label11 - ' - Me.Label11.AutoSize = true - Me.Label11.ForeColor = System.Drawing.Color.Black - Me.Label11.Location = New System.Drawing.Point(40, 88) - Me.Label11.Name = "Label11" - Me.Label11.Size = New System.Drawing.Size(19, 13) - Me.Label11.TabIndex = 30 - Me.Label11.Text = "40" - ' 'grpTable6000PRM ' - Me.grpTable6000PRM.Controls.Add(Me.txt6K60Efficiency) + Me.grpTable6000PRM.Controls.Add(Me.txt6KMaxAmps) + Me.grpTable6000PRM.Controls.Add(Me.txt6KMax2Amps) + Me.grpTable6000PRM.Controls.Add(Me.txt6K10Amps) + Me.grpTable6000PRM.Controls.Add(Me.Label10) + Me.grpTable6000PRM.Controls.Add(Me.Label11) + Me.grpTable6000PRM.Controls.Add(Me.txt6KMaxEfficiency) Me.grpTable6000PRM.Controls.Add(Me.txt6K10Efficiency) - Me.grpTable6000PRM.Controls.Add(Me.txt6K40Efficiency) + Me.grpTable6000PRM.Controls.Add(Me.txt6KMax2Efficiency) Me.grpTable6000PRM.Controls.Add(Me.Label12) Me.grpTable6000PRM.Controls.Add(Me.Label13) - Me.grpTable6000PRM.Controls.Add(Me.Label14) - Me.grpTable6000PRM.Controls.Add(Me.Label15) - Me.grpTable6000PRM.Controls.Add(Me.Label16) Me.grpTable6000PRM.FlatStyle = System.Windows.Forms.FlatStyle.Popup Me.grpTable6000PRM.ForeColor = System.Drawing.SystemColors.MenuHighlight - Me.grpTable6000PRM.Location = New System.Drawing.Point(398, 62) + Me.grpTable6000PRM.Location = New System.Drawing.Point(491, 102) Me.grpTable6000PRM.Name = "grpTable6000PRM" - Me.grpTable6000PRM.Size = New System.Drawing.Size(162, 166) + Me.grpTable6000PRM.Size = New System.Drawing.Size(183, 166) Me.grpTable6000PRM.TabIndex = 32 - Me.grpTable6000PRM.TabStop = false + Me.grpTable6000PRM.TabStop = False Me.grpTable6000PRM.Text = " [ 6000 RPM ]" ' - 'txt6K60Efficiency + 'txt6KMaxEfficiency ' - Me.txt6K60Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt6K60Efficiency.Location = New System.Drawing.Point(78, 117) - Me.txt6K60Efficiency.Name = "txt6K60Efficiency" - Me.txt6K60Efficiency.Size = New System.Drawing.Size(50, 20) - Me.txt6K60Efficiency.TabIndex = 120 + Me.txt6KMaxEfficiency.ForeColor = System.Drawing.Color.Black + Me.txt6KMaxEfficiency.Location = New System.Drawing.Point(112, 113) + Me.txt6KMaxEfficiency.Name = "txt6KMaxEfficiency" + Me.txt6KMaxEfficiency.Size = New System.Drawing.Size(50, 20) + Me.txt6KMaxEfficiency.TabIndex = 120 ' 'txt6K10Efficiency ' Me.txt6K10Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt6K10Efficiency.Location = New System.Drawing.Point(78, 57) + Me.txt6K10Efficiency.Location = New System.Drawing.Point(112, 57) Me.txt6K10Efficiency.Name = "txt6K10Efficiency" Me.txt6K10Efficiency.Size = New System.Drawing.Size(50, 20) Me.txt6K10Efficiency.TabIndex = 100 ' - 'txt6K40Efficiency + 'txt6KMax2Efficiency ' - Me.txt6K40Efficiency.ForeColor = System.Drawing.Color.Black - Me.txt6K40Efficiency.Location = New System.Drawing.Point(78, 85) - Me.txt6K40Efficiency.Name = "txt6K40Efficiency" - Me.txt6K40Efficiency.Size = New System.Drawing.Size(50, 20) - Me.txt6K40Efficiency.TabIndex = 110 + Me.txt6KMax2Efficiency.ForeColor = System.Drawing.Color.Black + Me.txt6KMax2Efficiency.Location = New System.Drawing.Point(112, 85) + Me.txt6KMax2Efficiency.Name = "txt6KMax2Efficiency" + Me.txt6KMax2Efficiency.Size = New System.Drawing.Size(50, 20) + Me.txt6KMax2Efficiency.TabIndex = 110 ' 'Label12 ' - Me.Label12.AutoSize = true + Me.Label12.AutoSize = True Me.Label12.ForeColor = System.Drawing.Color.Black - Me.Label12.Location = New System.Drawing.Point(24, 30) + Me.Label12.Location = New System.Drawing.Point(58, 30) Me.Label12.Name = "Label12" Me.Label12.Size = New System.Drawing.Size(33, 13) Me.Label12.TabIndex = 8 @@ -335,44 +287,14 @@ Partial Class frmCombinedAlternators ' 'Label13 ' - Me.Label13.AutoSize = true + Me.Label13.AutoSize = True Me.Label13.ForeColor = System.Drawing.Color.Black - Me.Label13.Location = New System.Drawing.Point(75, 30) + Me.Label13.Location = New System.Drawing.Point(109, 30) Me.Label13.Name = "Label13" Me.Label13.Size = New System.Drawing.Size(53, 13) Me.Label13.TabIndex = 9 Me.Label13.Text = "Efficiency" ' - 'Label14 - ' - Me.Label14.AutoSize = true - Me.Label14.ForeColor = System.Drawing.Color.Black - Me.Label14.Location = New System.Drawing.Point(40, 60) - Me.Label14.Name = "Label14" - Me.Label14.Size = New System.Drawing.Size(19, 13) - Me.Label14.TabIndex = 29 - Me.Label14.Text = "10" - ' - 'Label15 - ' - Me.Label15.AutoSize = true - Me.Label15.ForeColor = System.Drawing.Color.Black - Me.Label15.Location = New System.Drawing.Point(40, 115) - Me.Label15.Name = "Label15" - Me.Label15.Size = New System.Drawing.Size(19, 13) - Me.Label15.TabIndex = 30 - Me.Label15.Text = "60" - ' - 'Label16 - ' - Me.Label16.AutoSize = true - Me.Label16.ForeColor = System.Drawing.Color.Black - Me.Label16.Location = New System.Drawing.Point(40, 88) - Me.Label16.Name = "Label16" - Me.Label16.Size = New System.Drawing.Size(19, 13) - Me.Label16.TabIndex = 30 - Me.Label16.Text = "40" - ' 'TabControl1 ' Me.TabControl1.Controls.Add(Me.tabInputs) @@ -385,7 +307,7 @@ Partial Class frmCombinedAlternators ' 'tabInputs ' - Me.tabInputs.CausesValidation = false + Me.tabInputs.CausesValidation = False Me.tabInputs.Controls.Add(Me.txtAlternatorName) Me.tabInputs.Controls.Add(Me.lblAlternatorName) Me.tabInputs.Controls.Add(Me.btnClearForm) @@ -405,19 +327,19 @@ Partial Class frmCombinedAlternators Me.tabInputs.Size = New System.Drawing.Size(692, 468) Me.tabInputs.TabIndex = 0 Me.tabInputs.Text = " Inputs " - Me.tabInputs.UseVisualStyleBackColor = true + Me.tabInputs.UseVisualStyleBackColor = True ' 'txtAlternatorName ' - Me.txtAlternatorName.Location = New System.Drawing.Point(242, 22) + Me.txtAlternatorName.Location = New System.Drawing.Point(290, 22) Me.txtAlternatorName.Name = "txtAlternatorName" Me.txtAlternatorName.Size = New System.Drawing.Size(160, 20) Me.txtAlternatorName.TabIndex = 20 ' 'lblAlternatorName ' - Me.lblAlternatorName.AutoSize = true - Me.lblAlternatorName.Location = New System.Drawing.Point(156, 25) + Me.lblAlternatorName.AutoSize = True + Me.lblAlternatorName.Location = New System.Drawing.Point(204, 25) Me.lblAlternatorName.Name = "lblAlternatorName" Me.lblAlternatorName.Size = New System.Drawing.Size(80, 13) Me.lblAlternatorName.TabIndex = 40 @@ -425,26 +347,26 @@ Partial Class frmCombinedAlternators ' 'btnClearForm ' - Me.btnClearForm.Location = New System.Drawing.Point(589, 140) + Me.btnClearForm.Location = New System.Drawing.Point(599, 61) Me.btnClearForm.Name = "btnClearForm" Me.btnClearForm.Size = New System.Drawing.Size(75, 23) Me.btnClearForm.TabIndex = 39 Me.btnClearForm.Text = "Clear Form" - Me.btnClearForm.UseVisualStyleBackColor = true + Me.btnClearForm.UseVisualStyleBackColor = True ' 'gvAlternators ' Me.gvAlternators.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - Me.gvAlternators.Location = New System.Drawing.Point(38, 276) + Me.gvAlternators.Location = New System.Drawing.Point(38, 306) Me.gvAlternators.Name = "gvAlternators" Me.gvAlternators.Size = New System.Drawing.Size(419, 140) Me.gvAlternators.TabIndex = 38 ' 'Label18 ' - Me.Label18.AutoSize = true + Me.Label18.AutoSize = True Me.Label18.ForeColor = System.Drawing.SystemColors.MenuHighlight - Me.Label18.Location = New System.Drawing.Point(38, 258) + Me.Label18.Location = New System.Drawing.Point(38, 288) Me.Label18.Name = "Label18" Me.Label18.Size = New System.Drawing.Size(57, 13) Me.Label18.TabIndex = 37 @@ -452,16 +374,16 @@ Partial Class frmCombinedAlternators ' 'btnUpdate ' - Me.btnUpdate.Location = New System.Drawing.Point(589, 73) + Me.btnUpdate.Location = New System.Drawing.Point(509, 61) Me.btnUpdate.Name = "btnUpdate" Me.btnUpdate.Size = New System.Drawing.Size(75, 23) Me.btnUpdate.TabIndex = 35 Me.btnUpdate.Text = "Add" - Me.btnUpdate.UseVisualStyleBackColor = true + Me.btnUpdate.UseVisualStyleBackColor = True ' 'Label17 ' - Me.Label17.AutoSize = true + Me.Label17.AutoSize = True Me.Label17.Location = New System.Drawing.Point(38, 25) Me.Label17.Name = "Label17" Me.Label17.Size = New System.Drawing.Size(33, 13) @@ -472,7 +394,7 @@ Partial Class frmCombinedAlternators ' Me.txtIndex.Location = New System.Drawing.Point(77, 22) Me.txtIndex.Name = "txtIndex" - Me.txtIndex.ReadOnly = true + Me.txtIndex.ReadOnly = True Me.txtIndex.Size = New System.Drawing.Size(47, 20) Me.txtIndex.TabIndex = 33 ' @@ -485,14 +407,14 @@ Partial Class frmCombinedAlternators Me.tabDiagnostics.Size = New System.Drawing.Size(692, 468) Me.tabDiagnostics.TabIndex = 1 Me.tabDiagnostics.Text = " Diagnostics" - Me.tabDiagnostics.UseVisualStyleBackColor = true + Me.tabDiagnostics.UseVisualStyleBackColor = True ' 'txtDiagnostics ' - Me.txtDiagnostics.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.txtDiagnostics.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtDiagnostics.Location = New System.Drawing.Point(23, 16) Me.txtDiagnostics.Margin = New System.Windows.Forms.Padding(0) - Me.txtDiagnostics.Multiline = true + Me.txtDiagnostics.Multiline = True Me.txtDiagnostics.Name = "txtDiagnostics" Me.txtDiagnostics.ScrollBars = System.Windows.Forms.ScrollBars.Vertical Me.txtDiagnostics.Size = New System.Drawing.Size(648, 429) @@ -505,7 +427,7 @@ Partial Class frmCombinedAlternators Me.btnSave.Size = New System.Drawing.Size(75, 23) Me.btnSave.TabIndex = 34 Me.btnSave.Text = "Save" - Me.btnSave.UseVisualStyleBackColor = true + Me.btnSave.UseVisualStyleBackColor = True ' 'btnCancel ' @@ -514,18 +436,141 @@ Partial Class frmCombinedAlternators Me.btnCancel.Size = New System.Drawing.Size(75, 23) Me.btnCancel.TabIndex = 35 Me.btnCancel.Text = "Cancel" - Me.btnCancel.UseVisualStyleBackColor = true + Me.btnCancel.UseVisualStyleBackColor = True ' 'ErrorProvider1 ' Me.ErrorProvider1.ContainerControl = Me ' + 'txt2K10Amps + ' + Me.txt2K10Amps.Location = New System.Drawing.Point(54, 57) + Me.txt2K10Amps.Name = "txt2K10Amps" + Me.txt2K10Amps.ReadOnly = True + Me.txt2K10Amps.Size = New System.Drawing.Size(38, 20) + Me.txt2K10Amps.TabIndex = 61 + Me.txt2K10Amps.Text = "10" + ' + 'txt2KMax2Amps + ' + Me.txt2KMax2Amps.Location = New System.Drawing.Point(54, 85) + Me.txt2KMax2Amps.Name = "txt2KMax2Amps" + Me.txt2KMax2Amps.Size = New System.Drawing.Size(38, 20) + Me.txt2KMax2Amps.TabIndex = 62 + ' + 'txt2KMaxAmps + ' + Me.txt2KMaxAmps.Location = New System.Drawing.Point(54, 115) + Me.txt2KMaxAmps.Name = "txt2KMaxAmps" + Me.txt2KMaxAmps.Size = New System.Drawing.Size(38, 20) + Me.txt2KMaxAmps.TabIndex = 63 + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(7, 87) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(45, 13) + Me.Label5.TabIndex = 64 + Me.Label5.Text = "l_max/2" + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Location = New System.Drawing.Point(10, 115) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(34, 13) + Me.Label6.TabIndex = 65 + Me.Label6.Text = "l_max" + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(9, 115) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(34, 13) + Me.Label8.TabIndex = 92 + Me.Label8.Text = "l_max" + ' + 'Label9 + ' + Me.Label9.AutoSize = True + Me.Label9.Location = New System.Drawing.Point(6, 87) + Me.Label9.Name = "Label9" + Me.Label9.Size = New System.Drawing.Size(45, 13) + Me.Label9.TabIndex = 91 + Me.Label9.Text = "l_max/2" + ' + 'Label10 + ' + Me.Label10.AutoSize = True + Me.Label10.Location = New System.Drawing.Point(9, 116) + Me.Label10.Name = "Label10" + Me.Label10.Size = New System.Drawing.Size(34, 13) + Me.Label10.TabIndex = 122 + Me.Label10.Text = "l_max" + ' + 'Label11 + ' + Me.Label11.AutoSize = True + Me.Label11.Location = New System.Drawing.Point(6, 88) + Me.Label11.Name = "Label11" + Me.Label11.Size = New System.Drawing.Size(45, 13) + Me.Label11.TabIndex = 121 + Me.Label11.Text = "l_max/2" + ' + 'txt4K10Amps + ' + Me.txt4K10Amps.Location = New System.Drawing.Point(54, 57) + Me.txt4K10Amps.Name = "txt4K10Amps" + Me.txt4K10Amps.ReadOnly = True + Me.txt4K10Amps.Size = New System.Drawing.Size(38, 20) + Me.txt4K10Amps.TabIndex = 93 + Me.txt4K10Amps.Text = "10" + ' + 'txt6K10Amps + ' + Me.txt6K10Amps.Location = New System.Drawing.Point(55, 57) + Me.txt6K10Amps.Name = "txt6K10Amps" + Me.txt6K10Amps.ReadOnly = True + Me.txt6K10Amps.Size = New System.Drawing.Size(38, 20) + Me.txt6K10Amps.TabIndex = 123 + Me.txt6K10Amps.Text = "10" + ' + 'txt4KMax2Amps + ' + Me.txt4KMax2Amps.Location = New System.Drawing.Point(54, 84) + Me.txt4KMax2Amps.Name = "txt4KMax2Amps" + Me.txt4KMax2Amps.Size = New System.Drawing.Size(38, 20) + Me.txt4KMax2Amps.TabIndex = 94 + ' + 'txt4KMaxAmps + ' + Me.txt4KMaxAmps.Location = New System.Drawing.Point(54, 112) + Me.txt4KMaxAmps.Name = "txt4KMaxAmps" + Me.txt4KMaxAmps.Size = New System.Drawing.Size(38, 20) + Me.txt4KMaxAmps.TabIndex = 95 + ' + 'txt6KMax2Amps + ' + Me.txt6KMax2Amps.Location = New System.Drawing.Point(55, 85) + Me.txt6KMax2Amps.Name = "txt6KMax2Amps" + Me.txt6KMax2Amps.Size = New System.Drawing.Size(38, 20) + Me.txt6KMax2Amps.TabIndex = 124 + ' + 'txt6KMaxAmps + ' + Me.txt6KMaxAmps.Location = New System.Drawing.Point(55, 113) + Me.txt6KMaxAmps.Name = "txt6KMaxAmps" + Me.txt6KMaxAmps.Size = New System.Drawing.Size(38, 20) + Me.txt6KMaxAmps.TabIndex = 125 + ' 'frmCombinedAlternators ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoValidate = System.Windows.Forms.AutoValidate.EnableAllowFocusChange - Me.CausesValidation = false + Me.CausesValidation = False Me.ClientSize = New System.Drawing.Size(774, 579) Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.btnSave) @@ -534,51 +579,42 @@ Partial Class frmCombinedAlternators Me.Name = "frmCombinedAlternators" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Combined Alternators - ( Excel V03 )" - Me.grpTable2000PRM.ResumeLayout(false) - Me.grpTable2000PRM.PerformLayout - Me.grpTable4000PRM.ResumeLayout(false) - Me.grpTable4000PRM.PerformLayout - Me.grpTable6000PRM.ResumeLayout(false) - Me.grpTable6000PRM.PerformLayout - Me.TabControl1.ResumeLayout(false) - Me.tabInputs.ResumeLayout(false) - Me.tabInputs.PerformLayout - CType(Me.gvAlternators,System.ComponentModel.ISupportInitialize).EndInit - Me.tabDiagnostics.ResumeLayout(false) - Me.tabDiagnostics.PerformLayout - CType(Me.ErrorProvider1,System.ComponentModel.ISupportInitialize).EndInit - Me.ResumeLayout(false) + Me.grpTable2000PRM.ResumeLayout(False) + Me.grpTable2000PRM.PerformLayout() + Me.grpTable4000PRM.ResumeLayout(False) + Me.grpTable4000PRM.PerformLayout() + Me.grpTable6000PRM.ResumeLayout(False) + Me.grpTable6000PRM.PerformLayout() + Me.TabControl1.ResumeLayout(False) + Me.tabInputs.ResumeLayout(False) + Me.tabInputs.PerformLayout() + CType(Me.gvAlternators, System.ComponentModel.ISupportInitialize).EndInit() + Me.tabDiagnostics.ResumeLayout(False) + Me.tabDiagnostics.PerformLayout() + CType(Me.ErrorProvider1, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) -End Sub + End Sub Friend WithEvents txt2K10Efficiency As System.Windows.Forms.TextBox - Friend WithEvents txt2K60Efficiency As System.Windows.Forms.TextBox - Friend WithEvents txt2K40Efficiency As System.Windows.Forms.TextBox + Friend WithEvents txt2KMaxEfficiency As System.Windows.Forms.TextBox + Friend WithEvents txt2KMax2Efficiency As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents txtPulleyRatio As System.Windows.Forms.TextBox Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents grpTable2000PRM As System.Windows.Forms.GroupBox - Friend WithEvents Label10 As System.Windows.Forms.Label - Friend WithEvents Label9 As System.Windows.Forms.Label - Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents grpTable4000PRM As System.Windows.Forms.GroupBox - Friend WithEvents txt4K60Efficiency As System.Windows.Forms.TextBox + Friend WithEvents txt4KMaxEfficiency As System.Windows.Forms.TextBox Friend WithEvents txt4K10Efficiency As System.Windows.Forms.TextBox - Friend WithEvents txt4K40Efficiency As System.Windows.Forms.TextBox + Friend WithEvents txt4KMax2Efficiency As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label - Friend WithEvents Label5 As System.Windows.Forms.Label - Friend WithEvents Label6 As System.Windows.Forms.Label - Friend WithEvents Label11 As System.Windows.Forms.Label Friend WithEvents grpTable6000PRM As System.Windows.Forms.GroupBox - Friend WithEvents txt6K60Efficiency As System.Windows.Forms.TextBox + Friend WithEvents txt6KMaxEfficiency As System.Windows.Forms.TextBox Friend WithEvents txt6K10Efficiency As System.Windows.Forms.TextBox - Friend WithEvents txt6K40Efficiency As System.Windows.Forms.TextBox + Friend WithEvents txt6KMax2Efficiency As System.Windows.Forms.TextBox Friend WithEvents Label12 As System.Windows.Forms.Label Friend WithEvents Label13 As System.Windows.Forms.Label - Friend WithEvents Label14 As System.Windows.Forms.Label - Friend WithEvents Label15 As System.Windows.Forms.Label - Friend WithEvents Label16 As System.Windows.Forms.Label Friend WithEvents TabControl1 As System.Windows.Forms.TabControl Friend WithEvents tabInputs As System.Windows.Forms.TabPage Friend WithEvents gvAlternators As System.Windows.Forms.DataGridView @@ -594,4 +630,19 @@ End Sub Friend WithEvents txtAlternatorName As System.Windows.Forms.TextBox Friend WithEvents lblAlternatorName As System.Windows.Forms.Label Friend WithEvents txtDiagnostics As System.Windows.Forms.TextBox + Friend WithEvents Label6 As System.Windows.Forms.Label + Friend WithEvents Label5 As System.Windows.Forms.Label + Friend WithEvents txt2KMaxAmps As System.Windows.Forms.TextBox + Friend WithEvents txt2KMax2Amps As System.Windows.Forms.TextBox + Friend WithEvents txt2K10Amps As System.Windows.Forms.TextBox + Friend WithEvents txt4KMaxAmps As System.Windows.Forms.TextBox + Friend WithEvents txt4KMax2Amps As System.Windows.Forms.TextBox + Friend WithEvents txt4K10Amps As System.Windows.Forms.TextBox + Friend WithEvents Label8 As System.Windows.Forms.Label + Friend WithEvents Label9 As System.Windows.Forms.Label + Friend WithEvents txt6KMaxAmps As System.Windows.Forms.TextBox + Friend WithEvents txt6KMax2Amps As System.Windows.Forms.TextBox + Friend WithEvents txt6K10Amps As System.Windows.Forms.TextBox + Friend WithEvents Label10 As System.Windows.Forms.Label + Friend WithEvents Label11 As System.Windows.Forms.Label End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb b/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb index 2faa025890483914c565dfcd9f8c5a8243c4f912..864b01ff18e2de55742cd1606cbb0c7ec49661fb 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmCombinedAlternators.vb @@ -10,599 +10,612 @@ Imports VectoAuxiliaries.Hvac Public Class frmCombinedAlternators - Private combinedAlt As CombinedAlternator - Private originalAlt As CombinedAlternator - Private altSignals As ICombinedAlternatorSignals - Protected gbColor As System.Drawing.Color = Color.LightGreen - Private UserHitCancel As Boolean = false - Private UserHitSave As Boolean = false - Private aaltPath As String = "" + Private combinedAlt As CombinedAlternator + Private originalAlt As CombinedAlternator + Private altSignals As ICombinedAlternatorSignals + Protected gbColor As System.Drawing.Color = Color.LightGreen + Private UserHitCancel As Boolean = False + Private UserHitSave As Boolean = False + Private aaltPath As String = "" - 'Constructor(s) - Public Sub New(aaltPath As String, altSignals As ICombinedAlternatorSignals) + 'Constructor(s) + Public Sub New(aaltPath As String, altSignals As ICombinedAlternatorSignals) - ' This call is required by the designer. - InitializeComponent() + ' This call is required by the designer. + InitializeComponent() - ' Add any initialization after the InitializeComponent() call. + ' Add any initialization after the InitializeComponent() call. + Me.aaltpath = aaltPath - Me.aaltpath = aaltPath + combinedAlt = New CombinedAlternator(aaltPath) + originalAlt = New CombinedAlternator(aaltPath) - combinedAlt = New CombinedAlternator(aaltPath) - originalAlt = New CombinedAlternator(aaltPath) + SetupControls() + BindGrid() - SetupControls() - BindGrid() + End Sub - End Sub + 'General Helpders + Private Sub BindGrid() - 'General Helpders - Private Sub BindGrid() + gvAlternators.DataSource = New BindingList(Of IAlternator)(combinedAlt.Alternators.OrderBy(Function(o) o.AlternatorName).ToList()) - gvAlternators.DataSource = New BindingList(Of IAlternator)( combinedAlt.Alternators.OrderBy( Function(o) o.AlternatorName ).ToList()) + End Sub + Private Sub SetupControls() - End Sub - Private Sub SetupControls() + 'gvAlternators + gvAlternators.AutoGenerateColumns = False - 'gvAlternators - gvAlternators.AutoGenerateColumns = False + Dim cIndex As Integer - Dim cIndex As Integer + 'Column - AlternatorName + cIndex = gvAlternators.Columns.Add("AlternatorName", "AlternatorName") + gvAlternators.Columns(cIndex).DataPropertyName = "AlternatorName" + gvAlternators.Columns(cIndex).Width = 250 + gvAlternators.Columns(cIndex).ReadOnly = True + gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - 'Column - AlternatorName - cIndex = gvAlternators.Columns.Add("AlternatorName", "AlternatorName") - gvAlternators.Columns(cIndex).DataPropertyName = "AlternatorName" - gvAlternators.Columns(cIndex).Width = 250 - gvAlternators.Columns(cIndex).ReadOnly = True - gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + 'Column - PulleyRatio + cIndex = gvAlternators.Columns.Add("PulleyRatio", "PulleyRatio") + gvAlternators.Columns(cIndex).DataPropertyName = "PulleyRatio" + gvAlternators.Columns(cIndex).Width = 70 + gvAlternators.Columns(cIndex).ReadOnly = True + gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - 'Column - PulleyRatio - cIndex = gvAlternators.Columns.Add("PulleyRatio", "PulleyRatio") - gvAlternators.Columns(cIndex).DataPropertyName = "PulleyRatio" - gvAlternators.Columns(cIndex).Width = 70 - gvAlternators.Columns(cIndex).ReadOnly = True - gvAlternators.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvAlternators.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + Dim deleteColumn As New DeleteAlternatorColumn() + With deleteColumn + .HeaderText = "" + .ToolTipText = "Delete this row" + .Name = "Delete" + .Width = 25 + .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + End With - Dim deleteColumn As New DeleteAlternatorColumn() - With deleteColumn - .HeaderText = "" - .ToolTipText = "Delete this row" - .Name = "Delete" - .Width = 25 - .DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter - End With + ' deleteColumn.CellTemplate.ToolTipText="Delete this alternator" + gvAlternators.Columns.Add(deleteColumn) - ' deleteColumn.CellTemplate.ToolTipText="Delete this alternator" - gvAlternators.Columns.Add(deleteColumn) + End Sub + Public Sub UpdateButtonText() - End Sub - public Sub UpdateButtonText() + If txtIndex.Text = String.Empty Then + btnUpdate.Text = "Add" + Else + btnUpdate.Text = "Update" + End If - If txtIndex.Text=String.Empty then - btnUpdate.Text = "Add" - Else - btnUpdate.Text = "Update" - End if + End Sub + Private Sub CreateDiagnostics() - End sub - Private Sub CreateDiagnostics() - - txtDiagnostics.Text = combinedAlt.ToString() - - End Sub + txtDiagnostics.Text = combinedAlt.ToString() + End Sub - 'Validation Helpers - Private Sub IsTextBoxNumber(control As TextBox, errorProviderMessage As String, ByRef result As Boolean) - If Not IsNumeric(control.Text) Then - ErrorProvider1.SetError(control, errorProviderMessage) - result = False + 'Validation Helpers + Private Sub IsTextBoxNumber(control As TextBox, errorProviderMessage As String, ByRef result As Boolean) + + If Not IsNumeric(control.Text) Then + ErrorProvider1.SetError(control, errorProviderMessage) + result = False Else - ErrorProvider1.SetError(control, String.Empty) + ErrorProvider1.SetError(control, String.Empty) End If - End Sub - Private Sub IsEmptyString(text As String, control As Control, errorProviderMessage As String, ByRef result As Boolean) + End Sub + Private Sub IsEmptyString(text As String, control As Control, errorProviderMessage As String, ByRef result As Boolean) - If String.IsNullOrEmpty(text) Then - ErrorProvider1.SetError(control, errorProviderMessage) - result = False + If String.IsNullOrEmpty(text) Then + ErrorProvider1.SetError(control, errorProviderMessage) + result = False Else - ErrorProvider1.SetError(control, String.Empty) + ErrorProvider1.SetError(control, String.Empty) End If - End Sub - Private Function IsPostiveInteger(ByVal test As String) As Boolean + End Sub + Private Function IsPostiveInteger(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As integer + Dim number As Integer - If Not Integer.TryParse(test, number) Then Return False + If Not Integer.TryParse(test, number) Then Return False - If number <= 0 Then Return False + If number <= 0 Then Return False - Return True + Return True -End Function - Private Function IsPostiveNumber(ByVal test As String) As Boolean + End Function + Private Function IsPostiveNumber(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As double + Dim number As Double - If Not Double.TryParse(test, number) Then Return False + If Not Double.TryParse(test, number) Then Return False - If number <= 0 Then Return False + If number <= 0 Then Return False - Return True + Return True -End Function - Private Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean + End Function + Private Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As double + Dim number As Double - If Not Double.TryParse(test, number) Then Return False + If Not Double.TryParse(test, number) Then Return False - If number < 0 Then Return False + If number < 0 Then Return False - Return True + Return True -End Function - Private Function IsNumberBetweenZeroandOne(test As String) As Boolean + End Function + Private Function IsNumberBetweenZeroandOne(test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - Dim number As double + Dim number As Double - If Not Double.TryParse(test, number) Then Return False + If Not Double.TryParse(test, number) Then Return False - If number < 0 OrElse number > 1 Then Return False + If number < 0 OrElse number > 1 Then Return False - Return True + Return True -End Function - Private Function IsNumberBetweenOverZeroAndLessThan100(txtBox As TextBox ) As Boolean + End Function + Private Function IsNumberBetweenOverZeroAndLessThan100(txtBox As TextBox) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(txtBox.Text) Then - ErrorProvider1.SetError(txtBox,"Please enter a number") - return false - else - ErrorProvider1.SetError(txtBox,"") - End If + 'Is this numeric sanity check. + If Not IsNumeric(txtBox.Text) Then + ErrorProvider1.SetError(txtBox, "Please enter a number") + Return False + Else + ErrorProvider1.SetError(txtBox, "") + End If - Dim number As double = 0 + Dim number As Double = 0 - If Not Double.TryParse(txtBox.Text, number) Then - ErrorProvider1.SetError(txtBox,"Please enter a number >0 and <100") - Return False + If Not Double.TryParse(txtBox.Text, number) Then + ErrorProvider1.SetError(txtBox, "Please enter a number >0 and <100") + Return False Else - ErrorProvider1.SetError(txtBox,String.Empty) - End If + ErrorProvider1.SetError(txtBox, String.Empty) + End If - If number <= 0 OrElse number >=100 Then + If number <= 0 OrElse number >= 100 Then - ErrorProvider1.SetError(txtBox,"Please enter a number >0 and <100") - Return False - Else - ErrorProvider1.SetError(txtBox,String.Empty) - Return true + ErrorProvider1.SetError(txtBox, "Please enter a number >0 and <100") + Return False + Else + ErrorProvider1.SetError(txtBox, String.Empty) + Return True - End If + End If - Return True + Return True -End Function - Private Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean + End Function + Private Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False - 'if not integer then return false + 'if not integer then return false - Dim number As Integer + Dim number As Integer - If Not Integer.TryParse(test, number) Then Return False + If Not Integer.TryParse(test, number) Then Return False - If number < 0 Then Return False + If number < 0 Then Return False - Return True + Return True -End Function - Private Function ValidateAll() As Boolean + End Function + Private Function ValidateAll() As Boolean - End Function + End Function - 'Other events - Private Sub groupBoxUserInput_Paint(sender As Object, e As Windows.Forms.PaintEventArgs) Handles grpTable2000PRM.Paint, grpTable6000PRM.Paint, grpTable4000PRM.Paint + 'Other events + Private Sub groupBoxUserInput_Paint(sender As Object, e As Windows.Forms.PaintEventArgs) Handles grpTable2000PRM.Paint, grpTable6000PRM.Paint, grpTable4000PRM.Paint - Dim p As Pen = Nothing + Dim p As Pen = Nothing - Dim sdr As Control = DirectCast(sender, Control) + Dim sdr As Control = DirectCast(sender, Control) - Select Case sdr.Name + Select Case sdr.Name - Case "grpTable2000PRM" + Case "grpTable2000PRM" p = New Pen(Color.LightGreen, 3) - Case "grpTable4000PRM" + Case "grpTable4000PRM" p = New Pen(Color.Yellow, 3) - Case "grpTable6000PRM" + Case "grpTable6000PRM" p = New Pen(Color.LightPink, 3) - - Case Else + Case Else p = New Pen(Color.Black, 3) + End Select + + Dim gfx As Graphics = e.Graphics + + gfx.DrawLine(p, 0, 5, 0, e.ClipRectangle.Height - 2) + gfx.DrawLine(p, 0, 5, 10, 5) + gfx.DrawLine(p, 85, 5, e.ClipRectangle.Width - 2, 5) + gfx.DrawLine(p, e.ClipRectangle.Width - 2, 5, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2) + gfx.DrawLine(p, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2, 0, e.ClipRectangle.Height - 2) + + End Sub + + + 'Grid Events + Private Sub gvAlternators_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles gvAlternators.CellClick + + If e.ColumnIndex < 0 OrElse e.RowIndex < 0 Then Return + + If gvAlternators.Columns(e.ColumnIndex).Name = "Delete" Then + + + Dim feedback As String = String.Empty + Dim alternatorName As String = gvAlternators.Rows(e.RowIndex).Cells(0).Value.ToString() + + Select Case gvAlternators.Columns(e.ColumnIndex).Name + + Case "Delete" + Dim dr As DialogResult = MessageBox.Show(String.Format("Do you want to delete '{0}' ?", alternatorName), "", MessageBoxButtons.YesNo) + If dr = Windows.Forms.DialogResult.Yes Then + If combinedAlt.DeleteAlternator(alternatorName, feedback) Then + BindGrid() + Else + MessageBox.Show(feedback) + + End If + + End If + End Select + End If + + End Sub + Private Sub gvAlternators_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles gvAlternators.CellDoubleClick + + If gvAlternators.SelectedCells.Count < 1 Then Return + + Dim row As Integer = gvAlternators.SelectedCells(0).OwningRow.Index + + Dim alternatorName As String + + alternatorName = gvAlternators.Rows(row).Cells("AlternatorName").Value.ToString() + + Dim alt As IAlternator = combinedAlt.Alternators.First(Function(w) w.AlternatorName = alternatorName) + + + FillEditPanel(row) + + UpdateButtonText() - Dim gfx As Graphics = e.Graphics + End Sub + 'Button Events + Private Sub btnClearForm_Click(sender As Object, e As EventArgs) Handles btnClearForm.Click + ClearEditPanel() + UpdateButtonText() - gfx.DrawLine(p, 0, 5, 0, e.ClipRectangle.Height - 2) - gfx.DrawLine(p, 0, 5, 10, 5) - gfx.DrawLine(p, 85, 5, e.ClipRectangle.Width - 2, 5) - gfx.DrawLine(p, e.ClipRectangle.Width - 2, 5, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2) - gfx.DrawLine(p, e.ClipRectangle.Width - 2, e.ClipRectangle.Height - 2, 0, e.ClipRectangle.Height - 2) + End Sub + Public Function GetAlternatorFromPanel() As List(Of ICombinedAlternatorMapRow) - End Sub + Dim newAlt As New List(Of ICombinedAlternatorMapRow) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2K10Amps.Text), Convert.ToSingle(txt2K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMax2Amps.Text), Convert.ToSingle(txt2KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000, Convert.ToSingle(txt2KMaxAmps.Text), Convert.ToSingle(txt2KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - 'Grid Events - Private Sub gvAlternators_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles gvAlternators.CellClick + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4K10Amps.Text), Convert.ToSingle(txt4K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMax2Amps.Text), Convert.ToSingle(txt4KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000, Convert.ToSingle(txt4KMaxAmps.Text), Convert.ToSingle(txt4KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) - If e.ColumnIndex < 0 OrElse e.RowIndex < 0 Then Return + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6K10Amps.Text), Convert.ToSingle(txt6K10Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMax2Amps.Text), Convert.ToSingle(txt6KMax2Efficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + newAlt.Add(New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000, Convert.ToSingle(txt6KMaxAmps.Text), Convert.ToSingle(txt6KMaxEfficiency.Text), Convert.ToSingle(txtPulleyRatio.Text))) + Return newAlt - If gvAlternators.Columns(e.ColumnIndex).Name = "Delete" Then + End Function + Private Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click Dim feedback As String = String.Empty - Dim alternatorName As String = gvAlternators.Rows(e.RowIndex).Cells(0).Value.ToString() + If Not Validate_UpdatePanel() Then Return + + If txtIndex.Text.Trim.Length = 0 Then + 'This is an Add + If Not combinedAlt.AddAlternator(GetAlternatorFromPanel(), feedback) Then + MessageBox.Show(feedback) + Else - Select Case gvAlternators.Columns(e.ColumnIndex).Name + BindGrid() - Case "Delete" - Dim dr As DialogResult = MessageBox.Show(String.Format("Do you want to delete '{0}' ?", alternatorName), "", MessageBoxButtons.YesNo) - If dr = Windows.Forms.DialogResult.Yes Then - If combinedAlt.DeleteAlternator(alternatorName, feedback) Then - BindGrid() - Else - MessageBox.Show(feedback) + UpdateButtonText() End If - End If + Else + 'Get Existing row name. + Dim altName As String = gvAlternators.Rows(Convert.ToInt32(txtIndex.Text)).Cells("AlternatorName").Value.ToString() + 'Does name used in update exist in other alternators excluding the original being edited ?, if so abort. + If combinedAlt.Alternators.Where(Function(f) f.AlternatorName <> altName AndAlso f.AlternatorName = txtAlternatorName.Text).Count > 0 Then + MessageBox.Show(String.Format("The lternator '{0}' name you are using to update the alternator '{1}' already exists, operation aborted", txtAlternatorName.Text, altName)) + Return + End If + 'This is an update so delete the one being updated + If combinedAlt.DeleteAlternator(altName, feedback) AndAlso combinedAlt.AddAlternator(GetAlternatorFromPanel(), feedback) Then - End Select + BindGrid() + ClearEditPanel() + UpdateButtonText() + Else + MessageBox.Show(feedback) + End If + End If - End If -End Sub - Private Sub gvAlternators_CellDoubleClick( sender As Object, e As DataGridViewCellEventArgs) Handles gvAlternators.CellDoubleClick - - If gvAlternators.SelectedCells.Count<1 then Return - - - Dim row As Integer = gvAlternators.SelectedCells(0).OwningRow.Index - - Dim alternatorName As String - - alternatorName = gvAlternators.Rows(row).Cells("AlternatorName").Value.ToString() - - Dim alt as IAlternator = combinedAlt.Alternators.First( Function(w) w.AlternatorName= alternatorName) - - - FillEditPanel( row ) - - UpdateButtonText() - - - End Sub - - 'Button Events - Private Sub btnClearForm_Click( sender As Object, e As EventArgs) Handles btnClearForm.Click - - ClearEditPanel() - UpdateButtonText() - - End Sub - public function GetAlternatorFromPanel() As List(Of ICombinedAlternatorMapRow ) - - - - Dim newAlt As New List(Of ICombinedAlternatorMapRow) - - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000,10,Convert.ToSingle(txt2K10Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000,40,Convert.ToSingle(txt2K40Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 2000,60,Convert.ToSingle(txt2K60Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000,10,Convert.ToSingle(txt4K10Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000,40,Convert.ToSingle(txt4K40Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 4000,60,Convert.ToSingle(txt4K60Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000,10,Convert.ToSingle(txt6K10Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000,40,Convert.ToSingle(txt6K40Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - newAlt.Add( New CombinedAlternatorMapRow(txtAlternatorName.Text, 6000,60,Convert.ToSingle(txt6K60Efficiency.Text),Convert.ToSingle(txtPulleyRatio.Text))) - - - - Return newAlt - - - End Function - Private Sub btnUpdate_Click( sender As Object, e As EventArgs) Handles btnUpdate.Click - - - Dim feedback As String = String.Empty - - If NOT Validate_UpdatePanel() then Return - - If txtIndex.Text.Trim.Length=0 then - 'This is an Add - If Not combinedAlt.AddAlternator( GetAlternatorFromPanel(), feedback) then - MessageBox.Show( feedback ) - Else - - - BindGrid() - - UpdateButtonText() - - End if - - Else - - 'Get Existing row name. - Dim altName As String = gvAlternators.Rows( Convert.ToInt32(txtIndex.Text)).Cells("AlternatorName").Value.ToString() - - 'Does name used in update exist in other alternators excluding the original being edited ?, if so abort. - If combinedAlt.Alternators.Where( Function(f) f.AlternatorName<> altName AndAlso f.AlternatorName=txtAlternatorName.Text).Count>0 then - MessageBox.Show( String.Format("The lternator '{0}' name you are using to update the alternator '{1}' already exists, operation aborted",txtAlternatorName.Text,altName)) - return - End If - - 'This is an update so delete the one being updated - - If combinedAlt.DeleteAlternator(altName, feedback) AndAlso combinedAlt.AddAlternator(GetAlternatorFromPanel(),feedback ) then - - BindGrid() - ClearEditPanel() - UpdateButtonText() - - Else - MessageBox.Show( feedback ) + + End Sub + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + + UserHitCancel = True + Me.close() + + End Sub + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + + ' If Not ValidateAll then Return + + UserHitSave = True + + Me.DialogResult = Windows.Forms.DialogResult.OK + Me.Close() + + + + End Sub + + + 'Form / Tab Events + Private Sub TabControl1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged + + If TabControl1.SelectedIndex = 1 Then + CreateDiagnostics() End If - - End If - - - - End Sub - Private Sub btnCancel_Click( sender As Object, e As EventArgs) Handles btnCancel.Click - - UserHitCancel=true - Me.close - - End Sub - Private Sub btnSave_Click( sender As Object, e As EventArgs) Handles btnSave.Click - - ' If Not ValidateAll then Return - - UserHitSave=true - - Me.DialogResult=Windows.Forms.DialogResult.OK - Me.Close - + + End Sub + Private Sub frmCombinedAlternators_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing - End Sub - - - 'Form / Tab Events - Private Sub TabControl1_SelectedIndexChanged( sender As Object, e As EventArgs) Handles TabControl1.SelectedIndexChanged - - If TabControl1.SelectedIndex = 1 - - - CreateDiagnostics() - - - End If - End Sub - Private Sub frmCombinedAlternators_FormClosing( sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing - - - Dim result As DialogResult - - 'If UserHitCancel then bail - If UserHitCancel then - DialogResult= Windows.Forms.DialogResult.Cancel - UserHitCancel=false - return - End If - - 'UserHitSave - If UserHitSave then - DialogResult= Windows.Forms.DialogResult.Cancel - If NOT combinedAlt.Save(aaltPath ) then + Dim result As DialogResult + + 'If UserHitCancel then bail + If UserHitCancel Then + DialogResult = Windows.Forms.DialogResult.Cancel + UserHitCancel = False + Return + End If + + 'UserHitSave + If UserHitSave Then + DialogResult = Windows.Forms.DialogResult.Cancel + If Not combinedAlt.Save(aaltPath) Then MessageBox.Show("Unable to save file, aborting.") - e.Cancel=true - End If - UserHitSave=false - DialogResult=Windows.Forms.DialogResult.OK - return - End If - - - ''This must be a close box event. If nothing changed, then bail, otherwise ask user if they wanna save - If Not combinedAlt.IsEqualTo( originalAlt ) - - result = (MessageBox.Show("Would you like to save changes before closing?","Save Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) - - - Select Case result - - case DialogResult.Yes: - 'save - - If NOT combinedAlt.Save(aaltPath) then - e.Cancel=true - End If - - case DialogResult.No: - 'just allow the form to close - 'without saving - Me.DialogResult=Windows.Forms.DialogResult.Cancel - - - - case DialogResult.Cancel: - 'cancel the close - e.Cancel = true - Me.DialogResult=Windows.Forms.DialogResult.Cancel - - - end select - - End If - - UserHitCancel=false - UserHitSave=false - - - - End Sub - - - 'List Management - Private Sub ClearEditPanel() - - txtIndex.Text = String.Empty - txtAlternatorName.Text = String.Empty - txt2K10Efficiency.Text = string.Empty - txt2K40Efficiency.Text = string.Empty - txt2K60Efficiency.Text = string.Empty - - txt4K10Efficiency.Text = string.Empty - txt4K40Efficiency.Text = string.Empty - txt4K60Efficiency.Text = string.Empty - - txt6K10Efficiency.Text = string.Empty - txt6K40Efficiency.Text = string.Empty - txt6K60Efficiency.Text = string.Empty - - txtPulleyRatio .Text = string.Empty - - ErrorProvider1.SetError(txtAlternatorName , String.empty) - ErrorProvider1.SetError(txt2K10Efficiency , String.empty) - ErrorProvider1.SetError(txt2K40Efficiency , String.empty) - ErrorProvider1.SetError(txt2K60Efficiency , String.empty) - ErrorProvider1.SetError(txt4K10Efficiency , String.empty) - ErrorProvider1.SetError(txt4K40Efficiency , String.empty) - ErrorProvider1.SetError(txt4K60Efficiency , String.empty) - ErrorProvider1.SetError(txt6K10Efficiency , String.empty) - ErrorProvider1.SetError(txt6K40Efficiency , String.empty) - ErrorProvider1.SetError(txt6K60Efficiency , String.empty) - - ErrorProvider1.SetError(txtPulleyRatio , String.empty) - - - End Sub - public Function Validate_UpdatePanel() As Boolean - - Dim returnResult As Boolean = True - - IsEmptyString(txtAlternatorName.Text, txtAlternatorName,"Please enter a name for the alternator, names must be unique", returnResult) - - If Not IsNumberBetweenOverZeroAndLessThan100(txt2K10Efficiency) then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt2K40Efficiency) then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt2K60Efficiency) then returnResult = False - - If Not IsNumberBetweenOverZeroAndLessThan100(txt4K10Efficiency) then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt4K40Efficiency) then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt4K60Efficiency) then returnResult = False - - If Not IsNumberBetweenOverZeroAndLessThan100(txt6K10Efficiency) then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt6K40Efficiency) then returnResult = False - If Not IsNumberBetweenOverZeroAndLessThan100(txt6K60Efficiency) then returnResult = False - - If Not IsPostiveNumber(txtPulleyRatio.text) then - ErrorProvider1.SetError(txtPulleyRatio,"Please enter a sensible positive number") - returnResult=False - Else - ErrorProvider1.SetError(txtPulleyRatio,String.Empty) - End If - - Return returnResult - - End Function - Private sub FillEditPanel( index as integer ) - - Dim alt As IAlternator - Dim alternatorName As String = gvAlternators.Rows(index).Cells("AlternatorName").Value.ToString() - - alt = combinedAlt.Alternators.First( Function(f) f.AlternatorName=alternatorName ) - - txtIndex.Text = index.ToString() - txtAlternatorName.Text = alt.AlternatorName - txt2K10Efficiency.Text = alt.InputTable2000.First( Function(x) x.Amps=10).Eff.ToString() - txt2K40Efficiency.Text = alt.InputTable2000.First( Function(x) x.Amps=40).Eff.ToString() - txt2K60Efficiency.Text = alt.InputTable2000.First( Function(x) x.Amps=60).Eff.ToString() - - txt4K10Efficiency.Text = alt.InputTable4000.First( Function(x) x.Amps=10).Eff.ToString() - txt4K40Efficiency.Text = alt.InputTable4000.First( Function(x) x.Amps=40).Eff.ToString() - txt4K60Efficiency.Text = alt.InputTable4000.First( Function(x) x.Amps=60).Eff.ToString() - - txt6K10Efficiency.Text = alt.InputTable6000.First( Function(x) x.Amps=10).Eff.ToString() - txt6K40Efficiency.Text = alt.InputTable6000.First( Function(x) x.Amps=40).Eff.ToString() - txt6K60Efficiency.Text = alt.InputTable6000.First( Function(x) x.Amps=60).Eff.ToString() - - txtPulleyRatio .Text = alt.PulleyRatio.ToString() - - - End Sub + e.Cancel = True + End If + UserHitSave = False + DialogResult = Windows.Forms.DialogResult.OK + Return + End If + + + ''This must be a close box event. If nothing changed, then bail, otherwise ask user if they wanna save + If Not combinedAlt.IsEqualTo(originalAlt) Then + + result = (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) + + + Select Case result + + Case DialogResult.Yes + 'save + + If Not combinedAlt.Save(aaltPath) Then + e.Cancel = True + End If + + Case DialogResult.No + 'just allow the form to close + 'without saving + Me.DialogResult = Windows.Forms.DialogResult.Cancel + + Case DialogResult.Cancel + 'cancel the close + e.Cancel = True + Me.DialogResult = Windows.Forms.DialogResult.Cancel + + End Select + + End If + + UserHitCancel = False + UserHitSave = False + + + + End Sub + + + 'List Management + Private Sub ClearEditPanel() + + txtIndex.Text = String.Empty + txtAlternatorName.Text = String.Empty + txt2K10Efficiency.Text = String.Empty + txt2KMax2Efficiency.Text = String.Empty + txt2KMaxEfficiency.Text = String.Empty + + txt4K10Efficiency.Text = String.Empty + txt4KMax2Efficiency.Text = String.Empty + txt4KMaxEfficiency.Text = String.Empty + + txt6K10Efficiency.Text = String.Empty + txt6KMax2Efficiency.Text = String.Empty + txt6KMaxEfficiency.Text = String.Empty + + txt2KMax2Amps.Text = String.Empty + txt2KMaxAmps.Text = String.Empty + + txt4KMax2Amps.Text = String.Empty + txt4KMaxAmps.Text = String.Empty + + txt6KMax2Amps.Text = String.Empty + txt6KMaxAmps.Text = String.Empty + + txtPulleyRatio.Text = String.Empty + + ErrorProvider1.SetError(txtAlternatorName, String.empty) + ErrorProvider1.SetError(txt2K10Efficiency, String.empty) + ErrorProvider1.SetError(txt2KMax2Efficiency, String.empty) + ErrorProvider1.SetError(txt2KMaxEfficiency, String.empty) + ErrorProvider1.SetError(txt4K10Efficiency, String.empty) + ErrorProvider1.SetError(txt4KMax2Efficiency, String.empty) + ErrorProvider1.SetError(txt4KMaxEfficiency, String.empty) + ErrorProvider1.SetError(txt6K10Efficiency, String.empty) + ErrorProvider1.SetError(txt6KMax2Efficiency, String.empty) + ErrorProvider1.SetError(txt6KMaxEfficiency, String.empty) + + ErrorProvider1.SetError(txtPulleyRatio, String.empty) + + + End Sub + Public Function Validate_UpdatePanel() As Boolean + + Dim returnResult As Boolean = True + + IsEmptyString(txtAlternatorName.Text, txtAlternatorName, "Please enter a name for the alternator, names must be unique", returnResult) + + If Not IsNumberBetweenOverZeroAndLessThan100(txt2K10Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMax2Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMaxEfficiency) Then returnResult = False + + If Not IsNumberBetweenOverZeroAndLessThan100(txt4K10Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMax2Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMaxEfficiency) Then returnResult = False + + If Not IsNumberBetweenOverZeroAndLessThan100(txt6K10Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMax2Efficiency) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMaxEfficiency) Then returnResult = False + + If Not IsNumberBetweenOverZeroAndLessThan100(txt2K10Amps) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMax2Amps) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt2KMaxAmps) Then returnResult = False + + If Not IsNumberBetweenOverZeroAndLessThan100(txt4K10Amps) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMax2Amps) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt4KMaxAmps) Then returnResult = False + + If Not IsNumberBetweenOverZeroAndLessThan100(txt6K10Amps) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMax2Amps) Then returnResult = False + If Not IsNumberBetweenOverZeroAndLessThan100(txt6KMaxAmps) Then returnResult = False + + If Not IsPostiveNumber(txtPulleyRatio.text) Then + ErrorProvider1.SetError(txtPulleyRatio, "Please enter a sensible positive number") + returnResult = False + Else + ErrorProvider1.SetError(txtPulleyRatio, String.Empty) + End If + + Return returnResult + + End Function + Private Sub FillEditPanel(index As Integer) + + Dim alt As IAlternator + Dim alternatorName As String = gvAlternators.Rows(index).Cells("AlternatorName").Value.ToString() + + alt = combinedAlt.Alternators.First(Function(f) f.AlternatorName = alternatorName) + + txtIndex.Text = index.ToString() + txtAlternatorName.Text = alt.AlternatorName + + 'Table1 - 2K Table + txt2K10Amps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() + txt2K10Efficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() + + txt2KMax2Amps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() + txt2KMax2Efficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() + + txt2KMaxAmps.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() + txt2KMaxEfficiency.Text = alt.InputTable2000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() + + 'Table2 - 4K Table + txt4K10Amps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() + txt4K10Efficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() + + txt4KMax2Amps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() + txt4KMax2Efficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() + + txt4KMaxAmps.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() + txt4KMaxEfficiency.Text = alt.InputTable4000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() + + 'Table3 - 6K Table + txt6K10Amps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(1).First().Amps.ToString() + txt6K10Efficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(1).First().Eff.ToString() + + txt6KMax2Amps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(2).First().Amps.ToString() + txt6KMax2Efficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(2).First().Eff.ToString() + + txt6KMaxAmps.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(3).First().Amps.ToString() + txt6KMaxEfficiency.Text = alt.InputTable6000.OrderBy(Function(x) x.Amps).Skip(3).First().Eff.ToString() + + txtPulleyRatio.Text = alt.PulleyRatio.ToString() + + + End Sub