Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 5bf88ad4 authored by Terry Burns's avatar Terry Burns Committed by Kostis ANAGNOSTOPOULOS
Browse files
parent 08aa4fa3
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 3565 deletions

Namespace Electrics
Public Class Alternator
Implements IAlternator
Private Const MinRatio As Single = 1.25
Private Const MaxRatio As Single = 5.5
Private Const MinEff As Single = 0.25
Private Const MaxEff As Single = 0.95
Private _pulleyGearRatio As Single
Private _pulleyGearEfficiency As Single
Private _map As IAlternatorMap
''' <summary>
''' Ratio of gear/pulley to engine
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property PulleyGearRatio() As Single Implements IAlternator.PulleyGearRatio
Get
Return _pulleyGearRatio
End Get
Set(value As Single)
If (value < MinRatio OrElse value > MaxRatio) Then
Throw New ArgumentOutOfRangeException(String.Format("Invalid value, should be in the range {0} to {1}", MinRatio, MaxRatio), value)
Else
_pulleyGearRatio = value
End If
End Set
End Property
''' <summary>
''' Efficiency of gear/pulley to engine
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property PulleyGearEfficiency() As Single Implements IAlternator.PulleyGearEfficiency
Get
Return _pulleyGearEfficiency
End Get
Set(value As Single)
If (value < MinEff OrElse value > MaxEff) Then
Throw New ArgumentOutOfRangeException(String.Format("Invalid value, should be in the range {0} to {1}", MinEff, MaxEff), value)
Else
_pulleyGearEfficiency = value
End If
End Set
End Property
''' <summary>
''' Creates a new instance of the Alternator class
''' </summary>
''' <param name="map">instance of and object implementing IAlternatorMap</param>
''' <remarks></remarks>
Public Sub New(ByRef map As IAlternatorMap)
_map = map
End Sub
''' <summary>
''' Creates a new instance of the Alternator class
''' </summary>
''' <param name="ratio">pulley / gear ratio to engine</param>
''' <param name="efficiency">pulley / gear efficiency to engine</param>
''' <param name="map">Instance of an object that implements IAlternatorMap</param>
''' <remarks></remarks>
Public Sub New(ByRef map As IAlternatorMap, ByVal ratio As Single, ByVal efficiency As Single)
PulleyGearRatio = ratio
PulleyGearEfficiency = efficiency
_map = map
End Sub
''' <summary>
''' Initialises the efficiency map
''' </summary>
''' <returns>Boolean - true is initialisation succeeds</returns>
''' <remarks></remarks>
Public Function Initialise() As Boolean Implements IAlternator.Initialise
Return _map.Initialise()
End Function
''' <summary>
''' Returns the alternator efficiency at a given engine speed
''' </summary>
''' <param name="engineRpm"></param>
''' <returns>Single</returns>
''' <remarks>rpm must result in alternator rpm values that fall within the alternator efficiency map</remarks>
Public Function GetEfficiency(ByVal engineRpm As Single) As Single Implements IAlternator.GetEfficiency
Dim alternatorspeed As Single = engineRpm * PulleyGearRatio
Dim value As Single '= _map.GetEfficiency(alternatorspeed)
Return value
End Function
''' <summary>
''' Gets the maximum Regenration Power of the alternator at the given engine speed
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function GetMaximumRegenerationPower(ByVal engineRpm As Single) As Single Implements IAlternator.GetMaximumRegenerationPower
Dim alternatorspeed As Single = engineRpm * PulleyGearRatio
Dim value As Single '= _map.GetMaximumRegenerationPower(alternatorspeed)
Return value
End Function
''' <summary>
''' Retuns the maximum regeneration power at the engine for the given engine speed
''' </summary>
''' <param name="engineRpm"></param>
''' <returns>Single</returns>
''' <remarks>rpm must result in alternator rpm values that fall within the alternator efficiency map</remarks>
Public Function GetMaximumRegeneratinPowerAtCrank(ByVal engineRpm As Single) As Single Implements IAlternator.GetMaximumRegeneratinPowerAtCrank
Dim maxRegenPower As Single = GetMaximumRegenerationPower(engineRpm) '100 from mock
Dim efficiency As Single = GetEfficiency(engineRpm) '0.5 from mock
Dim value As Single = maxRegenPower / (efficiency / PulleyGearEfficiency)
Return value
End Function
End Class
End Namespace
\ No newline at end of file
Namespace Electrics
Public Interface IAlternator
''' <summary>
''' Ratio of gear/pulley to engine
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Property PulleyGearRatio() As Single
''' <summary>
''' Efficiency of gear/pulley to engine
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Property PulleyGearEfficiency() As Single
''' <summary>
''' Initialises the efficiency map
''' </summary>
''' <returns>Boolean - true is initialisation succeeds</returns>
''' <remarks></remarks>
Function Initialise() As Boolean
''' <summary>
''' Returns the alternator efficiency at a given engine speed
''' </summary>
''' <param name="engineRpm"></param>
''' <returns>Single</returns>
''' <remarks>rpm must result in alternator rpm values that fall within the alternator efficiency map</remarks>
Function GetEfficiency(ByVal engineRpm As Single) As Single
''' <summary>
''' Gets the maximum Regenration Power of the alternator at the given engine speed
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Function GetMaximumRegenerationPower(ByVal engineRpm As Single) As Single
''' <summary>
''' Retuns the maximum regeneration power at the engine for the given engine speed
''' </summary>
''' <param name="engineRpm"></param>
''' <returns>Single</returns>
''' <remarks>rpm must result in alternator rpm values that fall within the alternator efficiency map</remarks>
Function GetMaximumRegeneratinPowerAtCrank(ByVal engineRpm As Single) As Single
End Interface
End Namespace
\ No newline at end of file
Region,Season,MechD,ElecD
1,1,50,10
1,2,50,11
1,3,50,12
1,4,50,13
2,1,50,14
2,2,50,15
2,3,50,16
2,4,50,17
3,1,50,18
3,2,50,19
3,3,50,10
3,4,50,11
4,1,50,12
4,2,50,13
4,3,50,14
4,4,50,15
\ No newline at end of file
Namespace Pneumatics
Public Interface IPneumaticConsumer
''' <summary>
''' Name of the consumer
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
ReadOnly Property ConsumerName() As String
''' <summary>
''' Volume of Air consumed per cycle of the consumer
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
ReadOnly Property VolumePerActuation() As Single
''' <summary>
''' Get the total volume of air required for a number of cycles
''' </summary>
''' <param name="cycles">Number of cycles of consumer</param>
''' <returns></returns>
''' <remarks></remarks>
Function GetTotalVolume(ByVal actuations As Integer) As Single
End Interface
End NameSpace
\ No newline at end of file

