Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit f84a6b6e authored by Terry Burns's avatar Terry Burns Committed by Kostis ANAGNOSTOPOULOS
Browse files

WIP. Several Bugs and changes made. The revisions is just prior to changing...

WIP. Several Bugs and changes made. The revisions is just prior to changing the UI to support Composite Results for HVAC and Composite Advanced alternators.

git-tfs-id: [http://tfs00.element.root.com:8080/tfs/TFSCollection]$/VECTO;C1696
parent 1227c248
Branches
Tags
No related merge requests found
......@@ -20,6 +20,7 @@ property Signals as ISignals
'Configuration
Function Configure( filePath As String, vectoFilePath As string ) As Boolean
Function ValidateAAUXFile( ByVal filePath As String , byref message As String ) As Boolean
'Command
Function CycleStep( seconds As Integer, ByRef message As string ) As boolean
......
......@@ -27,7 +27,6 @@ Partial Class AuxLauncher
Me.btnLaunchAux = New System.Windows.Forms.Button()
Me.btnRun = New System.Windows.Forms.Button()
Me.btnStop = New System.Windows.Forms.Button()
Me.btnInformation = New System.Windows.Forms.Button()
Me.txtTotalFCGrams = New System.Windows.Forms.TextBox()
Me.txtTotalFCLitres = New System.Windows.Forms.TextBox()
Me.lblTotalFCGRAMS = New System.Windows.Forms.Label()
......@@ -75,15 +74,6 @@ Partial Class AuxLauncher
Me.btnStop.Text = "Stop"
Me.btnStop.UseVisualStyleBackColor = true
'
'btnInformation
'
Me.btnInformation.Location = New System.Drawing.Point(414, 269)
Me.btnInformation.Name = "btnInformation"
Me.btnInformation.Size = New System.Drawing.Size(75, 23)
Me.btnInformation.TabIndex = 4
Me.btnInformation.Text = "Info"
Me.btnInformation.UseVisualStyleBackColor = true
'
'txtTotalFCGrams
'
Me.txtTotalFCGrams.Location = New System.Drawing.Point(30, 152)
......@@ -121,18 +111,18 @@ Partial Class AuxLauncher
Me.lblAuxiliaryName.AutoSize = true
Me.lblAuxiliaryName.Location = New System.Drawing.Point(30, 9)
Me.lblAuxiliaryName.Name = "lblAuxiliaryName"
Me.lblAuxiliaryName.Size = New System.Drawing.Size(39, 13)
Me.lblAuxiliaryName.Size = New System.Drawing.Size(130, 13)
Me.lblAuxiliaryName.TabIndex = 9
Me.lblAuxiliaryName.Text = "Label2"
Me.lblAuxiliaryName.Text = "Auxiliary Name Goes Here"
'
'lblAuxiliaryVersion
'
Me.lblAuxiliaryVersion.AutoSize = true
Me.lblAuxiliaryVersion.Location = New System.Drawing.Point(30, 37)
Me.lblAuxiliaryVersion.Name = "lblAuxiliaryVersion"
Me.lblAuxiliaryVersion.Size = New System.Drawing.Size(39, 13)
Me.lblAuxiliaryVersion.Size = New System.Drawing.Size(137, 13)
Me.lblAuxiliaryVersion.TabIndex = 10
Me.lblAuxiliaryVersion.Text = "Label3"
Me.lblAuxiliaryVersion.Text = "Auxiliary Version Goes Here"
'
'Timer1
'
......@@ -177,7 +167,6 @@ Partial Class AuxLauncher
Me.Controls.Add(Me.lblTotalFCGRAMS)
Me.Controls.Add(Me.txtTotalFCLitres)
Me.Controls.Add(Me.txtTotalFCGrams)
Me.Controls.Add(Me.btnInformation)
Me.Controls.Add(Me.btnStop)
Me.Controls.Add(Me.btnRun)
Me.Controls.Add(Me.btnLaunchAux)
......@@ -192,7 +181,6 @@ End Sub
Friend WithEvents btnLaunchAux As System.Windows.Forms.Button
Friend WithEvents btnRun As System.Windows.Forms.Button
Friend WithEvents btnStop As System.Windows.Forms.Button
Friend WithEvents btnInformation As System.Windows.Forms.Button
Friend WithEvents txtTotalFCGrams As System.Windows.Forms.TextBox
Friend WithEvents txtTotalFCLitres As System.Windows.Forms.TextBox
Friend WithEvents lblTotalFCGRAMS As System.Windows.Forms.Label
......
......@@ -16,52 +16,38 @@ End Sub
'Configure
Private Sub btnLaunchAux_Click(sender As Object, e As EventArgs) Handles btnLaunchAux.Click
If Not advancedAuxiliaries.Configure(txtAdvancedAuxiliaries.Text, "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto") then
MessageBox.Show("Unable to configure Advanced Auxilliaries")
End If
End If
End Sub
'Run
'Stop
'Set Statics
'Invoke Messages
'Information
Private Sub txtAdvancedAuxiliaries_Validating( sender As Object, e As System.ComponentModel.CancelEventArgs) Handles txtAdvancedAuxiliaries.Validating
'Check for correct extension
Dim message As String = String.Empty
'Formatted correctely
If VectoAuxiliaries.FilePathUtils.ValidateFilePath( txtAdvancedAuxiliaries.Text,".aaux", message)=False
messageBox.Show(message)
e.Cancel=true
End If
End If
'Can load the file.
If Not advancedAuxiliaries.ValidateAAUXFile(txtAdvancedAuxiliaries.Text, message)
MessageBox.Show(message & " : Please reenter and try again.")
e.Cancel=true
End If
End Sub
......@@ -72,14 +58,11 @@ Private sub setup()
Dim message As String = String.Empty
'Set Statics
advancedAuxiliaries.VectoInputs.Cycle="Urban"
advancedAuxiliaries.VectoInputs.VehicleWeightKG=16500
advancedAuxiliaries.VectoInputs.FuelMap= "testFuelGoodMap.vmap"
advancedAuxiliaries.VectoInputs.PowerNetVoltage=26.3
'advancedAuxiliaries.VectoInputs.CycleDurationMinutes=51.9
'set Signals
......@@ -92,12 +75,10 @@ End Sub
Private Sub btnRun_Click( sender As Object, e As EventArgs) Handles btnRun.Click
setup()
timer1.Start
End Sub
......@@ -105,32 +86,22 @@ End Sub
Private Sub AuxLauncher_Load( sender As Object, e As EventArgs) Handles MyBase.Load
cboWarningLevel.DataSource = System.Enum.GetValues(GetType(AdvancedAuxiliaryMessageType))
'cboWarningLevel.SelectedIndex=1
cboWarningLevel.SelectedIndex= AdvancedAuxiliaryMessageType.Critical
Dim obj As System.Runtime.Remoting.ObjectHandle
Try
obj = Activator.CreateInstance("VectoAuxiliaries", "VectoAuxiliaries.AdvancedAuxiliaries")
obj = Activator.CreateInstance("BusAuxiliaries", "VectoAuxiliaries.AdvancedAuxiliaries")
advancedAuxiliaries = DirectCast(obj.Unwrap, IAdvancedAuxiliaries)
advancedAuxiliaries.Signals.AuxiliaryEventReportingLevel=CType(cboWarningLevel.SelectedValue, AdvancedAuxiliaryMessageType)
lblAuxiliaryName.Text= advancedAuxiliaries.AuxiliaryName
lblAuxiliaryVersion.Text = advancedAuxiliaries.AuxiliaryVersion
Catch ex As Exception
Dim a As String= "tdgfdgfdg"
Finally
......@@ -177,14 +148,13 @@ Timer1.Stop
End Sub
Private Sub cboWarningLevel_SelectedIndexChanged( sender As Object, e As EventArgs) Handles cboWarningLevel.SelectedIndexChanged
advancedAuxiliaries.Signals.AuxiliaryEventReportingLevel=CType(cboWarningLevel.SelectedValue, AdvancedAuxiliaryMessageType)
Private Sub cboWarningLevel_SelectionChangeCommitted( sender As Object, e As EventArgs) Handles cboWarningLevel.SelectionChangeCommitted
advancedAuxiliaries.Signals.AuxiliaryEventReportingLevel=CType(cboWarningLevel.SelectedValue, AdvancedAuxiliaryMessageType)
End Sub
End Class
\ No newline at end of file
......@@ -8,6 +8,7 @@ Imports System.Windows.Forms
Public Class AdvancedAuxiliaries
Implements IAdvancedAuxiliaries
Private auxConfig As AuxiliaryConfig
'Supporting classes which may generate event messages
......@@ -156,6 +157,17 @@ End Sub
frmAuxiliaryConfig.Show()
If frmAuxiliaryConfig.DialogResult<>DialogResult.OK then
Return true
Else
Return False
End If
Catch ex As Exception
Return False
......@@ -256,5 +268,30 @@ End Sub
End Function
Public Function ValidateAAUXFile(filePath As String, ByRef message As String) As Boolean Implements IAdvancedAuxiliaries.ValidateAAUXFile
Try
Dim AConfig As New AuxiliaryConfig( filePath )
If Not AConfig is Nothing then
message="OK"
Return true
End If
Return True
Catch ex As Exception
message= "AAUX File not found, or Invalid "
Return false
End Try
End Function
End Class
......@@ -314,7 +314,7 @@ Public Function Load( auxFile As String ) As Boolean Implements IAuxiliaryCon
End Function
'Persistance Helpers
Private sub AssumeValuesOfOther( other As AuxiliaryConfig )
Public sub AssumeValuesOfOther( other As AuxiliaryConfig )
CloneElectricaConfiguration( other )
ClonePneumaticsAuxiliariesConfig( other )
......
......@@ -154,7 +154,7 @@ Implements IAlternatorMap
Public Function GetValue(x As Single, y As Single) As Single
' If x < minX OrElse x > maxX OrElse y < minY OrElse y > maxY then
If x < minX OrElse x > maxX OrElse y < minY OrElse y > maxY then
'OnAuxiliaryEvent(String.Format("Alternator Map Limiting : RPM{0}, AMPS{1}",x,y),AdvancedAuxiliaryMessageType.Warning)
......@@ -165,7 +165,7 @@ Implements IAlternatorMap
If y < minY Then y = minY
If y > maxY Then y = maxY
' End If
End If
'Satisfies both data points - non interpolated value
......
This diff is collapsed.
......@@ -10,12 +10,12 @@ Public Class frmAuxiliaryConfig
#Region "Fields"
Public auxConfig As AuxiliaryConfig
Public originalConfig As AuxiliaryConfig ' required to test if the form is dirty
Private TabColors As Dictionary(Of TabPage, Color) = New Dictionary(Of TabPage, Color)()
Private processing As Boolean = False
Private SecondsIntoCycle As Integer = 0
Private vectoFile As String = ""
'C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto
Private auxFile As string
......@@ -24,9 +24,10 @@ Private auxFile As string
Private Function ValidateAuxFileName( filename As String ) As Boolean
If( fileName.Length=0) then
MessageBox.Show("Sorry you need to supply a filename for the aux file you want to configure")
Return False
Dim message As String = String.Empty
If Not FilePathUtils.ValidateFilePath(filename,".aaux", message) then
MessageBox.Show ( message )
End If
Return true
......@@ -42,10 +43,10 @@ Public Sub new( byval fileName As String, byval vectoFileName As String )
Me.DialogResult=Windows.Forms.DialogResult.Abort
Me.Close
End If
'TODO:Better validate this
If vectoFileName.Length>0 then vectoFile= vectoFileName
Me.vectoFile = vectoFileName
' This call is required by the designer.
InitializeComponent()
......@@ -55,6 +56,7 @@ Public Sub new( byval fileName As String, byval vectoFileName As String )
Try
auxConfig = New AuxiliaryConfig( auxFile )
originalConfig = New AuxiliaryConfig( auxFile)
Catch ex As Exception
......@@ -167,8 +169,8 @@ Private Sub CreateBindings()
'auxConfig.Vecto Bindings
txtPowernetVoltage.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "PowerNetVoltage")
txtVehicleWeightKG.DataBindings.Add("Text", auxConfig.VectoInputs, "VehicleWeightKG")
cboCycle.DataBindings.Add("Text", auxConfig.VectoInputs, "Cycle")
'txtVehicleWeightKG.DataBindings.Add("Text", auxConfig.VectoInputs, "VehicleWeightKG")
'cboCycle.DataBindings.Add("Text", auxConfig.VectoInputs, "Cycle")
txtFuelMap.DataBindings.Add("Text", auxConfig.VectoInputs, "FuelMap")
'Electricals General
......@@ -937,33 +939,48 @@ End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
If Not auxConfig.Save(auxFile)
If SaveFile() then
MessageBox.Show(String.Format("Unable to Save the file '{0}'",auxFile) )
End If
End If
End Sub
Private Sub btnLoad_Click(sender As Object, e As EventArgs) Handles btnLoad.Click
Private function SaveFile() As Boolean
Dim result As Boolean
result = auxConfig.Save(auxFile)
If Not result then MessageBox.Show(String.Format("Unable to Save the file '{0}'",auxFile) )
Return result
End Function
Private Function LoadFile() As boolean
'JSON METHOD
Dim result As boolean
'Release existing databindings
UnbindAllControls(Me)
result = auxConfig.Load(auxFile)
If Not auxConfig.Load(auxFile)
If Not result then
MessageBox.Show(String.Format("Unable to load the file '{0}'",auxFile) )
End If
Else
CreateBindings()
End If
End Sub
Return result
End function
Private Sub btnFuelMap_Click(sender As Object, e As EventArgs) Handles btnFuelMap.Click
......@@ -985,6 +1002,7 @@ Private Sub btnFuelMap_Click(sender As Object, e As EventArgs) Handles btnFuelMa
End Sub
Private Sub btnAlternatorMapPath_Click(sender As Object, e As EventArgs) Handles btnAlternatorMapPath.Click
......@@ -1009,6 +1027,7 @@ Private Sub btnAlternatorMapPath_Click(sender As Object, e As EventArgs) Handles
txtAlternatorMapPath.Focus()
End Sub
Private Sub btnCompressorMap_Click(sender As Object, e As EventArgs) Handles btnCompressorMap.Click
......@@ -1033,6 +1052,7 @@ Private Sub btnCompressorMap_Click(sender As Object, e As EventArgs) Handles btn
End Sub
Private Sub btnActuationsMap_Click(sender As Object, e As EventArgs) Handles btnActuationsMap.Click
Dim fbAux As New cFileBrowser(True, False)
......@@ -1055,7 +1075,6 @@ Private Sub btnActuationsMap_Click(sender As Object, e As EventArgs) Handles btn
End Sub
#End Region
......@@ -1100,4 +1119,57 @@ Public Sub UnbindAllControls(ByRef container As Control)
End Sub
Private Sub btnCancel_Click( sender As Object, e As EventArgs) Handles btnCancel.Click
Me.DialogResult = Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private Sub frmAuxiliaryConfig_FormClosing( sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If Me.DialogResult=Windows.Forms.DialogResult.Cancel then return
Dim result As DialogResult
If Not auxConfig.ConfigValuesAreTheSameAs( originalConfig )
result = (MessageBox.Show("Would you like to save changes before closing?","Save Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question))
Select Case result
case DialogResult.Yes:
'save
If NOT SaveFile() then
e.Cancel=true
End If
case DialogResult.No:
'just allow the form to close
'without saving
Me.DialogResult=Windows.Forms.DialogResult.Cancel
case DialogResult.Cancel:
'cancel the close
e.Cancel = true
Me.DialogResult=Windows.Forms.DialogResult.Cancel
end select
End If
End Sub
End Class
\ No newline at end of file
......@@ -7,7 +7,7 @@
<ProjectGuid>{FDEEE460-0B8A-4EF6-8D9E-72F203A50F65}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>VectoAuxiliaries</RootNamespace>
<AssemblyName>VectoAuxiliaries</AssemblyName>
<AssemblyName>BusAuxiliaries</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Windows</MyType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
......@@ -23,7 +23,7 @@
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>VectoAuxiliaries.xml</DocumentationFile>
<DocumentationFile>BusAuxiliaries.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42032,42036</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
......@@ -32,7 +32,7 @@
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>VectoAuxiliaries.xml</DocumentationFile>
<DocumentationFile>BusAuxiliaries.xml</DocumentationFile>
<NoWarn>41999,42016,42017,42018,42019,42032,42036</NoWarn>
</PropertyGroup>
<PropertyGroup>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment