diff --git a/AuxillaryTestHarness/AuxillaryTestHarness.vbproj b/AuxillaryTestHarness/AuxillaryTestHarness.vbproj index 8329c37ea650b2213433ad2d328372c991608dfc..b040a28ae41427cd501eb24ef7a0888f3a126b1d 100644 --- a/AuxillaryTestHarness/AuxillaryTestHarness.vbproj +++ b/AuxillaryTestHarness/AuxillaryTestHarness.vbproj @@ -28,7 +28,7 @@ <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> - <ApplicationRevision>2</ApplicationRevision> + <ApplicationRevision>5</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <UseApplicationTrust>false</UseApplicationTrust> <PublishWizardCompleted>true</PublishWizardCompleted> diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb index ec88a9b0397b4316c2c2e688540fbbe1c6108cef..ea21ab86ad49cfefa136a81a75696eef60f5f2be 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb @@ -1,312 +1,324 @@ -Imports System.IO + +Imports System.Text +Imports System.IO Namespace Electrics - ''' <summary> - ''' Alternator Efficiency Map - - ''' </summary> - ''' <remarks></remarks> - Public Class AlternatorMap - Implements IAlternatorMap - - - ''' <summary> - ''' path to csv file containing map data - ''' expects header row - ''' Columns - [rpm - integer], [efficiency float, range 0-1], [max regen power float] - ''' </summary> - ''' <remarks></remarks> - Private ReadOnly filePath As String - - Private map As Dictionary(Of AlternatorMapKey, AlternatorMapValues) - - ''' <summary> - ''' Creates a new instance of AlternatorMap class - ''' </summary> - ''' <param name="filePath">full path to csv data</param> - ''' <remarks></remarks> - Public Sub New(ByVal filePath As String) - Me.filePath = filePath - End Sub +Public Class AlternatorMap +Implements IAlternatorMap - ''' <summary> - ''' Initialise the map from supplied csv data - ''' </summary> - ''' <returns>Boolean - true if map is created successfully</returns> - ''' <remarks></remarks> - Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise - 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) + Private ReadOnly filePath As String - 'Must have at least 2 entries in map to make it usable [dont forget the header row] - If (lines.Count() < 3) Then - Throw New ArgumentException("Insufficient rows in csv to build a usable map") - End If + Public map As New List(Of MapPoint) + Public yRange As List(Of Single) + Public xRange As List(Of Single) + Private minX, minY, maxX, maxY As Single - map = New Dictionary(Of AlternatorMapKey, AlternatorMapValues)() - Dim firstline As Boolean = True + 'Required Action Test or Interpolation Type + Public Function OnBoundaryYInterpolatedX(x As Single, y As Single) As Boolean + Return yRange.Contains(y) AndAlso Not xRange.Contains(x) + End Function + Public Function OnBoundaryXInterpolatedY(x As Single, y As Single) As Boolean + Return Not yRange.Contains(y) AndAlso xRange.Contains(x) + End Function + Public Function ONBoundaryXY(x As Single, y As Single) As Boolean + Return (From sector In map Where sector.Y = y AndAlso sector.x = x).Count = 1 + End Function - For Each line As String In lines - If Not firstline Then - 'split the line - Dim elements() As String = line.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 3) Then - Throw New ArgumentException("Incorrect number of values in csv file") - End If - 'add values to map + 'Determine Value Methods + Private Function GetOnBoundaryXY(x As Single, y As Single) As Single + Return (From sector In map Where sector.Y = y AndAlso sector.x = x).First().v + End Function + Private Function GetOnBoundaryYInterpolatedX(x As Single, y As Single) As Single - 'Create AlternatorKey - Dim aKey As AlternatorMapKey = New AlternatorMapKey(elements(0), elements(1)) - Dim aValue As AlternatorMapValues = New AlternatorMapValues() + Dim x0, x1, v0, v1, slope, dx As Single - 'Add Efficiency Value to Key. - map.Add(aKey, New AlternatorMapValues(elements(2))) + x0 = (From p In xRange Order By p Where p < x).Last() + x1 = (From p In xRange Order By p Where p > x).First() + dx = x1 - x0 - Else - firstline = False - End If - Next line - End Using - Return True - Else - Throw New ArgumentException("Supplied input file does not exist") - End If - End Function + v0 = GetOnBoundaryXY(x0, y) + v1 = GetOnBoundaryXY(x1, y) - ''' <summary> - ''' Returns the alternator efficiency at given rpm - ''' </summary> - ''' <param name="rpm">alternator rotation speed</param> - ''' <returns>Single</returns> - ''' <remarks></remarks> - Public Function GetEfficiency(ByVal rpm As Integer, ByVal amps As Integer) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency + slope = (v1 - v0) / (x1 - x0) - Dim key As New AlternatorMapKey(amps, rpm) + Return v0 + ((x - x0) * slope) - Return GetValueOrInterpolate(key) + End Function + Private Function GetOnBoundaryXInterpolatedY(x As Single, y As Single) As Single - End Function + Dim y0, y1, v0, v1, dy, v, slope As Single + y0 = (From p In yRange Order By p Where p < y).Last() + y1 = (From p In yRange Order By p Where p > y).First() + dy = y1 - y0 - ''' <summary> - ''' Returns a AlternatorMapValues instance containing the entries at a given key, or new interpolated values - ''' </summary> - ''' <returns>AlternatorMapValues</returns> - ''' <remarks>Throws exception if Rpm or Amps are outside the map </remarks> - Private Function GetValueOrInterpolate(mapKey As AlternatorMapKey) As AlternatorMapValues - 'check the rpm is within the map + v0 = GetOnBoundaryXY(x, y0) + v1 = GetOnBoundaryXY(x, y1) + slope = (v1 - v0) / (y1 - y0) - Dim min As AlternatorMapKey = map.Keys.Min() - Dim max As AlternatorMapKey = map.Keys.Max() + v = v0 + ((y - y0) * slope) - 'If mapKey.amps < min.amps Or mapKey.amps > max.amps Or mapKey.rpm < min.rpm Or mapKey.rpm > max.rpm Then - ' Throw New ArgumentOutOfRangeException(String.Format("Extrapolation - Amp/Rpm Values should should be in the range {0} to {1}", min.ToString(), max.ToString())) - 'End If + Return v + End Function + Private Function GetBiLinearInterpolatedValue(x As Single, y As Single) As Single - 'LIMITING - If mapKey.amps < min.amps then mapKey.amps=min.amps - If mapKey.amps > max.amps then mapKey.amps = max.amps - If mapKey.rpm < min.rpm then mapKey.rpm = min.rpm - If mapKey.rpm > max.rpm then mapKey.rpm= max.rpm + Dim q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p As Single + y1 = (From mapSector As MapPoint In map Where mapSector.Y < y).Last().Y + y2 = (From mapSector As MapPoint In map Where mapSector.Y > y).First().Y + x1 = (From mapSector As MapPoint In map Where mapSector.x < x).Last().x + x2 = (From mapSector As MapPoint In map Where mapSector.x > x).First().x + q11 = GetOnBoundaryXY(x1, y1) + q12 = GetOnBoundaryXY(x1, y2) - 'Check if the rpm is in the current memo - 'If supplied present key, we can just return the values - If map.ContainsKey(mapKey) Then - Return map(mapKey) - End If + q21 = GetOnBoundaryXY(x2, y1) + q22 = GetOnBoundaryXY(x2, y2) + r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)) * q21 - 'Get Pre and Post Keys - Dim rpmPre As AlternatorMapValues - Dim rpmPost As AlternatorMapValues - Dim ampsPre As AlternatorMapValues - Dim ampsPost As AlternatorMapValues + r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)) * q22 - 'Pre and Post Data Points - Dim intRpmPre As Integer - Dim intRpmPost As Integer - Dim intAmpsPre As Integer - Dim intAmpsPost As Integer + p = ((y2 - y) / (y2 - y1)) * r1 + ((y - y1) / (y2 - y1)) * r2 - intRpmPre = (From m In map Where m.Key.rpm <= mapKey.rpm Select m.Key.rpm).Last() - intRpmPost = (From m In map Where m.Key.rpm => mapKey.rpm Select m.Key.rpm).First() - intAmpsPre = (From m In map Where m.Key.amps <= mapKey.amps Select m.Key.amps).Last() - intAmpsPost = (From m In map Where m.Key.amps => mapKey.amps Select m.Key.amps).First() + Return p - Dim dAmps As Single - dim dAmpEfficiency as single - Dim ampsEfficiencySlope as single - Dim dRpm As Integer - Dim dRpmEfficiency as single - Dim rpmEfficiencySlope As Single - Dim interpolatedEfficiency As single - Dim ampPreEfficiency As Single - Dim ampPostEfficiency As Single - Dim rpmPreEfficiency As Single - Dim rpmPostEfficiency As Single - + End Function - '*********** IF PRE AND POST RPM OR PRE AND POST AMPS are the same, the calculation is different. *********** - 'SO + 'Utilities + Private Sub fillMapWithDefaults() - 'Case RPM is the same - If intRpmPre = intRpmPost then - dAmps = intAmpsPost - intAmpsPre - ampPreEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPre)).Efficiency - ampPostEfficiency = map( New AlternatorMapKey( intAmpsPost, intRpmPre)).Efficiency - interpolatedEfficiency = ampPreEfficiency + ( ( ampPostEfficiency-ampPreEfficiency ) * (( mapKey.amps - intAmpsPre ) / ( intAmpsPost-intAmpsPre ))) - - Return New AlternatorMapValues(interpolatedEfficiency) + map.Add(New MapPoint(10, 1500, 0.615)) + map.Add(New MapPoint(27, 1500, 0.7)) + map.Add(New MapPoint(53, 1500, 0.1947)) + map.Add(New MapPoint(63, 1500, 0.0)) + map.Add(New MapPoint(68, 1500, 0.0)) + map.Add(New MapPoint(125, 1500, 0.0)) + map.Add(New MapPoint(136, 1500, 0.0)) + map.Add(New MapPoint(10, 2000, 0.62)) + map.Add(New MapPoint(27, 2000, 0.7)) + map.Add(New MapPoint(53, 2000, 0.3)) + map.Add(New MapPoint(63, 2000, 0.1462)) + map.Add(New MapPoint(68, 2000, 0.692)) + map.Add(New MapPoint(125, 2000, 0.0)) + map.Add(New MapPoint(136, 2000, 0.0)) + map.Add(New MapPoint(10, 4000, 0.64)) + map.Add(New MapPoint(27, 4000, 0.6721)) + map.Add(New MapPoint(53, 4000, 0.7211)) + map.Add(New MapPoint(63, 4000, 0.74)) + map.Add(New MapPoint(68, 4000, 0.7352)) + map.Add(New MapPoint(125, 4000, 0.68)) + map.Add(New MapPoint(136, 4000, 0.6694)) + map.Add(New MapPoint(10, 6000, 0.53)) + map.Add(New MapPoint(27, 6000, 0.5798)) + map.Add(New MapPoint(53, 6000, 0.656)) + map.Add(New MapPoint(63, 6000, 0.6853)) + map.Add(New MapPoint(68, 6000, 0.7)) + map.Add(New MapPoint(125, 6000, 0.6329)) + map.Add(New MapPoint(136, 6000, 0.62)) + map.Add(New MapPoint(10, 7000, 0.475)) + map.Add(New MapPoint(27, 7000, 0.5337)) + map.Add(New MapPoint(53, 7000, 0.6235)) + map.Add(New MapPoint(63, 7000, 0.658)) + map.Add(New MapPoint(68, 7000, 0.6824)) + map.Add(New MapPoint(125, 7000, 0.6094)) + map.Add(New MapPoint(136, 7000, 0.5953)) - End If - If intAmpsPre = intAmpsPost then - rpmPreEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPre)).Efficiency - rpmPostEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPost)).Efficiency + End Sub + Private Sub getMapRanges() - interpolatedEfficiency = rpmPreEfficiency + ( ( rpmPostEfficiency-rpmPreEfficiency ) * (( mapKey.rpm - intRpmPre ) / ( intRpmPost-intRpmPre ))) - - Return New AlternatorMapValues(interpolatedEfficiency) + yRange = (From coords As MapPoint In map Order By coords.Y Select coords.Y Distinct).ToList() + xRange = (From coords As MapPoint In map Order By coords.x Select coords.x Distinct).ToList() + minX = xRange.First + maxX = xRange.Last + minY = yRange.First + maxY = yRange.Last - End If + End Sub + 'Single entry point to determine Value on map + Public Function GetValue(x As Single, y As Single) As Single - rpmPre = map(New AlternatorMapKey(intAmpsPre, intRpmPre)) - rpmPost = map(New AlternatorMapKey(intAmpsPre, intRpmPost)) + 'Limiting + If x < minX Then x = minX + If x > maxX Then x = maxX + If y < minY Then y = minY + If y > maxY Then y = maxY - ampsPre = map(New AlternatorMapKey(intAmpsPost, intRpmPre)) - ampsPost = map(New AlternatorMapKey(intAmpsPost, intRpmPost)) + 'Satisfies both data points - non interpolated value + If ONBoundaryXY(x, y) Then Return GetOnBoundaryXY(x, y) - '************************************************************************* - 'The following biaxial linear interpolation formula was provided - 'by Engineering. See example below. - ' - ' 1500 2000 4000 - ' 10 A-B <=Interpolated Horizontally - ' (C-D)-(A-B) <=Interpolated Virtically - ' 27 C-D <=Interpolated Horizontally - ' - '************************************************************************ - ' - '*** A-B Efficiency ( Lower Using Lower Amps ) - 'get the delta values for rpm and the values - dRpm = intRpmPost - intRpmPre - dRpmEfficiency = rpmPost.Efficiency - rpmPre.Efficiency + 'Satisfies only x or y - single interpolation value + If OnBoundaryXInterpolatedY(x, y) Then Return GetOnBoundaryXInterpolatedY(x, y) + If OnBoundaryYInterpolatedX(x, y) Then Return GetOnBoundaryYInterpolatedX(x, y) - 'calculate the slopes - rpmEfficiencySlope = dRpmEfficiency / dRpm + 'satisfies no data points - Bi-Linear interpolation + Return GetBiLinearInterpolatedValue(x, y) - 'calculate the new values - 'Dim AB_Efficiency As Single = If( drpm=0,rpmPre.Efficiency, ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + rpmPre.Efficiency) - Dim AB_Efficiency As Single = ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + rpmPre.Efficiency - '*** C-D Efficiency ( Using Higher Amps ) - 'get the delta values for rpm and the values - dRpm = intRpmPost - intRpmPre - dRpmEfficiency = ampsPost.Efficiency - ampsPre.Efficiency + End Function + Public Function ReturnDefaultMapValueTests() As String - 'calculate the slopes - rpmEfficiencySlope = dRpmEfficiency / dRpm + Dim sb = New StringBuilder() + Dim x, y As Single - 'calculate the new values - 'Dim CD_Efficiency As Single = If( dRpm=0, rpmPre.Efficiency, ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + ampsPre.Efficiency) - Dim CD_Efficiency As Single = ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + ampsPre.Efficiency + 'All Sector Values + sb.AppendLine("All Values From Map") + sb.AppendLine("-------------------") + For Each x In xRange - '(C-D) - (A-B) Efficiency - 'Deltas - dAmps = intAmpsPost - intAmpsPre - dAmpEfficiency = CD_Efficiency - AB_Efficiency + For Each y In yRange + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + Next - 'slopes - ampsEfficiencySlope = dAmpEfficiency / dAmps + Next - 'calculate final Values - ' Dim ABCDEfficiency As Single = If( dAmps=0, CD_Efficiency, ((mapKey.amps - intAmpsPre) * ampsEfficiencySlope) + AB_Efficiency) - Dim ABCDEfficiency As Single = ((mapKey.amps - intAmpsPre) * ampsEfficiencySlope) + AB_Efficiency + sb.AppendLine("") + sb.AppendLine("Four Corners with interpolated other") + sb.AppendLine("-------------------") + x = 1500 : y = 18.5 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + x = 7000 : y = 96.5 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + x = 1750 : y = 10 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + x = 6500 : y = 10 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + sb.AppendLine("") + sb.AppendLine("Interpolated both") + sb.AppendLine("-------------------") - Return New AlternatorMapValues(ABCDEfficiency) + Dim mx, my As Single + For x = 0 To xRange.Count - 2 + For y = 0 To yRange.Count - 2 + mx = xRange(x) + (xRange(x + 1) - xRange(x)) / 2 + my = yRange(y) + (yRange(y + 1) - yRange(y)) / 2 - End Function + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", mx, my, GetValue(mx, my))) - Private Structure AlternatorMapKey - Implements IComparable - Public amps As Integer - Public rpm As Integer + Next + Next + sb.AppendLine("") + sb.AppendLine("MIKE -> 40 & 1000") + sb.AppendLine("-------------------") + x = 1000 : y = 40 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - Public Sub New(ByVal amps As Integer, ByVal rpm As Integer) - Me.amps = amps - Me.rpm = rpm - End Sub + Return sb.ToString() - Public Overrides Function ToString() As String + End Function - Return "Amps:" & amps & " / " & "Rpm:" & rpm + 'Constructors + Public Sub New(filepath As String) - End Function + Me.filePath = filepath + + Initialise() + + getMapRanges() - Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo + End Sub + Public Sub New(values As List(Of MapPoint)) + map = values + getMapRanges() - Dim compared As AlternatorMapKey = CType(obj, AlternatorMapKey) + End Sub - Dim otherAlternatorMapKey As AlternatorMapKey = CType(obj, AlternatorMapKey) + Public Class MapPoint - 'Same Place - If (Me.amps = otherAlternatorMapKey.amps AndAlso Me.rpm = otherAlternatorMapKey.rpm) Then + Public Y As Single + Public x As Single + Public v As Single - Return 0 + Public Sub New(y As Single, x As Single, v As Single) - End If + Me.Y = y + Me.x = x + Me.v = v - 'smaller - If (Me.amps > otherAlternatorMapKey.amps) Or (Me.rpm > otherAlternatorMapKey.rpm) Then + End Sub - Return 1 + End Class - Else - Return -1 + Public Function GetEfficiency(rpm As single, amps As single) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency - End If + Return New AlternatorMapValues( GetValue(rpm,amps)) + End Function + Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise + 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) + 'Must have at least 2 entries in map to make it usable [dont forget the header row] + If (lines.Count() < 3) Then + Throw New ArgumentException("Insufficient rows in csv to build a usable map") + End If - End Function + map = New List(Of MapPoint) + Dim firstline As Boolean = True + For Each line As String In lines + If Not firstline Then + 'split the line + Dim elements() As String = line.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries) + '3 entries per line required + If (elements.Length <> 3) Then + Throw New ArgumentException("Incorrect number of values in csv file") + End If + 'add values to map - End Structure + 'Create AlternatorKey + Dim newPoint as MapPoint = New MapPoint(elements(0),elements(1),elements(2)) + + map.Add(newPoint) + + Else + firstline = False + End If + Next line + End Using + Return True + Else + Throw New ArgumentException("Supplied input file does not exist") + End If + End Function + + +End Class + + +End Namespace - End Class -End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapOLDREMOVELATER.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapOLDREMOVELATER.vb new file mode 100644 index 0000000000000000000000000000000000000000..4be843238d70322997946a3c71afca320afedc6b --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapOLDREMOVELATER.vb @@ -0,0 +1,313 @@ +Imports System.IO + +Namespace Electrics + + ''' <summary> + ''' Alternator Efficiency Map - + ''' </summary> + ''' <remarks></remarks> + Public Class AlternatorMapX + + Implements IAlternatorMap + + + ''' <summary> + ''' path to csv file containing map data + ''' expects header row + ''' Columns - [rpm - integer], [efficiency float, range 0-1], [max regen power float] + ''' </summary> + ''' <remarks></remarks> + Private ReadOnly filePath As String + + Private map As Dictionary(Of AlternatorMapKey, AlternatorMapValues) + + ''' <summary> + ''' Creates a new instance of AlternatorMap class + ''' </summary> + ''' <param name="filePath">full path to csv data</param> + ''' <remarks></remarks> + Public Sub New(ByVal filePath As String) + Me.filePath = filePath + End Sub + + ''' <summary> + ''' Initialise the map from supplied csv data + ''' </summary> + ''' <returns>Boolean - true if map is created successfully</returns> + ''' <remarks></remarks> + Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise + 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) + + 'Must have at least 2 entries in map to make it usable [dont forget the header row] + If (lines.Count() < 3) Then + Throw New ArgumentException("Insufficient rows in csv to build a usable map") + End If + + map = New Dictionary(Of AlternatorMapKey, AlternatorMapValues)() + Dim firstline As Boolean = True + + For Each line As String In lines + If Not firstline Then + 'split the line + Dim elements() As String = line.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries) + '3 entries per line required + If (elements.Length <> 3) Then + Throw New ArgumentException("Incorrect number of values in csv file") + End If + 'add values to map + + 'Create AlternatorKey + Dim aKey As AlternatorMapKey = New AlternatorMapKey(elements(0), elements(1)) + Dim aValue As AlternatorMapValues = New AlternatorMapValues() + + 'Add Efficiency Value to Key. + map.Add(aKey, New AlternatorMapValues(elements(2))) + + Else + firstline = False + End If + Next line + End Using + Return True + Else + Throw New ArgumentException("Supplied input file does not exist") + End If + End Function + + ''' <summary> + ''' Returns the alternator efficiency at given rpm + ''' </summary> + ''' <param name="rpm">alternator rotation speed</param> + ''' <returns>Single</returns> + ''' <remarks></remarks> + Public Function GetEfficiency(ByVal rpm As single, ByVal amps As single) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency + + Dim key As New AlternatorMapKey(amps, rpm) + + Return GetValueOrInterpolate(key) + + End Function + + + ''' <summary> + ''' Returns a AlternatorMapValues instance containing the entries at a given key, or new interpolated values + ''' </summary> + ''' <returns>AlternatorMapValues</returns> + ''' <remarks>Throws exception if Rpm or Amps are outside the map </remarks> + Private Function GetValueOrInterpolate(mapKey As AlternatorMapKey) As AlternatorMapValues + 'check the rpm is within the map + + + Dim min As AlternatorMapKey = map.Keys.Min() + Dim max As AlternatorMapKey = map.Keys.Max() + + 'If mapKey.amps < min.amps Or mapKey.amps > max.amps Or mapKey.rpm < min.rpm Or mapKey.rpm > max.rpm Then + ' Throw New ArgumentOutOfRangeException(String.Format("Extrapolation - Amp/Rpm Values should should be in the range {0} to {1}", min.ToString(), max.ToString())) + 'End If + + + 'LIMITING + If mapKey.amps < min.amps then mapKey.amps=min.amps + If mapKey.amps > max.amps then mapKey.amps = max.amps + If mapKey.rpm < min.rpm then mapKey.rpm = min.rpm + If mapKey.rpm > max.rpm then mapKey.rpm= max.rpm + + + + + 'Check if the rpm is in the current memo + 'If supplied present key, we can just return the values + If map.ContainsKey(mapKey) Then + Return map(mapKey) + End If + + + 'Get Pre and Post Keys + Dim rpmPre As AlternatorMapValues + Dim rpmPost As AlternatorMapValues + Dim ampsPre As AlternatorMapValues + Dim ampsPost As AlternatorMapValues + + 'Pre and Post Data Points + Dim intRpmPre As Integer + Dim intRpmPost As Integer + Dim intAmpsPre As Integer + Dim intAmpsPost As Integer + + + intRpmPre = (From m In map Where m.Key.rpm <= mapKey.rpm Select m.Key.rpm).Last() + intRpmPost = (From m In map Where m.Key.rpm => mapKey.rpm Select m.Key.rpm).First() + intAmpsPre = (From m In map Where m.Key.amps <= mapKey.amps Select m.Key.amps).Last() + intAmpsPost = (From m In map Where m.Key.amps => mapKey.amps Select m.Key.amps).First() + + + Dim dAmps As Single + dim dAmpEfficiency as single + Dim ampsEfficiencySlope as single + Dim dRpm As Integer + Dim dRpmEfficiency as single + Dim rpmEfficiencySlope As Single + Dim interpolatedEfficiency As single + Dim ampPreEfficiency As Single + Dim ampPostEfficiency As Single + Dim rpmPreEfficiency As Single + Dim rpmPostEfficiency As Single + + + '*********** IF PRE AND POST RPM OR PRE AND POST AMPS are the same, the calculation is different. *********** + 'SO + + 'Case RPM is the same + If intRpmPre = intRpmPost then + + dAmps = intAmpsPost - intAmpsPre + ampPreEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPre)).Efficiency + ampPostEfficiency = map( New AlternatorMapKey( intAmpsPost, intRpmPre)).Efficiency + + interpolatedEfficiency = ampPreEfficiency + ( ( ampPostEfficiency-ampPreEfficiency ) * (( mapKey.amps - intAmpsPre ) / ( intAmpsPost-intAmpsPre ))) + + Return New AlternatorMapValues(interpolatedEfficiency) + + End If + + + If intAmpsPre = intAmpsPost then + + rpmPreEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPre)).Efficiency + rpmPostEfficiency = map( New AlternatorMapKey( intAmpsPre, intRpmPost)).Efficiency + + interpolatedEfficiency = rpmPreEfficiency + ( ( rpmPostEfficiency-rpmPreEfficiency ) * (( mapKey.rpm - intRpmPre ) / ( intRpmPost-intRpmPre ))) + + Return New AlternatorMapValues(interpolatedEfficiency) + + + End If + + + + + rpmPre = map(New AlternatorMapKey(intAmpsPre, intRpmPre)) + rpmPost = map(New AlternatorMapKey(intAmpsPre, intRpmPost)) + + ampsPre = map(New AlternatorMapKey(intAmpsPost, intRpmPre)) + ampsPost = map(New AlternatorMapKey(intAmpsPost, intRpmPost)) + + '************************************************************************* + 'The following biaxial linear interpolation formula was provided + 'by Engineering. See example below. + ' + ' 1500 2000 4000 + ' 10 A-B <=Interpolated Horizontally + ' (C-D)-(A-B) <=Interpolated Virtically + ' 27 C-D <=Interpolated Horizontally + ' + '************************************************************************ + ' + '*** A-B Efficiency ( Lower Using Lower Amps ) + 'get the delta values for rpm and the values + dRpm = intRpmPost - intRpmPre + dRpmEfficiency = rpmPost.Efficiency - rpmPre.Efficiency + + 'calculate the slopes + rpmEfficiencySlope = dRpmEfficiency / dRpm + + 'calculate the new values + 'Dim AB_Efficiency As Single = If( drpm=0,rpmPre.Efficiency, ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + rpmPre.Efficiency) + Dim AB_Efficiency As Single = ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + rpmPre.Efficiency + + '*** C-D Efficiency ( Using Higher Amps ) + 'get the delta values for rpm and the values + dRpm = intRpmPost - intRpmPre + dRpmEfficiency = ampsPost.Efficiency - ampsPre.Efficiency + + 'calculate the slopes + rpmEfficiencySlope = dRpmEfficiency / dRpm + + 'calculate the new values + 'Dim CD_Efficiency As Single = If( dRpm=0, rpmPre.Efficiency, ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + ampsPre.Efficiency) + Dim CD_Efficiency As Single = ((mapKey.rpm - intRpmPre) * rpmEfficiencySlope) + ampsPre.Efficiency + + '(C-D) - (A-B) Efficiency + 'Deltas + dAmps = intAmpsPost - intAmpsPre + dAmpEfficiency = CD_Efficiency - AB_Efficiency + + 'slopes + ampsEfficiencySlope = dAmpEfficiency / dAmps + + 'calculate final Values + ' Dim ABCDEfficiency As Single = If( dAmps=0, CD_Efficiency, ((mapKey.amps - intAmpsPre) * ampsEfficiencySlope) + AB_Efficiency) + Dim ABCDEfficiency As Single = ((mapKey.amps - intAmpsPre) * ampsEfficiencySlope) + AB_Efficiency + + + Return New AlternatorMapValues(ABCDEfficiency) + + + + End Function + + Private Structure AlternatorMapKey + Implements IComparable + + Public amps As Integer + Public rpm As Integer + + + + Public Sub New(ByVal amps As Integer, ByVal rpm As Integer) + + Me.amps = amps + Me.rpm = rpm + + + End Sub + + Public Overrides Function ToString() As String + + Return "Amps:" & amps & " / " & "Rpm:" & rpm + + End Function + + Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo + + + Dim compared As AlternatorMapKey = CType(obj, AlternatorMapKey) + + Dim otherAlternatorMapKey As AlternatorMapKey = CType(obj, AlternatorMapKey) + + 'Same Place + If (Me.amps = otherAlternatorMapKey.amps AndAlso Me.rpm = otherAlternatorMapKey.rpm) Then + + Return 0 + + End If + + 'smaller + If (Me.amps > otherAlternatorMapKey.amps) Or (Me.rpm > otherAlternatorMapKey.rpm) Then + + Return 1 + + Else + + Return -1 + + End If + + + + + End Function + + + End Structure + + + End Class + + + + +End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb b/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb index f29f4b327e17e26d618e725e9c5372458ab0c239..54371ce9b654351aea5fc7efe5f1d65c276f9adc 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb @@ -15,7 +15,7 @@ Namespace Electrics ''' <param name="rpm">alternator rotation speed</param> ''' <returns>Single</returns> ''' <remarks></remarks> - Function GetEfficiency(ByVal rpm As Integer, ByVal amps As Integer) As AlternatorMapValues + Function GetEfficiency(ByVal rpm As single, ByVal amps As single) As AlternatorMapValues End Interface diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb index 6349d1b4778d8d2fa8b390e57e69019bcf1da9b7..224fa052a76596f76728490e47b059b10a32d0f2 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb @@ -28,7 +28,7 @@ End Sub Public Sub SetDefaults() OverrunUtilisationForCompressionFraction = 0.97 - BrakingWithRetarderNIperKG = 0.0006 + BrakingWithRetarderNIperKG = 0.0005 BrakingNoRetarderNIperKG = 0.00081 BreakingPerKneelingNIperKGinMM = 0.000066 PerDoorOpeningNI = 12.7 diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj index d9301ef5ac41b6ad4dad2a0424e6860d23375fb7..542ab82cf5ea72d0242b6ff84ec91c99715da484 100644 --- a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj @@ -74,6 +74,7 @@ <ItemGroup> <Compile Include="AuxillaryEnvironment.vb" /> <Compile Include="Electrics\AlternatorMapValues.vb" /> + <Compile Include="Electrics\AlternatorMap.vb" /> <Compile Include="Electrics\ElectricsUserInputsConfig.vb" /> <Compile Include="Electrics\IElectricsUserInputsConfig.vb" /> <Compile Include="Electrics\IM0_5_SmartAlternatorSetEfficiency.vb" /> @@ -105,7 +106,7 @@ <Compile Include="Pneumatics\ActuationsKey.vb" /> <Compile Include="Pneumatics\IM3_AveragePneumaticLoadDemand.vb" /> <Compile Include="Pneumatics\M4_AirCompressor.vb" /> - <Compile Include="Electrics\AlternatorMap.vb" /> + <Compile Include="Electrics\AlternatorMapOLDREMOVELATER.vb" /> <Compile Include="Electrics\M2_AverageElectricalLoadDemand.vb" /> <Compile Include="Hvac\M1_AverageHVACLoadDemand.vb" /> <Compile Include="Pneumatics\M3_AveragePneumaticLoadDemand.vb" /> diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb index b3b2873eeb8b431ac2a31412322a1cc537f2977f..e224c8d29b2d9215913e20c64f8416f67e098004 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/AlternatorMapMock.vb @@ -19,7 +19,7 @@ Namespace Mocks End If End Function - Public Function GetEfficiency(ByVal rpm As Integer, ByVal amps As Integer) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency + Public Function GetEfficiency(ByVal rpm As single, ByVal amps As single) As AlternatorMapValues Implements IAlternatorMap.GetEfficiency Return New AlternatorMapValues() End Function diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb index 455e7d6396de519bf7fd031c213e74595a99c70a..1421d4c399b5d749b78a2106ac826a555e939c78 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AlternatorMapTests.vb @@ -36,7 +36,7 @@ End Sub <TestCase(55,7000,0.6304f)> _ <TestCase(10,3000,0.63f)> _ <TestCase(136,3000,0.3347f)> _ -Public sub FourCornerWithInterpolatedOtherTest(ByVal amps as integer, ByVal rpm as integer, ByVal expected as single) +Public sub FourCornerWithInterpolatedOtherTest(ByVal amps as single, ByVal rpm as single, ByVal expected as single) Dim map As IAlternatorMap = GetInitialisedMap() Dim target As IAlternatorMap = GetInitialisedMap( ) @@ -49,8 +49,8 @@ End Sub <TestCase(18,1750,0.656323552f)> _ <TestCase(18,6500,0.5280294f)> _ <TestCase(130,1750,0.0f)> _ -<TestCase(130,6500,0.6150136f)> _ -Public sub InterpolatedCornersBothMidPreviousTest(ByVal amps as integer, ByVal rpm as integer, ByVal expected as single) +<TestCase(130.5f,6500,0.6144f)> _ +Public sub InterpolatedCornersBothMidPreviousTest(ByVal amps as single, ByVal rpm as single, ByVal expected as single) Dim map As IAlternatorMap = GetInitialisedMap() Dim target As IAlternatorMap = GetInitialisedMap( ) @@ -62,6 +62,46 @@ Public sub InterpolatedCornersBothMidPreviousTest(ByVal amps as integer, ByVal End Sub +<Test()> _ +<TestCase(18.5f, 1750, 0.6587500f)> _ +<TestCase(40, 1750, 0.4736750f)> _ +<TestCase(58, 1750, 0.1602250f)> _ +<TestCase(65.5f, 1750, 0.2095500f)> _ +<TestCase(96.5f, 1750, 0.1730000f)> _ +<TestCase(130.5f, 1750, 0.0000000f)> _ +<TestCase(18.5f, 3000, 0.6580250f)> _ +<TestCase(40, 3000, 0.5983000f)> _ +<TestCase(58, 3000, 0.4768250f)> _ +<TestCase(65.5f, 3000, 0.5783500f)> _ +<TestCase(96.5f, 3000, 0.5268000f)> _ +<TestCase(130.5f, 3000, 0.3373500f)> _ +<TestCase(18.5f, 5000, 0.6054750f)> _ +<TestCase(40, 5000, 0.6572500f)> _ +<TestCase(58, 5000, 0.7006000f)> _ +<TestCase(65.5f, 5000, 0.7151250f)> _ +<TestCase(96.5f, 5000, 0.6870250f)> _ +<TestCase(130.5f, 5000, 0.6505750f)> _ +<TestCase(18.5f, 6500, 0.5296250f)> _ +<TestCase(40, 6500, 0.5982500f)> _ +<TestCase(58, 6500, 0.6557000f)> _ +<TestCase(65.5f, 6500, 0.6814250f)> _ +<TestCase(96.5f, 6500, 0.6561750f)> _ +<TestCase(130.5f, 6500, 0.6144000f)> _ +Public Sub InterpolatedAllMidPointsTest( byval amps As Single, byval rpm As Single, byval expected As single) + + + Dim map As IAlternatorMap = GetInitialisedMap() + Dim target As IAlternatorMap = GetInitialisedMap( ) + + Dim actual As Single = map.GetEfficiency( rpm,amps).Efficiency + + Assert.AreEqual(expected, CType(Math.Round(actual,6),Single)) + + +End Sub + + + #Region "Helpers" @@ -79,6 +119,11 @@ End Sub #End Region - End Class + + + +End Class + + End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb index fabd004ac20e1ada68ff3aa007f51b98332dfd0b..aa111c805c1f0df1431bdc5dfcaf404dbf469a58 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/AveragePneumaticLoadDemandTests.vb @@ -86,7 +86,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 7947.684 + Dim expected As Single = 7664.94 Dim actual As Single = target.TotalAirDemand() Assert.AreEqual(expected, actual) @@ -107,7 +107,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 31.9030322 + Dim expected As Single = 30.7680626 Dim actual As Single = target.GetAveragePowerDemandAtCrankFromPneumatics() Assert.AreEqual(expected, actual) @@ -130,7 +130,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 25.78023 + Dim expected As Single = 24.863081 Dim actual As Single = target.GetAveragePowerDemandAtCrankFromPneumatics() Assert.AreEqual(expected, actual) @@ -150,7 +150,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 7947.684 + Dim expected As Single = 7664.94 Dim actual As Single = target.TotalAirConsumedPerCycle() Assert.AreEqual(expected, actual) @@ -173,7 +173,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 8863.295 + Dim expected As Single = 8545.207 Dim actual As Single = target.TotalAirConsumedPerCycle() Assert.AreEqual(expected, actual) @@ -220,7 +220,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 8557.52 + Dim expected As Single = 8274.78 Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) @@ -240,11 +240,11 @@ Namespace UnitTests psCompressorMap.Initialise() - _defaultInputConfig.AirSuspensionControl = "mechanically" + _defaultInputConfig.AirSuspensionControl = "Mechanically" Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 8726.18 + Dim expected As Single = 8443.44 Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) @@ -264,11 +264,11 @@ Namespace UnitTests psCompressorMap.Initialise() - _defaultInputConfig.AdBlueDosing = "Electric" + _defaultInputConfig.AdBlueDosing = "Pneumatic" Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 7490.96 + Dim expected As Single = 7664.94 Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) @@ -292,7 +292,7 @@ Namespace UnitTests Dim target As New M3_AveragePneumaticLoadDemand(_defaultInputConfig, psAuxConfig, psActuationsMap, psCompressorMap, _vehicleMassKG, "Urban", _cycleDurationMinutes) - Dim expected As Single = 6880.88 + Dim expected As Single = 6598.14 Dim actual As Single = Math.Round(target.TotalAirConsumedPerCycle(), 2) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb index d09d9b6991c732e3e7891df0301e779470c2a003..ef815e4c3235059e40d11cf97843757f0b29b3f6 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_5_SmartAlternatorSetEfficiencyTests.vb @@ -76,7 +76,7 @@ End Sub Public Sub AlternatorsEfficiencyIdle2000rpmTest() Initialise() - Dim expected As Single = 0.5769231 + Dim expected As Single = 0.577212 Dim actual As Single = target.AlternatorsEfficiencyIdleResultCard() Assert.AreEqual(expected, actual) @@ -89,7 +89,7 @@ End Sub Public Sub AlternatorsEfficiencyTraction2000rpmTest() Initialise() - Dim expected As Single = 0.5769231 + Dim expected As Single = 0.577212 Dim actual As Single = target.AlternatorsEfficiencyTractionOnResultCard() Assert.AreEqual(expected, actual) @@ -101,7 +101,7 @@ End Sub Public Sub AlternatorsEfficiencyOverrun2000rpmTest() Initialise() - Dim expected As Single = 0.5769231 + Dim expected As Single = 0.577212 Dim actual As Single = target.AlternatorsEfficiencyOverrunResultCard() Assert.AreEqual(expected, actual) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb index 7b7bd682ed78d2db1f47332e0535bfc9616a61d1..377583515b46a8beb2388612f9ae154c8236f891 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M0_NonSmart_AlternatorsSetEfficiencyTests.vb @@ -89,7 +89,7 @@ Public Sub EfficiencyValueTest() Dim actual As Single = target.AlternatorsEfficiency - Dim expected As Single = 0.6388235 + Dim expected As Single = 0.6378931 Assert.AreEqual(expected, actual) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb index cb2da531c58ed5b63494cba1f2c279e25eb8bdff..00ffbd425194afc1739e6c99d2398d82668b35fa 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M1_AverageHVACLoadDemandTests.vb @@ -74,7 +74,7 @@ Public Sub AveragePowerDemandAtCrankFromHVACElectricsWattsTest() Dim target As IM1_AverageHVACLoadDemand = GETM1Instance() - Dim expected As Single = 194.029846 + Dim expected As Single = 196.576889 dim actual as Single = target.AveragePowerDemandAtCrankFromHVACElectricsWatts Assert.AreEqual( expected , actual) diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb index 5feb1fd4972d4a01da1a05551c5ee8bed8ab51fb..348a2d66599b875d4a5b734bb1778ce78f896c8b 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M2_AverageElectricalLoadTests.vb @@ -64,7 +64,7 @@ Namespace UnitTests <Test()> Public Sub GetAveragePowerAtCrankTest() Dim target As M2_AverageElectricalLoadDemand = GetAverageElectricalDemandInstance() - Dim expected As Single = 2272.85522 + Dim expected As Single = 2302.69116 Dim actual As Single = target.GetAveragePowerAtCrank() Assert.AreEqual(expected, actual) End Sub diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb index 3bdf78ffe9f4bd639ca81ac92c1d927f0e4f34d2..d0df61a764d30dfda0e3d573eb35fbc79f260558 100644 --- a/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/M5_SmartAlternatorSetGenerationTests.vb @@ -65,7 +65,7 @@ Public Sub PowerAtCrankIdleWatts() Initialise() _target = New M5__SmartAlternatorSetGeneration(_m05,_powerNetVoltage,_altGearPullyEfficiency) - Dim expected As Single =1993.34644 + Dim expected As Single =1992.34875 Dim actual As Single = _target.AlternatorsGenerationPowerAtCrankIdleWatts() Assert.AreEqual( expected, actual) @@ -77,7 +77,7 @@ Public Sub PowerAtCrankTractionWatts() Initialise() _target = New M5__SmartAlternatorSetGeneration(_m05,_powerNetVoltage,_altGearPullyEfficiency) - Dim expected As Single =1993.34644 + Dim expected As Single =1992.34875 Dim actual As Single = _target.AlternatorsGenerationPowerAtCrankTractionOnWatts() Assert.AreEqual( expected, actual) @@ -89,7 +89,7 @@ Public Sub PowerAtCrankOverrunWatts() Initialise() _target = New M5__SmartAlternatorSetGeneration(_m05,_powerNetVoltage,_altGearPullyEfficiency) - Dim expected As Single =1993.34644 + Dim expected As Single =1992.34875 Dim actual As Single = _target.AlternatorsGenerationPowerAtCrankOverrunWatts()