diff --git a/VECTOAux/AUXUITEST/AUXUITEST.vbproj b/VECTOAux/AUXUITEST/AUXUITEST.vbproj new file mode 100644 index 0000000000000000000000000000000000000000..a38eb504eac4146741208dc613a6e78660e5f2ee --- /dev/null +++ b/VECTOAux/AUXUITEST/AUXUITEST.vbproj @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{D72E93A7-3EF3-44BD-9859-70BFA89BF5E1}</ProjectGuid> + <OutputType>WinExe</OutputType> + <StartupObject>AUXUITEST.My.MyApplication</StartupObject> + <RootNamespace>AUXUITEST</RootNamespace> + <AssemblyName>AUXUITEST</AssemblyName> + <FileAlignment>512</FileAlignment> + <MyType>WindowsForms</MyType> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <SccProjectName>SAK</SccProjectName> + <SccLocalPath>SAK</SccLocalPath> + <SccAuxPath>SAK</SccAuxPath> + <SccProvider>SAK</SccProvider> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <DefineDebug>true</DefineDebug> + <DefineTrace>true</DefineTrace> + <OutputPath>bin\Debug\</OutputPath> + <DocumentationFile>AUXUITEST.xml</DocumentationFile> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <DefineDebug>false</DefineDebug> + <DefineTrace>true</DefineTrace> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DocumentationFile>AUXUITEST.xml</DocumentationFile> + <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn> + </PropertyGroup> + <PropertyGroup> + <OptionExplicit>On</OptionExplicit> + </PropertyGroup> + <PropertyGroup> + <OptionCompare>Binary</OptionCompare> + </PropertyGroup> + <PropertyGroup> + <OptionStrict>Off</OptionStrict> + </PropertyGroup> + <PropertyGroup> + <OptionInfer>On</OptionInfer> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Deployment" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + </ItemGroup> + <ItemGroup> + <Import Include="Microsoft.VisualBasic" /> + <Import Include="System" /> + <Import Include="System.Collections" /> + <Import Include="System.Collections.Generic" /> + <Import Include="System.Data" /> + <Import Include="System.Drawing" /> + <Import Include="System.Diagnostics" /> + <Import Include="System.Windows.Forms" /> + <Import Include="System.Linq" /> + <Import Include="System.Xml.Linq" /> + <Import Include="System.Threading.Tasks" /> + </ItemGroup> + <ItemGroup> + <Compile Include="F_HVAC.Designer.vb" /> + <Compile Include="F_HVAC.vb"> + <SubType>Form</SubType> + </Compile> + <Compile Include="My Project\AssemblyInfo.vb" /> + <Compile Include="My Project\Application.Designer.vb"> + <AutoGen>True</AutoGen> + <DependentUpon>Application.myapp</DependentUpon> + </Compile> + <Compile Include="My Project\Resources.Designer.vb"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="My Project\Settings.Designer.vb"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="F_HVAC.resx" /> + <EmbeddedResource Include="My Project\Resources.resx"> + <Generator>VbMyResourcesResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.vb</LastGenOutput> + <CustomToolNamespace>My.Resources</CustomToolNamespace> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <None Include="My Project\Application.myapp"> + <Generator>MyApplicationCodeGenerator</Generator> + <LastGenOutput>Application.Designer.vb</LastGenOutput> + </None> + <None Include="My Project\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <CustomToolNamespace>My</CustomToolNamespace> + <LastGenOutput>Settings.Designer.vb</LastGenOutput> + </None> + <None Include="App.config" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\VectoAuxiliaries\VectoAuxiliaries.vbproj"> + <Project>{fdeee460-0b8a-4ef6-8d9e-72f203a50f65}</Project> + <Name>VectoAuxiliaries</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/VECTOAux/AUXUITEST/App.config b/VECTOAux/AUXUITEST/App.config new file mode 100644 index 0000000000000000000000000000000000000000..3a327fa4d1aefb8403561cd1832c93601d37e317 --- /dev/null +++ b/VECTOAux/AUXUITEST/App.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> + </startup> +</configuration> diff --git a/VECTOAux/AUXUITEST/F_HVAC.Designer.vb b/VECTOAux/AUXUITEST/F_HVAC.Designer.vb new file mode 100644 index 0000000000000000000000000000000000000000..2d4e511be895a084d080eb70629b54ec05bae749 --- /dev/null +++ b/VECTOAux/AUXUITEST/F_HVAC.Designer.vb @@ -0,0 +1,198 @@ +<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.txtPullyEfficiency = New System.Windows.Forms.TextBox() + Me.lblPullyEfficiency = New System.Windows.Forms.Label() + 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, 183) + 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, 218) + Me.dgMapResults.TabIndex = 0 + ' + 'btnSave + ' + Me.btnSave.Location = New System.Drawing.Point(497, 425) + 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, 425) + 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, 114) + Me.pnlSearchBar.Name = "pnlSearchBar" + Me.pnlSearchBar.Size = New System.Drawing.Size(643, 59) + Me.pnlSearchBar.TabIndex = 6 + ' + 'txtPullyEfficiency + ' + Me.txtPullyEfficiency.Location = New System.Drawing.Point(107, 60) + Me.txtPullyEfficiency.Name = "txtPullyEfficiency" + Me.txtPullyEfficiency.Size = New System.Drawing.Size(46, 20) + Me.txtPullyEfficiency.TabIndex = 7 + ' + 'lblPullyEfficiency + ' + Me.lblPullyEfficiency.AutoSize = True + Me.lblPullyEfficiency.Location = New System.Drawing.Point(20, 63) + Me.lblPullyEfficiency.Name = "lblPullyEfficiency" + Me.lblPullyEfficiency.Size = New System.Drawing.Size(81, 13) + Me.lblPullyEfficiency.TabIndex = 8 + Me.lblPullyEfficiency.Text = " Pully Efficiency" + ' + 'lblMechanicalDemand + ' + Me.lblMechanicalDemand.AutoSize = True + Me.lblMechanicalDemand.Location = New System.Drawing.Point(175, 63) + 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(315, 59) + 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(390, 62) + 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(516, 59) + 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, 460) + Me.Controls.Add(Me.txtElectricalDemand) + Me.Controls.Add(Me.lblElectricalDemand) + Me.Controls.Add(Me.txtMechanicalDemand) + Me.Controls.Add(Me.lblMechanicalDemand) + Me.Controls.Add(Me.lblPullyEfficiency) + Me.Controls.Add(Me.txtPullyEfficiency) + 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 txtPullyEfficiency As System.Windows.Forms.TextBox + Friend WithEvents lblPullyEfficiency As System.Windows.Forms.Label + 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 diff --git a/VECTOAux/AUXUITEST/F_HVAC.resx b/VECTOAux/AUXUITEST/F_HVAC.resx new file mode 100644 index 0000000000000000000000000000000000000000..1af7de150c99c12dd67a509fe57c10d63e4eeb04 --- /dev/null +++ b/VECTOAux/AUXUITEST/F_HVAC.resx @@ -0,0 +1,120 @@ +<?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 diff --git a/VECTOAux/AUXUITEST/F_HVAC.vb b/VECTOAux/AUXUITEST/F_HVAC.vb new file mode 100644 index 0000000000000000000000000000000000000000..de09548767f18beacd7fa0cca7544ce8868b8966 --- /dev/null +++ b/VECTOAux/AUXUITEST/F_HVAC.vb @@ -0,0 +1,210 @@ + +Imports VectoAuxiliaries.Hvac + + + +Public Class F_HVAC + + + 'Private Variables. + Private _mapPath As String + Private _cfgPath As String + Private _map As HVACMap + Private _mapFilter As List(Of String) = New List(Of String)() + + Public Property MapPath As String + + Get + Return _mapPath + End Get + Set(value As String) + _mapPath = value + txtMapFile.Text = value + End Set + + + End Property + + + + + + 'Binding Base + + + 'Constructor + Public Sub F_HVAC() + + + End Sub + + Private Sub btnBrowseMap_Click(sender As Object, e As EventArgs) Handles btnBrowseMap.Click + + 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() + + _map = New HVACMap(_mapPath) + + _mapFilter.Clear() + For Each item In _map.GetMapHeaders + _mapFilter.Add("") + Next + + BuildSearchBar() + + End Sub + + 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 = 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 FilterComboHandler(sender As Object, e As EventArgs) + + 'TODO:We need to update the _mapFilter here + + '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 = _map.GetMapSubSet(_mapFilter.ToArray()) + + PopulateResultsTable(results) + + End Sub + + Private Sub PopulateResultsTable(subsetResults As List(Of String())) + + Dim table As New DataTable + For Each item In _map.GetMapHeaders + Dim col As New DataColumn(item.Value.Name) + table.Columns.Add(col) + Next + + For Each row In subsetResults + Dim cell As Integer + Dim newTableRow = 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 + + + 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 + + + + + + End Sub + + + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + + End Sub + + +End Class + + + + + + + + + diff --git a/VECTOAux/AUXUITEST/My Project/Application.Designer.vb b/VECTOAux/AUXUITEST/My Project/Application.Designer.vb new file mode 100644 index 0000000000000000000000000000000000000000..20f9fd600ff1519c90c1da49bc4b7e27d5a26078 --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/Application.Designer.vb @@ -0,0 +1,38 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:4.0.30319.18444 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + 'NOTE: This file is auto-generated; do not modify it directly. To make changes, + ' or if you encounter build errors in this file, go to the Project Designer + ' (go to Project Properties or double-click the My Project node in + ' Solution Explorer), and make changes on the Application tab. + ' + Partial Friend Class MyApplication + + <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ + Public Sub New() + MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) + Me.IsSingleInstance = false + Me.EnableVisualStyles = true + Me.SaveMySettingsOnExit = true + Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses + End Sub + + <Global.System.Diagnostics.DebuggerStepThroughAttribute()> _ + Protected Overrides Sub OnCreateMainForm() + Me.MainForm = Global.AUXUITEST.F_HVAC + End Sub + End Class +End Namespace diff --git a/VECTOAux/AUXUITEST/My Project/Application.myapp b/VECTOAux/AUXUITEST/My Project/Application.myapp new file mode 100644 index 0000000000000000000000000000000000000000..9852abe906ba7785cec6d3bbeae22e699344592a --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/Application.myapp @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <MySubMain>true</MySubMain> + <MainForm>F_HVAC</MainForm> + <SingleInstance>false</SingleInstance> + <ShutdownMode>0</ShutdownMode> + <EnableVisualStyles>true</EnableVisualStyles> + <AuthenticationMode>0</AuthenticationMode> + <SaveMySettingsOnExit>true</SaveMySettingsOnExit> +</MyApplicationData> \ No newline at end of file diff --git a/VECTOAux/AUXUITEST/My Project/AssemblyInfo.vb b/VECTOAux/AUXUITEST/My Project/AssemblyInfo.vb new file mode 100644 index 0000000000000000000000000000000000000000..6997e280d76038cae396af00f7e0c84a3fa2ff68 --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/AssemblyInfo.vb @@ -0,0 +1,35 @@ +Imports System +Imports System.Reflection +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + +' Review the values of the assembly attributes + +<Assembly: AssemblyTitle("AUXUITEST")> +<Assembly: AssemblyDescription("")> +<Assembly: AssemblyCompany("AEA Group")> +<Assembly: AssemblyProduct("AUXUITEST")> +<Assembly: AssemblyCopyright("Copyright © AEA Group 2014")> +<Assembly: AssemblyTrademark("")> + +<Assembly: ComVisible(False)> + +'The following GUID is for the ID of the typelib if this project is exposed to COM +<Assembly: Guid("97e334cc-90c4-4ae1-9115-38163f3c837e")> + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Build and Revision Numbers +' by using the '*' as shown below: +' <Assembly: AssemblyVersion("1.0.*")> + +<Assembly: AssemblyVersion("1.0.0.0")> +<Assembly: AssemblyFileVersion("1.0.0.0")> diff --git a/VECTOAux/AUXUITEST/My Project/Resources.Designer.vb b/VECTOAux/AUXUITEST/My Project/Resources.Designer.vb new file mode 100644 index 0000000000000000000000000000000000000000..2c407b426fcc29be975ca593c3a0bab4a7c11915 --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:4.0.30319.18444 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + +Imports System + +Namespace My.Resources + + 'This class was auto-generated by the StronglyTypedResourceBuilder + 'class via a tool like ResGen or Visual Studio. + 'To add or remove a member, edit your .ResX file then rerun ResGen + 'with the /str option, or rebuild your VS project. + '''<summary> + ''' A strongly-typed resource class, for looking up localized strings, etc. + '''</summary> + <Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _ + Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ + Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ + Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ + Friend Module Resources + + Private resourceMan As Global.System.Resources.ResourceManager + + Private resourceCulture As Global.System.Globalization.CultureInfo + + '''<summary> + ''' Returns the cached ResourceManager instance used by this class. + '''</summary> + <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If Object.ReferenceEquals(resourceMan, Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("AUXUITEST.Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + '''<summary> + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + '''</summary> + <Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Friend Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set + resourceCulture = value + End Set + End Property + End Module +End Namespace diff --git a/VECTOAux/AUXUITEST/My Project/Resources.resx b/VECTOAux/AUXUITEST/My Project/Resources.resx new file mode 100644 index 0000000000000000000000000000000000000000..af7dbebbacef595e3089c01c05671016c21a8304 --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/Resources.resx @@ -0,0 +1,117 @@ +<?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.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: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" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </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" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/VECTOAux/AUXUITEST/My Project/Settings.Designer.vb b/VECTOAux/AUXUITEST/My Project/Settings.Designer.vb new file mode 100644 index 0000000000000000000000000000000000000000..3ebd11d1f3f05f4e60cc0fd4021692c4d4199d95 --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/Settings.Designer.vb @@ -0,0 +1,73 @@ +'------------------------------------------------------------------------------ +' <auto-generated> +' This code was generated by a tool. +' Runtime Version:4.0.30319.18444 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' </auto-generated> +'------------------------------------------------------------------------------ + +Option Strict On +Option Explicit On + + +Namespace My + + <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ + Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0"), _ + Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Partial Friend NotInheritable Class MySettings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) + +#Region "My.Settings Auto-Save Functionality" +#If _MyType = "WindowsForms" Then + Private Shared addedHandler As Boolean + + Private Shared addedHandlerLockObject As New Object + + <Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _ + Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs) + If My.Application.SaveMySettingsOnExit Then + My.Settings.Save() + End If + End Sub +#End If +#End Region + + Public Shared ReadOnly Property [Default]() As MySettings + Get + +#If _MyType = "WindowsForms" Then + If Not addedHandler Then + SyncLock addedHandlerLockObject + If Not addedHandler Then + AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings + addedHandler = True + End If + End SyncLock + End If +#End If + Return defaultInstance + End Get + End Property + End Class +End Namespace + +Namespace My + + <Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _ + Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ + Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _ + Friend Module MySettingsProperty + + <Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _ + Friend ReadOnly Property Settings() As Global.AUXUITEST.My.MySettings + Get + Return Global.AUXUITEST.My.MySettings.Default + End Get + End Property + End Module +End Namespace diff --git a/VECTOAux/AUXUITEST/My Project/Settings.settings b/VECTOAux/AUXUITEST/My Project/Settings.settings new file mode 100644 index 0000000000000000000000000000000000000000..85b890b3c66b9beee248abaddd2ec71f8b1df2b2 --- /dev/null +++ b/VECTOAux/AUXUITEST/My Project/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile> diff --git a/VECTOAux/VectoAuxiliaries.sln b/VECTOAux/VectoAuxiliaries.sln index 6d8a14d2f46517fb1aa1cfcae355c79e16cfc10e..5cef2d707033a8eadef517f2723b74729fa1a859 100644 --- a/VECTOAux/VectoAuxiliaries.sln +++ b/VECTOAux/VectoAuxiliaries.sln @@ -1,12 +1,14 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 +VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VectoAuxiliaries", "VectoAuxiliaries\VectoAuxiliaries.vbproj", "{FDEEE460-0B8A-4EF6-8D9E-72F203A50F65}" EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VectoAuxiliariesTests", "VectoAuxiliariesTests\VectoAuxiliariesTests.vbproj", "{6F31F8B2-6AB3-4F85-8AC9-D09ADCA6432D}" EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "AUXUITEST", "AUXUITEST\AUXUITEST.vbproj", "{D72E93A7-3EF3-44BD-9859-70BFA89BF5E1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {6F31F8B2-6AB3-4F85-8AC9-D09ADCA6432D}.Debug|Any CPU.Build.0 = Debug|Any CPU {6F31F8B2-6AB3-4F85-8AC9-D09ADCA6432D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6F31F8B2-6AB3-4F85-8AC9-D09ADCA6432D}.Release|Any CPU.Build.0 = Release|Any CPU + {D72E93A7-3EF3-44BD-9859-70BFA89BF5E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D72E93A7-3EF3-44BD-9859-70BFA89BF5E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D72E93A7-3EF3-44BD-9859-70BFA89BF5E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D72E93A7-3EF3-44BD-9859-70BFA89BF5E1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vaux b/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vaux new file mode 100644 index 0000000000000000000000000000000000000000..66a75392f7d65fa5269dd83b7b6807fa84642cff --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vaux @@ -0,0 +1,33 @@ +Region,CountryCode,Season,MechD,ElecD +1,45,1,50,10 +1,45,2,50,11 +1,45,3,50,12 +1,45,4,50,13 +2,45,1,50,14 +2,45,2,50,15 +2,45,3,50,16 +2,45,4,50,17 +3,45,1,50,18 +3,45,2,50,19 +3,45,3,50,10 +3,45,4,50,11 +4,45,1,50,12 +4,45,2,50,13 +4,45,3,50,14 +4,45,4,50,15 +1,44,1,50,20 +1,44,2,50,21 +1,44,3,50,22 +1,44,4,50,23 +2,44,1,50,24 +2,44,2,50,25 +2,44,3,50,26 +2,44,4,50,27 +3,44,1,50,28 +3,44,2,50,29 +3,44,3,50,20 +3,44,4,50,21 +4,44,1,50,22 +4,44,2,50,23 +4,44,3,50,24 +4,44,4,50,25 \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb index 98d97bf9cd10280bf8fcabe729077278cfd215b2..84c827e01754cf3c7e762c8f8de02e4315123a3f 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACMap.vb @@ -1,8 +1,16 @@ Imports System.IO +Imports VectoAuxiliaries.Electrics +Imports System.Windows.Forms Namespace Hvac + Public Class HVACMap Implements IHVACMap + + + +#Region "Header Comments" + 'Some sort of multi-dimensional map implemented here 'No interpolation - too expensive/complex to implement? 'Set list of choices in each dimension of input @@ -18,116 +26,249 @@ Namespace Hvac 'could define the list of inputs based on the supplied map - ''' <summary> - ''' Path to HVAC map csv - ''' </summary> - ''' <remarks></remarks> - Private ReadOnly filePath As String - ''' <summary> - ''' Dictionary of values keyed by input value combinations - ''' </summary> - ''' <remarks></remarks> - Private map As Dictionary(Of InputValues, OutputValues) +#End Region + 'Private Fields + Public Property _mapHeaders As Dictionary(Of String, HVACMapParameter) + Public Property MapHeaders As Dictionary(Of String, HVACMapParameter) Implements IHVACMap.MapHeaders + Get + Return Me._mapHeaders + End Get + Private Set(ByVal Value As Dictionary(Of String, HVACMapParameter)) + Me._mapHeaders = Value + End Set + End Property + + Private _map As List(Of String()) + Private _mapDimensions As Integer + Private _mapPath As String + Private _mechanicalDemandLookupKW As Single + Private _electricalDemandLookupKW As Single + + + 'Constructor ''' <summary> - ''' Creates a new instance of and HVACMap class + ''' Constructor ''' </summary> + ''' <param name="iMapPath"></param> ''' <remarks></remarks> - Public Sub New(ByVal path As String) - filePath = path + Public Sub New(iMapPath As String) + + _mapPath = iMapPath + MapHeaders = New Dictionary(Of String, HVACMapParameter)() + _map = New List(Of String()) + + InitialiseMapHeaders() + + Initialise() + + Dim result As Object = (From line In _map Where line(0) = "2") + + End Sub - ''' <summary> - ''' Initialise the map data - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> + 'Initialisers and Map related Methods Public Function Initialise() As Boolean Implements IHVACMap.Initialise - If (File.Exists(filePath)) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array of lines from csv - Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), StringSplitOptions.RemoveEmptyEntries) - - map = New Dictionary(Of InputValues, OutputValues)() - Dim firstline As Boolean = True - - For Each line As String In lines - If Not firstline Then - 'split the line - Dim elements() As String = line.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries) - '4 entries per line required - If (elements.Length <> 4) Then Throw New ArgumentException("Incorrect number of values in csv file") - 'add values to map - Dim region As String = elements(0) - Dim season As String = elements(1) - Dim input As New InputValues(region, season) - Dim electricalDemand As String = elements(2) - Dim mechanicalDemand As String = elements(3) - Dim output As New OutputValues(electricalDemand, mechanicalDemand) - map.Add(input, output) - Else - firstline = False - End If - Next - End Using - Return True - Else - Throw New ArgumentException("supplied input file does not exist") + + Dim myData As String + Dim linesArray As String() + + Try + + myData = System.IO.File.ReadAllText(_mapPath, System.Text.Encoding.UTF8) + linesArray = (From s As String In myData.Split(vbLf) Select s.Trim).ToArray + + + + 'getValuesIntoMap + For Each line As String In linesArray + _map.Add(line.Split(","c)) + Next + + _mapDimensions = _map(0).Length + + 'Validate Map + If validateMap() = False Then + Throw New Exception("Unable to complete Load of HVAC MAP") + End If + + 'Set Unique Values for headers which can be used as a selection device. + + + Catch ffe As FileNotFoundException + + Throw ffe + + Catch ex As Exception + + Throw ex + + End Try + + Return True + + End Function + Private Function validateMap() As Boolean + + 'Lets make sure we have header and also data. + If _map.Count < 2 Then + MessageBox.Show("Map did not contain any data") + Return False End If + + 'Make sure we have matching headers for our list of HVACMapParameterList + Dim i As Integer + + For i = 0 To _mapDimensions - 1 + + If Not MapHeaders.ContainsKey(_map(0)(i)) Then + MessageBox.Show("Map header {0} was not found in the prefdefined and expected header list", _map(0)(i)) + Return False + Else + 'Set ordinal position of respective header. + MapHeaders(_map(0)(i)).OrdinalPosition = i + + 'Get Unique Values associated with Headers. + MapHeaders(_map(0)(i)).UniqueDataValues = GetUniqueValuesByOrdinal(i) + + End If + + Next + + Return True + End Function + Public Sub InitialiseMapHeaders() + + 'Region, CountryCode, Season, MechD, ElecD + Dim region As New HVACMapParameter With {.Key = "Region", + .Description = "Region Code", + .Max = 0, + .Min = 0, + .Name = "Regional Code", + .Notes = "", + .SystemType = GetType(Integer), + .SearchControlType = GetType(System.Windows.Forms.ComboBox)} + + MapHeaders.Add("Region", region) + + Dim countryCode As New HVACMapParameter With {.Key = "CountryCode", + .Description = "Country Code", + .Max = 0, + .Min = 0, + .Name = "Country Code", + .Notes = "", + .SystemType = GetType(Integer), + .SearchControlType = GetType(System.Windows.Forms.ComboBox)} + MapHeaders.Add("CountryCode", countryCode) + + Dim season As New HVACMapParameter With {.Key = "Season", + .Description = "Season Code", + .Max = 0, + .Min = 0, + .Name = "Season Code", + .Notes = "", + .SystemType = GetType(Integer), + .SearchControlType = GetType(System.Windows.Forms.ComboBox)} + MapHeaders.Add("Season", season) + + + Dim mechD As New HVACMapParameter With {.Key = "MechD", + .Description = "MechD", + .Max = 0, + .Min = 0, + .Name = "MechD", + .Notes = "", + .SystemType = GetType(Integer), + .IsOutput = True} + + MapHeaders.Add("MechD", mechD) + + Dim elecD As New HVACMapParameter With {.Key = "ElecD", + .Description = "ElecD", + .Max = 0, + .Min = 0, + .Name = "ElecD", + .Notes = "", + .SystemType = GetType(Integer), + .IsOutput = True} + + MapHeaders.Add("ElecD", elecD) + + + End Sub + + + 'Map Enquiry Methods + Public Function GetMapHeaders() As Dictionary(Of String, HVACMapParameter) Implements IHVACMap.GetMapHeaders + + Return MapHeaders - ''' <summary> - ''' Get the average mechanical demand for the given imput parameters - ''' </summary> - ''' <param name="region"></param> - ''' <param name="season"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetMechanicalDemand(ByVal region As Integer, ByVal season As Integer) As Integer Implements IHVACMap.GetMechanicalDemand - Dim key As InputValues = New InputValues(region, season) - Dim val As OutputValues = map(key) - Return val.MechanicalDemand End Function + Public Function GetMapSubSet(search As String()) As List(Of String()) Implements IHVACMap.GetMapSubSet - ''' <summary> - ''' Get the average electrical demand for the given imput parameters - ''' </summary> - ''' <param name="region"></param> - ''' <param name="season"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetElectricalDemand(ByVal region As Integer, ByVal season As Integer) As Integer Implements IHVACMap.GetElectricalDemand - Dim key As InputValues = New InputValues(region, season) - If (map.ContainsKey(key)) Then - Dim val As OutputValues = map(key) - Return val.ElectricalDemand - Else - Throw New ArgumentException("Key was not present") + 'Sanity Check + If (search.Length <> _mapDimensions) Then + Throw New Exception("The search array does not match the number elements in the map") End If + + Dim reducer As New List(Of String()) + Dim matched As Boolean + Dim i As Integer ' For each data row + + For i = 1 To (_map.Count - 1) + + matched = True + + Dim o As Integer ' For each ordinal column + For o = 0 To search.Length - 1 + 'Dont try and match it if it is an output or nothing, what would be the point? + If search(o) = Nothing Or search(o) = "" Or GetMapHeaders.ToArray()(o).Value.IsOutput Then + Continue For ' Get next ordinal + Else + 'Try and match + If search(o) <> _map(i)(o) Then + matched = False + End If + End If + + Next o + + If matched Then + reducer.Add(_map(i)) + End If + + Next i + + Return reducer + End Function + Public Function GetUniqueValuesByOrdinal(o As Integer) As List(Of String) Implements IHVACMap.GetUniqueValuesByOrdinal -#Region "Nested Structures" - Private Structure InputValues - Private ReadOnly region As Integer - Private ReadOnly season As Integer - - Public Sub New(ByVal region As Integer, ByVal season As Integer) - Me.region = region - Me.season = season - End Sub - End Structure - - Private Structure OutputValues - Public ReadOnly MechanicalDemand As Single - Public ReadOnly ElectricalDemand As Single - - Public Sub New(ByVal electricalDemand As Single, ByVal mechanicalDemand As Single) - Me.MechanicalDemand = mechanicalDemand - Me.ElectricalDemand = electricalDemand - End Sub - End Structure -#End Region + 'Sanity Check + If (o < 0 Or o >= _mapDimensions) Then + Throw New Exception(Format("Get Unique Values by ordinal ordinal passed {0} is outside the bounds of the array.", o)) + End If + + Dim results As List(Of String) = + (From r In _map Select r(o) Distinct).ToList() + + 'Remove Headers + results.Remove(results(0)) + + Return results + + End Function + + Public Function GetMechanicalDemand(region As Integer, season As Integer) As Integer Implements IHVACMap.GetMechanicalDemand + Return 1 + End Function + + Public Function GetElectricalDemand(region As Integer, season As Integer) As Integer Implements IHVACMap.GetElectricalDemand + Return 1 + End Function End Class + End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACMapParameter.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACMapParameter.vb new file mode 100644 index 0000000000000000000000000000000000000000..7c397d435f3701c047a9874fbd4e4162431ebf47 --- /dev/null +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACMapParameter.vb @@ -0,0 +1,27 @@ + +'POCO Class to hold information required to +'1. Reference Value +'2. Create UI Controls on Form. + +Namespace Hvac + + Public Class HVACMapParameter + + Public Key As String + Public Name As String + Public Description As String + Public Notes As String + Public Min As Double + Public Max As Double + Public SystemType As System.Type + Public SearchControlType As System.Type + Public ValueType As System.Type + Public OrdinalPosition As Integer + Public UniqueDataValues As List(Of String) + Public IsOutput As Boolean = False + + End Class + + + +End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb index 9f13b02cfd9929ddea7c26cb4160ad34e1bd9821..c3d623efd228e5f54596d28843a6e278ea4105cb 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/IHVACMap.vb @@ -1,28 +1,27 @@ +Imports System.IO +Imports VectoAuxiliaries.Electrics +Imports System.Windows.Forms + Namespace Hvac + Public Interface IHVACMap - ''' <summary> - ''' Initialise the map data - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> + + Property MapHeaders As Dictionary(Of String, HVACMapParameter) + Function Initialise() As Boolean - ''' <summary> - ''' Get the average mechanical demand for the given imput parameters - ''' </summary> - ''' <param name="region"></param> - ''' <param name="season"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetMechanicalDemand(ByVal region As Integer, ByVal season As Integer) As Integer + 'Map Enquiry Methods + Function GetMapHeaders() As Dictionary(Of String, HVACMapParameter) + Function GetMapSubSet(search As String()) As List(Of String()) + Function GetUniqueValuesByOrdinal(o As Integer) As List(Of String) - ''' <summary> - ''' Get the average electrical demand for the given imput parameters - ''' </summary> - ''' <param name="region"></param> - ''' <param name="season"></param> - ''' <returns></returns> - ''' <remarks></remarks> + Function GetMechanicalDemand(ByVal region As Integer, ByVal season As Integer) As Integer Function GetElectricalDemand(ByVal region As Integer, ByVal season As Integer) As Integer + + End Interface -End NameSpace \ No newline at end of file + + + +End Namespace + diff --git a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj index 9ff001686351e5b7891a0bb0373e444586c7c3e5..5bdc223e11dd8a000a400319472e9905f0069d69 100644 --- a/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj +++ b/VECTOAux/VectoAuxiliaries/VectoAuxiliaries.vbproj @@ -50,6 +50,7 @@ <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> + <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="System.Core" /> <Reference Include="System.Xml.Linq" /> @@ -67,6 +68,7 @@ <Import Include="System.Threading.Tasks" /> </ItemGroup> <ItemGroup> + <Compile Include="Hvac\HVACMapParameter.vb" /> <Compile Include="Hvac\IHVACMap.vb" /> <Compile Include="Pneumatics\AirCompressor.vb" /> <Compile Include="Electrics\Alternator.vb" /> @@ -108,6 +110,7 @@ </EmbeddedResource> </ItemGroup> <ItemGroup> + <None Include="Hvac\HVACMap.vaux" /> <None Include="My Project\Application.myapp"> <Generator>MyApplicationCodeGenerator</Generator> <LastGenOutput>Application.Designer.vb</LastGenOutput> diff --git a/VECTOAux/VectoAuxiliariesTests/Mocks/HVACMapMock.vb b/VECTOAux/VectoAuxiliariesTests/Mocks/HVACMapMock.vb index d990a4cc55a1e0f24959754d4c7c3a9838e1165f..40f31f825dfe779b397b026117c696e8dd435c8b 100644 --- a/VECTOAux/VectoAuxiliariesTests/Mocks/HVACMapMock.vb +++ b/VECTOAux/VectoAuxiliariesTests/Mocks/HVACMapMock.vb @@ -4,6 +4,8 @@ Namespace Mocks Public Class HVACMapMock Implements IHVACMap + + Public Function Initialise() As Boolean Implements IHVACMap.Initialise Return True End Function @@ -12,8 +14,24 @@ Namespace Mocks Return 10 End Function - Public Function GetElectricalDemand(ByVal region As Integer, ByVal season As Integer) As Integer Implements IHVACMap.GetElectricalDemand - Return 10 + + Public Function GetMapHeaders() As Dictionary(Of String, HVACMapParameter) Implements IHVACMap.GetMapHeaders + + Throw New NotImplementedException + End Function + + Public Function GetMapSubSet(search() As String) As List(Of String()) Implements IHVACMap.GetMapSubSet + Throw New NotImplementedException + End Function + + Public Function GetUniqueValuesByOrdinal(o As Integer) As List(Of String) Implements IHVACMap.GetUniqueValuesByOrdinal + Throw New NotImplementedException + End Function + + Public Property MapHeaders As Dictionary(Of String, HVACMapParameter) Implements IHVACMap.MapHeaders + + Public Function GetElectricalDemand(region As Integer, season As Integer) As Integer Implements IHVACMap.GetElectricalDemand + Return 1 End Function End Class End Namespace \ No newline at end of file