Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Apps/BlueM.Opt.Apps.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{2DCFE99E-CBFE-4CCC-93E7-A6D628B16DEC}</ProjectGuid>
<OutputType>Library</OutputType>
Expand Down Expand Up @@ -87,6 +87,7 @@
<ItemGroup>
<Compile Include="BlueM\BlueM.vb" />
<Compile Include="BlueM\BlueMThread.vb" />
<Compile Include="Generic.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
Expand Down
132 changes: 132 additions & 0 deletions Apps/Generic.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
' Copyright (c) BlueM Dev Group
' Website: http://bluemodel.org
'
' All rights reserved.
'
' Released under the BSD-2-Clause License:
'
' Redistribution and use in source and binary forms, with or without modification,
' are permitted provided that the following conditions are met:
'
' * Redistributions of source code must retain the above copyright notice, this list
' of conditions and the following disclaimer.
' * Redistributions in binary form must reproduce the above copyright notice, this list
' of conditions and the following disclaimer in the documentation and/or other materials
' provided with the distribution.
'
' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
' EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
' OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
' SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
' SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
' OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
' HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
' TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
' EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
'--------------------------------------------------------------------------------------------
Public Class Generic
Inherits Sim

''' <summary>
''' Eine StringCollection mit allen Dateiendungen (ohne Punkt), die in einem Datensatz vorkommen können
''' </summary>
''' <remarks>Die erste Dateiendung in dieser Collection repräsentiert den Datensatz (wird z.B. als Filter für OpenFile-Dialoge verwendet)</remarks>
Public Overrides ReadOnly Property DatensatzDateiendungen() As Collections.Specialized.StringCollection
Get
Dim extensions As New Collections.Specialized.StringCollection()
extensions.Add("bat")
Return extensions
End Get
End Property

''' <summary>
''' Multithreading support flag
''' </summary>
''' <returns>False</returns>
Public Overrides ReadOnly Property MultithreadingSupported() As Boolean
Get
'TODO: enable multithreading
Return False
End Get
End Property

''' <summary>
''' Die Sim-Anwendung für die Simulation vorbereiten
''' </summary>
Public Overrides Sub prepareSimulation()

'TODO: Immer im Originalverzeichnis des Datensatzes simulieren?
Me.WorkDir_Current = Me.WorkDir_Original

End Sub

''' <summary>
''' Simulationsparameter einlesen
''' </summary>
Protected Overrides Sub Read_SimParameter()
'TODO
End Sub

''' <summary>
''' TODO: this should not be MustOverride in the base class
''' </summary>
Protected Overrides Sub Read_Verzweigungen()
'pass
End Sub

''' <summary>
''' TODO: this should not be MustOverride in the base class
''' </summary>
Protected Overrides Sub Write_Verzweigungen()
'pass
End Sub

''' <summary>
''' Launch simulation
''' </summary>
''' <remarks>launches the batch file named launchSim.bat in the dataset directory</remarks>
Protected Overloads Overrides Function launchSim() As Boolean

Dim proc As Process
Dim startInfo As New ProcessStartInfo()
Dim isFinished As Boolean = False

startInfo.FileName = Me.Datensatz & Me.DatensatzExtension
'startInfo.Arguments = ""
startInfo.UseShellExecute = True
startInfo.WindowStyle = ProcessWindowStyle.Normal
startInfo.WorkingDirectory = IO.Path.GetDirectoryName(Me.WorkDir_Current)
'start
proc = Process.Start(startInfo)
'wait until finished
Do
isFinished = proc.WaitForExit(100)
System.Windows.Forms.Application.DoEvents()
Loop Until isFinished

'close the process
proc.Close()

End Function

'For Multithreading
Protected Overloads Overrides Function launchSim(ByVal Thread_ID As Integer, ByVal Child_ID As Integer) As Boolean
'pass
End Function
Protected Overloads Overrides Function ThreadFree(ByRef Thread_ID As Integer) As Boolean
'pass
End Function
Protected Overloads Overrides Function ThreadReady(ByRef Thread_ID As Integer, ByRef SimIsOK As Boolean, ByVal Child_ID As Integer) As Boolean
'pass
End Function

''' <summary>
''' Simulationsergebnis einlesen
''' </summary>
''' <remarks></remarks>
Protected Overrides Sub SIM_Ergebnis_Lesen()
'TODO:

End Sub

End Class
1 change: 1 addition & 0 deletions Common/Constants.vb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Public Module Constants
Public Const ANW_TALSIM As String = "TALSIM"
Public Const ANW_TESTPROBLEMS As String = "Testproblems"
Public Const ANW_TSP As String = "Traveling Salesman"
Public Const ANW_GENERIC As String = "Generic"

'Optimierungsmethoden
Public Const METH_PES As String = "PES"
Expand Down
6 changes: 5 additions & 1 deletion Main/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Partial Public Class Form1
'---------
'Liste der Anwendungen in ComboBox schreiben und Anfangseinstellung w�hlen
Me.ComboBox_Anwendung.Items.Clear()
Me.ComboBox_Anwendung.Items.AddRange(New Object() {"", ANW_BLUEM, ANW_SCAN, ANW_SWMM, ANW_TALSIM, ANW_TESTPROBLEMS, ANW_TSP}) 'ANW_SMUSI entfernt (Bug 265)
Me.ComboBox_Anwendung.Items.AddRange(New Object() {"", ANW_BLUEM, ANW_SCAN, ANW_SWMM, ANW_TALSIM, ANW_TESTPROBLEMS, ANW_TSP, ANW_GENERIC}) 'ANW_SMUSI entfernt (Bug 265)
Me.ComboBox_Anwendung.SelectedIndex = 0

'Datensatz
Expand Down Expand Up @@ -533,6 +533,10 @@ Partial Public Class Form1
Me.ComboBox_Methode.SelectedIndex = 0
'Button_Start.Enabled = True

Case ANW_GENERIC 'Generic simulation application
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sim1 = New BlueM.Opt.Apps.Generic()

End Select

'Bei Sim-Anwendungen
Expand Down