Namespace Pneumatics
Public Interface IPneumaticConsumerList
ReadOnly Property Items As Dictionary(Of String, IPneumaticConsumer)
Sub AddConsumer(consumer As IPneumaticConsumer)
Sub RemoveConsumer(consumer As IPneumaticConsumer)
End Interface
End Namespace
Namespace Pneumatics
Public Class PneumaticConsumer
Implements IPneumaticConsumer
Private ReadOnly _name As String
Private ReadOnly _volumePerActuation As Single
''' <summary>
''' Name of the consumer
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property Name() As String Implements IPneumaticConsumer.ConsumerName
Get
Return _name
End Get
End Property
''' <summary>
''' Volume of Air consumed per cycle of the consumer
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property VolumePerCycle() As Single Implements IPneumaticConsumer.VolumePerActuation
Get
Return _volumePerActuation
End Get
End Property
''' <summary>
''' Get the total volume of air required for a number of cycles
''' </summary>
''' <param name="cycles">Number of cycles of consumer</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function GetTotalVolume(ByVal cycles As Integer) As Single Implements IPneumaticConsumer.GetTotalVolume
Return VolumePerCycle * cycles
End Function
''' <summary>
''' Creates an instance of the PneumaticConsumer class
''' </summary>
''' <param name="name"></param>
''' <param name="volumePerCycle"></param>
''' <remarks></remarks>
Public Sub New(ByVal name As String, ByVal volumePerActuation As Single)
If name = String.Empty Then
Throw New ArgumentException("Name cannot be empty string")
End If
If Math.Abs(volumePerCycle - 0.0) < 0.001 Then
Throw New ArgumentOutOfRangeException("volumePerActuation",
volumePerCycle,
"Supplied volume should be grater than zero")
End If
_name = name
_volumePerActuation = _volumePerActuation
End Sub
End Class
End Namespace
\ No newline at end of file
Imports VectoAuxiliaries.Pneumatics
Namespace Pneumatics
Public Class PneumaticConsumerList
Implements IPneumaticConsumerList
Private _items As New Dictionary(Of String, IPneumaticConsumer)
Public ReadOnly Property Items As Dictionary(Of String, IPneumaticConsumer) Implements Pneumatics.IPneumaticConsumerList.Items
Get
Return _items
End Get
End Property
Public Sub AddConsumer(consumer As IPneumaticConsumer) Implements IPneumaticConsumerList.AddConsumer
If Not _items.ContainsKey(consumer.ConsumerName) Then
_items.Add(consumer.ConsumerName, consumer)
Else
Throw New ArgumentException("Consumer Already Present in the list")
End If
End Sub
Public Sub RemoveConsumer(consumer As IPneumaticConsumer) Implements IPneumaticConsumerList.RemoveConsumer
If _items.ContainsKey(consumer.ConsumerName) Then
_items.Remove(consumer.ConsumerName)
Else
Throw New ArgumentException("Consumer Not In List")
End If
End Sub
End Class
End Namespace
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="resultCardContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>362, 19</value>
</metadata>
<metadata name="ErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>168, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>82</value>
</metadata>
</root>
\ No newline at end of file
This diff is collapsed.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class ElectricalConsumers
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Text = "ElectricalConsumers"
End Sub
End Class
Public Class ElectricalConsumers
End Class
\ No newline at end of file
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class F_Alternator
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Text = "F_Alternator"
End Sub
End Class
Public Class F_Alternator
End Class
\ No newline at end of file

