From 30ccc99e7070c4134ab4c4e4bda8560a9f7aebdf Mon Sep 17 00:00:00 2001
From: "Zarb, Glenn" <STC\GZ1>
Date: Tue, 14 Jul 2015 08:07:42 +0000
Subject: [PATCH] Schematic V11 Change C & D

git-tfs-id: [http://tfs00.element.root.com:8080/tfs/TFSCollection]$/VECTO;C2011
---
 .../VectoAuxiliaries/DownstreamModules/M9.vb  | 320 +++++++++---------
 1 file changed, 167 insertions(+), 153 deletions(-)

diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb
index cec2f7d7ff..c556509142 100644
--- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb
+++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb
@@ -15,191 +15,205 @@ Imports VectoAuxiliaries.Hvac
 
 Namespace DownstreamModules
 
-  Public Class M9
-    Implements  IM9
-
-  Private Const RPM_TO_RADS_PER_SECOND As Single = 9.55f
- 
-  #Region "Aggregates"
-
-'AG1
-Private _LitresOfAirCompressorOnContinuallyAggregate As Single
-'AG2
-Private _LitresOfAirCompressorOnOnlyInOverrunAggregate As Single
-'AG3
-Private _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate As Single
-'AG4
-Private _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate As Single
+    Public Class M9
+        Implements IM9
+
+        Private Const RPM_TO_RADS_PER_SECOND As Single = 9.55F
+
+#Region "Aggregates"
+
+        'AG1
+        Private _LitresOfAirCompressorOnContinuallyAggregate As Single
+        'AG2
+        Private _LitresOfAirCompressorOnOnlyInOverrunAggregate As Single
+        'AG3
+        Private _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate As Single
+        'AG4
+        Private _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate As Single
 
 #End Region
-  #Region "Constructor Requirements"
+#Region "Constructor Requirements"
 
-Private M1 As IM1_AverageHVACLoadDemand
-Private M4 As IM4_AirCompressor
-Private M6 As IM6
-Private M8 As IM8
-Private FMAP As IFUELMAP
-Private PSAC As IPneumaticsAuxilliariesConfig
-Private Signals As ISignals
+        Private M1 As IM1_AverageHVACLoadDemand
+        Private M4 As IM4_AirCompressor
+        Private M6 As IM6
+        Private M8 As IM8
+        Private FMAP As IFUELMAP
+        Private PSAC As IPneumaticsAuxilliariesConfig
+        Private Signals As ISignals
 
-#end region
+#End Region
 
 
-  #Region "Class Outputs"
-  'OUT 1
-  Public ReadOnly Property LitresOfAirCompressorOnContinually As Single Implements IM9.LitresOfAirCompressorOnContinually
+#Region "Class Outputs"
+        'OUT 1
+        Public ReadOnly Property LitresOfAirCompressorOnContinually As Single Implements IM9.LitresOfAirCompressorOnContinually
             Get
-              Return _LitresOfAirCompressorOnContinuallyAggregate
+                Return _LitresOfAirCompressorOnContinuallyAggregate
             End Get
         End Property
-  'OUT 2
-  Public ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As Single Implements IM9.LitresOfAirCompressorOnOnlyInOverrun
+        'OUT 2
+        Public ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As Single Implements IM9.LitresOfAirCompressorOnOnlyInOverrun
             Get
-             Return  _LitresOfAirCompressorOnOnlyInOverrunAggregate
+                Return _LitresOfAirCompressorOnOnlyInOverrunAggregate
             End Get
         End Property
-  'OUT 3
-  Public ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Single Implements IM9.TotalCycleFuelConsumptionCompressorOffContinuously
+        'OUT 3
+        Public ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Single Implements IM9.TotalCycleFuelConsumptionCompressorOffContinuously
             Get
-             Return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate
+                Return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate
             End Get
         End Property
-  'OUT 4
-  Public ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Single Implements IM9.TotalCycleFuelConsumptionCompressorOnContinuously
+        'OUT 4
+        Public ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Single Implements IM9.TotalCycleFuelConsumptionCompressorOnContinuously
             Get
-            Return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate
+                Return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate
             End Get
         End Property
 
 #End Region
 
-  'Staging Calculations
-  Private Function S0( byval rpm As Single ) As Single
-
-  If rpm<1 then rpm=1
-  
-  Return rpm / RPM_TO_RADS_PER_SECOND
-
-End Function
-  
-  Private readonly Property S1 As single
-    Get
-     Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts
-    End Get
-End Property
-  Private readonly Property S2 As single
-    Get
-      If S0( Signals.EngineSpeed)=0 then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.")
-      Return M4.GetPowerCompressorOn/S0( Signals.EngineSpeed)
-    End Get
-End Property
-  Private readonly Property S3 As single
-    Get
-       If S0( Signals.EngineSpeed)=0 then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.")
-       Return M4.GetPowerCompressorOff/ S0( Signals.EngineSpeed)
-    End Get
-End Property
-  Private readonly Property S4 As single
-    Get
-    If S0( Signals.EngineSpeed)=0 then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.")
-     Return S1/S0( Signals.EngineSpeed)
-    End Get
-End Property
-  Private readonly Property S5 As single
-    Get
-      Return S2 + Signals.EngineDrivelineTorque
-    End Get
-End Property
-  Private readonly Property S6 As single 
-    Get
-     Return Signals.EngineDrivelineTorque + s3
-    End Get
-End Property
-  Private readonly Property S7 As single
-    Get
-      Return S4 + S5
-    End Get
-End Property
-  Private readonly Property S8 As single
-    Get
-     Return S4 + S6
-    End Get
-End Property
-  Private readonly Property S9 As single
-    Get
-     Return M4.GetFlowRate * M6.OverrunFlag * M8.CompressorFlag
-    End Get
-End Property
-  Private ReadOnly Property S10 As Single
-     Get
-     Return S9 * PSAC.OverrunUtilisationForCompressionFraction
-     End Get
- End Property
-  private ReadOnly Property S11 As Single
-     Get
-      'SCHM 3_02
-       Dim int1 As Single = FMAP.fFCdelaunay_Intp(Signals.EngineSpeed,s7)   
-       int1 = If( int1 >0 Andalso Not Single.IsNaN(int1), int1,0)
-
-       Return int1/3600 
-
-     End Get
- End Property
-  private ReadOnly Property S12 As Single
-      Get
-
-         'SCHM 3_02
-         Dim int2 As Single = FMAP.fFCdelaunay_Intp(Signals.EngineSpeed,s8)
-         int2 = If( int2 >0 Andalso Not Single.IsNaN(int2), int2,0)
-
-         Return  int2 /3600
-
-      End Get
-  End Property
-  
-  Private ReadOnly Property SW1 As Integer
-     Get
-       Return If( Signals.EngineStopped,0,1)
-     End Get
- End Property
-
-  'Utility Methods
-  Public Sub ClearAggregates() Implements IM9.ClearAggregates
-
-          _LitresOfAirCompressorOnContinuallyAggregate =0
-          _LitresOfAirCompressorOnOnlyInOverrunAggregate =0
-          _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate =0
-          _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate=0
+        'Staging Calculations
+        Private Function S0(ByVal rpm As Single) As Single
+
+            If rpm < 1 Then rpm = 1
+
+            Return rpm / RPM_TO_RADS_PER_SECOND
+
+        End Function
+
+        Private ReadOnly Property S1 As Single
+            Get
+                Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts
+            End Get
+        End Property
+        Private ReadOnly Property S2 As Single
+            Get
+                If S0(Signals.EngineSpeed) = 0 Then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.")
+                Return M4.GetPowerCompressorOn / S0(Signals.EngineSpeed)
+            End Get
+        End Property
+        Private ReadOnly Property S3 As Single
+            Get
+                If S0(Signals.EngineSpeed) = 0 Then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.")
+                Return M4.GetPowerCompressorOff / S0(Signals.EngineSpeed)
+            End Get
+        End Property
+        Private ReadOnly Property S4 As Single
+            Get
+                If S0(Signals.EngineSpeed) = 0 Then Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.")
+                Return S1 / S0(Signals.EngineSpeed)
+            End Get
+        End Property
+        Private ReadOnly Property S5 As Single
+            Get
+                Return S2 + S14
+            End Get
+        End Property
+        Private ReadOnly Property S6 As Single
+            Get
+                Return S14 + S3
+            End Get
+        End Property
+        Private ReadOnly Property S7 As Single
+            Get
+                Return S4 + S5
+            End Get
+        End Property
+        Private ReadOnly Property S8 As Single
+            Get
+                Return S4 + S6
+            End Get
+        End Property
+        Private ReadOnly Property S9 As Single
+            Get
+                Return M4.GetFlowRate * M6.OverrunFlag * M8.CompressorFlag
+            End Get
+        End Property
+        Private ReadOnly Property S10 As Single
+            Get
+                Return S13 * PSAC.OverrunUtilisationForCompressionFraction
+            End Get
+        End Property
+        Private ReadOnly Property S11 As Single
+            Get
+                'SCHM 3_02
+                Dim int1 As Single = FMAP.fFCdelaunay_Intp(Signals.EngineSpeed, s7)
+                int1 = If(int1 > 0 AndAlso Not Single.IsNaN(int1), int1, 0)
+
+                Return int1 / 3600
+
+            End Get
+        End Property
+        Private ReadOnly Property S12 As Single
+            Get
+
+                'SCHM 3_02
+                Dim int2 As Single = FMAP.fFCdelaunay_Intp(Signals.EngineSpeed, s8)
+                int2 = If(int2 > 0 AndAlso Not Single.IsNaN(int2), int2, 0)
+
+                Return int2 / 3600
+
+            End Get
+        End Property
+        Private ReadOnly Property S13 As Single
+            Get
+
+                Return (Signals.ClutchEngaged * Not (Signals.InNeutral)) * S9
+
+            End Get
+        End Property
+        Private ReadOnly Property S14 As Single
+            Get
+
+                Return Signals.EngineDrivelineTorque + Signals.PreExistingAuxPower
+
+            End Get
+        End Property
+
+        Private ReadOnly Property SW1 As Integer
+            Get
+                Return If(Signals.EngineStopped, 0, 1)
+            End Get
+        End Property
+
+        'Utility Methods
+        Public Sub ClearAggregates() Implements IM9.ClearAggregates
+
+            _LitresOfAirCompressorOnContinuallyAggregate = 0
+            _LitresOfAirCompressorOnOnlyInOverrunAggregate = 0
+            _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate = 0
+            _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate = 0
 
         End Sub
-  Public Sub CycleStep(Optional stepTimeInSeconds As Single = 0.0) Implements IM9.CycleStep
+        Public Sub CycleStep(Optional stepTimeInSeconds As Single = 0.0) Implements IM9.CycleStep
 
-          If Signals.EngineStopped then return
+            If Signals.EngineStopped Then Return
 
-          _LitresOfAirCompressorOnContinuallyAggregate +=stepTimeInSeconds* M4.GetFlowRate * sw1
-          _LitresOfAirCompressorOnOnlyInOverrunAggregate +=stepTimeInSeconds * s10 * sw1
-          _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate+= stepTimeInSeconds * s11 * sw1
-          _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate +=stepTimeInSeconds * s12 * sw1
+            _LitresOfAirCompressorOnContinuallyAggregate += stepTimeInSeconds * M4.GetFlowRate * sw1
+            _LitresOfAirCompressorOnOnlyInOverrunAggregate += stepTimeInSeconds * s10 * sw1
+            _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate += stepTimeInSeconds * s11 * sw1
+            _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate += stepTimeInSeconds * s12 * sw1
 
-  End Sub
+        End Sub
 
- 'Constructor
-  Public Sub new ( m1 As IM1_AverageHVACLoadDemand, m4 As IM4_AirCompressor, m6 As IM6, m8 As IM8, fmap As IFUELMAP, psac As IPneumaticsAuxilliariesConfig, signals As ISignals)
-                Me.M1=m1
-                Me.M4=m4
-                Me.M6=m6
-                Me.M8=m8
-                Me.FMAP=fmap
-                Me.PSAC= psac
-                Me.Signals=signals  
+        'Constructor
+        Public Sub New(m1 As IM1_AverageHVACLoadDemand, m4 As IM4_AirCompressor, m6 As IM6, m8 As IM8, fmap As IFUELMAP, psac As IPneumaticsAuxilliariesConfig, signals As ISignals)
+            Me.M1 = m1
+            Me.M4 = m4
+            Me.M6 = m6
+            Me.M8 = m8
+            Me.FMAP = fmap
+            Me.PSAC = psac
+            Me.Signals = signals
 
         End Sub
 
- 'Auxiliary Event
-  Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) Implements IAuxiliaryEvent.AuxiliaryEvent
+        'Auxiliary Event
+        Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) Implements IAuxiliaryEvent.AuxiliaryEvent
 
 
-  End Class
+    End Class
 
 End Namespace
 
-- 
GitLab