From ce2e8ae17c145bfc191476562f7f9c3f9902a91e Mon Sep 17 00:00:00 2001 From: "Burns, Terry" <Terry.Burns@ricardo.com> Date: Mon, 15 Dec 2014 15:56:16 +0000 Subject: [PATCH] **MAJOR** - LAST STATE PRIOR TO VECTO GRAFTING git-tfs-id: [http://tfs00.element.root.com:8080/tfs/TFSCollection]$/VECTO;C1699 --- .../AuxiliaryTestHarness.vbproj | 2 +- AuxillaryTestHarness/Dashboard.Designer.vb | 58 ++--- AuxillaryTestHarness/Dashboard.vb | 49 ++++ .../HVACSteadyStateModel.AHSM | 2 +- VECTO/MODcalc/cPower.vb | 8 +- .../Hvac/HVACSteadyStateModel.vb | 95 +++++++- .../Hvac/IHVACSteadyStateModel.vb | 3 + .../UI/frmAuxiliaryConfig.Designer.vb | 217 +++++++++--------- .../VectoAuxiliaries/UI/frmAuxiliaryConfig.vb | 34 +++ .../VectoAuxiliaries/VectoAuxiliaries.vbproj | 1 - .../HVACSteadyStateModelBadHeaders.ahsm | 11 + .../HVACSteadyStateModelBadValues.ahsm | 11 + .../HVACSteadyStateModelGOODMAP.ahsm | 11 + ...HVACSteadyStateModelInsufficientLines.ahsm | 1 + .../UnitTests/HVACSSMMapTests.vb | 99 ++++++++ .../VectoAuxiliariesTests.vbproj | 14 +- 16 files changed, 466 insertions(+), 150 deletions(-) create mode 100644 VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadHeaders.ahsm create mode 100644 VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadValues.ahsm create mode 100644 VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelGOODMAP.ahsm create mode 100644 VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelInsufficientLines.ahsm create mode 100644 VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb diff --git a/AuxillaryTestHarness/AuxiliaryTestHarness.vbproj b/AuxillaryTestHarness/AuxiliaryTestHarness.vbproj index cb43fa8c9d..8b645bcc71 100644 --- a/AuxillaryTestHarness/AuxiliaryTestHarness.vbproj +++ b/AuxillaryTestHarness/AuxiliaryTestHarness.vbproj @@ -28,7 +28,7 @@ <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> - <ApplicationRevision>18</ApplicationRevision> + <ApplicationRevision>20</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <UseApplicationTrust>false</UseApplicationTrust> <PublishWizardCompleted>true</PublishWizardCompleted> diff --git a/AuxillaryTestHarness/Dashboard.Designer.vb b/AuxillaryTestHarness/Dashboard.Designer.vb index 077ef313da..181e11e03b 100644 --- a/AuxillaryTestHarness/Dashboard.Designer.vb +++ b/AuxillaryTestHarness/Dashboard.Designer.vb @@ -118,6 +118,9 @@ Partial Class Dashboard Me.txtPerStopBrakeActuationNIperKG = New System.Windows.Forms.TextBox() Me.txtSmartRegenFractionTotalAirDemand = New System.Windows.Forms.TextBox() Me.tabHVACConfig = New System.Windows.Forms.TabPage() + Me.btnSSMBSource = New System.Windows.Forms.Button() + Me.lblSSMFilePath = New System.Windows.Forms.Label() + Me.txtSSMFilePath = New System.Windows.Forms.TextBox() Me.lblHVACTitle = New System.Windows.Forms.Label() Me.txtHVACFuellingLitresPerHour = New System.Windows.Forms.TextBox() Me.lblHVACFuellingLitresPerHour = New System.Windows.Forms.Label() @@ -286,9 +289,6 @@ Partial Class Dashboard Me.DeleteToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.ErrorProvider = New System.Windows.Forms.ErrorProvider(Me.components) Me.Timer1 = New System.Windows.Forms.Timer(Me.components) - Me.btnSSMBSource = New System.Windows.Forms.Button() - Me.lblSSMFilePath = New System.Windows.Forms.Label() - Me.txtSSMFilePath = New System.Windows.Forms.TextBox() Me.pnlMain.SuspendLayout Me.tabMain.SuspendLayout Me.tabGeneralConfig.SuspendLayout @@ -1235,6 +1235,32 @@ Partial Class Dashboard Me.tabHVACConfig.Text = "HVAC" Me.tabHVACConfig.UseVisualStyleBackColor = true ' + 'btnSSMBSource + ' + Me.btnSSMBSource.Location = New System.Drawing.Point(706, 93) + Me.btnSSMBSource.Name = "btnSSMBSource" + Me.btnSSMBSource.Size = New System.Drawing.Size(45, 23) + Me.btnSSMBSource.TabIndex = 31 + Me.btnSSMBSource.Text = ". . ." + Me.btnSSMBSource.UseVisualStyleBackColor = true + ' + 'lblSSMFilePath + ' + Me.lblSSMFilePath.AutoSize = true + Me.lblSSMFilePath.Location = New System.Drawing.Point(25, 99) + Me.lblSSMFilePath.Name = "lblSSMFilePath" + Me.lblSSMFilePath.Size = New System.Drawing.Size(171, 13) + Me.lblSSMFilePath.TabIndex = 30 + Me.lblSSMFilePath.Text = "Steady State Model File ( .AHSM )" + ' + 'txtSSMFilePath + ' + Me.txtSSMFilePath.Location = New System.Drawing.Point(204, 96) + Me.txtSSMFilePath.Name = "txtSSMFilePath" + Me.txtSSMFilePath.ReadOnly = true + Me.txtSSMFilePath.Size = New System.Drawing.Size(485, 20) + Me.txtSSMFilePath.TabIndex = 29 + ' 'lblHVACTitle ' Me.lblHVACTitle.AutoSize = true @@ -2854,32 +2880,6 @@ Partial Class Dashboard ' Me.Timer1.Interval = 1000 ' - 'btnSSMBSource - ' - Me.btnSSMBSource.Location = New System.Drawing.Point(706, 93) - Me.btnSSMBSource.Name = "btnSSMBSource" - Me.btnSSMBSource.Size = New System.Drawing.Size(45, 23) - Me.btnSSMBSource.TabIndex = 31 - Me.btnSSMBSource.Text = ". . ." - Me.btnSSMBSource.UseVisualStyleBackColor = true - ' - 'lblSSMFilePath - ' - Me.lblSSMFilePath.AutoSize = true - Me.lblSSMFilePath.Location = New System.Drawing.Point(25, 99) - Me.lblSSMFilePath.Name = "lblSSMFilePath" - Me.lblSSMFilePath.Size = New System.Drawing.Size(171, 13) - Me.lblSSMFilePath.TabIndex = 30 - Me.lblSSMFilePath.Text = "Steady State Model File ( .AHSM )" - ' - 'txtSSMFilePath - ' - Me.txtSSMFilePath.Location = New System.Drawing.Point(204, 96) - Me.txtSSMFilePath.Name = "txtSSMFilePath" - Me.txtSSMFilePath.ReadOnly = true - Me.txtSSMFilePath.Size = New System.Drawing.Size(485, 20) - Me.txtSSMFilePath.TabIndex = 29 - ' 'Dashboard ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) diff --git a/AuxillaryTestHarness/Dashboard.vb b/AuxillaryTestHarness/Dashboard.vb index 8908db9431..a1a8530b51 100644 --- a/AuxillaryTestHarness/Dashboard.vb +++ b/AuxillaryTestHarness/Dashboard.vb @@ -1244,4 +1244,53 @@ public sub UnbindAllControls(ByRef container As Control) End Sub +Private Sub btnSSMBSource_Click( sender As Object, e As EventArgs) Handles btnSSMBSource.Click + + + Dim fbAux As New cFileBrowser(True, False) + Dim ssmMap As New Hvac.HVACSteadyStateModel() + Dim message As String = String.Empty + + + fbAux.Extensions = New String() {"ahsm"} + + If fbAux.OpenDialog(fPATH(vectoFile)) Then + + txtSSMFilePath.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) + + + Try + + If Not ssmMap.SetValuesFromMap(txtSSMFilePath.Text, message) then + + txtHVACElectricalLoadPowerWatts.Text = string.empty + txtHVACMechanicalLoadPowerWatts.Text = string.empty + txtHVACFuellingLitresPerHour.Text = string.empty + messagebox.Show("Unable to load") + + else + + 'Populate boxes + + txtHVACElectricalLoadPowerWatts.Text = ssmMap.HVACElectricalLoadPowerWatts.ToString() + txtHVACMechanicalLoadPowerWatts.Text = ssmMap.HVACMechanicalLoadPowerWatts.ToString() + txtHVACFuellingLitresPerHour.Text = ssmMap.HVACFuellingLitresPerHour.ToString() + + End If + + + Catch ex As Exception + + messagebox.Show("Unable to load") + + End Try + + + + + End If + +End Sub + + End Class \ No newline at end of file diff --git a/AuxillaryTestHarness/HVACSteadyStateModel.AHSM b/AuxillaryTestHarness/HVACSteadyStateModel.AHSM index 73b88edcab..f39fc18d7f 100644 --- a/AuxillaryTestHarness/HVACSteadyStateModel.AHSM +++ b/AuxillaryTestHarness/HVACSteadyStateModel.AHSM @@ -1,4 +1,4 @@ -[Electrical Power (w)],[ Mechanical Power (w)], [Fuelling (L/H)] +[Electrical Power (w)],[Mechanical Power (w)], [Fuelling (L/H)] 100,100,0 [MODELSOURCE] Modelname : HVAC MODEL SYSTEM diff --git a/VECTO/MODcalc/cPower.vb b/VECTO/MODcalc/cPower.vb index ae4b826b9e..7be1a3a4f9 100644 --- a/VECTO/MODcalc/cPower.vb +++ b/VECTO/MODcalc/cPower.vb @@ -222,7 +222,7 @@ Public Class cPower 'TODO:CHECK THIS FOR AAUX M8 'Aux Demand - ' + 'REMAINING SIGNALS NEEDED AT THIS POINT FOR AAUX @@ -444,6 +444,10 @@ Public Class cPower Loop Until i = 0 + + 'CALCULATE ADVANCED AUXILIARIES + + Return True End Function @@ -2281,6 +2285,8 @@ lb10: End Function '----------------Ancillaries(Nebenaggregate) ---------------- + + 'TODO: AAUX ANCILIARIES CALCULATIONS Public Function fPaux(ByVal t As Integer, ByVal nU As Single) As Single Return CSng(MODdata.Vh.Padd(t) + VEC.PauxSum(t, nU)) End Function diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb index 0e6883efae..17e5a6cca2 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb @@ -1,29 +1,110 @@ - +Imports System.IO + Namespace Hvac Public Class HVACSteadyStateModel -implements IHVACSteadyStateModel +Implements IHVACSteadyStateModel + Public Property HVACElectricalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACElectricalLoadPowerWatts Public Property HVACFuellingLitresPerHour As Single Implements IHVACSteadyStateModel.HVACFuellingLitresPerHour Public Property HVACMechanicalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACMechanicalLoadPowerWatts -Public Sub new () +Public Sub New() End Sub -Public Sub new( elecPowerW As Single, mechPowerW As Single, fuellingLPH As single) +Public Sub New(elecPowerW As Single, mechPowerW As Single, fuellingLPH As Single) - HVACElectricalLoadPowerWatts=elecPowerW - HVACFuellingLitresPerHour =mechPowerW - HVACMechanicalLoadPowerWatts=fuellingLPH + HVACElectricalLoadPowerWatts = elecPowerW + HVACFuellingLitresPerHour = mechPowerW + HVACMechanicalLoadPowerWatts = fuellingLPH End Sub +Public Function SetValuesFromMap( ByVal filePath As String, byref message As String ) As Boolean Implements IHVACSteadyStateModel.SetValuesFromMap + + + Dim myData As String + Dim linesArray As String() + + + 'Check map file can be found. + Try + myData = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8) + Catch ex As FileNotFoundException + + message = "HVAC Steady State Model : The map file was not found" + Return false + End Try + + + linesArray = (From s As String In myData.Split(vbLf) Select s.Trim).ToArray + + 'Check count is at least 2 rows + If linesArray.Count<2 then + message="HVAC Steady State Model : Insufficient Lines in this File" + Return False + End If + + 'validate headers + Dim headers As String() = linesArray(0).Split(","c) + If headers.Count<>3 OrElse + headers(0).Trim<>"[Electrical Power (w)]" OrElse _ + headers(1).Trim<>"[Mechanical Power (w)]" OrElse _ + headers(2).Trim<>"[Fuelling (L/H)]" Then + message = "HVAC Steady State Model : Column headers in *.AHSM file being read are incompatable." + Return False + + End If + + 'validate values + Dim values As String() = linesArray(1).Split(","c) + If headers.Count<>3 OrElse _ + NOT IsNumeric( values(0)) OrElse _ + NOT IsNumeric( values(1)) OrElse _ + Not IsNumeric( values(2)) + message="Steady State Model : Unable to confirm numeric values in the *.AHSM file being read." + Return False + End If + + 'OK we have the values so lets set the properties + Dim out1,out2,out3 As single + out1= HVACElectricalLoadPowerWatts + out2= HVACMechanicalLoadPowerWatts + out3= HVACFuellingLitresPerHour + try + + HVACElectricalLoadPowerWatts = Single.Parse(values(0)) + HVACMechanicalLoadPowerWatts = Single.Parse(values(1)) + HVACFuellingLitresPerHour = Single.Parse(values(2)) + + Catch ex As Exception + + 'Restore in the event of failure to fully assign + HVACElectricalLoadPowerWatts = out1 + HVACMechanicalLoadPowerWatts = out2 + HVACFuellingLitresPerHour = out3 + + 'Return result + message="Steady State Model : Unable to parse the values in the *.AHSM file being read no values were harmed in reading of this file." + Return False + + End Try + + + + Return True + + +End Function + + + End Class diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb index 45488330d3..46e963057e 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb @@ -4,6 +4,9 @@ Namespace Hvac Public Interface IHVACSteadyStateModel + +Function SetValuesFromMap( byval filePath As String , ByRef message As string) As Boolean + Property HVACMechanicalLoadPowerWatts As Single Property HVACElectricalLoadPowerWatts As Single diff --git a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.Designer.vb b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.Designer.vb index f763008869..84f48d1cb2 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.Designer.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.Designer.vb @@ -23,18 +23,18 @@ Partial Class frmAuxiliaryConfig <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle7 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle8 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle9 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle10 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle12 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle25 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle26 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle27 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle28 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle29 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle30 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle31 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle32 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle33 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle34 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle35 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle36 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Me.pnlMain = New System.Windows.Forms.Panel() Me.btnCancel = New System.Windows.Forms.Button() Me.btnSave = New System.Windows.Forms.Button() @@ -286,97 +286,97 @@ Partial Class frmAuxiliaryConfig ' 'gvResultsCardOverrun ' - DataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvResultsCardOverrun.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle1 + DataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle25.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvResultsCardOverrun.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle25 Me.gvResultsCardOverrun.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.gvResultsCardOverrun.DefaultCellStyle = DataGridViewCellStyle2 + DataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle26.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle26.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle26.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle26.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.gvResultsCardOverrun.DefaultCellStyle = DataGridViewCellStyle26 Me.gvResultsCardOverrun.Location = New System.Drawing.Point(590, 451) Me.gvResultsCardOverrun.Name = "gvResultsCardOverrun" - DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvResultsCardOverrun.RowHeadersDefaultCellStyle = DataGridViewCellStyle3 + DataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle27.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle27.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle27.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle27.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle27.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle27.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvResultsCardOverrun.RowHeadersDefaultCellStyle = DataGridViewCellStyle27 Me.gvResultsCardOverrun.Size = New System.Drawing.Size(246, 125) Me.gvResultsCardOverrun.TabIndex = 18 ' 'gvResultsCardTraction ' - DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvResultsCardTraction.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle4 + DataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle28.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle28.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle28.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle28.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle28.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvResultsCardTraction.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle28 Me.gvResultsCardTraction.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.gvResultsCardTraction.DefaultCellStyle = DataGridViewCellStyle5 + DataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle29.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle29.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle29.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle29.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle29.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle29.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.gvResultsCardTraction.DefaultCellStyle = DataGridViewCellStyle29 Me.gvResultsCardTraction.Location = New System.Drawing.Point(311, 451) Me.gvResultsCardTraction.Name = "gvResultsCardTraction" - DataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle6.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvResultsCardTraction.RowHeadersDefaultCellStyle = DataGridViewCellStyle6 + DataGridViewCellStyle30.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle30.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle30.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle30.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle30.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle30.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle30.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvResultsCardTraction.RowHeadersDefaultCellStyle = DataGridViewCellStyle30 Me.gvResultsCardTraction.Size = New System.Drawing.Size(258, 125) Me.gvResultsCardTraction.TabIndex = 17 ' 'gvResultsCardIdle ' - DataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle7.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvResultsCardIdle.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle7 + DataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle31.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle31.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle31.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle31.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle31.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle31.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvResultsCardIdle.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle31 Me.gvResultsCardIdle.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle8.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.gvResultsCardIdle.DefaultCellStyle = DataGridViewCellStyle8 + DataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle32.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.gvResultsCardIdle.DefaultCellStyle = DataGridViewCellStyle32 Me.gvResultsCardIdle.Location = New System.Drawing.Point(35, 451) Me.gvResultsCardIdle.Name = "gvResultsCardIdle" - DataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle9.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvResultsCardIdle.RowHeadersDefaultCellStyle = DataGridViewCellStyle9 + DataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle33.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle33.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle33.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle33.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle33.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle33.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvResultsCardIdle.RowHeadersDefaultCellStyle = DataGridViewCellStyle33 Me.gvResultsCardIdle.Size = New System.Drawing.Size(256, 125) Me.gvResultsCardIdle.TabIndex = 16 ' @@ -428,33 +428,33 @@ Partial Class frmAuxiliaryConfig ' 'gvElectricalConsumables ' - DataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle10.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvElectricalConsumables.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle10 + DataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle34.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle34.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle34.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle34.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle34.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle34.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvElectricalConsumables.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle34 Me.gvElectricalConsumables.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - DataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle11.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.gvElectricalConsumables.DefaultCellStyle = DataGridViewCellStyle11 + DataGridViewCellStyle35.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle35.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle35.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle35.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle35.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle35.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle35.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.gvElectricalConsumables.DefaultCellStyle = DataGridViewCellStyle35 Me.gvElectricalConsumables.Location = New System.Drawing.Point(33, 170) Me.gvElectricalConsumables.Name = "gvElectricalConsumables" - DataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle12.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) - DataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.gvElectricalConsumables.RowHeadersDefaultCellStyle = DataGridViewCellStyle12 + DataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle36.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + DataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle36.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.gvElectricalConsumables.RowHeadersDefaultCellStyle = DataGridViewCellStyle36 Me.gvElectricalConsumables.Size = New System.Drawing.Size(803, 250) Me.gvElectricalConsumables.TabIndex = 10 ' @@ -1051,7 +1051,6 @@ Partial Class frmAuxiliaryConfig ' Me.txtSSMFilePath.Location = New System.Drawing.Point(210, 85) Me.txtSSMFilePath.Name = "txtSSMFilePath" - Me.txtSSMFilePath.ReadOnly = true Me.txtSSMFilePath.Size = New System.Drawing.Size(485, 20) Me.txtSSMFilePath.TabIndex = 26 ' diff --git a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb index c342a979f7..fab56e8045 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb @@ -1190,6 +1190,8 @@ Private Sub btnSSMBSource_Click( sender As Object, e As EventArgs) Handles btnS Dim fbAux As New cFileBrowser(True, False) + Dim ssmMap As New Hvac.HVACSteadyStateModel() + Dim message As String = String.Empty fbAux.Extensions = New String() {"ahsm"} @@ -1198,8 +1200,40 @@ Private Sub btnSSMBSource_Click( sender As Object, e As EventArgs) Handles btnS txtSSMFilePath.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) + + Try + + If Not ssmMap.SetValuesFromMap(txtSSMFilePath.Text, message) then + + txtHVACElectricalLoadPowerWatts.Text = string.empty + txtHVACMechanicalLoadPowerWatts.Text = string.empty + txtHVACFuellingLitresPerHour.Text = string.empty + messagebox.Show("Unable to load") + + else + + 'Populate boxes + + txtHVACElectricalLoadPowerWatts.Text = ssmMap.HVACElectricalLoadPowerWatts.ToString() + txtHVACMechanicalLoadPowerWatts.Text = ssmMap.HVACMechanicalLoadPowerWatts.ToString() + txtHVACFuellingLitresPerHour.Text = ssmMap.HVACFuellingLitresPerHour.ToString() + + End If + + + Catch ex As Exception + + messagebox.Show("Unable to load") + + End Try + + + + End If + 'Causes binding to fire + txtSSMFilePath.Focus() End Sub diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj index 253edb497a..a1cafac3ae 100644 --- a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj @@ -119,7 +119,6 @@ <Compile Include="Electrics\IElectricalConsumerList.vb" /> <Compile Include="Hvac\HVACSteadyStateModel.vb" /> <Compile Include="Hvac\HVACUserInputsConfig.vb" /> - <Compile Include="Hvac\IHVACInputs.vb" /> <Compile Include="Hvac\HVACMapParameter.vb" /> <Compile Include="Hvac\IHVACSteadyStateModel.vb" /> <Compile Include="Hvac\IHVACUserInputsConfig.vb" /> diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadHeaders.ahsm b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadHeaders.ahsm new file mode 100644 index 0000000000..83d71f631a --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadHeaders.ahsm @@ -0,0 +1,11 @@ +[Electrical Power (w)],[Mechanical Power (w)],BadHeader +100,100,0 +[MODELSOURCE] +Modelname : HVAC MODEL SYSTEM +Model Version : 1.0 +UserName : Joe Bloggs +DateTime : 15th Feb 2014 +Comments :This is some descriptive Comments on the production of this model. + +[KeyValuePairs] +AmbientTemperature Deg C : 22 diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadValues.ahsm b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadValues.ahsm new file mode 100644 index 0000000000..14de75b875 --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelBadValues.ahsm @@ -0,0 +1,11 @@ +[Electrical Power (w)],[Mechanical Power (w)], [Fuelling (L/H)] +100,d,0 +[MODELSOURCE] +Modelname : HVAC MODEL SYSTEM +Model Version : 1.0 +UserName : Joe Bloggs +DateTime : 15th Feb 2014 +Comments :This is some descriptive Comments on the production of this model. + +[KeyValuePairs] +AmbientTemperature Deg C : 22 diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelGOODMAP.ahsm b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelGOODMAP.ahsm new file mode 100644 index 0000000000..f39fc18d7f --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelGOODMAP.ahsm @@ -0,0 +1,11 @@ +[Electrical Power (w)],[Mechanical Power (w)], [Fuelling (L/H)] +100,100,0 +[MODELSOURCE] +Modelname : HVAC MODEL SYSTEM +Model Version : 1.0 +UserName : Joe Bloggs +DateTime : 15th Feb 2014 +Comments :This is some descriptive Comments on the production of this model. + +[KeyValuePairs] +AmbientTemperature Deg C : 22 diff --git a/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelInsufficientLines.ahsm b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelInsufficientLines.ahsm new file mode 100644 index 0000000000..2cb6918141 --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/TestFiles/HVACSteadyStateModelInsufficientLines.ahsm @@ -0,0 +1 @@ +[Electrical Power (w)],[Mechanical Power (w)], [Fuelling (L/H)] diff --git a/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb b/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb new file mode 100644 index 0000000000..ac2b0656c7 --- /dev/null +++ b/VECTOAux/VectoAuxiliariesTests/UnitTests/HVACSSMMapTests.vb @@ -0,0 +1,99 @@ +Imports NUnit.Framework +Imports VectoAuxiliaries.Hvac + + +Namespace UnitTests + + <TestFixture()> Public Class HVACSSMMapTests +#Region "Test Values" + const goodMap As String = "TestFiles\HVACSteadyStateModelGOODMAP.ahsm" + Const badHeaders As String = "TESTFILES\HVACSteadyStateModelBADHEADERS.ahsm" + Const badValues As String = "TestFiles\HVACSteadyStateModelBADVALUES.ahsm" + Const insufficientLines As String = "TestFiles\HVACSteadyStateModelInsufficientLines.ahsm" + Const badMapFileNotExist As String = "TestFiles\fileNotExist.csv" + + Private Function GetMap() As HVACSteadyStateModel + + Dim target As New HVACSteadyStateModel() + Return target + + End Function + + +#End Region + + + <Test()> + Public Sub InitialiseTestWithValues() + Dim message As String = String.Empty + Dim expected As boolean = true + Dim actual As Boolean + Dim target = GetMap + + actual = target.SetValuesFromMap(goodMap, message) + Assert.AreEqual(expected, actual) + Assert.AreEqual(target.HVACFuellingLitresPerHour,0) + Assert.AreEqual(target.HVACElectricalLoadPowerWatts,100) + Assert.AreEqual(target.HVACMechanicalLoadPowerWatts,100) + + End Sub + + <Test()> + Public Sub BadHeaderTest() + Dim message As String = String.Empty + Dim expected As boolean = false + Dim actual As Boolean + Dim target = GetMap + + actual = target.SetValuesFromMap( badHeaders, message) + Assert.AreEqual(expected, actual) + + + End Sub + + <Test()> + Public Sub BadValuesTest() + Dim message As String = String.Empty + Dim expected As boolean = false + Dim actual As Boolean + Dim target = GetMap + + actual = target.SetValuesFromMap( badValues, message) + Assert.AreEqual(expected, actual) + + + End Sub + + + <Test()> + Public Sub InsufficientLinesTest() + Dim message As String = String.Empty + Dim expected As boolean = false + Dim actual As Boolean + Dim target = GetMap + + actual = target.SetValuesFromMap( badMapFileNotExist, message) + Assert.AreEqual(expected, actual) + + + End Sub + + <Test()> + Public Sub BadFilePathNotExistTest() + Dim message As String = String.Empty + Dim expected As boolean = false + Dim actual As Boolean + Dim target = GetMap + + actual = target.SetValuesFromMap( insufficientLines, message) + Assert.AreEqual(expected, actual) + + + End Sub + + + End Class + +End Namespace + + diff --git a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj index 69bce9a6be..156f4c8035 100644 --- a/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj +++ b/VECTOAux/VectoAuxiliariesTests/VectoAuxiliariesTests.vbproj @@ -105,6 +105,7 @@ <Compile Include="Mocks\MockFuel50PC.vb" /> <Compile Include="UnitTests\FilePathUtilityTests.vb" /> <Compile Include="UnitTests\FuelMapTests.vb" /> + <Compile Include="UnitTests\HVACSSMMapTests.vb" /> <Compile Include="UnitTests\M0_5_SmartAlternatorSetEfficiencyTests.vb" /> <Compile Include="UnitTests\M0_NonSmart_AlternatorsSetEfficiencyTests.vb" /> <Compile Include="UnitTests\AveragePneumaticLoadDemandTests.vb" /> @@ -226,13 +227,24 @@ <Content Include="TestFiles\auxiliaryConfigKEEP.json"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> - <None Include="TestFiles\HVACMap.vaux" /> <Content Include="TestFiles\TestHvacMap - ExtraBlankLines.csv"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> <Content Include="TestFiles\TestHvacMap - MissingHeader.csv"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Content> + <Content Include="TestFiles\HVACSteadyStateModelGOODMAP.ahsm"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="TestFiles\HVACSteadyStateModelBadHeaders.ahsm"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="TestFiles\HVACSteadyStateModelBadValues.ahsm"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> + <Content Include="TestFiles\HVACSteadyStateModelInsufficientLines.ahsm"> + <CopyToOutputDirectory>Always</CopyToOutputDirectory> + </Content> <None Include="TestFiles\testAlternatorMap.aalt"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </None> -- GitLab