Namespace UI
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class F_Compressor
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.lblPullyEfficiency = New System.Windows.Forms.Label()
Me.txtPullyEfficiency = New System.Windows.Forms.TextBox()
Me.lblMapFile = New System.Windows.Forms.Label()
Me.txtMapFile = New System.Windows.Forms.TextBox()
Me.btnBrowseMap = New System.Windows.Forms.Button()
Me.btnCancel = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
Me.lblMapLabel = New System.Windows.Forms.Label()
Me.txtMapPath = New System.Windows.Forms.TextBox()
Me.btnBrowsePowerMap = New System.Windows.Forms.Button()
Me.lblPulleyGearRatio = New System.Windows.Forms.Label()
Me.txtPulleyEfficiency = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'lblPullyEfficiency
'
Me.lblPullyEfficiency.AutoSize = True
Me.lblPullyEfficiency.Location = New System.Drawing.Point(6, 116)
Me.lblPullyEfficiency.Name = "lblPullyEfficiency"
Me.lblPullyEfficiency.Size = New System.Drawing.Size(87, 13)
Me.lblPullyEfficiency.TabIndex = 21
Me.lblPullyEfficiency.Text = " Pully Efficiency :"
'
'txtPullyEfficiency
'
Me.txtPullyEfficiency.Location = New System.Drawing.Point(105, 113)
Me.txtPullyEfficiency.Name = "txtPullyEfficiency"
Me.txtPullyEfficiency.Size = New System.Drawing.Size(46, 20)
Me.txtPullyEfficiency.TabIndex = 20
'
'lblMapFile
'
Me.lblMapFile.AutoSize = True
Me.lblMapFile.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblMapFile.Location = New System.Drawing.Point(-52, -32)
Me.lblMapFile.Name = "lblMapFile"
Me.lblMapFile.Size = New System.Drawing.Size(34, 13)
Me.lblMapFile.TabIndex = 18
Me.lblMapFile.Text = "Map :"
'
'txtMapFile
'
Me.txtMapFile.Location = New System.Drawing.Point(-13, -35)
Me.txtMapFile.Name = "txtMapFile"
Me.txtMapFile.ReadOnly = True
Me.txtMapFile.Size = New System.Drawing.Size(530, 20)
Me.txtMapFile.TabIndex = 17
'
'btnBrowseMap
'
Me.btnBrowseMap.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnBrowseMap.Location = New System.Drawing.Point(523, -35)
Me.btnBrowseMap.Name = "btnBrowseMap"
Me.btnBrowseMap.Size = New System.Drawing.Size(75, 23)
Me.btnBrowseMap.TabIndex = 16
Me.btnBrowseMap.Text = "Browse"
Me.btnBrowseMap.UseVisualStyleBackColor = True
'
'btnCancel
'
Me.btnCancel.Location = New System.Drawing.Point(518, 166)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 15
Me.btnCancel.Text = "Cancel"
Me.btnCancel.UseVisualStyleBackColor = True
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(431, 166)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 14
Me.btnSave.Text = "Save"
Me.btnSave.UseVisualStyleBackColor = True
'
'lblMapLabel
'
Me.lblMapLabel.AutoSize = True
Me.lblMapLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblMapLabel.Location = New System.Drawing.Point(59, 78)
Me.lblMapLabel.Name = "lblMapLabel"
Me.lblMapLabel.Size = New System.Drawing.Size(34, 13)
Me.lblMapLabel.TabIndex = 28
Me.lblMapLabel.Text = "Map :"
'
'txtMapPath
'
Me.txtMapPath.Location = New System.Drawing.Point(105, 75)
Me.txtMapPath.Name = "txtMapPath"
Me.txtMapPath.ReadOnly = True
Me.txtMapPath.Size = New System.Drawing.Size(397, 20)
Me.txtMapPath.TabIndex = 27
'
'btnBrowsePowerMap
'
Me.btnBrowsePowerMap.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnBrowsePowerMap.Location = New System.Drawing.Point(512, 75)
Me.btnBrowsePowerMap.Name = "btnBrowsePowerMap"
Me.btnBrowsePowerMap.Size = New System.Drawing.Size(75, 23)
Me.btnBrowsePowerMap.TabIndex = 26
Me.btnBrowsePowerMap.Text = "Browse"
Me.btnBrowsePowerMap.UseVisualStyleBackColor = True
'
'lblPulleyGearRatio
'
Me.lblPulleyGearRatio.AutoSize = True
Me.lblPulleyGearRatio.Location = New System.Drawing.Point(163, 117)
Me.lblPulleyGearRatio.Name = "lblPulleyGearRatio"
Me.lblPulleyGearRatio.Size = New System.Drawing.Size(81, 13)
Me.lblPulleyGearRatio.TabIndex = 30
Me.lblPulleyGearRatio.Text = " Pully Efficiency"
'
'txtPulleyEfficiency
'
Me.txtPulleyEfficiency.Location = New System.Drawing.Point(250, 114)
Me.txtPulleyEfficiency.Name = "txtPulleyEfficiency"
Me.txtPulleyEfficiency.Size = New System.Drawing.Size(41, 20)
Me.txtPulleyEfficiency.TabIndex = 29
'
'F_Compressor
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(652, 272)
Me.Controls.Add(Me.lblPulleyGearRatio)
Me.Controls.Add(Me.txtPulleyEfficiency)
Me.Controls.Add(Me.lblMapLabel)
Me.Controls.Add(Me.txtMapPath)
Me.Controls.Add(Me.btnBrowsePowerMap)
Me.Controls.Add(Me.lblPullyEfficiency)
Me.Controls.Add(Me.txtPullyEfficiency)
Me.Controls.Add(Me.lblMapFile)
Me.Controls.Add(Me.txtMapFile)
Me.Controls.Add(Me.btnBrowseMap)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave)
Me.Name = "F_Compressor"
Me.Text = "Pneumatic Compressor"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents lblPullyEfficiency As System.Windows.Forms.Label
Friend WithEvents txtPullyEfficiency As System.Windows.Forms.TextBox
Friend WithEvents lblMapFile As System.Windows.Forms.Label
Friend WithEvents txtMapFile As System.Windows.Forms.TextBox
Friend WithEvents btnBrowseMap As System.Windows.Forms.Button
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents btnSave As System.Windows.Forms.Button
Friend WithEvents lblMapLabel As System.Windows.Forms.Label
Friend WithEvents txtMapPath As System.Windows.Forms.TextBox
Friend WithEvents btnBrowsePowerMap As System.Windows.Forms.Button
Friend WithEvents lblPulleyGearRatio As System.Windows.Forms.Label
Friend WithEvents txtPulleyEfficiency As System.Windows.Forms.TextBox
End Class
End Namespace
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file

Imports VectoAuxiliaries.Hvac
Imports System.Windows.Forms
Namespace UI
Public Class F_Compressor
End Class
End Namespace
Namespace UI
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class F_HVAC
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.dgMapResults = New System.Windows.Forms.DataGridView()
Me.btnSave = New System.Windows.Forms.Button()
Me.btnCancel = New System.Windows.Forms.Button()
Me.btnBrowseMap = New System.Windows.Forms.Button()
Me.txtMapFile = New System.Windows.Forms.TextBox()
Me.lblMapFile = New System.Windows.Forms.Label()
Me.pnlSearchBar = New System.Windows.Forms.Panel()
Me.lblMechanicalDemand = New System.Windows.Forms.Label()
Me.txtMechanicalDemand = New System.Windows.Forms.TextBox()
Me.lblElectricalDemand = New System.Windows.Forms.Label()
Me.txtElectricalDemand = New System.Windows.Forms.TextBox()
CType(Me.dgMapResults, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'dgMapResults
'
Me.dgMapResults.AllowUserToAddRows = False
Me.dgMapResults.AllowUserToDeleteRows = False
Me.dgMapResults.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgMapResults.Location = New System.Drawing.Point(14, 164)
Me.dgMapResults.MultiSelect = False
Me.dgMapResults.Name = "dgMapResults"
Me.dgMapResults.ReadOnly = True
Me.dgMapResults.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.dgMapResults.Size = New System.Drawing.Size(650, 245)
Me.dgMapResults.TabIndex = 0
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(497, 426)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 1
Me.btnSave.Text = "Save"
Me.btnSave.UseVisualStyleBackColor = True
'
'btnCancel
'
Me.btnCancel.Location = New System.Drawing.Point(584, 426)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(75, 23)
Me.btnCancel.TabIndex = 2
Me.btnCancel.Text = "Cancel"
Me.btnCancel.UseVisualStyleBackColor = True
'
'btnBrowseMap
'
Me.btnBrowseMap.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnBrowseMap.Location = New System.Drawing.Point(584, 12)
Me.btnBrowseMap.Name = "btnBrowseMap"
Me.btnBrowseMap.Size = New System.Drawing.Size(75, 23)
Me.btnBrowseMap.TabIndex = 3
Me.btnBrowseMap.Text = "Browse"
Me.btnBrowseMap.UseVisualStyleBackColor = True
'
'txtMapFile
'
Me.txtMapFile.Location = New System.Drawing.Point(48, 12)
Me.txtMapFile.Name = "txtMapFile"
Me.txtMapFile.ReadOnly = True
Me.txtMapFile.Size = New System.Drawing.Size(530, 20)
Me.txtMapFile.TabIndex = 4
'
'lblMapFile
'
Me.lblMapFile.AutoSize = True
Me.lblMapFile.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblMapFile.Location = New System.Drawing.Point(9, 15)
Me.lblMapFile.Name = "lblMapFile"
Me.lblMapFile.Size = New System.Drawing.Size(34, 13)
Me.lblMapFile.TabIndex = 5
Me.lblMapFile.Text = "Map :"
'
'pnlSearchBar
'
Me.pnlSearchBar.Location = New System.Drawing.Point(16, 95)
Me.pnlSearchBar.Name = "pnlSearchBar"
Me.pnlSearchBar.Size = New System.Drawing.Size(643, 59)
Me.pnlSearchBar.TabIndex = 6
'
'lblMechanicalDemand
'
Me.lblMechanicalDemand.AutoSize = True
Me.lblMechanicalDemand.Location = New System.Drawing.Point(291, 58)
Me.lblMechanicalDemand.Name = "lblMechanicalDemand"
Me.lblMechanicalDemand.Size = New System.Drawing.Size(132, 13)
Me.lblMechanicalDemand.TabIndex = 9
Me.lblMechanicalDemand.Text = "Mechanical Demand (KW)"
'
'txtMechanicalDemand
'
Me.txtMechanicalDemand.Location = New System.Drawing.Point(431, 54)
Me.txtMechanicalDemand.Name = "txtMechanicalDemand"
Me.txtMechanicalDemand.ReadOnly = True
Me.txtMechanicalDemand.Size = New System.Drawing.Size(56, 20)
Me.txtMechanicalDemand.TabIndex = 10
Me.txtMechanicalDemand.Text = "0"
'
'lblElectricalDemand
'
Me.lblElectricalDemand.AutoSize = True
Me.lblElectricalDemand.Location = New System.Drawing.Point(493, 58)
Me.lblElectricalDemand.Name = "lblElectricalDemand"
Me.lblElectricalDemand.Size = New System.Drawing.Size(120, 13)
Me.lblElectricalDemand.TabIndex = 11
Me.lblElectricalDemand.Text = "Electrical Demand (KW)"
'
'txtElectricalDemand
'
Me.txtElectricalDemand.Location = New System.Drawing.Point(619, 54)
Me.txtElectricalDemand.Name = "txtElectricalDemand"
Me.txtElectricalDemand.ReadOnly = True
Me.txtElectricalDemand.Size = New System.Drawing.Size(26, 20)
Me.txtElectricalDemand.TabIndex = 12
Me.txtElectricalDemand.Text = "0"
'
'F_HVAC
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(674, 458)
Me.Controls.Add(Me.txtElectricalDemand)
Me.Controls.Add(Me.lblElectricalDemand)
Me.Controls.Add(Me.txtMechanicalDemand)
Me.Controls.Add(Me.lblMechanicalDemand)
Me.Controls.Add(Me.pnlSearchBar)
Me.Controls.Add(Me.lblMapFile)
Me.Controls.Add(Me.txtMapFile)
Me.Controls.Add(Me.btnBrowseMap)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnSave)
Me.Controls.Add(Me.dgMapResults)
Me.Name = "F_HVAC"
Me.Text = "HVAC Properties"
CType(Me.dgMapResults, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents dgMapResults As System.Windows.Forms.DataGridView
Friend WithEvents btnSave As System.Windows.Forms.Button
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents btnBrowseMap As System.Windows.Forms.Button
Friend WithEvents txtMapFile As System.Windows.Forms.TextBox
Friend WithEvents lblMapFile As System.Windows.Forms.Label
Friend WithEvents pnlSearchBar As System.Windows.Forms.Panel
Friend WithEvents lblMechanicalDemand As System.Windows.Forms.Label
Friend WithEvents txtMechanicalDemand As System.Windows.Forms.TextBox
Friend WithEvents lblElectricalDemand As System.Windows.Forms.Label
Friend WithEvents txtElectricalDemand As System.Windows.Forms.TextBox
End Class
End Namespace
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
Imports VectoAuxiliaries.Hvac
Imports System.Windows.Forms
Namespace UI
Public Class F_HVAC
'Private Fields
Private _mapPath As String
Private _cfgPath As String
Private _map As HVACMap
Private _mapFilter As List(Of String) = New List(Of String)()
Private _selectedInputs As New Dictionary(Of String, String)
'Properties
Public Property MapPath As String
Get
Return _mapPath
End Get
Set(value As String)
_mapPath = value
txtMapFile.Text = value
End Set
End Property
Public Property Inputs As Dictionary(Of String, String)
Get
Return _selectedInputs
End Get
Private Set(value As Dictionary(Of String, String))
_selectedInputs = value
End Set
End Property
'Helpers
Private Sub BuildSearchBar()
'Clear out anything which may be resident
pnlSearchBar.Controls.Clear()
If _map Is Nothing Then
MessageBox.Show("Map not yet loaded")
Return
End If
'Ok Showtime
'Get all the columns who's header is an input
Dim results As Dictionary(Of String, HVACMapParameter) = (From p In _map.GetMapHeaders() Where Not p.Value.IsOutput Select p).ToDictionary(Function(p) p.Key, Function(p) p.Value)
'Add Layuout Table inside the pnlSearchBar
Dim filterPanelTable As TableLayoutPanel = New TableLayoutPanel()
filterPanelTable.RowCount = 2
filterPanelTable.ColumnCount = _map.GetMapHeaders().Count
filterPanelTable.Dock = DockStyle.Fill
pnlSearchBar.Controls.Add(filterPanelTable)
For Each parameter As HVACMapParameter In results.Values
'TB : 'Dies ist, wo die Magie passiert
Dim sp1 As Control = Convert.ChangeType(Activator.CreateInstance(parameter.SearchControlType), parameter.SearchControlType)
sp1.Name = "FilterControl_" + parameter.OrdinalPosition.ToString()
FillControl(sp1, parameter.UniqueDataValues, parameter)
'Set Label
filterPanelTable.Controls.Add((New Label() With {.Text = parameter.Name}), parameter.OrdinalPosition, 0)
'Set Control
filterPanelTable.Controls.Add(sp1, parameter.OrdinalPosition, 1)
Next
End Sub
Private Sub FillControl(ByRef control As Control, values As List(Of String), param As HVACMapParameter)
'ComboBox Filter Control
If TypeOf control Is ComboBox Then
Dim cb As ComboBox = CType(control, ComboBox)
AddHandler cb.SelectionChangeCommitted, AddressOf Me.FilterComboHandler
cb.Items.Add("<Select>")
For Each item As String In values
cb.Items.Add(item)
Next
cb.SelectedIndex = 0
End If
End Sub
Private Sub PopulateResultsTable(subsetResults As List(Of String()))
Dim table As New DataTable
For Each item As KeyValuePair(Of String, HVACMapParameter) In _map.GetMapHeaders
Dim col As New DataColumn(item.Value.Name)
table.Columns.Add(col)
Next
For Each row As String() In subsetResults
Dim cell As Integer
Dim newTableRow As DataRow = table.NewRow
For cell = 0 To table.Columns.Count - 1
newTableRow.SetField(cell, row(cell))
Next
table.Rows.Add(newTableRow)
Next
dgMapResults.DataSource = table
dgMapResults.ClearSelection()
txtElectricalDemand.Text = String.Empty
txtMechanicalDemand.Text = String.Empty
End Sub
'Constructors
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Public Sub New(ByVal iMapPath As String)
Me.New()
MapPath = iMapPath
End Sub
'Event Handlers
'**************
'Programatically attached when filer is built
Private Sub FilterComboHandler(sender As Object, e As EventArgs)
'Determine where in the filer we need to be
Dim combo As ComboBox = CType(sender, ComboBox)
Dim oridnal As Integer = combo.Name.Split("_")(1)
If (combo.SelectedIndex > 0) Then
_mapFilter(oridnal) = combo.Items(combo.SelectedIndex).ToString()
Else
_mapFilter(oridnal) = String.Empty
End If
Dim results as List(Of String()) = _map.GetMapSubSet(_mapFilter.ToArray())
PopulateResultsTable(results)
End Sub
'Delcaratively attached
Private Sub dgMapResults_SelectionChanged(sender As Object, e As EventArgs) Handles dgMapResults.SelectionChanged
If (CType(sender, DataGridView).SelectedRows.Count = 1) Then
txtMechanicalDemand.Text = CType(sender, DataGridView).SelectedRows(0).Cells("MechD").Value
txtElectricalDemand.Text = CType(sender, DataGridView).SelectedRows(0).Cells("ElecD").Value
End If
End Sub
Private Sub F_HVAC_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'If we have a map on load lets try and get the information
If (MapPath.Length <> 0) Then
GetMapData()
End If
End Sub
Private Sub GetMapData()
'Dim openFileDialog1 = New OpenFileDialog()
'openFileDialog1.InitialDirectory = "."
'openFileDialog1.Filter = "Map Files (*.vaux)|*.vaux"
'openFileDialog1.FilterIndex = 1
'openFileDialog1.RestoreDirectory = True
'openFileDialog1.ShowDialog(Me)
'MapPath = openFileDialog1.FileName
'openFileDialog1.Dispose()
Try
_map = New HVACMap(_mapPath)
_map.Initialise()
_mapFilter.Clear()
For Each item As KeyValuePair(Of String, HVACMapParameter) In _map.GetMapHeaders
_mapFilter.Add("")
Next
BuildSearchBar()
Catch ex As Exception
MessageBox.Show("An error has occured while trying to read the map file selected ")
'TODO:Log this error message.
DialogResult = Windows.Forms.DialogResult.Abort
Me.Close()
End Try
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
DialogResult = Windows.Forms.DialogResult.OK
End Sub
Private Sub btnBrowseMap_Click(sender As Object, e As EventArgs) Handles btnBrowseMap.Click
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
DialogResult = Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private Sub F_HVAC_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
'If closing as a result of OK being pressed
Select DialogResult
Case Windows.Forms.DialogResult.OK
If (Me.dgMapResults.Rows.Count > 0 AndAlso Me.dgMapResults.SelectedRows.Count = 1) Then
Inputs.Clear()
'Build a list of Inputs
For Each p As HVACMapParameter In _map.MapHeaders.OrderBy(Function(x) x.Value.OrdinalPosition).Select(Function(x) x.Value)
Dim val As String = Me.dgMapResults.SelectedRows(0).Cells(p.OrdinalPosition).Value.ToString()
If Not p.IsOutput Then
Inputs.Add(p.Name, val)
End If
Next
Else
'Cancel the event as nothing has been selected althoug the users has pressed the ok button indicating a submit.
MessageBox.Show("You do not have a selected row.")
e.Cancel = True
End If
Case Else
Inputs.Clear()
txtMapFile.Text = String.Empty
End Select
End Sub
End Class
End Namespace
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment