Public Class frm_ThermalEnergyControlSystem '// ########################################################## '// Copyright (C) Mowast Engineering 2011. All rights reserved. '/* Rechtlicher Hinweis: ' Diese Software wurde mit besonderer Sorgfalt entwickelt; ' trotzdem koennen unerkannte Fehler vorhanden sein. ' Mowast Engineering kann keine Gewaehrleistung uebernehmen. ' Der Anwender dieser Software erkennt diese Tatsachen ' stillschweigend an. ' A legal statement: ' This software was developed with extraordinary diligence; ' nevertheless it may include some unknown errors. ' Mowast Engineering can not be held liable for any damages ' caused by these errors. ' The user of this software accepts these facts and agrees ' tacitly. '*/ '// ########################################################## Dim OrigBackColor As System.Drawing.Color Dim I_Month_Length(13) As Integer Dim strMonth(13) As String Dim Date_PresentTime As Date Dim I_MESZ_Fahne As Integer Dim strTodaysDataFileName As String = String.Empty Dim strTodaysProtocolFileName As String = String.Empty Dim strDataFilePathName As String Dim strProtocolFilePathName As String Dim strDataFolderName As String = "Temperatur_Data" Dim strProtocolFolderName As String = "Protocol_Data" Dim strInitFolderName As String = "Initialization_Data" Dim strDataFileNameBeginning As String = "Data_" Dim strProtocolFileNameBeginning As String = "Protocol_" Dim strFileNameEnding As String = ".txt" Dim str_Datum_Numbers As String Dim str_CurrentDirectory As String = String.Empty Dim strModuleId As String = String.Empty Dim strModuleAddress As String = String.Empty Dim I_Delay_Flag As Integer Dim iMaxHeatingValveCount As Integer = 600 Dim iMaxBallValveCount As Integer = 250 Dim iMAXNUMBERMODULES As Integer = 32 Dim iSTORINGFLAG As Integer = 1 Dim iLookingAtFileFlag As Integer = 0 Dim ipreTemprModRegisteredFlag As Integer = 0 Dim iTempratureModuleRegisteredFlag As Integer = 0 Dim strTemprModuleAddress(iMAXNUMBERMODULES) As String Dim iTemprModuleAddressIndex As Integer = 0 Dim iPumpCntrModRegisteredFlag As Integer = 0 Dim strPumpCntrModuleAddress(iMAXNUMBERMODULES) As String Dim iPumpCntrModuleAddressIndex As Integer = 0 Dim iHeatValveCntrModRegisteredFlag As Integer = 0 Dim strHeatValveCntrModuleAddress(iMAXNUMBERMODULES) As String Dim iHeatValveCntrModuleAddressIndex As Integer = 0 Dim iBalValve_C_trolModRegisteredFlag As Integer = 0 Dim strBalValve_C_trolModuleAddress(iMAXNUMBERMODULES) As String Dim iBalValve_C_trolModuleAddressIndex As Integer = 0 Dim iPowSwiModRegisteredFlag As Integer = 0 Dim strPowSwiModuleAddress(iMAXNUMBERMODULES) As String Dim iPowSwiModuleAddressIndex As Integer = 0 Dim i_POWMODONE As Integer = 1 Dim iClient_TemplateCntrModRegisteredFlag As Integer = 0 Dim strClient_TemplateCntrModuleAddress(iMAXNUMBERMODULES) As String Dim iClient_TemplateCntrModuleAddressIndex As Integer = 0 Dim iManualTestFlag As Integer = 1 ' is set to "1" when manual testing is in progress ' is set to "0" first when modules have been registered Dim iRepeatScanOneFlag As Integer Dim iRepeatScanTwoFlag As Integer Dim sgl_SOLARTHERMOSTART As Single = -30.0 ' changed 8 May 2012 from -27.0 Dim sgl_SOLARTHERMOEND As Single = 30.0 ' changed 29 May 2012 from 20.0 ' COS Function 15.06.2012 'Dim sgl_SOLARTHERMOEND As Single = 15.0 ' Testing changed 29 May 2012 from 20.0 Dim strProtocolMessage As String = String.Empty Dim str_SolarStatusEchelon As String = "Cold_Start" Dim i_StartungUpLoopCounter As Integer = 0 Dim I_SunIsNotshiningCounter As Integer = 0 Dim I_SOLARPUMP As Integer = 1 Dim I_PRIMARYHEATINGPUMP As Integer = 2 Dim I_SECUNDARYHEATINGPUMP As Integer = 3 Dim I_GEOTHERMIEPUMP As Integer = 4 Dim i_NUMBEROFTRACKS As Integer = 13 Dim sgl_OldThermalValue(i_NUMBEROFTRACKS) As Single Dim sgl_ActualThermalValue(i_NUMBEROFTRACKS) As Single Dim i_Ch_EXTERNAL_TEMPERATURE As Integer = 1 ' Definitions of the temperatur channels Dim i_Ch_BUFTOP_TEMPERATURE As Integer = 2 Dim i_Ch_BUFMID_TEMPERATURE As Integer = 3 Dim i_Ch_BUFBOT_TEMPERATURE As Integer = 4 Dim i_Ch_BUFRETURN_TEMPERATURE As Integer = 5 Dim i_Ch_PRIMARYRETURN_TEMPERATURE As Integer = 6 Dim i_Ch_SECUNDARYSOURCE_TEMPERATURE As Integer = 7 Dim i_Ch_SECUNDARYRETURN_TEMPERATURE As Integer = 8 Dim i_Ch_SOLARHOTCHANNEL As Integer = 9 Dim i_Ch_SOLARCOLDCHANNEL As Integer = 10 Dim i_Ch_GEOSOURCE_TEMPERATURE As Integer = 11 Dim i_Ch_GEORETURN_TEMPERATURE As Integer = 12 Dim I_NUMBEROFTHERMALSENSORS As Integer = 12 Dim i_PLOTHOTSOLARSLOPECHANNEL As Integer = 13 Dim i_PLOTCOLDSOLARSLOPECHANNEL As Integer = 14 Dim i_PLOTSOLARPUMPSTATUS As Integer = 15 Dim i_PLOTSUPPLY_TEMPERATURE As Integer = 16 ' Vorlauftemperatur Dim i_PLOTCORRECTED_EXTERNAL_TEMPERATURE As Integer = 17 ' Dim i_PLOTMINBUFSOLLTEMPERATURE As Integer = 18 ' Dim i_MAINBALLVALVEINDEX As Integer = 1 Dim i_SHOW_SOLLSEKUNDAERYVORLAUF As Integer = 19 ' Dim i_EXPECTEDTEMPRMODULES As Integer ' defined in >txt_ExpTemprModule.Text< Dim i_HeatValveIndexCounter As Integer Dim i_SIX_THIRTY As Integer = 390 ' 6.5 * 60 Minutes Dim i_NINE_O_CLOCK As Integer = 540 ' 9 * 60 Minutes Dim i_MAXCOLNUMBER As Integer = 6 Dim i_AddressFieldLenght As Integer Dim i_Count_One As Integer Dim i_Count_Two As Integer Dim str_Address(iMAXNUMBERMODULES) As String Dim str_Command(i_MAXCOLNUMBER) As String Dim str_DGVBox(i_MAXCOLNUMBER) As String Dim str_DummyBox As String Dim strCommando(7) As String Dim strTemporModAddress As String Dim iWaitCounter As Integer Dim I_Channel_Nr As Integer Dim iPublicStoreFlag As Integer Dim iPublicOffset As Integer Dim str_Status As String = String.Empty Dim strCommand As String = String.Empty Dim str_MeasurementEchelon As String Dim str_IdentifyEchelon As String Dim str_SelectEchelon As String = String.Empty Dim str_TemprScanEchelon As String = String.Empty Dim str_AuxiliaryTaskManagerEchelon As String = String.Empty Dim i_Speed As Integer = 0 Dim i_Stop As Integer = 3 Dim i_Timeout As Integer = 20 'Dim i_DummyCounter As Integer = 0 Dim i_Method_StartTemprScanBusyFlag As Integer = 0 Dim i_FirstTemprScanDone As Integer = 0 Dim i_DataFileCreatedFlag As Integer = 0 Dim i_SecondTick As Integer = 0 Dim str_PresentValveStatus(iMAXNUMBERMODULES) As String Dim str_HeatingPatternandFlag As String Dim str_HeatingPattern As String Dim i_HeatValveActionFlag(iMAXNUMBERMODULES) As Integer Dim i_DoScanFlag As Integer = 0 Dim i_NumberofValvesrequired As Integer Dim i_TemprModulePresentFlag As Integer = 0 Dim i_HeatValveCntrModulePresentFlag As Integer = 0 Dim i_BalValve_C_trolModulePresentFlag As Integer = 0 Dim i_PumpControllerPresentFlag As Integer = 0 Dim i_PowerSwitchPresentFlag As Integer = 0 Dim i_ClientTemplatePresentFlag As Integer = 0 Dim i_BallValveControllerPresentFlag As Integer = 0 Dim i_ScanLoopEnabled As Integer = 1 'Dim i_SyncFlag As Integer = 1 ' i.e. synchronization is in progress Dim str_HeatingFlag As String = String.Empty Dim str_SolDumpFlag As String = String.Empty Dim strJahr As String = String.Empty Dim strMonat As String = String.Empty Dim strTag As String = String.Empty Dim str_SecondTickEchelon As String = String.Empty ' as used in >Timer_MainClockSecondTick_Tick< Dim str_DiagnosticBufferZer As String ' 05.03.2013 Dim str_DiagnosticBufferOne As String ' 04.03.2013 Dim str_DiagnosticBufferTwo As String ' 05.03.2013 Dim str_DiagnosticBufferTre As String ' 05.03.2013 Dim str_DiagnosticBufferFor As String ' 06.03.2013 Dim i_RepeatFlag As Integer ' 14.03.2013 Dim strStopPumpAddress(5) As String 'Dim strPrimarySecundaryPumpStatus As String = "Running" Dim flt_Supply_Minimum_Soll_Temperature As Double ' Vorlauf-Temperatur Dim flt_Corrected_External_Ist_Temperature As Double Dim str_RoomHeatingEchelon As String = "Starting RoomHeating" Dim str_OverflowDumpEchelon As String = "Starting Overflow" Dim i_InitialPrimaryHeatingPumpSpeed As Integer Dim i_InitialSecundaryHeatingPumpSpeed As Integer Dim i_InitialPrimaryDumpPumpSpeed As Integer Dim i_InitialSecundaryDumpPumpSpeed As Integer Dim i_InitialPrimaryOverflowDumpPumpSpeed As Integer Dim i_InitialSecundaryOverflowDumpPumpSpeed As Integer Dim i_Heating_InitialBallValvePosition As Integer Dim i_Dump_InitialBallValvePosition As Integer Dim i_OverflowDump_InitialBallValvePosition As Integer Dim i_DeltaBallValvePosition As Integer Dim i_BallValvePositionOffset As Integer = 0 Dim i_CummulativeBallValvePosition As Integer Dim i_MAXBALLVALVEVALUE As Integer = 125 Dim i_DEFAULTBALLVALVEVALUE As Integer = 7 Dim str_SLOWPUMPCOMMAND As String = "S3" Dim str_STOPPUMPCOMMAND As String = "S0" Dim str_SLOWPUMP As String = "3" Dim str_PUMPNULL As String = "0" Dim i_DelayCounter As Integer ' used in >Timer_SecondTick_Tick< Dim str_StartParameters As String = String.Empty Dim i_LENPARAMETERLIST As Integer = 17 Dim str_StartParameterText(i_LENPARAMETERLIST) As String Dim i_StartParameterIndex(i_LENPARAMETERLIST) As Integer Dim i_ParameterIndexIst(i_LENPARAMETERLIST) As Integer Dim i_ParameterIndexNicht(i_LENPARAMETERLIST) As Integer Dim i_EndParameterIndex(i_LENPARAMETERLIST) As Integer Dim i_BRENNERAUTOMATIC As Integer = 1 Dim i_BRENNERANAUS As Integer = 2 Dim i_HEIZUNGSSTEUERUNG As Integer = 3 Dim i_AUTODUMP As Integer = 4 Dim i_MANUDUMP As Integer = 5 Dim i_EXTTEMPOFFSET As Integer = 12 Dim str_InitialSystemFile As String Dim str_FIVEDOTS As String = "....." Dim str_NICHT As String = "nicht" Dim i_BrennerAutomaticFlag As Integer Dim i_BrennerManualFlag As Integer Dim i_HeatingControlMasterFlag As Integer Dim int_HeatingActiveFlag As Integer = 0 Dim int_SolDumpFlag As Integer = 0 Dim int_ManualSolDumpFlag As Integer = 0 Dim int_FlagBothPumpsOff As Integer = 0 Dim flt_Supply_Ist_Temperature As Double ' Vorlauf-Temperatur Dim str_Supply_Minimum_Soll_Temperature As String Dim i_PrimaryPumpSpeed As Integer Dim sgl_SolarHotValueENN As Single Dim str_ManualSolDumpFlag As String Dim str_AutomaticDumpFlag As String Dim str_EWFE_ThermeStatus As String = "Heater in OFF" ' all calculated in >strfctn_CalculateDiverseTemperatures()< Dim flt_Original_External_Ist_Temperature As Double Dim flt_BufTop_Ist_Temperature As Double Dim flt_BufMid_Ist_Temperature As Double Dim flt_BufBot_Ist_Temperature As Double Dim flt_Delta_Temperature As Double ' Spreizung Dim flt_MinBuffer_Soll_Temperature As Double Dim flt_PufferAverageTemp As Double Dim i_X_MinuteIndex As Integer Dim str_DefaultPumpSpeedNumber As String Dim i_ErrorCounter As Integer = 0 Dim flt_MINBUFFERSOLLTEMPERATURE As Double = 43.0 '' Alternativ: letzte Minute voreinstellen (wenn um die 0. Sekunde herum) 'Private lastMeasureTime As DateTime = DateTime.MinValue '' Messinterval (hier 1 Minute) ''Private measureInterval As New TimeSpan(0, 1, 0) 'Private measureInterval As New TimeSpan(0, 0, 59) '' ########### NEU Dim str_Home_Nord As String = "48%01'28.27# N" Dim str_Home_East As String = "11%36'04.30# E" Dim Instance_SolarCalc = New Sonnenstand.Berechnung ' creates an INSTANCE Dim Class_SolarCalc As New Sonnenstand.Berechnung ' defines a Class Dim Instance_EzSloBus = New Ez.Slo_Bus_Test.Ez_Slo_Bus_Tester_Form1 ' creates an INSTANCE Dim Class_EzSloBus As New Ez.Slo_Bus_Test.Ez_Slo_Bus_Tester_Form1 ' defines a Class Dim Instance_DataDisp = New Data_Tabel.DataDisplayForm ' creates an INSTANCE Dim Class_DataDisp As New Data_Tabel.DataDisplayForm ' defines a Class Dim Instance_XY_Curves = New XY_Curves.Form_XY_Curves ' creates an INSTANCE Dim Class_XY_Curves As New XY_Curves.Form_XY_Curves ' defines a Class Dim Instance_HeatingSchedule = New HeatingSchedule.ScheduleForm ' creates an INSTANCE Dim Class_HeatingSchedule As New HeatingSchedule.ScheduleForm ' defines a Class Dim Instance_TemperatureCalculation = New AuxiliaryCalculation.TemperatureCalculation ' creates an INSTANCE Dim Class_TemperatureCalculation As New AuxiliaryCalculation.TemperatureCalculation ' defines a Class Dim Instance_TECS_Display = New TECS_Display.Form_TECS_Display ' creates an INSTANCE Dim Class_TECS_Display As New TECS_Display.Form_TECS_Display ' defines a Class ' ########################################################### ' ########################################################### Public Sub New() Dim str_FunctionReply As String ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. 'Me.Text &= " Version 12530a" 'Me.Text &= " Version 12615a" ' added Cold_Slope 'Me.Text &= " Version 12626a" ' moved .DoEvents in >Sub Main_Delay_Time< 'Me.Text &= " Version 12626b" ' If txt_PumpSpeed.Text <> "0" Then .... etc. 'Me.Text &= " Version 12718a" ' Added "q" to >SearchIdentifyToolStripMenuItem_Click< 'Me.Text &= " Version 12721a" ' Added HeatingSchedule 'Me.Text &= " Version 12727a" ' multi Valve addressing removing Main_DelayTimerFlag, etc. 'Me.Text &= " Version 12806b" ' removing >Main_Delay_Time< 'Me.Text &= " Version 12808a" ' improving timers 'Me.Text &= " Version 12820a" ' MainClock enabled 'Me.Text &= " Version 12821a" ' MainClock disabled for testing 'Me.Text &= " Version 12822a" 'trying to activate MainClock for testing 'Me.Text &= " Version 12823a" ' simplifying Timers 'Me.Text &= " Version 12824a" ' correcting second Temperatur Module Scan 'Me.Text &= " Version 12826a" ' changing timing of TemperaturScan 'Me.Text &= " Version 12828a" ' removing "try" around >Call Instance_XY_Curves.....< '' in >Sub fctn_ThermoSolar(ByVal iStoFlag As Integer)< 'Me.Text &= " Version 12829a" ' shifting .XYPlot.Invalidate() and .XYPlot.Refresh() '' when each point is written - except the last. 'Me.Text &= " Version 12830a" ' increased to >Timer_TaskManager.Interval = 250< ' in >Sub txt_MinuteIndex_TextChanged< 'Me.Text &= " Version 12903a" ' working on adapting >HeatingSchedule< 'Me.Text &= " Version 12904a" ' adding >Task_BurnerHeaterControl< 'Me.Text &= " Version 12905a" ' testing >Task_BurnerHeaterControl< 'Me.Text &= " Version 12907a" ' improving >Timer_TaskManager_Tick< 'Me.Text &= " Version 12909b" ' finding error in >Timer_TaskManager_Tick< 'Me.Text &= " Version 12911a" ' changes in >txt_Second.TextChanged< 'Me.Text &= " Version 12912b" ' more changes in >txt_Second.TextChanged< 'Me.Text &= " Version 12913a" ' removing error in File Opening 'Me.Text &= " Version 12917b" ' removing Plot refresh 'Me.Text &= " Version 12919a" ' moved >txt_Second.TextChanged< taskmanager to MainClock 'Me.Text &= " Version 12924b" ' introduced >Method_SendEzBusCommand< 'Me.Text &= " Version 12926a" ' added >Task_GetValveStatus()< 'Me.Text &= " Version 12927b" ' added Valve activity 'Me.Text &= " Version 12928b" ' added more and improving Valve activity 'Me.Text &= " Version 12929a" ' general improvements 'Me.Text &= " Version 12930a" ' general improvements 'Me.Text &= " Version 12a01a" ' general improvements 'Me.Text &= " Version 12a08a" ' added AuxiliaryCalculation.vbprj 'Me.Text &= " Version 12a09a" ' added AuxiliaryCalculation.vbprj 'Me.Text &= " Version 12a24a" ' Optional 1 or 2 Temperature Interfaces >i_EXPECTEDTEMPRMODULES< 'Me.Text &= " Version 12a28a" ' PumpControllerPresentFlag, PowerSwitchPresentFlag, ValvePresentFlag 'Me.Text &= " Version 12a29a" ' trying to remove error in >Method_FilterandGetValveStatus()< 'Me.Text &= " Version 12a30c" ' workaround for error in >Method_FilterandGetValveStatus()< 'Me.Text &= " Version 12b01a" ' workaround for error in >Method_FilterandGetValveStatus()< 'Me.Text &= " Version 12b05a" ' workaround for error in >Method_FilterandGetValveStatus()< 'Me.Text &= " Version 12b09a" ' New Ez.Slo_Bus_Test " Version 12b06b" 'Me.Text &= " Version 12b16a" ' New Ez.Slo_Bus_Test " Version 12b16b" 'Me.Text &= " Version 12b17b" ' nesessary corrections in Ez.Slo_Bus_Test " Version 12b17a" ' str_SerPortBuffer = String.Empty 'Me.Text &= " Version 12b19b" ' decreasing reading time for temperature results 'Me.Text &= " Version 12b19c" ' turned on >MainClock_Second.Enabled< 'Me.Text &= " Version 12c03a" ' optional >MainClock_Second.Enabled< 'Me.Text &= " Version 12c06a" ' optimizing timing 'Me.Text &= " Version 12c11a" ' adding StopWatch for testing 'Me.Text &= " Version 12c12a" ' localizing error in valve control 'Me.Text &= " Version 12c21a" ' localizing error in valve control 'Me.Text &= " Version 13114b" ' improving Main Timer Loop 'Me.Text &= " Version 13121b" ' adapting for changes in >HeatingSchedule< 'Me.Text &= " Version 13123a" ' creating Folder/File 'Me.Text &= " Version 13126a" ' optimizing 'Me.Text &= " Version 13127b" ' optimizing 'Me.Text &= " Version 13129a" ' removing error in >Timer_SecondTick< 'Me.Text &= " Version 13130a" ' removing error in >Timer_SecondTick< 'Me.Text &= " Version 13131a" ' adding Timer_SyncTick which synchronizes to the internal clock 'Me.Text &= " Version 13202a" ' nesessary corrections in >Ez.Slo_Bus_Test< 'Me.Text &= " Version 13204a" ' nesessary corrections in >Ez.Slo_Bus_Test< 'Me.Text &= " Version 13205a" ' infrastructure for error in >Ch 0: C< in >strfctn_ManipulateDataandPlot< 'Me.Text &= " Version 13205b" ' nesessary corrections in >Ez.Slo_Bus_Test< 'Me.Text &= " Version 13206a" ' nesessary corrections in >strfctn_ManipulateDataandPlot< 'Me.Text &= " Version 13211a" ' removing messagebox in >strfctn_ManipulateDataandPlot< 'Me.Text &= " Version 13212a" ' improving >Method_StopPump< txt_ValveStatus 'Me.Text &= " Version 13213a" ' added >txt_ValveStatus< text box 'Me.Text &= " Version 13216b" ' improving Valve Control 'Me.Text &= " Version 13219a" ' removing error in >Method_StartTemprScan< 'Me.Text &= " Version 13224a" ' New Ez.Slo_Bus_Test " Version 13224a" 'Me.Text &= " Version 13226b" ' removing error in >Method_StartTemprScan< 'Me.Text &= " Version 13227a" ' redesigning Taskmanager in >Timer_SecondTick.Tick< 'Me.Text &= " Version 13303a" ' function <===> sub 'Me.Text &= " Version 13304a" ' more function <===> sub; new >Ez.Slo_Bus_Test< 'Me.Text &= " Version 13305a" ' more function <===> sub 'Me.Text &= " Version 13306a" ' more function <===> sub; improving >strfctn_StartTemprScan< 'Me.Text &= " Version 13308a" ' removing error in >i_ValveIndexCounter< 'Me.Text &= " Version 13308b" ' New Ez.Slo_Bus_Test " Version 13308a" 'Me.Text &= " Version 13309a" ' New Ez.Slo_Bus_Test " Version 13309a" 'Me.Text &= " Version 13310a" ' more function <===> sub 'Me.Text &= " Version 13311a" ' slowing down >strfctn_StartTemprScan< 'Me.Text &= " Version 13314a" ' correcting error in >Timer_SecondTick_Tick< around >i_RepeatFlag = 1< 'Me.Text &= " Version 13316a" ' changed pump stop: strStopPumpAddress(5) 'Me.Text &= " Version 13319a" ' handling error in >strfctn_StartTemprScan< 'Me.Text &= " Version 13320a" ' storing/fetching info in "C:\MowastEngineering\TECS_Data" 'Me.Text &= " Version 13323a" ' adding TECS_Display 'Me.Text &= " Version 13330a" ' improving TECS_Display 'Me.Text &= " Version 13331a" ' updating >strfctn_BurnerHeaterControl()< 'Me.Text &= " Version 13401b" ' updating >Subroutine_ThermoSolar()< 'Me.Text &= " Version 13407a" ' updating >strfctn_BurnerHeaterControl()< 'Me.Text &= " Version 13408b" ' preparing for >strfctn_RoomHeating()< 'Me.Text &= " Version 13409a" ' developing >strfctn_RoomHeating()< 'Me.Text &= " Version 13412a" ' adding DoubleSend in new >Ez.Slo_Bus_Test< 'Me.Text &= " Version 13416a" ' getting ready for two pump activation using >strfctn_SendDoubleEzBusCommand< 'Me.Text &= " Version 13417a" ' more two pump activation using >strfctn_SendDoubleEzBusCommand< 'Me.Text &= " Version 13419a" ' more >strfctn_RoomHeating< 'Me.Text &= " Version 13420a" ' changing some Names 'Me.Text &= " Version 13423a" ' cleaning up the main form 'Me.Text &= " Version 13424a" ' adding ability to read >StartParameters_13424.txt< 'Me.Text &= " Version 13425a" ' more adding ability to read >StartParameters_13424.txt< 'Me.Text &= " Version 13428a" ' more adding ability to read >StartParameters_13424.txt< 'Me.Text &= " Version 13429a" ' more adding ability to read >StartParameters_13424.txt< and improving 'Me.Text &= " Version 13430a" ' acting on >StartParameters_13424.txt< 'Me.Text &= " Version 13507a" ' adding >strfctn_HeatEnergySink()< 'Me.Text &= " Version 13509a" ' more adding >strfctn_HeatEnergySink()< 'Me.Text &= " Version 13511a" ' correction in >strfctn_HeatEnergySink()< : automatic shut off manual Dump 'Me.Text &= " Version 13513a" ' new/old version of >Ez.Slo_Bus_Test< 'Me.Text &= " Version 13519a" ' reorganizing start up procedure 'Me.Text &= " Version 13521a" ' showing Soll Secundary Source everytime 'Me.Text &= " Version 13522a" ' more showing Soll Secundary Source everytime and rearrangine temperature calculations 'Me.Text &= " Version 13525a" ' new version following changes in >AuxiliaryCalculation Version 13525a< 'Me.Text &= " Version 13531b" ' increased >Timer_TemperatureMeasurement.Interval< and added comments 'Me.Text &= " Version 13602b" ' changing more subs to functions 'Me.Text &= " Version 13604a" ' corrections in pump test dialog 'Me.Text &= " Version 13605b" ' removing comented listings; delay in valve test dialog 'Me.Text &= " Version 13616a" ' >sender.focus = False< in cbx_... - does not work 'Me.Text &= " Version 13617a" ' If e.KeyCode = Keys.Space Then in cbx_... 'Me.Text &= " Version 13812a" ' increasing ValveStatusInterrogation Interval 'Me.Text &= " Version 13820a" ' making >strfctn_ManipulateDataandPlot< more robust 'Me.Text &= " Version 13912a" ' improving >strfctn_ManipulateDataandPlot<; on error: use last Value 'Me.Text &= " Version 13914a" ' added external temperature offset see: >StartParameters_13914.txt< 'Me.Text &= " Version 13917a" ' >try< for >Instance_XY_Curves.fctn....< and >Instance_TECS_Display.str...< 'Me.Text &= " Version 13921a" ' making some of the errormessages more informative 'Me.Text &= " Version 13926a" ' CInt(txt_MinuteIndex.Text) + 1 prevents indexes from being zero. 'Me.Text &= " Version 13a07b" ' removed more >Call< 'Me.Text &= " Version 13a08b" ' more removed more >Call< 'Me.Text &= " Version 13a09a" ' more removed more >Call< which I forgot yesterday: >Call Instance_XY_Curves.fctnClearXYPlot() ' at Midnight< 'Me.Text &= " Version 13a16a" ' making Ez.Slo-Bus data communication more robust 'Me.Text &= " Version 13b02a" ' removed number manipulating error in >strfctn_ManipulateDataandPlot< 'Me.Text &= " Version 13b14a" ' adding >BUS_Time_out_Counter< and Ez.Slo_Bus reset 'Me.Text &= " Version 13b29a" ' increased >Timer_AuxiliaryTaskManager.Interval< to 300 mS in >strfctn_AutomaticGetValveStatus()< 'Me.Text &= " Version 13c18a" ' added waiting period in >strfctn_ThermoSolar< 'Me.Text &= " Version 13c30a" ' making >strfctn_ThermoSolar< more intelligent, also adding counter textbox 'Me.Text &= " Version 14108a" ' improving >strfctn_ThermoSolar< 'Me.Text &= " Version 14222a" ' adding default textboxes for >str_DEFAULTMINPUMPVALUE< in >strfctn_ThermoSolar< >"Cold_Start"< and >"StartingUp"< 'Me.Text &= " Version 14228a" ' correction in >strfctn_ThermoSolar< >"Monitoring"< 'Me.Text &= " Version 14401d" ' switch to Visual Studio Express 2013 'Me.Text &= " Version 14402a" ' >txt_Default_StartingUp.text< increased from "6" to "10" 'Me.Text &= " Version 14412a" ' improved version of >Ez.Slo_Bus_Test< 'Me.Text &= " Version 14415a without >XY_Curves<" ' without >XY_Curves< remove >' !"§< 'Me.Text &= " Version 14429a" ' removing >My.Application.DoEvents()< 'Me.Text &= " Version 14806a" ' Option: cooling primary heat exchanger 'Me.Text &= " Version 14807a" ' more Option: cooling primary heat exchanger 'Me.Text &= " Version 14a03a" ' Inclusion of >Ball Valve Actuator< 'Me.Text &= " Version 14a05a" ' Primary pump Max from 44 to 20 'Me.Text &= " Version 14a08b" ' Adding BallValveControl 'Me.Text &= " Version 14a11b" ' Adding >i_CummulativeBallValvePosition< 'Me.Text &= " Version 14a14a" ' Minimum Ball Valve Position during Heating set to 7 * 9 'Me.Text &= " Version 14a15a" ' Ball Valve Position when heater is ON 'Me.Text &= " Version 14a17a" ' Heating Pumps when heater is ON in standby 'Me.Text &= " Version 14a18a" ' Primary Pump and Ball Valve action on one task 'Me.Text &= " Version 14a20a" ' 45 => flt_MINBUFFERSOLLTEMPERATURE = 43, and some other corrections in >strfctn_RoomHeating()< Me.Text &= " Version 14a21a" ' some furhter corrections in >strfctn_RoomHeating()< ' 'str_CurrentDirectory = My.Computer.FileSystem.CurrentDirectory ' 20.03.2013 str_CurrentDirectory = "C:\MowastEngineering\TECS_Data" ' 20.03.2013 i_EXPECTEDTEMPRMODULES = CInt(txt_ExpTemprModule.Text) str_StartParameterText(1) = "Brennerautomatik ist" str_StartParameterText(2) = "Brenner ist" str_StartParameterText(3) = "Heizungssteuerung ist" str_StartParameterText(4) = "Automatische Dump ist" str_StartParameterText(5) = "Manueller Dump ist" str_StartParameterText(6) = "Primary Heizungspumpe Start ist" str_StartParameterText(7) = "Secundary Heizungspumpe Start ist" str_StartParameterText(8) = "Primary Dumppumpe Start ist" str_StartParameterText(9) = "Secundary Dumppumpe Start ist" str_StartParameterText(10) = "Primary OverflowDumppumpe Start ist" str_StartParameterText(11) = "Secundary OverflowDumppumpe Start ist" str_StartParameterText(12) = "Externe Temperatur Offset ist" str_StartParameterText(13) = "Heating InitialBallValvePosition ist" str_StartParameterText(14) = "Dump InitialBallValvePosition ist" str_StartParameterText(15) = "OverflowDump InitialBallValvePosition ist" str_StartParameterText(16) = "DeltaBallValvePosition ist" str_DiagnosticBufferZer = strfctn_GetInitialSystemParameter() Instance_DataDisp.Visible = True Instance_DataDisp.Visible = False Instance_XY_Curves.Visible = True Instance_XY_Curves.Visible = False Instance_EzSloBus.Visible = True ' makes sure the RS232 Interface COM is opened EzSloBusTestToolStripMenuItem.Checked = True 'Instance_EzSloBus.Visible = False Instance_HeatingSchedule.Visible = True Instance_HeatingSchedule.Visible = False Instance_TemperatureCalculation.Visible = True Instance_TemperatureCalculation.Visible = False Instance_TECS_Display.Visible = True Instance_TECS_Display.Visible = False Timer_SyncTick.Interval = 100 ' milliseconds Timer_SyncTick.Enabled = True Timer_MainClockSecondTick.Interval = 1000 ' milliseconds i.e. every second Timer_MainClockSecondTick.Enabled = False If i_ScanLoopEnabled = 1 Then ScanLoopToolStripMenuItem.Text = "Scan Loop is enabled" ScanLoopToolStripMenuItem.Checked = True Else ScanLoopToolStripMenuItem.Text = "Scan Loop is disabled" ScanLoopToolStripMenuItem.Checked = False End If str_FunctionReply = strfctn_ModuleSearchandIdentify() End Sub ' ######################################################################################################### Private Function strfctn_GetInitialSystemParameter() As String Dim i_StartParameterIndexCounter As Integer Dim str_PrimaryHeatingPumpStart As String Dim str_SecundaryHeatingPumpStart As String Dim str_PrimaryDumpPumpStart As String Dim str_SecundaryDumpPumpStart As String Dim str_PrimaryOverflowDumpPumpStart As String Dim str_SecundaryOverflowDumpPumpStart As String Dim str_Heating_InitialBallValvePosition As String Dim str_Dump_InitialBallValvePosition As String Dim str_OverflowDump_InitialBallValvePosition As String Dim str_DeltaBallValvePosition As String 'str_InitialSystemFile = str_CurrentDirectory & "\" & strInitFolderName & "\" & "StartParameters_13424.txt" 'str_InitialSystemFile = str_CurrentDirectory & "\" & strInitFolderName & "\" & "StartParameters_13914.txt" str_InitialSystemFile = str_CurrentDirectory & "\" & strInitFolderName & "\" & "StartParameters_14a08.txt" Try str_StartParameters = My.Computer.FileSystem.ReadAllText(str_InitialSystemFile) Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try i_StartParameterIndex(1) = InStr(1, str_StartParameters, str_StartParameterText(1)) i_ParameterIndexIst(1) = InStr(i_StartParameterIndex(1), str_StartParameters, "ist") i_ParameterIndexNicht(1) = i_ParameterIndexIst(1) + 4 i_EndParameterIndex(1) = InStr(i_StartParameterIndex(1), str_StartParameters, "#") 'For i_StartParameterIndexCounter = 2 To 11 Step 1 For i_StartParameterIndexCounter = 2 To (i_LENPARAMETERLIST - 1) Step 1 'i_StartParameterIndex(i_StartParameterIndexCounter) = InStr((i_StartParameterIndexCounter - 1), str_StartParameters, str_StartParameterText(i_StartParameterIndexCounter)) i_StartParameterIndex(i_StartParameterIndexCounter) = InStr(i_StartParameterIndex(i_StartParameterIndexCounter - 1), str_StartParameters, str_StartParameterText(i_StartParameterIndexCounter)) i_ParameterIndexIst(i_StartParameterIndexCounter) = InStr(i_StartParameterIndex(i_StartParameterIndexCounter), str_StartParameters, "ist") i_ParameterIndexNicht(i_StartParameterIndexCounter) = i_ParameterIndexIst(i_StartParameterIndexCounter) + 4 i_EndParameterIndex(i_StartParameterIndexCounter) = InStr(i_StartParameterIndex(i_StartParameterIndexCounter), str_StartParameters, "#") Next i_StartParameterIndexCounter cbx_BrennerAutomatic.Text = Mid(str_StartParameters, i_StartParameterIndex(i_BRENNERAUTOMATIC), (i_EndParameterIndex(i_BRENNERAUTOMATIC) - i_StartParameterIndex(i_BRENNERAUTOMATIC))) cbx_Brenner.Text = Mid(str_StartParameters, i_StartParameterIndex(i_BRENNERANAUS), (i_EndParameterIndex(i_BRENNERANAUS) - i_StartParameterIndex(i_BRENNERANAUS))) cbx_HeatingControll.Text = Mid(str_StartParameters, i_StartParameterIndex(i_HEIZUNGSSTEUERUNG), (i_EndParameterIndex(i_HEIZUNGSSTEUERUNG) - i_StartParameterIndex(i_HEIZUNGSSTEUERUNG))) cbx_AutomaticDump.Text = Mid(str_StartParameters, i_StartParameterIndex(i_AUTODUMP), (i_EndParameterIndex(i_AUTODUMP) - i_StartParameterIndex(i_AUTODUMP))) cbx_ManualDump.Text = Mid(str_StartParameters, i_StartParameterIndex(i_MANUDUMP), (i_EndParameterIndex(i_MANUDUMP) - i_StartParameterIndex(i_MANUDUMP))) Select Case Mid(str_StartParameters, i_ParameterIndexNicht(i_BRENNERAUTOMATIC), 5) Case str_FIVEDOTS cbx_BrennerAutomatic.Checked = True i_BrennerAutomaticFlag = 1 Case str_NICHT cbx_BrennerAutomatic.Checked = False i_BrennerAutomaticFlag = 0 Case Else End Select Select Case Mid(str_StartParameters, i_ParameterIndexNicht(i_BRENNERANAUS), 5) Case str_FIVEDOTS cbx_Brenner.Checked = True i_BrennerManualFlag = 1 'str_DummyText = strfctn_TurnHeaterOn() Case str_NICHT cbx_Brenner.Checked = False i_BrennerManualFlag = 0 'str_DummyText = strfctn_TurnHeaterOff() Case Else End Select Select Case Mid(str_StartParameters, i_ParameterIndexNicht(i_HEIZUNGSSTEUERUNG), 5) Case str_FIVEDOTS cbx_HeatingControll.Checked = True i_HeatingControlMasterFlag = 1 Case str_NICHT cbx_HeatingControll.Checked = False i_HeatingControlMasterFlag = 0 Case Else End Select Select Case Mid(str_StartParameters, i_ParameterIndexNicht(i_AUTODUMP), 5) Case str_FIVEDOTS cbx_AutomaticDump.Checked = True str_AutomaticDumpFlag = "I" Case str_NICHT cbx_AutomaticDump.Checked = False str_AutomaticDumpFlag = "O" Case Else End Select Select Case Mid(str_StartParameters, i_ParameterIndexNicht(i_MANUDUMP), 5) Case str_FIVEDOTS cbx_ManualDump.Checked = True str_ManualSolDumpFlag = "I" Case str_NICHT cbx_ManualDump.Checked = False str_ManualSolDumpFlag = "O" Case Else End Select str_PrimaryHeatingPumpStart = Mid(str_StartParameters, i_ParameterIndexIst(6) + 4, (i_EndParameterIndex(6) - (i_ParameterIndexIst(6) + 4))) str_SecundaryHeatingPumpStart = Mid(str_StartParameters, i_ParameterIndexIst(7) + 4, (i_EndParameterIndex(7) - (i_ParameterIndexIst(7) + 4))) str_PrimaryDumpPumpStart = Mid(str_StartParameters, i_ParameterIndexIst(8) + 4, (i_EndParameterIndex(8) - (i_ParameterIndexIst(8) + 4))) str_SecundaryDumpPumpStart = Mid(str_StartParameters, i_ParameterIndexIst(9) + 4, (i_EndParameterIndex(9) - (i_ParameterIndexIst(9) + 4))) str_PrimaryOverflowDumpPumpStart = Mid(str_StartParameters, i_ParameterIndexIst(10) + 4, (i_EndParameterIndex(10) - (i_ParameterIndexIst(10) + 4))) str_SecundaryOverflowDumpPumpStart = Mid(str_StartParameters, i_ParameterIndexIst(11) + 4, (i_EndParameterIndex(11) - (i_ParameterIndexIst(11) + 4))) i_InitialPrimaryHeatingPumpSpeed = CInt(str_PrimaryHeatingPumpStart) i_InitialSecundaryHeatingPumpSpeed = CInt(str_SecundaryHeatingPumpStart) i_InitialPrimaryDumpPumpSpeed = CInt(str_PrimaryDumpPumpStart) i_InitialSecundaryDumpPumpSpeed = CInt(str_SecundaryDumpPumpStart) i_InitialPrimaryOverflowDumpPumpSpeed = CInt(str_PrimaryOverflowDumpPumpStart) i_InitialSecundaryOverflowDumpPumpSpeed = CInt(str_SecundaryOverflowDumpPumpStart) lbl_ExternalTemperatureOffset.Text = Mid(str_StartParameters, i_StartParameterIndex(i_EXTTEMPOFFSET), (i_ParameterIndexIst(i_EXTTEMPOFFSET) - i_StartParameterIndex(i_EXTTEMPOFFSET) + 3)) txt_ExternalTemperatureOffset.Text = Mid(str_StartParameters, (i_ParameterIndexIst(i_EXTTEMPOFFSET) + 3), (i_EndParameterIndex(i_EXTTEMPOFFSET) - i_ParameterIndexIst(i_EXTTEMPOFFSET) - 3)) str_Heating_InitialBallValvePosition = Mid(str_StartParameters, i_ParameterIndexIst(13) + 4, (i_EndParameterIndex(13) - (i_ParameterIndexIst(13) + 4))) str_Dump_InitialBallValvePosition = Mid(str_StartParameters, i_ParameterIndexIst(14) + 4, (i_EndParameterIndex(14) - (i_ParameterIndexIst(14) + 4))) str_OverflowDump_InitialBallValvePosition = Mid(str_StartParameters, i_ParameterIndexIst(15) + 4, (i_EndParameterIndex(15) - (i_ParameterIndexIst(15) + 4))) str_DeltaBallValvePosition = Mid(str_StartParameters, i_ParameterIndexIst(16) + 4, (i_EndParameterIndex(16) - (i_ParameterIndexIst(16) + 4))) i_Heating_InitialBallValvePosition = Convert.ToInt32(str_Heating_InitialBallValvePosition) i_Dump_InitialBallValvePosition = Convert.ToInt32(str_Dump_InitialBallValvePosition) i_OverflowDump_InitialBallValvePosition = Convert.ToInt32(str_OverflowDump_InitialBallValvePosition) i_DeltaBallValvePosition = Convert.ToInt32(str_DeltaBallValvePosition) i_CummulativeBallValvePosition = i_Heating_InitialBallValvePosition strfctn_GetInitialSystemParameter = "finished getting parameters" ' these lines are for testing only and should be commented out for the final BUILD ! 'i_PrimaryPumpSpeed = 16 ''i_PrimaryPumpSpeed = 10 'i_PrimaryPumpSpeed = 3 'Select Case i_PrimaryPumpSpeed ' Case Is >= 16 ' i_BallValvePositionOffset = i_DeltaBallValvePosition ' Ball Valve will be opened one notch in >strfctn_SelectBallValvePosition< ' i_PrimaryPumpSpeed = 5 ' lowered because of Range Switching ' Case Is < 4 ' i_BallValvePositionOffset = (-1 * i_DeltaBallValvePosition) ' Ball Valve will be closed one notch in >strfctn_SelectBallValvePosition< ' i_PrimaryPumpSpeed = 14 ' increased because of Range Switching ' Case Else ' i_BallValvePositionOffset = 0 ' No action in Ball Valve Position 'End Select 'i_PrimaryPumpSpeed = 3 ' stop for test ' these lines are for testing only and should be commented out for the final BUILD ! End Function ' ######################################################################################################### ' ########################################################### ' cbx_.AutoCheck set to False ' ########################################################### Private Sub cbx_BrennerAutomatic_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles cbx_BrennerAutomatic.MouseClick Dim str_Reply As String Select Case cbx_BrennerAutomatic.Checked Case True Mid(str_StartParameters, i_ParameterIndexNicht(i_BRENNERAUTOMATIC)) = str_NICHT i_BrennerAutomaticFlag = 0 cbx_BrennerAutomatic.Checked = False Case False Mid(str_StartParameters, i_ParameterIndexNicht(i_BRENNERAUTOMATIC)) = str_FIVEDOTS i_BrennerAutomaticFlag = 1 cbx_BrennerAutomatic.Checked = True End Select cbx_BrennerAutomatic.Text = Mid(str_StartParameters, i_StartParameterIndex(i_BRENNERAUTOMATIC), (i_EndParameterIndex(i_BRENNERAUTOMATIC) - i_StartParameterIndex(i_BRENNERAUTOMATIC))) str_Reply = strftcn_StoreStartParameters() End Sub '' ######################################################################################################### ' ########################################################### ' ########################################################### ' ########################################################### Private Sub cbx_BrennerAutomatic_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles cbx_BrennerAutomatic.KeyUp Dim str_Reply As String 'handles key.space when cbx_... is focussed! nothing must happen!!!! str_Reply = "Dummy Line" End Sub ' ########################################################### ' ########################################################### Private Sub cbx_Brenner_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles cbx_Brenner.KeyUp Dim str_Reply As String 'handles key.space when cbx_... is focussed! nothing must happen!!!! str_Reply = "Dummy Line" End Sub ' ########################################################### Private Sub cbx_Brenner_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles cbx_Brenner.MouseClick Dim str_Reply As String Dim str_BrennerDummy As String Select Case cbx_Brenner.Checked Case True Mid(str_StartParameters, i_ParameterIndexNicht(i_BRENNERANAUS)) = str_NICHT If cbx_BrennerAutomatic.Checked = True Then ' Nothing; Brenner stayes ON! Else str_BrennerDummy = strfctn_TurnHeaterOff() str_EWFE_ThermeStatus = str_BrennerDummy End If cbx_Brenner.Checked = False Case False Mid(str_StartParameters, i_ParameterIndexNicht(i_BRENNERANAUS)) = str_FIVEDOTS str_BrennerDummy = strfctn_TurnHeaterOn() str_EWFE_ThermeStatus = str_BrennerDummy cbx_Brenner.Checked = True End Select cbx_Brenner.Text = Mid(str_StartParameters, i_StartParameterIndex(i_BRENNERANAUS), (i_EndParameterIndex(i_BRENNERANAUS) - i_StartParameterIndex(i_BRENNERANAUS))) str_Reply = strftcn_StoreStartParameters() End Sub ' ########################################################### ' ########################################################### ' ######################################################################################################### ' ########################################################### Private Sub cbx_HeatingControll_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles cbx_HeatingControll.KeyUp Dim str_Reply As String 'handles key.space when cbx_... is focussed! nothing must happen!!!! str_Reply = "Dummy Line" End Sub ' ########################################################### ' ########################################################### Private Sub cbx_HeatingControll_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles cbx_HeatingControll.MouseClick Dim str_Reply As String Select Case cbx_HeatingControll.Checked Case True Mid(str_StartParameters, i_ParameterIndexNicht(i_HEIZUNGSSTEUERUNG)) = str_NICHT i_HeatingControlMasterFlag = 0 cbx_HeatingControll.Checked = False Case False Mid(str_StartParameters, i_ParameterIndexNicht(i_HEIZUNGSSTEUERUNG)) = str_FIVEDOTS i_HeatingControlMasterFlag = 1 cbx_HeatingControll.Checked = True End Select cbx_HeatingControll.Text = Mid(str_StartParameters, i_StartParameterIndex(i_HEIZUNGSSTEUERUNG), (i_EndParameterIndex(i_HEIZUNGSSTEUERUNG) - i_StartParameterIndex(i_HEIZUNGSSTEUERUNG))) str_Reply = strftcn_StoreStartParameters() End Sub ' ########################################################### ' ######################################################################################################### ' ########################################################### Private Sub cbx_AutomaticDump_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles cbx_AutomaticDump.KeyUp Dim str_Reply As String 'handles key.space when cbx_... is focussed! nothing must happen!!!! str_Reply = "Dummy Line" End Sub ' ########################################################### ' ########################################################### Private Sub cbx_AutomaticDump_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles cbx_AutomaticDump.MouseClick Dim str_Reply As String Select Case cbx_AutomaticDump.Checked Case True Mid(str_StartParameters, i_ParameterIndexNicht(i_AUTODUMP)) = str_NICHT str_AutomaticDumpFlag = "O" cbx_AutomaticDump.Checked = False Case False Mid(str_StartParameters, i_ParameterIndexNicht(i_AUTODUMP)) = str_FIVEDOTS str_AutomaticDumpFlag = "I" cbx_AutomaticDump.Checked = True End Select cbx_AutomaticDump.Text = Mid(str_StartParameters, i_StartParameterIndex(i_AUTODUMP), (i_EndParameterIndex(i_AUTODUMP) - i_StartParameterIndex(i_AUTODUMP))) str_Reply = strftcn_StoreStartParameters() End Sub ' ########################################################### ' ######################################################################################################### ' ########################################################### Private Sub cbx_ManualDump_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles cbx_ManualDump.KeyUp Dim str_Reply As String 'handles key.space when cbx_... is focussed! nothing must happen!!!! str_Reply = "Dummy Line" End Sub ' ########################################################### ' ########################################################### Private Sub cbx_ManualDump_MouseClick(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles cbx_ManualDump.MouseClick Dim str_Reply As String Select Case cbx_ManualDump.Checked Case True Mid(str_StartParameters, i_ParameterIndexNicht(i_MANUDUMP)) = str_NICHT str_ManualSolDumpFlag = "O" cbx_ManualDump.Checked = False Case False Mid(str_StartParameters, i_ParameterIndexNicht(i_MANUDUMP)) = str_FIVEDOTS str_ManualSolDumpFlag = "I" cbx_ManualDump.Checked = True End Select cbx_ManualDump.Text = Mid(str_StartParameters, i_StartParameterIndex(i_MANUDUMP), (i_EndParameterIndex(i_MANUDUMP) - i_StartParameterIndex(i_MANUDUMP))) str_Reply = strftcn_StoreStartParameters() End Sub ' ########################################################### Private Sub txt_ExternalTemperatureOffset_Leave(sender As Object, e As System.EventArgs) Handles txt_ExternalTemperatureOffset.Leave Dim str_Reply As String Dim i_CommaPosition As Integer If Len(txt_ExternalTemperatureOffset.Text) > (i_EndParameterIndex(i_EXTTEMPOFFSET) - i_ParameterIndexIst(i_EXTTEMPOFFSET) - 4) Then MessageBox.Show("Text too long", "Warning") Else i_CommaPosition = InStr(txt_ExternalTemperatureOffset.Text, ",") If i_CommaPosition = 0 Then Mid(str_StartParameters, (i_ParameterIndexIst(i_EXTTEMPOFFSET) + 3)) = Space(i_EndParameterIndex(i_EXTTEMPOFFSET) - (i_ParameterIndexIst(i_EXTTEMPOFFSET) + 3)) Mid(str_StartParameters, (i_ParameterIndexIst(i_EXTTEMPOFFSET) + 4), (i_EndParameterIndex(i_EXTTEMPOFFSET) - i_ParameterIndexIst(i_EXTTEMPOFFSET) - 4)) = txt_ExternalTemperatureOffset.Text str_Reply = strftcn_StoreStartParameters() Else MessageBox.Show("Bitte Dezimalpunkt verwenden.", "Warning") End If End If End Sub ' ########################################################### ' ########################################################### ' ########################################################### Private Function strftcn_StoreStartParameters() As String Try My.Computer.FileSystem.WriteAllText(str_InitialSystemFile, str_StartParameters, False) Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try strftcn_StoreStartParameters = "Done Storing" End Function ' ######################################################################################################### Private Sub frm_ThermalEnergyControlSystem_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim i_Eye As Integer OrigBackColor = Me.BackColor ' ##################### used in >MainClock< ####################################### strMonth(1) = ". Jan. " strMonth(2) = ". Feb. " strMonth(3) = ". Mär. " strMonth(4) = ". Apr. " strMonth(5) = ". Mai " strMonth(6) = ". Jun. " strMonth(7) = ". Jul. " strMonth(8) = ". Aug. " strMonth(9) = ". Sep. " strMonth(10) = ". Okt. " strMonth(11) = ". Nov. " strMonth(12) = ". Dez. " I_Month_Length(0) = 0 I_Month_Length(1) = 31 I_Month_Length(2) = 28 I_Month_Length(3) = 31 I_Month_Length(4) = 30 I_Month_Length(5) = 31 I_Month_Length(6) = 30 I_Month_Length(7) = 31 I_Month_Length(8) = 31 I_Month_Length(9) = 30 I_Month_Length(10) = 31 I_Month_Length(11) = 30 I_Month_Length(12) = 31 ' ############################################################ txt_SolarMonitor.Text = str_SolarStatusEchelon For i_Eye = 0 To i_NUMBEROFTRACKS Step 1 sgl_OldThermalValue(i_Eye) = 0.0 sgl_ActualThermalValue(i_Eye) = 0.0 Next i_Eye Instance_SolarCalc.MainTakt.Enabled = False 'Call Class_SolarCalc.Sonnenstand_Berechnung("08:00:00", "21.06.2006", "0", str_Home_Nord, str_Home_East, _ ' sgl_SOLARTHERMOSTART, sgl_SOLARTHERMOEND) 'txt_ElevationAngle.Text = Class_SolarCalc.sgl_F_ElevationAngle.ToString & " °" 'txt_Azimut.Text = Class_SolarCalc.sgl_F_Azimut_Result.ToString & " °" End Sub ' ########################################################### ' ########################################################### Private Sub Timer_SyncTick_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_SyncTick.Tick If (iTempratureModuleRegisteredFlag = 1 And i_ScanLoopEnabled = 1) Then i_DoScanFlag = 1 Else i_DoScanFlag = 0 End If Date_PresentTime = Now ' ####### str_DiagnosticBufferZer = strfctn_SetMinuteandDayIndices() If Date_PresentTime.Second = 0 Then i_SecondTick = -1 ' incremented by 1 in >Private Sub Timer_SecondTick_Tick(...)< lbl_Sync.Visible = False Timer_MainClockSecondTick.Enabled = True ' disabled in >Timer_SecondTick_Tick< Timer_SyncTick.Enabled = False ' enabled in >Timer_SecondTick_Tick< i_RepeatFlag = 1 Else lbl_Sync.Visible = True lbl_Sync.ForeColor = Color.Red End If End Sub ' ########################################################### ' ########################################################### ' This is the main task; it is synchronized every minute by >Timer_SyncTick.Tick< ' ########################################################### Private Sub Timer_MainClockSecondTick_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_MainClockSecondTick.Tick Dim str_DummyText As String Dim i_SyncTick As Integer = 56 'Seconds Dim strBuffer As String = String.Empty Static i_BUS_Time_out_Counter As Integer i_SecondTick += 1 ' the second is counted "manually" as not to miss any second ticks If i_SecondTick > i_SyncTick Then ' 31.01.2013 Timer_MainClockSecondTick.Enabled = False Timer_SyncTick.Enabled = True Else End If Date_PresentTime = Now ' ####### str_DiagnosticBufferZer = strfctn_SetMinuteandDayIndices() ' ####### str_DiagnosticBufferZer = strfctn_CreateFoldersandFiles() ' MainClock Taskmanager Select Case i_SecondTick Case 0 txt_Zeitpunkt.BackColor = Color.Black txt_Zeitpunkt.ForeColor = Color.Yellow ' the writing str_DiagnosticBufferTwo = strfctn_MinuteBeginning() If (i_DoScanFlag = 1) Then str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand("?", "") ' Clears Ez.Bus and also Tests RS232 Communication Case 1 If (i_DoScanFlag = 1) Then Select Case i_BrennerManualFlag Case 0 str_DummyText = strfctn_TurnHeaterOff() str_EWFE_ThermeStatus = str_DummyText i_BrennerManualFlag = 3 Case 1 str_DummyText = strfctn_TurnHeaterOn() str_EWFE_ThermeStatus = str_DummyText i_BrennerManualFlag = 3 Case 3 Case Else MessageBox.Show("Select Error in >?*?<", "Warning") End Select End If str_SecondTickEchelon = "FirstTask" i_RepeatFlag = 0 Case 2 ' second chance If i_RepeatFlag = 1 Then str_SecondTickEchelon = "FirstTask" i_RepeatFlag = 0 End If End Select If (i_DoScanFlag = 1) Then Select Case str_SecondTickEchelon Case "FirstTask" str_SecondTickEchelon = String.Empty Me.Cursor = Cursors.AppStarting pnl_SystemParameters.Visible = False btn_SetSpeedofHeatingPumps.Visible = False txt_Zeitpunkt.BackColor = Color.Brown txt_Zeitpunkt.ForeColor = Color.White ' the writing If (strTemprModuleAddress(1) <> "X") Then str_SecondTickEchelon = strfctn_StartTemprScan(strTemprModuleAddress(1), 0, iSTORINGFLAG) ' of Temperature Sensor Else str_SecondTickEchelon = "SecondTask" End If Me.Cursor = Cursors.Default Case "SecondTask" str_SecondTickEchelon = String.Empty Me.Cursor = Cursors.AppStarting txt_Zeitpunkt.BackColor = Color.Red txt_Zeitpunkt.ForeColor = Color.Yellow ' the writing If (strTemprModuleAddress(2) <> "X") Then str_SecondTickEchelon = strfctn_StartTemprScan(strTemprModuleAddress(2), 6, iSTORINGFLAG) ' of Temperature Sensor Else str_SecondTickEchelon = "ThirdTask" End If Me.Cursor = Cursors.Default Case "ThirdTask" str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Orange txt_Zeitpunkt.ForeColor = Color.Black ' the writing str_SecondTickEchelon = strfctn_CalculateDiverseTemperatures() If i_PowerSwitchPresentFlag = 1 And i_BrennerAutomaticFlag = 1 Then str_SecondTickEchelon = strfctn_BurnerHeaterControl() ' Call Task_BurnerHeaterControl() Else str_SecondTickEchelon = "FourthTask" End If Case "FourthTask" str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Yellow txt_Zeitpunkt.ForeColor = Color.Black ' the writing ' moved to >NinethTask< 'If DisplayCurvesToolStripMenuItem.Checked = True Then ' 'Call Instance_XY_Curves.fctn_RefreshPlot() ' ' +++13917+++++++++++++++++++++++++++++++++ ' Try ' 'Call Instance_XY_Curves.fctn_RefreshPlot() ' strBuffer = Instance_XY_Curves.strfctn_RefreshPlot() ' Catch ex As Exception ' MessageBox.Show(ex.Message, "Warnung01 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) ' End Try ' ' +++++++++++++++++++++++++++++++++++++++++ 'End If If i_PumpControllerPresentFlag = 1 Then str_SecondTickEchelon = strfctn_SolarControl() ' Call Task_SolarControl() Else str_SecondTickEchelon = "FifthTask" End If Case "FifthTask" ' str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Green txt_Zeitpunkt.ForeColor = Color.White ' the writing str_SecondTickEchelon = strfctn_HeatEnergySink() ' strfctn_HeatEnergySink = "FiveandahalfTask" Case "FiveandahalfTask" str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Cyan txt_Zeitpunkt.ForeColor = Color.Black ' the writing If i_BallValveControllerPresentFlag = 1 Then If int_HeatingActiveFlag = 1 Or int_SolDumpFlag = 1 Or int_ManualSolDumpFlag = 1 Then ' defined in strfctn_HeatEnergySink() ' open Ball Valve 'str_DummyText = strfctn_SendSingleEzBusCommand(strBalValve_C_trolModuleAddress(i_MAINBALLVALVEINDEX), "P50") str_DummyText = strfctn_SendSingleEzBusCommand(strBalValve_C_trolModuleAddress(i_MAINBALLVALVEINDEX), "P" & strfctn_SelectBallValvePosition()) Instance_TECS_Display.txt_BallValve.Text = (strfctn_SelectBallValvePosition()) Else ' close Ball Valve str_DummyText = strfctn_SendSingleEzBusCommand(strBalValve_C_trolModuleAddress(i_MAINBALLVALVEINDEX), "P0") 'closes Ball Valve i_CummulativeBallValvePosition = i_Heating_InitialBallValvePosition ' redefine txt_BallValveStatus.Text = "0" Instance_TECS_Display.txt_BallValve.Text = ("0") End If Else txt_BallValveStatus.Text = "????" Instance_TECS_Display.txt_BallValve.Text = ("???") End If ' end of >If i_BallValveControllerPresentFlag = 1 Then< str_SecondTickEchelon = "SixthTask" Case "SixthTask" 'str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Blue txt_Zeitpunkt.ForeColor = Color.Yellow ' the writing If i_HeatValveCntrModulePresentFlag = 1 Then If str_HeatingPattern <> str_PresentValveStatus(0) Then i_DelayCounter = 10 ' Wait of 10 seconds str_SecondTickEchelon = strfctn_AutomaticSetValvePosition() ' Call Task_AutomaticSetValvePosition() Else i_DelayCounter = 0 str_SecondTickEchelon = "SeventhTask" End If Else i_DelayCounter = 0 str_SecondTickEchelon = "SeventhTask" End If Case "SeventhTask" ' DELAY str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Violet txt_Zeitpunkt.ForeColor = Color.Yellow ' the writing If i_DelayCounter = 0 Then str_SecondTickEchelon = "EighthTask" Else i_DelayCounter -= 1 str_SecondTickEchelon = "SeventhTask" End If Case "EighthTask" Me.Cursor = Cursors.Default txt_Zeitpunkt.BackColor = Color.Gray txt_Zeitpunkt.ForeColor = Color.Yellow ' the writing If i_HeatValveCntrModulePresentFlag = 1 Then str_SecondTickEchelon = strfctn_AutomaticGetValveStatus() ' Call Task_AutomaticGetValveStatus() Else str_SecondTickEchelon = "NinethTask" End If Case "NinethTask" ' stops Solar Pump str_SecondTickEchelon = String.Empty txt_Zeitpunkt.BackColor = Color.Black txt_Zeitpunkt.ForeColor = Color.White ' the writing If strStopPumpAddress(I_SOLARPUMP) <> String.Empty Then str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strStopPumpAddress(I_SOLARPUMP), str_STOPPUMPCOMMAND) ' stop Try str_DiagnosticBufferZer = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), str_PUMPNULL) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung02 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try strStopPumpAddress(I_SOLARPUMP) = String.Empty End If If DisplayCurvesToolStripMenuItem.Checked = True Then Try strBuffer = Instance_XY_Curves.strfctn_RefreshPlot() Catch ex As Exception MessageBox.Show(ex.Message, "Warnung01 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try End If str_SecondTickEchelon = "TenthTask" Case "TenthTask" ' Stops Primary and Secundary Heating Pumps txt_Zeitpunkt.BackColor = Color.White txt_Zeitpunkt.ForeColor = Color.Black ' the writing If strStopPumpAddress(I_PRIMARYHEATINGPUMP) <> String.Empty And strStopPumpAddress(I_SECUNDARYHEATINGPUMP) <> String.Empty Then ' Write to SystemDisplay !!!! str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strStopPumpAddress(I_PRIMARYHEATINGPUMP), str_STOPPUMPCOMMAND, strStopPumpAddress(I_SECUNDARYHEATINGPUMP), (str_STOPPUMPCOMMAND)) Try str_DiagnosticBufferZer = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), str_PUMPNULL) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung03 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++13917+++++++++++++++++++++++++++++++++ Try str_DiagnosticBufferZer = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), str_PUMPNULL) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung04 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = str_PUMPNULL txt_SecundaryPumpSpeed.Text = str_PUMPNULL strStopPumpAddress(I_PRIMARYHEATINGPUMP) = String.Empty strStopPumpAddress(I_SECUNDARYHEATINGPUMP) = String.Empty End If If strStopPumpAddress(I_PRIMARYHEATINGPUMP) <> String.Empty And strStopPumpAddress(I_SECUNDARYHEATINGPUMP) = String.Empty Then ' Write to SystemDisplay !!!! str_DiagnosticBufferZer = strfctn_SendSingleEzBusCommand(strStopPumpAddress(I_PRIMARYHEATINGPUMP), str_STOPPUMPCOMMAND) ' "S0" Try str_DiagnosticBufferZer = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), str_PUMPNULL) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung03a >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = str_PUMPNULL strStopPumpAddress(I_PRIMARYHEATINGPUMP) = String.Empty End If str_SecondTickEchelon = "EleventhTask" Case "EleventhTask" pnl_SystemParameters.Visible = True btn_SetSpeedofHeatingPumps.Visible = True If Instance_EzSloBus.str_BUS_Time_Out_Flag = "Set" Then txt_BUS_Time_out_Counter.BackColor = Color.Black str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand("O", "") ' Turns OFF Module Power i_BUS_Time_out_Counter += 1 txt_BUS_Time_out_Counter.Text = i_BUS_Time_out_Counter.ToString End If str_SecondTickEchelon = "TwelfthTask" Case "TwelfthTask" If Instance_EzSloBus.str_BUS_Time_Out_Flag = "Set" Then Instance_EzSloBus.str_BUS_Time_Out_Flag = "Clear" txt_BUS_Time_out_Counter.BackColor = Color.White str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand("I", "") ' Turns ON Module Power End If str_SecondTickEchelon = "EndTask" Case Else End Select Else str_SecondTickEchelon = String.Empty End If ' End of >If (i_DoScanFlag = 1) Then< End Sub ' ########################################################### Private Function strfctn_SetMinuteandDayIndices() As String Dim iCounter As Integer Dim I_Day_Sum As Integer I_MESZ_Fahne = CInt(Date_PresentTime.IsDaylightSavingTime()) strJahr = Date_PresentTime.Year.ToString If Date_PresentTime.Month < 10 Then strMonat = "0" & Date_PresentTime.Month.ToString Else strMonat = Date_PresentTime.Month.ToString End If strTag = Date_PresentTime.Day.ToString If Date_PresentTime.Day < 10 Then strTag = "0" & Date_PresentTime.Day.ToString Else strTag = Date_PresentTime.Day.ToString End If Dim strFillHour As String = "" Dim strFillMinute As String = "" Dim strFillSecond As String = "" If (Len(Date_PresentTime.Hour.ToString) = 1) Then strFillHour = "0" If (Len(Date_PresentTime.Minute.ToString) = 1) Then strFillMinute = "0" If (Len(Date_PresentTime.Second.ToString) = 1) Then strFillSecond = "0" txt_Zeitpunkt.Text = strFillHour & Date_PresentTime.Hour.ToString & _ ":" & strFillMinute & Date_PresentTime.Minute.ToString & _ ":" & strFillSecond & Date_PresentTime.Second.ToString txt_Datum.Text = Date_PresentTime.Day.ToString & strMonth(Date_PresentTime.Month) & Date_PresentTime.Year.ToString str_Datum_Numbers = strTag & "." & strMonat & "." & Date_PresentTime.Year.ToString I_Day_Sum = 0 For iCounter = 1 To (Date_PresentTime.Month) Step 1 I_Day_Sum = I_Day_Sum + I_Month_Length(iCounter - 1) Next iCounter I_Day_Sum = I_Day_Sum + Date_PresentTime.Day If ((Date_PresentTime.Year Mod 4) = 0) And (Date_PresentTime.Month > 2) Then I_Day_Sum = I_Day_Sum + 1 End If txt_CalenderIndex.Text = I_Day_Sum.ToString txt_MinuteIndex.Text = ((Date_PresentTime.Hour * 60) + Date_PresentTime.Minute).ToString strfctn_SetMinuteandDayIndices = "finished SetMinuteandDayIndices" End Function ' ########################################################### Private Function strfctn_SelectBallValvePosition() As String Dim i_BallValvePositionValue As Integer If int_HeatingActiveFlag = 1 Then Select Case str_EWFE_ThermeStatus Case "Heater in OFF" i_CummulativeBallValvePosition += i_BallValvePositionOffset If i_CummulativeBallValvePosition > i_MAXBALLVALVEVALUE Then i_CummulativeBallValvePosition = i_MAXBALLVALVEVALUE ' 125 * 9 = 1125 MAX End If If i_CummulativeBallValvePosition < i_DEFAULTBALLVALVEVALUE Then i_CummulativeBallValvePosition = i_DEFAULTBALLVALVEVALUE ' MIN 7 * 9 = 63 Valve a little open End If i_BallValvePositionValue = i_CummulativeBallValvePosition Case "Heater in ON" i_BallValvePositionValue = i_DEFAULTBALLVALVEVALUE i_CummulativeBallValvePosition = i_Heating_InitialBallValvePosition i_BallValvePositionOffset = 0 Case Else MessageBox.Show("Select Error in >strfctn_SelectBallValvePosition()<", "Warning") End Select End If ' end of >If int_HeatingActiveFlag = 1 Then< If int_SolDumpFlag = 1 Then i_BallValvePositionValue = i_Dump_InitialBallValvePosition End If If int_ManualSolDumpFlag = 1 Then i_BallValvePositionValue = i_OverflowDump_InitialBallValvePosition End If txt_BallValveStatus.Text = ("9*" & Convert.ToString(i_BallValvePositionValue)) ' for a half turn on the ball valve driver strfctn_SelectBallValvePosition = Convert.ToString(i_BallValvePositionValue) End Function ' ########################################################### Private Function strfctn_CreateFoldersandFiles() As String Dim str_AnswerOne As String strTodaysDataFileName = strDataFileNameBeginning & strJahr & strMonat & strTag & strFileNameEnding strTodaysProtocolFileName = strProtocolFileNameBeginning & strJahr & strMonat & strTag & strFileNameEnding strDataFilePathName = str_CurrentDirectory strDataFilePathName &= "\" & strDataFolderName & "\" & strTodaysDataFileName strProtocolFilePathName = str_CurrentDirectory strProtocolFilePathName &= "\" & strProtocolFolderName & "\" & strTodaysProtocolFileName If i_DataFileCreatedFlag = 0 Then ' is "0" at the beginning and is i_DataFileCreatedFlag = 1 ' set to "0" at midnight Try My.Computer.FileSystem.CreateDirectory(str_CurrentDirectory & "\" & strDataFolderName) Catch ex As Exception MessageBox.Show(ex.Message) End Try Try ' creating file the first time My.Computer.FileSystem.WriteAllText(strDataFilePathName, vbCrLf & "Mowast Engineering Temperature Data" & vbCrLf, False) Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try If ProtocolToolStripMenuItem.Checked = True Then str_AnswerOne = strfctn_CreateProtocolFolderandFile() End If End If ' end of >If i_DataFileCreatedFlag = 0 Then< 'If i_DataFileCreatedFlag = 0 Then ' i_DataFileCreatedFlag = 1 ' set to "0" at midnight ' Dim fs As IO.FileStream ' Dim sw As IO.StreamWriter ' Try ' fs = New IO.FileStream(strDataFilePathName, IO.FileMode.Create) ' sw = New IO.StreamWriter(fs) ' sw.Close() ' Catch ex As Exception ' MessageBox.Show(ex.Message) ' End Try ' Try ' fs = New IO.FileStream(strProtocolFilePathName, IO.FileMode.Create) ' sw = New IO.StreamWriter(fs) ' sw.Close() ' Catch ex As Exception ' MessageBox.Show(ex.Message) ' End Try 'End If ' ######## strfctn_CreateFoldersandFiles = "finished CreateFoldersandFiles" End Function ' ########################################################### Private Function strfctn_RoomHeating() As String Dim str_strfctnReply As String Beep() Select Case str_RoomHeatingEchelon Case "Starting RoomHeating" str_RoomHeatingEchelon = "Control Heating" i_PrimaryPumpSpeed = i_InitialPrimaryHeatingPumpSpeed Case "Control Heating" Select Case str_EWFE_ThermeStatus Case "Heater in OFF" If flt_Supply_Ist_Temperature > (flt_Supply_Minimum_Soll_Temperature + 0.5) Then i_PrimaryPumpSpeed -= 1 End If If flt_Supply_Ist_Temperature < (flt_Supply_Minimum_Soll_Temperature - 0.5) Then i_PrimaryPumpSpeed += 1 End If Select Case i_PrimaryPumpSpeed Case Is >= 16 i_BallValvePositionOffset = i_DeltaBallValvePosition ' Ball Valve will be opened one notch in >strfctn_SelectBallValvePosition< i_PrimaryPumpSpeed = 5 ' lowered because of Range Switching Case Is < 4 i_BallValvePositionOffset = (-1 * i_DeltaBallValvePosition) ' Ball Valve will be closed one notch in >strfctn_SelectBallValvePosition< i_PrimaryPumpSpeed = 14 ' increased because of Range Switching Case Else ' i.e. i_PrimaryPumpSpeed < 16 and i_PrimaryPumpSpeed >= 4 i_BallValvePositionOffset = 0 ' No action in Ball Valve Position End Select Case "Heater in ON" i_PrimaryPumpSpeed = i_InitialPrimaryHeatingPumpSpeed Case Else MessageBox.Show("Select Error 2 in >strfctn_RoomHeating<", "Warning") End Select Case Else MessageBox.Show("Select Error 1 in >strfctn_RoomHeating<", "Warning") End Select str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP), ("S" & i_PrimaryPumpSpeed.ToString), _ strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP), ("S" & i_InitialSecundaryHeatingPumpSpeed.ToString)) 'str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_PrimaryPumpSpeed.ToString) ' +++13917+++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_PrimaryPumpSpeed.ToString) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung05 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_InitialSecundaryHeatingPumpSpeed.ToString) ' +++13917+++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_InitialSecundaryHeatingPumpSpeed.ToString) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung06 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = i_PrimaryPumpSpeed.ToString txt_SecundaryPumpSpeed.Text = i_InitialSecundaryHeatingPumpSpeed.ToString strfctn_RoomHeating = "Heating" End Function ' ########################################################### ' ########################################################### Private Function strfctn_SolarDumpOverflow() As String Dim str_strfctnReply As String Select Case str_OverflowDumpEchelon Case "Starting Overflow" str_OverflowDumpEchelon = "Control Dumping" i_PrimaryPumpSpeed = i_InitialPrimaryOverflowDumpPumpSpeed Case "Control Dumping" If sgl_SolarHotValueENN < 94.7 Then i_PrimaryPumpSpeed -= 1 End If If sgl_SolarHotValueENN > 95.3 Then i_PrimaryPumpSpeed += 1 End If Case Else End Select If i_PrimaryPumpSpeed > 40 Then i_PrimaryPumpSpeed = 40 ' Limit of Maximum Pump Speed If i_PrimaryPumpSpeed < 3 Then i_PrimaryPumpSpeed = 3 ' Limit of Minimum Pump Speed str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP), ("S" & i_PrimaryPumpSpeed.ToString), _ strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP), ("S" & i_InitialSecundaryOverflowDumpPumpSpeed.ToString)) 'str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_PrimaryPumpSpeed.ToString) ' +++13917+++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_PrimaryPumpSpeed.ToString) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung07 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_InitialSecundaryOverflowDumpPumpSpeed.ToString) ' +++13917+++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_InitialSecundaryOverflowDumpPumpSpeed.ToString) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung08 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = i_PrimaryPumpSpeed.ToString txt_SecundaryPumpSpeed.Text = i_InitialSecundaryOverflowDumpPumpSpeed.ToString strfctn_SolarDumpOverflow = "Overflowdump started" End Function ' ########################################################### Private Function strfctn_ManualDump() As String Dim str_strfctnReply As String i_PrimaryPumpSpeed = i_InitialPrimaryDumpPumpSpeed If i_PrimaryPumpSpeed > 40 Then i_PrimaryPumpSpeed = 40 ' Limit of Maximum Pump Speed If i_PrimaryPumpSpeed < 3 Then i_PrimaryPumpSpeed = 3 ' Limit of Minimum Pump Speed str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP), ("S" & i_PrimaryPumpSpeed.ToString), _ strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP), ("S" & i_InitialSecundaryDumpPumpSpeed.ToString)) 'str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_PrimaryPumpSpeed.ToString) ' +++13917+++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_PrimaryPumpSpeed.ToString) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung09 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_InitialSecundaryDumpPumpSpeed.ToString) ' +++13917+++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), i_InitialSecundaryDumpPumpSpeed.ToString) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung10 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = i_PrimaryPumpSpeed.ToString txt_SecundaryPumpSpeed.Text = i_InitialSecundaryDumpPumpSpeed.ToString strfctn_ManualDump = "Dumping manually" End Function ' ########################################################### Private Function strfctn_StopBothPumps() As String Dim str_strfctnReply As String If txt_CoolingFlag.Text = "OFF" Then str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP), (str_SLOWPUMPCOMMAND), _ strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP), (str_SLOWPUMPCOMMAND)) ' +++++++++++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), str_SLOWPUMP) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung11 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), str_SLOWPUMP) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung12 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = str_SLOWPUMP txt_SecundaryPumpSpeed.Text = str_SLOWPUMP i_DelayCounter = 10 ' Flags to stop both pumps in "Tenthtask" !!!!!! strStopPumpAddress(I_PRIMARYHEATINGPUMP) = strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP) strStopPumpAddress(I_SECUNDARYHEATINGPUMP) = strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP) Else ' i.e. txt_CoolingFlag.Text = "ON" str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP), (str_SLOWPUMPCOMMAND), _ strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP), "S" & (txt_PrimaryCoolingValue.Text)) ' +++++++++++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), str_SLOWPUMP) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung11a >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ Try str_strfctnReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), txt_PrimaryCoolingValue.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung12a >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ txt_PrimaryPumpSpeed.Text = str_SLOWPUMP txt_SecundaryPumpSpeed.Text = txt_PrimaryCoolingValue.Text i_DelayCounter = 10 ' Flags to stop only primary pump in "Tenthtask" !!!!!! strStopPumpAddress(I_PRIMARYHEATINGPUMP) = strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP) strStopPumpAddress(I_SECUNDARYHEATINGPUMP) = String.Empty End If ' end of >If txt_CoolingFlag.Text = "OFF" Then< strfctn_StopBothPumps = "Stopping" End Function ' ########################################################### Private Function strfctn_HeatEnergySink() As String Dim str_TextBuffer As String Dim str_Reply As String Dim str_HeatingRange As String = String.Empty If flt_Corrected_External_Ist_Temperature >= 13.0 And flt_Corrected_External_Ist_Temperature <= 13.5 Then Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Orange Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Black End If 'If str_HeatingFlag = "I" And flt_Corrected_External_Ist_Temperature < (13.5 + flt_ExternalIstTemperatureHyterese) And i_HeatingControlMasterFlag = 1 Then ' Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Red ' Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Yellow ' int_HeatingActiveFlag = 1 ' ' Do Action "A" ' str_TextBuffer = strfctn_RoomHeating() 'Else ' If int_HeatingActiveFlag = 1 Then ' str_RoomHeatingEchelon = "Starting RoomHeating" ' Initialization for next go-around ' int_HeatingActiveFlag = 0 ' int_FlagBothPumpsOff = 1 ' End If ' Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Blue ' Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Yellow 'End If If str_HeatingFlag = "I" And i_HeatingControlMasterFlag = 1 Then If flt_Corrected_External_Ist_Temperature <= 13.0 Then str_HeatingRange = "Cold" If flt_Corrected_External_Ist_Temperature > 13.0 And flt_Corrected_External_Ist_Temperature < 13.5 Then str_HeatingRange = "Middle" If flt_Corrected_External_Ist_Temperature >= 13.5 Then str_HeatingRange = "Too Warm" ' to heat ! Select Case str_HeatingRange Case "Cold" Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Red Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Yellow int_HeatingActiveFlag = 1 ' Do Action "A" str_TextBuffer = strfctn_RoomHeating() Case "Middle" Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Orange Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Black Case "Too Warm" If int_HeatingActiveFlag = 1 Then str_RoomHeatingEchelon = "Starting RoomHeating" ' Initialization for next go-around int_HeatingActiveFlag = 0 int_FlagBothPumpsOff = 1 End If Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Blue Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Yellow Case Else MessageBox.Show("Select Error in >strfctn_HeatEnergySink()<", "Warning") End Select Else If int_HeatingActiveFlag = 1 Then str_RoomHeatingEchelon = "Starting RoomHeating" ' Initialization for next go-around int_HeatingActiveFlag = 0 int_FlagBothPumpsOff = 1 End If Instance_TECS_Display.txt_SollSekundärVorlauf.Backcolor = Color.Cyan Instance_TECS_Display.txt_SollSekundärVorlauf.Forecolor = Color.Black End If Select Case str_SolDumpFlag ' set to "I" when sgl_SolarHotValueENN > 91.0 ' set to "O" when sgl_SolarHotValueENN < 90.0 Case "I" int_SolDumpFlag = 1 str_TextBuffer = strfctn_SolarDumpOverflow() Case "O" If int_SolDumpFlag = 1 Then str_OverflowDumpEchelon = "Starting Overflow" ' Initialization for next go-around int_SolDumpFlag = 0 int_FlagBothPumpsOff = 1 End If End Select If str_ManualSolDumpFlag = "I" And flt_PufferAverageTemp > 60.0 Then int_ManualSolDumpFlag = 1 str_TextBuffer = strfctn_ManualDump() Else If int_ManualSolDumpFlag = 1 Then int_ManualSolDumpFlag = 0 int_FlagBothPumpsOff = 1 str_ManualSolDumpFlag = "O" ' automatic shut off manual Dump Mid(str_StartParameters, i_ParameterIndexNicht(i_MANUDUMP)) = str_NICHT cbx_ManualDump.Text = Mid(str_StartParameters, i_StartParameterIndex(i_MANUDUMP), (i_EndParameterIndex(i_MANUDUMP) - i_StartParameterIndex(i_MANUDUMP))) cbx_ManualDump.Checked = False str_Reply = strftcn_StoreStartParameters() End If End If If int_FlagBothPumpsOff = 1 Then int_FlagBothPumpsOff = 0 ' Turn Off Pumps Routine str_TextBuffer = strfctn_StopBothPumps() End If 'strfctn_HeatEnergySink = "SixthTask" strfctn_HeatEnergySink = "FiveandahalfTask" End Function ' ########################################################### Private Function strfctn_ThermoSolar(ByVal iStoFlag As Integer) As String Dim sgl_SolarHotValueENNminusOne As Single Dim sgl_HotSlope As Single = 0.0 Dim str_HotSlope As String = "0.0" ' Default Dim sgl_ColdValueENN As Single Dim sgl_ColdValueENNminusOne As Single Dim sgl_ColdSlope As Single = 0.0 Dim str_ColdSlope As String = "0.0" ' Default Dim sgl_SolarDelta As Single = 0.0 Dim i_Index As Integer Dim i_MAXSOLARWAITCOUNT As Integer = 5 'Minuten Dim i_NewValue As Integer = 0 Dim str_DEFAULTMINPUMPVALUE As String = "6" Dim str_DEFAULTMAXPUMPVALUE As String = "30" Dim str_ThermoFunctionReply As String Static i_DynamicSolarDelayTime As Integer Dim strBuffer As String = String.Empty i_Index = CInt(txt_MinuteIndex.Text) + 1 ' " Version 13926a" Try sgl_SolarHotValueENN = sgl_ActualThermalValue(i_Ch_SOLARHOTCHANNEL) If sgl_SolarHotValueENN > 91.0 Then ' solar Dump 09.04.2013 str_SolDumpFlag = "I" txt_SolDumpFlag.BackColor = Color.Red txt_SolDumpFlag.ForeColor = Color.Yellow End If If sgl_SolarHotValueENN < 90.0 Then str_SolDumpFlag = "O" txt_SolDumpFlag.BackColor = Color.Blue txt_SolDumpFlag.ForeColor = Color.Yellow End If txt_SolDumpFlag.Text = str_SolDumpFlag Catch ex As Exception MessageBox.Show(ex.Message, "sgl_SolarHotValueENN") End Try txt_HotValueENN.Text = sgl_SolarHotValueENN.ToString Try sgl_ColdValueENN = sgl_ActualThermalValue(i_Ch_SOLARCOLDCHANNEL) Catch ex As Exception MessageBox.Show(ex.Message, "sgl_ColdValueEnn") End Try txt_ColdValueENN.Text = sgl_ColdValueENN.ToString sgl_SolarDelta = sgl_SolarHotValueENN - sgl_ColdValueENN txt_SolarDelta.Text = FormatNumber(sgl_SolarDelta.ToString, 1) If txt_Azimut.BackColor = Color.Yellow Then ' Yellow means: the first minute has elapsed and the slopes and delta ' can be calculated. 'txt_Azimut.BackColor = Color.White ' default condition ' ##################################################### Try sgl_SolarHotValueENNminusOne = sgl_OldThermalValue(i_Ch_SOLARHOTCHANNEL) Catch ex As Exception MessageBox.Show(ex.Message, "sgl_SolarHotValueENNminusOne") End Try txt_HotValueENNminusOne.Text = sgl_SolarHotValueENNminusOne.ToString sgl_HotSlope = sgl_SolarHotValueENN - sgl_SolarHotValueENNminusOne str_HotSlope = FormatNumber(sgl_HotSlope.ToString, 1) 'iCommaPosition = InStr(str_HotSlope, ",") ' >FormatNumber< returns decimal numbers with commas 'Mid(str_HotSlope, iCommaPosition) = "." ' not using periods "." txt_HotSlope.Text = str_HotSlope ' ##################################################### ' ##################################################### Try sgl_ColdValueENNminusOne = sgl_OldThermalValue(i_Ch_SOLARCOLDCHANNEL) Catch ex As Exception MessageBox.Show(ex.Message, "sgl_ColdValueENNminusOne") End Try txt_ColdValueENNminusOne.Text = sgl_ColdValueENNminusOne.ToString sgl_ColdSlope = sgl_ColdValueENN - sgl_ColdValueENNminusOne str_ColdSlope = FormatNumber(sgl_ColdSlope.ToString, 1) 'iCommaPosition = InStr(str_ColdSlope, ",") ' >FormatNumber< returns decimal numbers with commas 'Mid(str_ColdSlope, iCommaPosition) = "." ' not using periods "." txt_ColdSlope.Text = str_ColdSlope ' ##################################################### If sgl_SolarHotValueENN > 45.0 And sgl_HotSlope > 6.0 Then ' this may indicate some emergency condition. txt_SolPumpSpeed.Text = str_DEFAULTMAXPUMPVALUE Try str_ThermoFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), str_DEFAULTMAXPUMPVALUE) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung13 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strPumpCntrModuleAddress(I_SOLARPUMP), txt_SolPumpSpeed.Text) ' Top pump speed during emergency str_SolarStatusEchelon = "Monitoring" Else Select Case str_SolarStatusEchelon Case "Cold_Start" ' Default i_StartungUpLoopCounter = 0 txt_SolarDelayCounter.Text = i_StartungUpLoopCounter.ToString 'txt_SolPumpSpeed.Text = str_DEFAULTMINPUMPVALUE txt_SolPumpSpeed.Text = txt_Default_Cold_Start.Text Try str_ThermoFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), txt_SolPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung14 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strPumpCntrModuleAddress(I_SOLARPUMP), txt_SolPumpSpeed.Text) ' Default startup str_SolarStatusEchelon = "StartingUp" Case "StartingUp" txt_SolPumpSpeed.Text = txt_Default_StartingUp.Text str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strPumpCntrModuleAddress(I_SOLARPUMP), txt_SolPumpSpeed.Text) ' Default startup If sgl_SolarDelta <= 0.0 Then ' At the beginning cold water is pumped from the collector i_StartungUpLoopCounter += 1 ' to the thermal sensor on the hot side and warmed water from the ' storage tank to the thermal sensor on the cold side. txt_SolarDelayCounter.Text = i_StartungUpLoopCounter.ToString txt_EndSolarCount.Text = i_MAXSOLARWAITCOUNT.ToString 'If i_StartungUpLoopCounter > 10 Then ' 10 Minutes for normalization If i_StartungUpLoopCounter > i_MAXSOLARWAITCOUNT Then ' 5 Minutes for normalization i_StartungUpLoopCounter = 0 ' that should be enough time. txt_SolarDelayCounter.Text = i_StartungUpLoopCounter.ToString str_SolarStatusEchelon = "SunIsNotShining" i_DynamicSolarDelayTime = CInt(Math.Abs(2 * sgl_SolarDelta / 3)) txt_EndSolarCount.Text = i_DynamicSolarDelayTime.ToString End If Else str_SolarStatusEchelon = "Monitoring" End If Case "SunIsNotShining" txt_SolarDelayCounter.Text = I_SunIsNotshiningCounter.ToString If I_SunIsNotshiningCounter = 0 Then ' Solar pump is stopped str_DiagnosticBufferZer = strfctn_StopPump(strPumpCntrModuleAddress(I_SOLARPUMP)) ' Stops solar pump when energy can not be harvested. txt_SolPumpSpeed.Text = str_PUMPNULL Try str_ThermoFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), txt_SolPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung14.1 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ I_SunIsNotshiningCounter += 1 txt_SolarDelayCounter.Text = I_SunIsNotshiningCounter.ToString Else I_SunIsNotshiningCounter += 1 txt_SolarDelayCounter.Text = I_SunIsNotshiningCounter.ToString 'If I_SunIsNotshiningCounter > 15 Then ' 15 Minuten Pause If I_SunIsNotshiningCounter > i_DynamicSolarDelayTime Then ' dynamic >CInt(Math.Abs(2 * sgl_SolarDelta / 3))< str_SolarStatusEchelon = "Cold_Start" I_SunIsNotshiningCounter = 0 txt_SolarDelayCounter.Text = I_SunIsNotshiningCounter.ToString Else str_SolarStatusEchelon = "SunIsNotShining" End If End If ' end of >If I_SunIsNotshiningCounter = 0 Then< Case "Monitoring" ' txt_Default_StartingUp.Text txt_EndSolarCount.Text = vbEmpty txt_SolarDelayCounter.Text = vbEmpty If sgl_SolarDelta <= 0.0 Then str_SolarStatusEchelon = "Exit" ' System is cooling down: either a cloud or the sun is going down. Else 'i_NewValue = Val(str_DEFAULTMINPUMPVALUE) + CInt(sgl_SolarHotValueENN - 45.0) 'i_NewValue = Val(str_DEFAULTMINPUMPVALUE) + 2 * (CInt(sgl_SolarHotValueENN - 45.0)) ' 13c18 i_NewValue = Val(txt_Default_StartingUp.Text) + 2 * (CInt(sgl_SolarHotValueENN - 45.0)) ' 14228 If sgl_SolarHotValueENN > 45.0 Then ' the sun is shining If i_NewValue > Val(str_DEFAULTMAXPUMPVALUE) Then i_NewValue = Val(str_DEFAULTMAXPUMPVALUE) ' maximum value Else 'If i_NewValue < Val(str_DEFAULTMINPUMPVALUE) Then i_NewValue = Val(str_DEFAULTMINPUMPVALUE) ' minimum value If i_NewValue < Val(txt_Default_StartingUp.Text) Then i_NewValue = Val(txt_Default_StartingUp.Text) ' minimum value 14228 End If txt_SolPumpSpeed.Text = i_NewValue.ToString Try str_ThermoFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), txt_SolPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung15 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strPumpCntrModuleAddress(I_SOLARPUMP), i_NewValue.ToString) str_SolarStatusEchelon = "Monitoring" End If Case "Exit" str_DiagnosticBufferZer = strfctn_StopPump(strPumpCntrModuleAddress(I_SOLARPUMP)) ' Stops solar pump when energy can be harvested. str_SolarStatusEchelon = "Cold_Start" txt_SolPumpSpeed.Text = str_PUMPNULL Try str_ThermoFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), txt_SolPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung16 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ Case Else ' you should never get there, but just in case .... it's the same as in >Case "Cold_Start"< i_StartungUpLoopCounter = 0 txt_SolPumpSpeed.Text = str_DEFAULTMINPUMPVALUE Try str_ThermoFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), str_DEFAULTMINPUMPVALUE) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung17 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strPumpCntrModuleAddress(I_SOLARPUMP), txt_SolPumpSpeed.Text) ' Default startup str_SolarStatusEchelon = "StartingUp" End Select End If ' end of >If sgl_SolarHotValueENN > 45.0 And sgl_HotSlope > 6.0 Then< txt_SolarMonitor.Text = str_SolarStatusEchelon Else txt_Azimut.BackColor = Color.Yellow ' is used as FLAG to indicate that one measurement ' has been made and the slope can be calculated. End If ' end of >txt_Azimut.BackColor = Color.Yellow Then< If iStoFlag = 1 Then str_DiagnosticBufferFor = strfctn_StoreInfo(strDataFilePathName, "Ch " & i_PLOTHOTSOLARSLOPECHANNEL.ToString & _ ": " & str_HotSlope & " C") str_DiagnosticBufferFor = strfctn_StoreInfo(strDataFilePathName, "Ch " & i_PLOTCOLDSOLARSLOPECHANNEL.ToString & _ ": " & str_ColdSlope & " C") str_DiagnosticBufferFor = strfctn_StoreInfo(strDataFilePathName, "Ch " & i_PLOTSOLARPUMPSTATUS.ToString & _ ": " & txt_SolPumpSpeed.Text & " C") End If Try strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData(i_Index, i_PLOTHOTSOLARSLOPECHANNEL, sgl_HotSlope) ' in XY_Plot Catch ex As Exception MessageBox.Show(ex.Message, "strfctn_WriteXYPlotData_Hot") End Try Try strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData(i_Index, i_PLOTCOLDSOLARSLOPECHANNEL, sgl_ColdSlope) ' in XY_Plot Catch ex As Exception MessageBox.Show(ex.Message, "strfctn_WriteXYPlotData_Cold") End Try Try strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData(i_Index, i_PLOTSOLARPUMPSTATUS, CSng(Val(txt_SolPumpSpeed.Text))) ' in XY_Plot Catch ex As Exception MessageBox.Show(ex.Message, "strfctn_WriteXYPlotData_Pump") End Try strfctn_ThermoSolar = "ThermoSolar_done" End Function ' ########################################################### Private Sub EzSloBusTestToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles EzSloBusTestToolStripMenuItem.Click If (EzSloBusTestToolStripMenuItem.Checked = True) Then Try Instance_EzSloBus.Visible = True Instance_EzSloBus.btn_Exit.Visible = False SearchIdentifyToolStripMenuItem.Visible = True ProtocolToolStripMenuItem.Visible = True Catch ex As Exception MessageBox.Show(ex.Message) End Try Else Try Instance_EzSloBus.Visible = False Instance_EzSloBus.btn_Exit.Visible = True Catch ex As Exception MessageBox.Show(ex.Message) End Try End If End Sub ' ########################################################### Private Sub SearchIdentifyToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SearchIdentifyToolStripMenuItem.Click Dim str_FunctionReply As String str_FunctionReply = strfctn_ModuleSearchandIdentify() End Sub ' ########################################################### Private Function strfctn_ModuleSearchandIdentify() As String Dim i_CounterXxx As Integer iManualTestFlag = 1 ' prevents automatic measurement of temperatur every minute when set to "1" iTempratureModuleRegisteredFlag = 0 Me.Cursor = Cursors.WaitCursor ' changed 19.05.2013 For i_CounterXxx = 0 To 5 Step 1 ' making sure strStopPumpAddress(x) is empty strStopPumpAddress(i_CounterXxx) = String.Empty Next strTemprModuleAddress(1) = "X" ' as default an invalid address strTemprModuleAddress(2) = "X" ' as default an invalid address ' ##### iTemprModuleAddressIndex = 0 ipreTemprModRegisteredFlag = 0 iPowSwiModuleAddressIndex = 0 iHeatValveCntrModuleAddressIndex = 0 iPumpCntrModuleAddressIndex = 0 iBalValve_C_trolModuleAddressIndex = 0 Instance_EzSloBus.txt_Received_Data.Text = "..Searching.." Instance_EzSloBus.txt_Received_Data.BackColor = Color.White Instance_EzSloBus.txt_Received_Data.ForeColor = Color.Black Instance_EzSloBus.str_EzSloBusInfo = "..Searching.." str_AuxiliaryTaskManagerEchelon = "SearchIdentify" Timer_AuxiliaryTaskManager.Interval = 10 ' Milliseconds Timer_AuxiliaryTaskManager.Enabled = True 'Call Instance_EzSloBus.Search_Modules() str_DiagnosticBufferOne = Instance_EzSloBus.strfctn_SearchModules() ' 04.03.2013 strfctn_ModuleSearchandIdentify = "SearchandIdentify Done" End Function ' ####################################################################################### ' ########################################################### Private Function strfctn_Task_SearchIdentify() As String Dim str_ResultText As String = String.Empty Dim strBuffer As String = String.Empty Timer_AuxiliaryTaskManager.Enabled = False ' 02.03.2013 If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then ' do nothing Else str_ResultText = Instance_EzSloBus.str_EzSloBusInfo If (str_ResultText = "No Modules found") Then MessageBox.Show(str_ResultText, "Warning") SearchIdentifyToolStripMenuItem.Visible = True ProtocolToolStripMenuItem.Visible = True Me.Cursor = Cursors.Default Else i_AddressFieldLenght = Len(str_ResultText) ' Separating addresses For Me.i_Count_One = 1 To i_AddressFieldLenght Step 1 str_Address(i_Count_One) = Mid(str_ResultText, i_Count_One, 1) Next i_Count_One If ProtocolToolStripMenuItem.Checked = True Then ' str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, (Me.Text & vbCrLf & vbCrLf & txt_Datum.Text & " " & txt_Zeitpunkt.Text & " Uhr" & " ")) End If Try Instance_DataDisp.ControlBox = False 'Call Instance_DataDisp.fctn_CreateDGV() 'Call Instance_DataDisp.fctn_Setdgv_DisplaySize() strBuffer = Instance_DataDisp.strfctn_CreateDGV() strBuffer = Instance_DataDisp.strfctn_Setdgv_DisplaySize() Catch ex As Exception MessageBox.Show(ex.Message) End Try SearchIdentifyToolStripMenuItem.Visible = False str_Command(1) = "i" ' Command for Identity inquiry str_Command(2) = "v" ' Command for version inquiry str_Command(3) = "a" ' Command for Article number inquiry str_Command(4) = "s" ' Command for serial number inquiry str_Command(5) = "m" ' Command for manufacturer inquiry str_Command(6) = "q" ' Command for Status str_IdentifyEchelon = "Interrogation" ' "Answer" "Sorting" i_Count_One = 1 i_Count_Two = 1 'Timer_Identify.Interval = 150 ' Milliseconds 100 is too low Timer_Identify.Interval = 100 Timer_Identify.Enabled = True End If ' end of >(str_ResultText = "No Modules found") Then< iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" End If ' end of >If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then< strfctn_Task_SearchIdentify = String.Empty End Function ' ####################################################################################### Private Function strfctn_FilterandStoreAddresse(ByVal str_Select As String) Dim strAddress As String Dim strModuleIdent As String strAddress = Mid(str_Select, 1, 1) strModuleIdent = Mid(str_Select, 4, 15) Select Case strModuleIdent Case "06 Chn Temperat" iTemprModuleAddressIndex += 1 strTemprModuleAddress(iTemprModuleAddressIndex) = strAddress ipreTemprModRegisteredFlag += 1 Case "Power Switch..." 'MessageBox.Show("Not yet programmed", "Method_FilterandStoreAddresse") iPowSwiModuleAddressIndex += 1 strPowSwiModuleAddress(iPowSwiModuleAddressIndex) = strAddress iPowSwiModRegisteredFlag = 1 Case "Valve C'troller" 'MessageBox.Show("Not yet programmed", "Method_FilterandStoreAddresse") iHeatValveCntrModuleAddressIndex += 1 strHeatValveCntrModuleAddress(iHeatValveCntrModuleAddressIndex) = strAddress iHeatValveCntrModRegisteredFlag = 1 Case "Pump Controller" 'MessageBox.Show("Not yet programmed", "Method_FilterandStoreAddresse") iPumpCntrModuleAddressIndex += 1 strPumpCntrModuleAddress(iPumpCntrModuleAddressIndex) = strAddress iPumpCntrModRegisteredFlag = 1 Case "BalValve C'trol" 'MessageBox.Show("Not yet programmed", "Method_FilterandStoreAddresse") iBalValve_C_trolModuleAddressIndex += 1 strBalValve_C_trolModuleAddress(iBalValve_C_trolModuleAddressIndex) = strAddress iBalValve_C_trolModRegisteredFlag = 1 Case "Client Template" 'MessageBox.Show("Not yet programmed", "Method_FilterandStoreAddresse") iClient_TemplateCntrModuleAddressIndex += 1 strClient_TemplateCntrModuleAddress(iClient_TemplateCntrModuleAddressIndex) = strAddress iClient_TemplateCntrModRegisteredFlag = 1 Case "" MessageBox.Show("Not yet programmed", "Method_FilterandStoreAddresse") End Select strfctn_FilterandStoreAddresse = "Filtered and stored Addresses" End Function ' ########################################################### ' ########################################################### Private Sub TestModuleToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TestModuleToolStripMenuItem.Click txt_ModuleReply.Text = String.Empty txt_ModuleReply.BackColor = Color.White iManualTestFlag = 1 ' prevents automatic measurement of temperatur every minute when set to "1" Try Instance_DataDisp.dgv_Display.Visible = True Instance_DataDisp.Visible = True Instance_DataDisp.gbx_Fill_Table.Visible = False Instance_DataDisp.gbx_Fill_Row.Visible = False Catch ex As Exception MessageBox.Show(ex.Message, "qwert") End Try Instance_DataDisp.I_DGVWaitFlag = 1 str_AuxiliaryTaskManagerEchelon = "DGV_Display" Timer_AuxiliaryTaskManager.Interval = 10 Timer_AuxiliaryTaskManager.Enabled = True End Sub ' ################################################################################ Private Function strfctn_FillDataGridView() Dim str_Answerfor As String If Instance_DataDisp.I_DGVWaitFlag = 1 Then ' do nothing; wait Else TestModuleToolStripMenuItem.Visible = True 'ProtocolToolStripMenuItem.Visible = False str_Answerfor = strfctn_SelectTestDisplay() Timer_AuxiliaryTaskManager.Enabled = False End If strfctn_FillDataGridView = "DGV_Display" End Function ' ################################################################################ ' ' ################################################################################ Private Function strfctn_SelectTestDisplay() ' The configuration of pnl_ModuleTesting is determined and set strModuleAddress = Instance_DataDisp.txt_ModuleAddress.Text strModuleId = Instance_DataDisp.txt_ModuleID.text txt_ModuleReply.Text = strModuleId txt_ModuleReply.Visible = True txt_ModuleAddress.Text = strModuleAddress Select Case strModuleId Case "06 Chn Temperat" pnl_ModuleTesting.Visible = True btn_ZeroValve.Visible = False pgbWait.Visible = False btn_StatusUpdate.Visible = False btn_Right.BackColor = Color.BlanchedAlmond btn_Left.BackColor = Color.BlanchedAlmond btn_Right.ForeColor = Color.Black btn_Left.ForeColor = Color.Black btn_Left.Visible = True btn_Left.Text = "Store?" btn_Right.Visible = True btn_Right.Text = "Start Scan" str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Case "Power Switch..." ' 'MessageBox.Show("Not yet programmed", strModuleId) pnl_ModuleTesting.Visible = True btn_ZeroValve.Visible = False pgbWait.Visible = False btn_StatusUpdate.Visible = False txt_TestReply.Visible = True btn_Left.Visible = True btn_Left.Text = "Power &One" btn_Right.Visible = True btn_Right.Text = "Power &Two" btn_Right.ForeColor = Color.Black btn_Left.ForeColor = Color.Black str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Timer_PowerSwitch.Interval = 100 Timer_PowerSwitch.Enabled = True Case "Valve C'troller" ' 'MessageBox.Show("Not yet programmed", strModuleId) btn_ZeroValve.Visible = True btn_ZeroValve.Text = "Set to Zero" pgbWait.Visible = False pnl_ModuleTesting.Visible = True txt_TestReply.Visible = True btn_StatusUpdate.Visible = True lbl_PlusMinusDelta.Visible = True txt_TestReply.BackColor = Color.Beige btn_Left.Visible = True btn_Left.Text = "Set Delta" btn_Left.BackColor = Color.LightGreen btn_Left.ForeColor = Color.Black btn_Right.Visible = True btn_Right.Text = "Set Position" btn_Right.BackColor = Color.LightGreen btn_Right.ForeColor = Color.Black str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Case "Pump Controller" ' 'MessageBox.Show("Not yet programmed", strModuleId) pgbWait.Visible = False pnl_ModuleTesting.Visible = True btn_ZeroValve.Visible = False 'btnZeroStop.Text = "Stop" btn_StatusUpdate.Visible = True txt_TestReply.Visible = True btn_Right.Visible = True btn_Right.Text = "Set Speed" btn_Right.BackColor = Color.Blue btn_Right.ForeColor = Color.Yellow str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Timer_PumpController.Interval = 100 Timer_PumpController.Enabled = True Case "BalValve C'trol" ' 'MessageBox.Show("Not yet programmed", strModuleId) btn_ZeroValve.Visible = True btn_ZeroValve.Text = "Set to Zero" pgbWait.Visible = False pnl_ModuleTesting.Visible = True txt_TestReply.Visible = True btn_StatusUpdate.Visible = True txt_TestReply.BackColor = Color.Beige lbl_PlusMinusDelta.Visible = True btn_Left.Visible = True btn_Left.Text = "Set Delta" btn_Left.BackColor = Color.LightGreen btn_Left.ForeColor = Color.Black btn_Right.Visible = True btn_Right.Text = "Set Position" btn_Right.BackColor = Color.LightGreen btn_Right.ForeColor = Color.Black str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Case "Client Template" 'MessageBox.Show("Not yet programmed", strModuleId) pnl_ModuleTesting.Visible = True btn_StatusUpdate.Visible = True txt_TestReply.Visible = True pgbWait.Visible = False btn_Left.Visible = False btn_Right.Visible = False btn_ZeroValve.Visible = False iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Case "" ' 'MessageBox.Show("Not yet programmed", strModuleId) pnl_ModuleTesting.Visible = False btn_ZeroValve.Visible = False txt_ModuleReply.Text &= "Default Error" btn_StatusUpdate.Visible = False End Select strfctn_SelectTestDisplay = "Testdisplay selected" End Function ' ################################################################################ '' ########################################################### Private Function strfctn_FillPowerSwitchDisplay() As String Dim i_EqualSignPosition As Integer i_EqualSignPosition = InStr(txt_TestReply.Text, "=") str_Status = Mid(txt_TestReply.Text, (i_EqualSignPosition + 2), 2) Select Case str_Status Case "$$" btn_Right.BackColor = Color.Yellow btn_Left.BackColor = Color.Yellow Case "00" btn_Right.BackColor = Color.Red btn_Left.BackColor = Color.Red Case "01" btn_Right.BackColor = Color.Red btn_Left.BackColor = Color.Green Case "10" btn_Right.BackColor = Color.Green btn_Left.BackColor = Color.Red Case "11" btn_Right.BackColor = Color.Green btn_Left.BackColor = Color.Green Case Else End Select strfctn_FillPowerSwitchDisplay = "Filled" End Function ' ########################################################### ' ########################################################### Private Function strfctn_DisplayPumpControllerLeftSide() As String str_Status = Mid(txt_TestReply.Text, 4, 2) Select Case str_Status Case "Sp" btn_Left.Visible = True btn_Left.Text = "Programm &Pump" btn_Left.BackColor = Color.Blue btn_Left.ForeColor = Color.Yellow btn_ZeroValve.Visible = False Case Else btn_Left.Visible = False btn_ZeroValve.Visible = False End Select strfctn_DisplayPumpControllerLeftSide = "Displayed Left Side" End Function ' ########################################################### ' ########################################################### Private Function strfctn_ModuleStatusInquiry(ByVal strAddress As String) strfctn_ModuleStatusInquiry = String.Empty Me.Cursor = Cursors.Hand ' used in PumpControllerTimer.Tick as Flag Instance_EzSloBus.I_EzBusBusyFlag = 1 Instance_EzSloBus.strCommunicationFlag = "Send" Instance_EzSloBus.I_EzBusBusyFlag = 1 str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strAddress, "q") 'Timer_StatusInquiry.Interval = 100 ' 10 ... increased to 100 on 17 Nov. 2012 Timer_StatusInquiry.Interval = 50 ' decreased to 40 on 3 Dec. 2012 Timer_StatusInquiry.Enabled = True strfctn_ModuleStatusInquiry = "finished ModuleStatusInquiry" End Function ' ########################################################### ' ########################################################### Private Sub Timer_StatusInquiry_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_StatusInquiry.Tick Dim str_AnswerTrtn As String If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then ' Do nothing Else txt_TestReply.Text = Instance_EzSloBus.str_EzSloBusInfo Instance_EzSloBus.txt_Received_Data.Text = String.Empty Instance_EzSloBus.str_EzSloBusInfo = String.Empty If str_AuxiliaryTaskManagerEchelon = "GetValveStatus" Then str_PresentValveStatus(i_HeatValveIndexCounter) = txt_TestReply.Text i_HeatValveIndexCounter += 1 End If Select Case strModuleId Case "Pump Controller" If btn_Left.Visible = False Then str_AnswerTrtn = strfctn_DisplayPumpControllerLeftSide() Else str_AnswerTrtn = strfctn_ProgrammDefaultPumpSpeed(txt_TestReply.Text) End If End Select Me.Cursor = Cursors.Default Timer_StatusInquiry.Enabled = False End If End Sub ' ########################################################### ' ########################################################### ' ########################################################### ' ########################################################### Private Sub btn_Close_Click(sender As System.Object, e As System.EventArgs) Handles btn_Close.Click pgbWait.Visible = True btn_ZeroValve.Visible = False pnl_ModuleTesting.Visible = False lbl_PlusMinusDelta.Visible = False iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" btn_Right.BackColor = Color.BlanchedAlmond btn_Left.BackColor = Color.BlanchedAlmond End Sub ' ########################################################### ' ########################################################### ' ########################################################### ' ########################################################### Private Function strfctn_ProgrammDefaultPumpSpeed(ByVal str_ModuleStatus As String) As String Dim i_Number As Integer = 0 Dim str_Puffer As String = String.Empty Dim str_Number As String = String.Empty str_Number = str_DefaultPumpSpeedNumber str_Puffer = Mid(str_ModuleStatus, 4, 2) If (str_Puffer = "Sp") Then ' for Stop Try i_Number = Convert.ToInt16(str_Number) If (i_Number >= 0 And i_Number <= 45) Then strCommand = "P" & (str_Number) str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf str_SelectEchelon = "Display" Else txt_TestReply.Text = "Out of Range Error" End If Catch ex As System.Exception MessageBox.Show(ex.Message) End Try Else txt_TestReply.Text = "Stop Pump !" End If Me.Cursor = Cursors.Default btn_Left.Visible = False strfctn_ProgrammDefaultPumpSpeed = "Default Pump Speed programmed" End Function ' ########################################################### Private Sub btn_Left_Click(sender As System.Object, e As System.EventArgs) Handles btn_Left.Click Dim strNumber As String = String.Empty 'Dim strPuffer As String = String.Empty Dim iNumber As Integer = 0 Dim strProtocolMessage As String = String.Empty Dim strCommand As String = String.Empty Instance_EzSloBus.strCommunicationFlag = "Send" Select Case strModuleId Case "06 Chn Temperat" If txt_TestReply.Text = "Yes" Then txt_TestReply.Text = "No" Else txt_TestReply.Text = "Yes" End If Case "Power Switch..." btn_Right.ForeColor = Color.Black btn_Left.ForeColor = Color.Black If btn_Left.BackColor = Color.Green Then strCommand = "S1N" btn_Left.BackColor = Color.Red Else strCommand = "S1P" btn_Left.BackColor = Color.Green End If str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf str_SelectEchelon = "Display" str_AuxiliaryTaskManagerEchelon = "GeneralModuleQuery" Timer_AuxiliaryTaskManager.Interval = 500 Timer_AuxiliaryTaskManager.Enabled = True Case "Pump Controller" 'Me.Cursor = Cursors.WaitCursor Me.Cursor = Cursors.UpArrow str_DefaultPumpSpeedNumber = txt_TestReply.Text str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Case "Valve C'troller" strNumber = txt_TestReply.Text Try iNumber = Convert.ToInt16(strNumber) If iNumber > iMaxHeatingValveCount Then txt_TestReply.Text = "Range Error: too large" If (iNumber >= 0 And iNumber <= iMaxHeatingValveCount) Then strCommand = "O" & (strNumber) End If If (iNumber <= 0 And iNumber >= (-1 * iMaxHeatingValveCount)) Then iNumber *= -1 strNumber = Convert.ToString(iNumber) strCommand = "C" & (strNumber) End If If iNumber < (-1 * iMaxHeatingValveCount) Then txt_TestReply.Text = "Range Error: too small" Else str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf End If Catch ex As System.Exception MessageBox.Show(ex.Message) End Try Case "BalValve C'trol" strNumber = txt_TestReply.Text Try iNumber = Convert.ToInt16(strNumber) If iNumber > iMaxBallValveCount Then txt_TestReply.Text = "Range Error: too large" If (iNumber >= 0 And iNumber <= iMaxBallValveCount) Then strCommand = "O" & (strNumber) End If If (iNumber <= 0 And iNumber >= (-1 * iMaxBallValveCount)) Then iNumber *= -1 strNumber = Convert.ToString(iNumber) strCommand = "C" & (strNumber) End If If iNumber < (-1 * iMaxBallValveCount) Then txt_TestReply.Text = "Range Error: too small" Else str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf End If Catch ex As System.Exception MessageBox.Show(ex.Message) End Try End Select If ProtocolToolStripMenuItem.Checked = True Then str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, txt_Zeitpunkt.Text & " Uhr") str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, " " & strProtocolMessage) End If End Sub ' ########################################################### Private Sub btn_Right_Click(sender As System.Object, e As System.EventArgs) Handles btn_Right.Click Dim strNumber As String = String.Empty Dim iNumber As Integer = 0 Dim iStoreFlag As Integer = 0 Dim strProtocolMessage As String = String.Empty Dim strCommand As String = String.Empty Dim str_Buffer As String = String.Empty Instance_EzSloBus.strCommunicationFlag = "Send" Select Case strModuleId Case "06 Chn Temperat" Instance_EzSloBus.txt_Received_Data.Text = String.Empty Instance_EzSloBus.str_EzSloBusInfo = String.Empty Select Case txt_TestReply.Text Case "Yes" iStoreFlag = 1 Case "No" iStoreFlag = 0 Case Else iStoreFlag = 0 End Select str_Buffer = strfctn_StartTemprScan(strModuleAddress, 0, iStoreFlag) ' of Temperature Sensor Case "Power Switch..." btn_Right.ForeColor = Color.Black btn_Left.ForeColor = Color.Black If btn_Right.BackColor = Color.Green Then strCommand = "S2N" btn_Right.BackColor = Color.Red Else strCommand = "S2P" btn_Right.BackColor = Color.Green End If str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf str_SelectEchelon = "Display" str_AuxiliaryTaskManagerEchelon = "GeneralModuleQuery" Timer_AuxiliaryTaskManager.Interval = 500 Timer_AuxiliaryTaskManager.Enabled = True Case "Pump Controller" 'Me.Cursor = Cursors.WaitCursor Me.Cursor = Cursors.VSplit strNumber = txt_TestReply.Text Try iNumber = Convert.ToInt16(strNumber) If (iNumber >= 0 And iNumber <= 45) Then str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strModuleAddress, strNumber) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf str_SelectEchelon = "Display" btn_Left.Visible = False 'btnZeroStop.Visible = True Else txt_TestReply.Text = "Out of Range Error" End If Catch ex As System.Exception MessageBox.Show(ex.Message) End Try Me.Cursor = Cursors.Default Case "Valve C'troller" strNumber = txt_TestReply.Text Try iNumber = Convert.ToInt16(strNumber) If (iNumber >= 0 And iNumber <= iMaxHeatingValveCount) Then strCommand = "P" & strNumber str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf str_AuxiliaryTaskManagerEchelon = "Setbtn_StatusUpdatetovisible" ' btn_StatusUpdate.Visible = False Timer_AuxiliaryTaskManager.Interval = 1000 Timer_AuxiliaryTaskManager.Enabled = True Else txt_TestReply.Text = "Out of Range Error" End If Catch ex As System.Exception MessageBox.Show(ex.Message) End Try Case "BalValve C'trol" strNumber = txt_TestReply.Text Try iNumber = Convert.ToInt16(strNumber) If (iNumber >= 0 And iNumber <= iMaxBallValveCount) Then strCommand = "P" & strNumber str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf str_AuxiliaryTaskManagerEchelon = "Setbtn_StatusUpdatetovisible" ' btn_StatusUpdate.Visible = False Timer_AuxiliaryTaskManager.Interval = 1000 Timer_AuxiliaryTaskManager.Enabled = True Else txt_TestReply.Text = "Out of Range Error" End If Catch ex As System.Exception MessageBox.Show(ex.Message) End Try End Select If ProtocolToolStripMenuItem.Checked = True Then str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, txt_Zeitpunkt.Text & " Uhr") str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, " " & strProtocolMessage) End If End Sub ' ########################################################### ' ########################################################### Private Sub btn_ZeroValve_Click(sender As System.Object, e As System.EventArgs) Handles btn_ZeroValve.Click Instance_EzSloBus.strCommunicationFlag = "Send" Select Case strModuleId Case "06 Chn Temperat" Case "Power Switch..." Case "Pump Controller" Case "Valve C'troller" btn_Right.BackColor = Color.Green strCommand = "Z0" str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf btn_Right.BackColor = Color.LightGreen str_SelectEchelon = "Display" str_AuxiliaryTaskManagerEchelon = "GeneralModuleQuery" Timer_AuxiliaryTaskManager.Interval = 500 Timer_AuxiliaryTaskManager.Enabled = True Case "BalValve C'trol" btn_Right.BackColor = Color.Green strCommand = "R0" str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strModuleAddress, strCommand) strProtocolMessage = strModuleAddress & " " & strCommand & vbCrLf btn_Right.BackColor = Color.LightGreen str_SelectEchelon = "Display" str_AuxiliaryTaskManagerEchelon = "GeneralModuleQuery" Timer_AuxiliaryTaskManager.Interval = 500 Timer_AuxiliaryTaskManager.Enabled = True Case "Client Template" Case Else End Select If ProtocolToolStripMenuItem.Checked = True Then str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, txt_Zeitpunkt.Text & " Uhr") str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, " " & strProtocolMessage) End If End Sub ' ########################################################### Private Function strfctn_SetPumpSpeed(ByVal str_PumpAddress As String, ByVal str_SpeedValue As String) As String Dim strPumpCommand As String strPumpCommand = "S" & str_SpeedValue str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(str_PumpAddress, strPumpCommand) strfctn_SetPumpSpeed = "finished SetPumpSpeed" End Function ' ########################################################### ' ########################################################### Private Function strfctn_StopPump(ByVal str_PumpeAddress As String) As String strCommand = str_SLOWPUMPCOMMAND ' set to lowest rotational speed str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(str_PumpeAddress, strCommand) strStopPumpAddress(I_SOLARPUMP) = str_PumpeAddress strfctn_StopPump = "finished StopPump" End Function ' ########################################################### ' ********************************************************* ' ********************************************************* ' ########################################################### Private Function strfctn_ManualSetValvePosition(ByVal str_ValveAddress As String, ByVal str_PositionValue As String) As String Dim strValveCommand As String strValveCommand = "P" & str_PositionValue str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(str_ValveAddress, strValveCommand) strfctn_ManualSetValvePosition = "Position is set" End Function ' ########################################################### ' ########################################################### ' ########################################################### ' ********************************************************* Private Function strfctn_StartTemprScan(ByVal strModAdd As String, ByVal iOffset As Integer, ByVal iStFlag As Integer) As String strfctn_StartTemprScan = String.Empty iManualTestFlag = 1 ' prevents automatic measurement of temperatur every minute when set to "1" i_Method_StartTemprScanBusyFlag = 1 Me.Cursor = Cursors.AppStarting Instance_EzSloBus.strCommunicationFlag = "Send" If (iOffset = 0 And iStFlag = 1) Then ' Flag to indicate that date/time is stored only for the first scan. str_DiagnosticBufferFor = strfctn_StoreInfo(strDataFilePathName, _ (vbCrLf & txt_Zeitpunkt.Text & " :: " & txt_MinuteIndex.Text & vbCrLf & "#%")) End If strTemporModAddress = strModAdd ' Used in >Sub MeasurementTimer_Tick< iPublicStoreFlag = iStFlag ' Used in >Sub MeasurementTimer_Tick< iPublicOffset = iOffset ' Used in >Sub MeasurementTimer_Tick< strCommando(0) = "M0" strCommando(1) = "b" strCommando(2) = "c" strCommando(3) = "d" strCommando(4) = "e" strCommando(5) = "f" strCommando(6) = "g" txt_ModuleReply.Text = String.Empty Instance_EzSloBus.I_EzBusBusyFlag = 1 str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strTemporModAddress, strCommando(0)) str_MeasurementEchelon = "AfterMeasurementTriggerWait" I_Channel_Nr = 1 ' Start condition iWaitCounter = 8 ' 8 x 300 = 2400 => 2.4 Seconds: time for the temperature measurement Timer_TemperatureMeasurement.Interval = 300 ' 31.05.2013 300 millisecond to get result => 6 Channel => 1800 mS 'iWaitCounter = 12 ' 12 x 200 = 2400 => 2.4 Seconds: time for the temperature measurement 'Timer_TemperatureMeasurement.Interval = 200 ' 26.02.2013 200 millisecond to get result => 6 Channel => 1200 mS 'iWaitCounter = 24 ' 24 x 100 = 2400 => 2.4 Seconds: time for the temperature measurement 'Timer_TemperatureMeasurement.Interval = 100 ' 26.02.2013 100 millisecond to get result => 6 Channel => 600 mS Timer_TemperatureMeasurement.Enabled = True End Function ' ********************************************************* '*************************************** Private Sub Timer_TemperatureMeasurement_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_TemperatureMeasurement.Tick Static Dim strDummy As String Static Dim strModuleReply As String Select Case str_MeasurementEchelon Case "AfterMeasurementTriggerWait" iWaitCounter -= 1 If iWaitCounter <= 0 Then str_MeasurementEchelon = "Measuring" txt_ModuleReply.Text = String.Empty strModuleReply = String.Empty End If Case "Measuring" str_MeasurementEchelon = "Default" ' 26.02.2013 added Instance_EzSloBus.strCommunicationFlag = "Send" Instance_EzSloBus.I_EzBusBusyFlag = 1 Instance_EzSloBus.str_EzSloBusInfo = String.Empty ' 09.03.2013 str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strTemporModAddress, strCommando(I_Channel_Nr)) str_MeasurementEchelon = "Listening" strCommando(I_Channel_Nr) = String.Empty ' 08.03.013 Case "Listening" str_MeasurementEchelon = "Default" ' 26.02.2013 added strDummy = Instance_EzSloBus.str_EzSloBusInfo & vbCrLf strModuleReply &= strfctn_ManipulateDataandPlot(strDummy, iPublicOffset) & vbCrLf I_Channel_Nr += 1 If I_Channel_Nr > 6 Then ' "> 6" indicates that all six channels have been read. txt_ModuleReply.Text = strModuleReply str_MeasurementEchelon = "Storing Data" Else str_MeasurementEchelon = "Measuring" End If Case "Storing Data" str_MeasurementEchelon = "Default" ' 09.03.2013 added If iPublicStoreFlag = 1 Then str_DiagnosticBufferFor = strfctn_StoreInfo(strDataFilePathName, strModuleReply) End If strModuleReply = String.Empty iManualTestFlag = 0 ' allowes automatic measurement of temperatur every minute Timer_TemperatureMeasurement.Enabled = False Me.Cursor = Cursors.Default i_Method_StartTemprScanBusyFlag = 0 If iPublicOffset = 0 Then str_SecondTickEchelon = "SecondTask" If iPublicOffset = 6 Then str_SecondTickEchelon = "ThirdTask" Case "Default" End Select End Sub ' ########################################################### ' **************************************************************************************** ' call: str_Dummy = strfctn_StoreInfo("Path and File", "second try") ' Path/Folder/File info to be stored ' **************************************************************************************** Private Function strfctn_StoreInfo(ByVal str_PathFileName As String, _ ByVal strInformation As String) As String Dim strfileContents As String = String.Empty Try strfileContents = My.Computer.FileSystem.ReadAllText(str_PathFileName) Catch thisExcep As System.StackOverflowException Catch ex As Exception 'MessageBox.Show(ex.Message, My.Application.Info.Title, _ ' MessageBoxButtons.OK, MessageBoxIcon.Error) End Try strfileContents = strfileContents & strInformation & vbCrLf Try My.Computer.FileSystem.WriteAllText(str_PathFileName, strfileContents, False) Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try strfctn_StoreInfo = "Storing done" End Function '' ########################################################### '' **************************************************************************************** '' **************************************************************************************** ' ########################################################### Private Function strfctn_ManipulateDataandPlot(ByVal strData As String, ByVal i_ChannelOffset As Integer) As String Dim I_Posi_Ch_ As Integer ' strData >"d(cr)(lf)Ch 1: 24.57 C(cr)(lf)< Dim I_Posi_Colon_ As Integer ' 4 8 1 1 Dim I_Posi_Centigrade As Integer ' 1 5 Dim I_Posi_DecPoint As Integer Dim I_Posi_Delta As Integer Dim I_Length As Integer = 0 Dim strChannelNr As String = "0" Dim I_Value As Integer Dim strStartText As String Dim strEndText As String Dim strTemperaturValue As String = String.Empty Dim strBuffer As String = String.Empty Dim str_ErrorPresent As String = String.Empty 'Dim sgl_TemperaturValue As Single strfctn_ManipulateDataandPlot = String.Empty '************************ 'i_ChannelOffset = 6 ' for testing only 'strData = vbCrLf ' for testing only '************************ I_Length = Len(strData) I_Posi_Ch_ = InStr(1, strData, "Ch") I_Posi_Colon_ = InStr((I_Posi_Ch_ + 1), strData, ": ") ' >+ 1< prevents Error >Argument start muss größer als 0 (Null) sein< I_Posi_DecPoint = InStr(I_Posi_Colon_ + 1, strData, ".") ' >+ 1< prevents Error >Argument start muss größer als 0 (Null) sein< I_Posi_Centigrade = InStr(I_Posi_Colon_ + 1, strData, " C") ' >+ 1< prevents Error >Argument start muss größer als 0 (Null) sein< I_Posi_Delta = I_Posi_Centigrade - I_Posi_Colon_ strChannelNr = (I_Channel_Nr + i_ChannelOffset).ToString If I_Posi_Delta = 7 Then 'correct fixed length in >strData< I_Value = CInt(strChannelNr) If (I_Value > 9) Then strStartText = Mid(strData, 1, (I_Posi_Ch_ + 1)) strEndText = Mid(strData, I_Posi_Colon_) strData = strStartText & Str(I_Value) & strEndText I_Posi_Colon_ = InStr(1, strData, ": ") Else Mid(strData, (I_Posi_Colon_ - 2), 2) = Str(I_Value) End If strChannelNr = Mid(strData, (I_Posi_Colon_ - 2), 2) I_Posi_Centigrade = InStr(I_Posi_Colon_, strData, " C") I_Posi_DecPoint = InStr(I_Posi_Colon_, strData, ".") strTemperaturValue = Mid(strData, (I_Posi_Colon_ + 1), (I_Posi_Centigrade - I_Posi_Colon_ - 1)) 'sgl_TemperaturValue = Val(strTemperaturValue) 'strTemperaturValue = FormatNumber(sgl_TemperaturValue.ToString, 1) Else strTemperaturValue = FormatNumber(sgl_OldThermalValue(Val(strChannelNr)).ToString, 1) End If strfctn_ManipulateDataandPlot = "Ch " & strChannelNr & ": " & strTemperaturValue & " C" ' the output If iLookingAtFileFlag = 0 Then sgl_OldThermalValue(Val(strChannelNr)) = sgl_ActualThermalValue(Val(strChannelNr)) sgl_ActualThermalValue(Val(strChannelNr)) = Val(strTemperaturValue) Try strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData((Val(txt_MinuteIndex.Text) + 1), Val(strChannelNr), Val(strTemperaturValue)) ' in XY_Plot Catch thisExcep As System.StackOverflowException ' " Version 13926a" Catch ex As Exception MessageBox.Show(ex.Message, "strfctn_WriteXYPlotData()") End Try Try strBuffer = Instance_TECS_Display.strfctn_FillinTemperatureTextBox(Val(strChannelNr), strTemperaturValue) Catch ex As Exception MessageBox.Show(ex.Message, "strfctn_FillinTemperatureTextBox()") End Try End If ' END >If iLookingAtFileFlag = 0 Then< ' ###################################################### 'If I_Length > 9 Then ' 06.02.2013 This filteres out communication Errors ' 'I_Posi_Ch_ = InStr(1, strData, "Ch ") ' I_Posi_Ch_ = InStr(1, strData, "Ch") ' 'I_Posi_Colon_ = InStr(I_Posi_Ch_, strData, ": ") ' I_Posi_Colon_ = InStr((I_Posi_Ch_ + 1), strData, ": ") ' >+ 1< prevents Error >Argument start muss größer als 0 (Null) sein< ' I_Posi_DecPoint = InStr(I_Posi_Colon_, strData, ".") ' I_Posi_Centigrade = InStr(I_Posi_Colon_, strData, " C") ' If I_Posi_Colon_ > 2 Then ' strChannelNr = Mid(strData, (I_Posi_Ch_ + 2), (I_Posi_Colon_ - I_Posi_Ch_ - 2)) ' ' ***** ' I_Channel_Nr = CInt(strChannelNr) ' 26.02.2013 re-synching in case of count error ' ' ***** ' I_Value = CInt(strChannelNr) + i_ChannelOffset ' 1 2 3 4 5 6 ' If (I_Value > 9) Then ' strStartText = Mid(strData, 1, (I_Posi_Ch_ + 1)) ' strEndText = Mid(strData, I_Posi_Colon_) ' strData = strStartText & Str(I_Value) & strEndText ' I_Posi_Colon_ = InStr(1, strData, ": ") ' Else ' Mid(strData, (I_Posi_Colon_ - 2), 2) = Str(I_Value) ' End If ' strChannelNr = Mid(strData, (I_Posi_Colon_ - 2), 2) ' I_Posi_Centigrade = InStr(I_Posi_Colon_, strData, " C") ' I_Posi_DecPoint = InStr(I_Posi_Colon_, strData, ".") ' End If ' If I_Posi_Centigrade > 7 Then ' strTemperaturValue = Mid(strData, (I_Posi_Colon_ + 1), (I_Posi_Centigrade - I_Posi_Colon_ - 1)) ' Else ' i.e. I_Posi_Centigrade = 0 meaning that " C" was not found ! ' 'str_ErrorPresent = Mid(strData, (I_Posi_Colon_ + 2), 5) ' 'If str_ErrorPresent = "Error" Then ' ' 'strTemperaturValue = "-30.0 " ' indicates an Error in the Temperature Module ' ' MessageBox.Show("Temperatur Channel " & strChannelNr, "Temperatur Modul Warning") ' 'Else ' ' 'strTemperaturValue = "-40.0 " ' indicates an Error in the Temperature Module ' ' MessageBox.Show("Temperatur Channel " & strChannelNr, "Other Error Warning") ' 'End If ' strTemperaturValue = FormatNumber(sgl_OldThermalValue(Val(strChannelNr)).ToString, 1) ' ' Fills in old Value of Temperatur >I_Channel_Nr< is original Counter in loop ' End If ' ' ****** for testing ***** ' If strChannelNr = "0" Then ' MessageBox.Show("Value = 0 >." & strData & ".<", "ChannelNr Warning") ' End If ' If strTemperaturValue = String.Empty Then ' MessageBox.Show("Empty >." & strData & ".<", "TemperatureValue Warning") ' End If ' ' ****** for testing ***** ' strfctn_ManipulateDataandPlot = "Ch " & strChannelNr & ": " & strTemperaturValue & " C" ' the output ' If (strChannelNr <> String.Empty) And (strTemperaturValue <> String.Empty) Then ' If iLookingAtFileFlag = 0 Then ' sgl_OldThermalValue(Val(strChannelNr)) = sgl_ActualThermalValue(Val(strChannelNr)) ' sgl_ActualThermalValue(Val(strChannelNr)) = Val(strTemperaturValue) ' Try ' 'Call Instance_XY_Curves.fctnWriteXYPlotData((Val(txt_MinuteIndex.Text) + 1), Val(strChannelNr), Val(strTemperaturValue)) ' in XY_Plot ' strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData((Val(txt_MinuteIndex.Text) + 1), Val(strChannelNr), Val(strTemperaturValue)) ' in XY_Plot ' Catch thisExcep As System.StackOverflowException ' " Version 13926a" ' Catch ex As Exception ' MessageBox.Show(ex.Message, "strfctn_WriteXYPlotData()") ' End Try ' Try ' strBuffer = Instance_TECS_Display.strfctn_FillinTemperatureTextBox(Val(strChannelNr), strTemperaturValue) ' Catch ex As Exception ' MessageBox.Show(ex.Message, "strfctn_FillinTemperatureTextBox()") ' End Try ' My.Application.DoEvents() ' 21.09.2013 ' End If ' END >If iLookingAtFileFlag = 0 Then< ' End If ' END > If (strChannelNr <> String.Empty) And (strTemperaturValue <> String.Empty) Then< 'Else ' ' ****** for testing ***** i_ErrorCounter ' i_ErrorCounter += 1 ' My.Application.DoEvents() ' 21.09.2013 ' Try ' MessageBox.Show(">." & I_Length.ToString & ".<" & "strData = >." & strData & ".<" & _ ' vbCrLf & txt_Datum.Text & vbCrLf & txt_Zeitpunkt.Text & vbCrLf & "======================", _ ' "Communication Error Nr. " & i_ErrorCounter.ToString) ' Catch ex As Exception ' MessageBox.Show(ex.Message, "strfctn_ManipulateDataandPlot()") ' End Try ' ' ****** for testing ***** 'End If ' END >If I_Length > 9 Then< ' ###################################################### End Function ' ########################################################### Private Sub DisplayCurvesToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DisplayCurvesToolStripMenuItem.Click Instance_XY_Curves.ControlBox = False Instance_XY_Curves.pnl_DataSearch.Visible = False If DisplayCurvesToolStripMenuItem.Checked = True Then Try Instance_XY_Curves.Enabled = True Instance_XY_Curves.Visible = True Catch ex As Exception MessageBox.Show(ex.Message, "DisplayCurves") End Try Else Try Instance_XY_Curves.Enabled = False Instance_XY_Curves.Visible = False Catch ex As Exception MessageBox.Show(ex.Message, "DisplayCurves") End Try End If End Sub ' ########################################################### ' ########################################################### ' ########################################################### Private Sub SonnenstandToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SonnenstandToolStripMenuItem.Click If SonnenstandToolStripMenuItem.Checked = True Then Instance_SolarCalc.Visible = True Instance_SolarCalc.ControlBox = False Else Instance_SolarCalc.Visible = False Instance_SolarCalc.ControlBox = True End If End Sub ' ########################################################### Private Function strfctn_MinuteBeginning() strfctn_MinuteBeginning = "finished_MinuteBeginning" Dim sgl_CalenderIndex As Single Dim str_AnswerEle As String Dim str_Answertwe As String Dim str_FunctionReply As String = String.Empty If txt_MinuteIndex.BackColor = Color.GreenYellow Then txt_MinuteIndex.BackColor = Color.Yellow Else txt_MinuteIndex.BackColor = Color.GreenYellow End If Beep() sgl_CalenderIndex = Val(txt_CalenderIndex.Text) + 1 ' " Version 13926a" 'Instance_HeatingSchedule.Subroutine_FetchPattern(CInt(txt_MinuteIndex.Text)) str_FunctionReply = Instance_HeatingSchedule.strfctn_FetchPattern(CInt(txt_MinuteIndex.Text)) Instance_HeatingSchedule.txt_MinuteIndex.Text = txt_MinuteIndex.Text str_HeatingPatternandFlag = Instance_HeatingSchedule.txt_Pattern.Text i_NumberofValvesrequired = Len(str_HeatingPatternandFlag) - 1 ' right most character is Heating Flag txtDataFile.Text = Mid(str_HeatingPatternandFlag, 1, i_NumberofValvesrequired) str_HeatingFlag = Mid(str_HeatingPatternandFlag, (i_NumberofValvesrequired + 1), 1) txtDataFile.Text &= " HeatingFlag = " & str_HeatingFlag Instance_TECS_Display.txt_Dummy.text = str_HeatingFlag Select Case str_HeatingFlag Case "O" Instance_TECS_Display.txt_Dummy.Backcolor = Color.Blue Instance_TECS_Display.txt_Dummy.Forecolor = Color.Yellow Case "I" Instance_TECS_Display.txt_Dummy.Backcolor = Color.Red Instance_TECS_Display.txt_Dummy.Forecolor = Color.White End Select str_HeatingPattern = Mid(str_HeatingPatternandFlag, 1, i_NumberofValvesrequired) ' 16.02.2013 If (i_DoScanFlag = 1) Then str_AnswerEle = strfctn_SetHeatValveActionFlags() ' 02.06.2013 If (txt_MinuteIndex.Text = "0") Then ' at Midnight i_DataFileCreatedFlag = 0 'Call Instance_XY_Curves.fctnClearXYPlot() ' at Midnight ' +++13917+++++++++++++++++++++++++++++++++ Try 'Call Instance_XY_Curves.fctnClearXYPlot() ' at Midnight str_FunctionReply = Instance_XY_Curves.strfctn_ClearXYPlot() ' at Midnight Catch ex As Exception MessageBox.Show(ex.Message, "Warnung18 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ str_ManualSolDumpFlag = str_AutomaticDumpFlag End If ' end of > If (txt_DayIndex.Text = "0") Then ' at Midnight< If (txt_MinuteIndex.Text <> "0") Then ' after Midnight sgl_SOLARTHERMOEND = 19 - 10 * Math.Cos((sgl_CalenderIndex) * 2 * CSng(Math.PI) / 365) sgl_SOLARTHERMOSTART = -1 * sgl_SOLARTHERMOEND txt_SollAngle.Text = "+/- " & sgl_SOLARTHERMOEND.ToString 'Call Class_SolarCalc.Sonnenstand_Berechnung(txt_Zeitpunkt.Text, str_Datum_Numbers, I_MESZ_Fahne.ToString, _ str_Answertwe = Class_SolarCalc.str_fctn_Sonnenstand_Berechnung(txt_Zeitpunkt.Text, str_Datum_Numbers, I_MESZ_Fahne.ToString, _ str_Home_Nord, str_Home_East, sgl_SOLARTHERMOSTART, sgl_SOLARTHERMOEND) txt_ElevationAngle.Text = Class_SolarCalc.sgl_F_ElevationAngle.ToString & " °" txt_Azimut.Text = Class_SolarCalc.sgl_F_Azimut_Result.ToString & " °" txt_ElevationAngle.BackColor = Class_SolarCalc.txt_SgnAziElev.BackColor End If ' end of > If (txt_DayIndex.Text <> "0") Then ' after Midnight< End Function ' ####################################################################################### ' ####################################################################################### Private Function strfctn_SolarControl() As String Dim str_FunctionReply As String Dim str_SolarControlFunctionReply As String Me.Cursor = Cursors.AppStarting If txt_SolPumpSpeed.BackColor = Color.White Then txt_SolPumpSpeed.BackColor = Color.Yellow Else txt_SolPumpSpeed.BackColor = Color.White End If 'txt_ElevationAngle.BackColor = Class_SolarCalc.txt_SgnAziElev.BackColor ' see >Method_MinuteBeginning()< If txt_ElevationAngle.BackColor = Color.Orange Then ' the elevation angle of the sun is large enough. 'If txt_ElevationAngle.BackColor = Color.White Then ' for **** TESTING **** only str_FunctionReply = strfctn_ThermoSolar(iSTORINGFLAG) ' here is where the action is !!!! Else If (iSTORINGFLAG = 1 And iTempratureModuleRegisteredFlag = 1) Then str_DiagnosticBufferFor = strfctn_StoreInfo(strDataFilePathName, "Ch 13: 0.0 C") ' default for >str_HotSlope< End If 'for the time >fctn_ThermoSolar< is not monitored ' i.e. at night txt_HotValueENN.Text = "*****" txt_HotValueENNminusOne.Text = "*****" txt_HotSlope.Text = "*****" txt_ColdValueENN.Text = "*****" txt_ColdValueENNminusOne.Text = "*****" txt_ColdSlope.Text = "*****" txt_SolarDelta.Text = "*****" txt_EndSolarCount.Text = "*****" txt_SolarDelayCounter.Text = "*****" If txt_SolPumpSpeed.Text <> str_PUMPNULL Then str_DiagnosticBufferZer = strfctn_StopPump(strPumpCntrModuleAddress(I_SOLARPUMP)) ' Stops solar pump when the sun is down. txt_SolPumpSpeed.Text = str_PUMPNULL Try str_SolarControlFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), str_PUMPNULL) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung19 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ str_SolarStatusEchelon = "Cold_Start" txt_SolarMonitor.Text = str_SolarStatusEchelon End If End If Me.Cursor = Cursors.Default strfctn_SolarControl = "FifthTask" End Function ' ########################################################### ' ########################################################### Private Sub btn_StopSolarPump_Click(sender As System.Object, e As System.EventArgs) Handles btn_StopSolarPump.Click str_DiagnosticBufferZer = strfctn_StopPump(strPumpCntrModuleAddress(I_SOLARPUMP)) End Sub ' ########################################################### Private Sub btn_SetSolPumpSpeed_Click(sender As System.Object, e As System.EventArgs) Handles btn_SetSolPumpSpeed.Click Dim i_TestFlag As Integer Dim str_SetSolPumpSpeedFunctionReply As String Try i_TestFlag = Convert.ToInt16(txt_SolPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "btn_SetSolPumpSpeed") End Try If i_TestFlag < 1 Or i_TestFlag > 45 Then txt_SolPumpSpeed.BackColor = Color.Red txt_SolPumpSpeed.ForeColor = Color.Yellow Else txt_SolPumpSpeed.BackColor = Color.White txt_SolPumpSpeed.ForeColor = Color.Black str_DiagnosticBufferZer = strfctn_SetPumpSpeed(strPumpCntrModuleAddress(I_SOLARPUMP), txt_SolPumpSpeed.Text) 'str_SetSolPumpSpeedFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), txt_SolPumpSpeed.Text) ' +++13917+++++++++++++++++++++++++++++++++ Try str_SetSolPumpSpeedFunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SOLARPUMP + I_NUMBEROFTHERMALSENSORS), txt_SolPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung20 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ End If End Sub ' ########################################################### Private Sub HeatingScheduleToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles HeatingScheduleToolStripMenuItem.Click If HeatingScheduleToolStripMenuItem.Checked = True Then HeatingScheduleToolStripMenuItem.Checked = False Instance_HeatingSchedule.Visible = False Instance_HeatingSchedule.ControlBox = True Else HeatingScheduleToolStripMenuItem.Checked = True Instance_HeatingSchedule.Visible = True Instance_HeatingSchedule.ControlBox = False End If End Sub ' ########################################################### Private Sub btn_SetValvePosition_Click(sender As System.Object, e As System.EventArgs) Handles btn_SetValvePosition.Click iManualTestFlag = 1 ' prevents automatic measurement of temperatur every minute when set to "1" Me.Cursor = Cursors.WaitCursor i_HeatValveIndexCounter = 1 str_AuxiliaryTaskManagerEchelon = "ValveTrigger" Timer_AuxiliaryTaskManager.Interval = 1000 ' Milliseconds 21.12.2012 Timer_AuxiliaryTaskManager.Enabled = True End Sub ' ########################################################### Private Function strfctn_ValveTrigger() As String Dim str_AnswerNin As String If txt_ValvePosition.BackColor = Color.Orange Then txt_ValvePosition.BackColor = Color.LightSeaGreen Else txt_ValvePosition.BackColor = Color.Orange End If 'Call Method_ManualSetValvePosition(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter), txt_ValvePosition.Text) str_AnswerNin = strfctn_ManualSetValvePosition(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter), txt_ValvePosition.Text) i_HeatValveIndexCounter += 1 If i_HeatValveIndexCounter > iHeatValveCntrModuleAddressIndex Then Timer_AuxiliaryTaskManager.Enabled = False i_HeatValveIndexCounter = 1 iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" Me.Cursor = Cursors.Default End If strfctn_ValveTrigger = "Valve triggered" End Function ' ########################################################### ' ########################################################### Private Sub btn_ManualGetValveStatus_Click(sender As System.Object, e As System.EventArgs) Handles btn_ManualGetValveStatus.Click iManualTestFlag = 1 ' prevents automatic measurement of temperatur every minute when set to "1" 'Call Task_AutomaticGetValveStatus() str_DiagnosticBufferZer = strfctn_AutomaticGetValveStatus() End Sub ' ########################################################### Private Function strfctn_AutomaticGetValveStatus() As String strfctn_AutomaticGetValveStatus = String.Empty Me.Cursor = Cursors.WaitCursor i_HeatValveIndexCounter = 1 txt_ValveStatus.Text = String.Empty str_AuxiliaryTaskManagerEchelon = "GetValveStatus" 'Timer_TaskManager.Interval = 500 ' Milliseconds 'Timer_AuxiliaryTaskManager.Interval = 100 ' Milliseconds 6. 12. 2012 'Timer_AuxiliaryTaskManager.Interval = 200 ' Milliseconds 12.08.2013 Timer_AuxiliaryTaskManager.Interval = 300 ' Milliseconds 29.11.2013 Timer_AuxiliaryTaskManager.Enabled = True End Function ' ########################################################### Private Function strfctn_GetHeatValveStatus() As String If i_HeatValveIndexCounter > iHeatValveCntrModuleAddressIndex Then Timer_AuxiliaryTaskManager.Enabled = False iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" i_HeatValveIndexCounter = 1 Me.Cursor = Cursors.Default str_DiagnosticBufferTre = strfctn_FilterandGetHeatValveStatus() str_AuxiliaryTaskManagerEchelon = String.Empty str_SecondTickEchelon = "NinethTask" Else 'i_HeatValveIndexCounter = 1 str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter)) End If strfctn_GetHeatValveStatus = "Getting Valve Status" End Function ' ########################################################### ' ########################################################### Private Function strfctn_FilterandGetHeatValveStatus() strfctn_FilterandGetHeatValveStatus = String.Empty Dim i_IndexCounter As Integer Dim i_StatusEqualSignPositionIndex As Integer Dim i_HeatValveStatus As Integer Dim str_AnswerTen As String Dim str_ValveValue As String = String.Empty Dim str_FunctionReply As String = String.Empty Dim i_PosiOffset As Integer str_PresentValveStatus(0) = "*" ' Initialisierung For i_IndexCounter = 1 To (iHeatValveCntrModuleAddressIndex - 1) Step 1 str_PresentValveStatus(0) &= "*" Next i_IndexCounter For i_IndexCounter = 1 To (iHeatValveCntrModuleAddressIndex) Step 1 'i_StatusEqualSignPositionIndex = InStr(str_PresentValveStatus(i_IndexCounter), "Status = ") i_StatusEqualSignPositionIndex = InStr(str_PresentValveStatus(i_IndexCounter), "St") i_PosiOffset = 8 If i_StatusEqualSignPositionIndex = 0 Then i_StatusEqualSignPositionIndex = InStr(str_PresentValveStatus(i_IndexCounter), " =") i_PosiOffset = 2 End If If i_StatusEqualSignPositionIndex > 2 Then 'str_ValveValue = Mid(str_PresentValveStatus(i_IndexCounter), (i_StatusEqualSignPositionIndex + 8)) str_ValveValue = Mid(str_PresentValveStatus(i_IndexCounter), (i_StatusEqualSignPositionIndex + i_PosiOffset)) Try i_HeatValveStatus = CInt(str_ValveValue) If i_HeatValveStatus > 500 Then Mid(str_PresentValveStatus(0), (i_IndexCounter)) = "I" End If If i_HeatValveStatus < 100 Then Mid(str_PresentValveStatus(0), (i_IndexCounter)) = "O" End If 'Call Instance_HeatingSchedule.Subroutine_SelectOvalShape(i_IndexCounter, str_ValveValue) str_FunctionReply = Instance_HeatingSchedule.strfctn_SelectOvalShape(i_IndexCounter, str_ValveValue) Catch ex As Exception MessageBox.Show(" in >strfctn_FilterandGetHeatValveStatus()< " & str_PresentValveStatus(i_IndexCounter), "Warning") End Try Else MessageBox.Show(" in >strfctn_FilterandGetHeatValveStatus()<", "Warning " & str_PresentValveStatus(i_IndexCounter)) End If Next i_IndexCounter 'Call Task_SetValveActionFlag() str_AnswerTen = strfctn_SetHeatValveActionFlags() strfctn_FilterandGetHeatValveStatus = "finished strfctn_FilterandHeatGetValveStatus" End Function ' ########################################################### Private Function strfctn_SetHeatValveActionFlags() As String Dim str_CharOne As String Dim str_CharTwo As String txt_ValveStatus.Text = str_PresentValveStatus(0) For i_IndexCounter = 1 To (iHeatValveCntrModuleAddressIndex) Step 1 str_CharOne = Mid(str_HeatingPattern, i_IndexCounter, 1) ' requested Status str_CharTwo = Mid(str_PresentValveStatus(0), i_IndexCounter, 1) ' present Status If str_CharOne = str_CharTwo Then i_HeatValveActionFlag(i_IndexCounter) = 0 Else If str_CharOne = "I" Then i_HeatValveActionFlag(i_IndexCounter) = 1 ' means Valve needs to be opened If str_CharOne = "O" Then i_HeatValveActionFlag(i_IndexCounter) = -1 ' means Valve needs to be closed End If Next strfctn_SetHeatValveActionFlags = "Valve Action Flags are set" End Function ' ########################################################### ' ########################################################### Private Function strfctn_AutomaticSetValvePosition() As String strfctn_AutomaticSetValvePosition = String.Empty Me.Cursor = Cursors.WaitCursor i_HeatValveIndexCounter = 1 str_AuxiliaryTaskManagerEchelon = "SetValvePosition" Timer_AuxiliaryTaskManager.Interval = 1000 ' Milliseconds 21.12.2012 Timer_AuxiliaryTaskManager.Enabled = True End Function ' ########################################################### ' ########################################################### Private Function strfctn_SetHeatValvePosition() If txt_Zeitpunkt.BackColor = Color.Yellow Then txt_Zeitpunkt.BackColor = Color.Blue txt_Zeitpunkt.ForeColor = Color.Yellow ' the writing Else txt_Zeitpunkt.BackColor = Color.Yellow txt_Zeitpunkt.ForeColor = Color.Blue ' the writing End If Select Case i_HeatValveActionFlag(i_HeatValveIndexCounter) Case -1 'Call Method_SendEzBusCommand(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter), "P40") ' close str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter), "P40") ' close Case 0 ' nothing; Valve is in correct position Case 1 'Call Method_SendEzBusCommand(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter), "P570") ' open str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strHeatValveCntrModuleAddress(i_HeatValveIndexCounter), "P570") ' open End Select i_HeatValveIndexCounter += 1 If i_HeatValveIndexCounter > iHeatValveCntrModuleAddressIndex Then Timer_AuxiliaryTaskManager.Enabled = False i_HeatValveIndexCounter = 1 iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" str_AuxiliaryTaskManagerEchelon = String.Empty Me.Cursor = Cursors.Default str_SecondTickEchelon = "SeventhTask" End If strfctn_SetHeatValvePosition = "Setting Valve Positions" End Function ' ########################################################### ' ########################################################### ' ########################################################### ' ########################################################### Private Sub Timer_Identify_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_Identify.Tick Dim str_AnswerTre As String Dim str_AnswerSev As String Dim strBuffer As String = String.Empty If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then ' waiting - do nothing Else Select Case str_IdentifyEchelon Case "Interrogation" Instance_EzSloBus.I_EzBusBusyFlag = 1 Instance_EzSloBus.txt_Received_Data.Text = String.Empty Instance_EzSloBus.str_EzSloBusInfo = String.Empty Instance_EzSloBus.strCommunicationFlag = "Send" str_IdentifyEchelon = "Answer" str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(str_Address(i_Count_One), str_Command(i_Count_Two)) Case "Answer" str_DummyBox = Instance_EzSloBus.str_EzSloBusInfo If (str_Command(i_Count_Two) = "i") Then str_AnswerTre = strfctn_FilterandStoreAddresse(str_DummyBox) End If str_DGVBox(i_Count_Two) = Mid(Instance_EzSloBus.str_EzSloBusInfo, 4, 15) i_Count_Two += 1 If i_Count_Two > i_MAXCOLNUMBER Then str_IdentifyEchelon = "Sorting" Else str_IdentifyEchelon = "Interrogation" End If Case "Sorting" 'Instance_DataDisp.FillNextRow(str_Address(i_Count_One), str_DGVBox(1), str_DGVBox(2), _ strBuffer = Instance_DataDisp.strfctn_FillNextRow(str_Address(i_Count_One), str_DGVBox(1), str_DGVBox(2), _ str_DGVBox(3), str_DGVBox(4), str_DGVBox(5), str_DGVBox(6)) If str_DGVBox(1) = "Valve C'troller" Then str_PresentValveStatus(iHeatValveCntrModuleAddressIndex) = "..." & str_DGVBox(6) End If If ProtocolToolStripMenuItem.Checked = True Then str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, (" " & str_Address(i_Count_One) & " " & str_DGVBox(1))) End If i_Count_One += 1 If i_Count_One > i_AddressFieldLenght Then If ProtocolToolStripMenuItem.Checked = True Then str_DiagnosticBufferFor = strfctn_StoreInfo(strProtocolFilePathName, ("===================" & vbCrLf)) End If SearchIdentifyToolStripMenuItem.Visible = False TestModuleToolStripMenuItem.Visible = True pnl_SystemParameters.Visible = True btn_SetSpeedofHeatingPumps.Visible = True 'ProtocolToolStripMenuItem.Visible = False If ipreTemprModRegisteredFlag = i_EXPECTEDTEMPRMODULES Then ' This prevents that a temperature measurement is iTempratureModuleRegisteredFlag = 1 ' scanned before ALL the modules have been registered Else iTempratureModuleRegisteredFlag = 0 End If Me.Cursor = Cursors.Default iManualTestFlag = 0 ' allows automatic measurement of temperatur every minute when set to "0" Timer_Identify.Enabled = False Else i_Count_Two = 1 str_IdentifyEchelon = "Interrogation" End If If Timer_Identify.Enabled = False Then If (i_DoScanFlag = 1) Then ' Otherwise you get a wrong "Warning" when starting If iHeatValveCntrModuleAddressIndex > i_NumberofValvesrequired Then _ MessageBox.Show("Too many Heating Valves present", "Warning") If iHeatValveCntrModuleAddressIndex < i_NumberofValvesrequired Then _ MessageBox.Show("Too few Heating Valves present", "Warning") End If str_AnswerSev = strfctn_SetHeatValveServiceButtons() If iHeatValveCntrModuleAddressIndex = 0 Then MessageBox.Show("No Heating Valves are registered", "Warning") i_HeatValveCntrModulePresentFlag = 0 Else If iHeatValveCntrModuleAddressIndex < 13 Then MessageBox.Show("No all 13 Heating Valves are registered", "Warning") End If i_HeatValveCntrModulePresentFlag = 1 str_DiagnosticBufferTre = strfctn_FilterandGetHeatValveStatus() End If If iBalValve_C_trolModuleAddressIndex = 0 Then MessageBox.Show("No Ball Valves is registered", "Warning") i_BalValve_C_trolModulePresentFlag = 0 Else If iBalValve_C_trolModuleAddressIndex > 1 Then MessageBox.Show("Too many Ball Valves are registered", "Warning") End If i_BalValve_C_trolModulePresentFlag = 1 End If If iTemprModuleAddressIndex = 0 Then MessageBox.Show("No Temperature Modules are registered", "Warning") i_TemprModulePresentFlag = 0 Else i_TemprModulePresentFlag = 1 End If 'If iPumpCntrModuleAddressIndex = 0 Then If iPumpCntrModuleAddressIndex < 3 Then MessageBox.Show("Not all 3 Pump Controllers are registered", "Warning") i_PumpControllerPresentFlag = 0 Else i_PumpControllerPresentFlag = 1 End If If iPowSwiModuleAddressIndex = 0 Then MessageBox.Show("No Power Switch Modules are registered", "Warning") i_PowerSwitchPresentFlag = 0 Else i_PowerSwitchPresentFlag = 1 End If If iBalValve_C_trolModRegisteredFlag = 0 Then MessageBox.Show("No Ball Valve Modules is registered", "Warning") i_BallValveControllerPresentFlag = 0 Else i_BallValveControllerPresentFlag = 1 End If If iClient_TemplateCntrModuleAddressIndex = 0 Then MessageBox.Show("No Client Templates are registered", "Warning") i_ClientTemplatePresentFlag = 0 Else i_ClientTemplatePresentFlag = 1 End If End If End Select End If End Sub ' ########################################################### Private Function strfctn_GeneralModuleQuery() As String Instance_EzSloBus.txt_Received_Data.Text = String.Empty Instance_EzSloBus.str_EzSloBusInfo = String.Empty Select Case str_SelectEchelon ' >Sub Method_StopPump< Case "Waiting" ' one Wait State str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) str_SelectEchelon = "Show_LeftButton" Case "Show_LeftButton" str_Status = Mid(txt_TestReply.Text, 4, 2) If str_Status = "Sp" Then btn_ZeroValve.Visible = False btn_Left.Visible = True btn_Left.BackColor = Color.Blue btn_Left.ForeColor = Color.Yellow btn_Left.Text = "Programm &Pump" str_SelectEchelon = "Display" Else str_SelectEchelon = "Waiting" End If Case "Display" str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Timer_AuxiliaryTaskManager.Enabled = False str_SelectEchelon = String.Empty End Select strfctn_GeneralModuleQuery = "Done" End Function ' ########################################################### ' ####################################################################################### Private Sub txtTestReply_TextClick(sender As System.Object, e As System.EventArgs) Handles txt_TestReply.Click txt_TestReply.Text = String.Empty End Sub ' ####################################################################################### Private Sub Timer_AuxiliaryTaskManager_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_AuxiliaryTaskManager.Tick Dim str_Answerfiv As String If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then ' waiting - do nothing Else Select Case str_AuxiliaryTaskManagerEchelon Case "GeneralModuleQuery" str_Answerfiv = strfctn_GeneralModuleQuery() Case "ValveTrigger" str_Answerfiv = strfctn_ValveTrigger() Case "GetValveStatus" str_Answerfiv = strfctn_GetHeatValveStatus() Case "SetValvePosition" str_Answerfiv = strfctn_SetHeatValvePosition() Case "SearchIdentify" str_AuxiliaryTaskManagerEchelon = strfctn_Task_SearchIdentify() Case "DGV_Display" str_Answerfiv = strfctn_FillDataGridView() Case "Setbtn_StatusUpdatetovisible" ' str_AuxiliaryTaskManagerEchelon btn_StatusUpdate.Visible = True Timer_AuxiliaryTaskManager.Enabled = False Case Else ' nothing End Select End If End Sub ' ####################################################################################### Private Function strfctn_CalculateDiverseTemperatures() As String Dim str_CalculationDummy As String Dim strBuffer As String = String.Empty ' ################################# 'txt_Ext_Temperature.Text = FormatNumber(flt_Corrected_External_Ist_Temperature.ToString, 1) i_X_MinuteIndex = Val(txt_MinuteIndex.Text) + 1 ' " Version 13926a" 'flt_External_Ist_Temperature = CDec(txt_Ext_Temperature.Text) ' For testing flt_Original_External_Ist_Temperature = sgl_ActualThermalValue(i_Ch_EXTERNAL_TEMPERATURE) 'flt_Corrected_External_Ist_Temperature = flt_Original_External_Ist_Temperature ' one to one txt_ExternalTemperatureOffset.Text flt_Corrected_External_Ist_Temperature = flt_Original_External_Ist_Temperature + Val(txt_ExternalTemperatureOffset.Text) 'flt_Corrected_External_Ist_Temperature = Instance_TemperatureCalculation.SingleFctn_LinearCorrectedTemperature(flt_Original_External_Ist_Temperature) 'flt_Corrected_External_Ist_Temperature = Instance_TemperatureCalculation.SingleFctn_PolyTwoCorrectedTemperature(flt_Original_External_Ist_Temperature) 'flt_Corrected_External_Ist_Temperature = Instance_TemperatureCalculation.SingleFctn_PolyTreCorrectedTemperature(flt_Original_External_Ist_Temperature) Try str_CalculationDummy = Instance_TECS_Display.strfctn_FillinTemperatureTextBox(i_Ch_EXTERNAL_TEMPERATURE, (FormatNumber(flt_Corrected_External_Ist_Temperature.ToString, 1) & " ")) Catch ex As Exception MessageBox.Show(ex.Message, "strfctn_CalculateDiverseTemperatures()") End Try flt_BufTop_Ist_Temperature = sgl_ActualThermalValue(i_Ch_BUFTOP_TEMPERATURE) flt_BufMid_Ist_Temperature = sgl_ActualThermalValue(i_Ch_BUFMID_TEMPERATURE) flt_BufBot_Ist_Temperature = sgl_ActualThermalValue(i_Ch_BUFBOT_TEMPERATURE) flt_Supply_Minimum_Soll_Temperature = Instance_TemperatureCalculation.SingleFctn_VorlaufValue(flt_Corrected_External_Ist_Temperature) ' 31.5 - 0.425 * flt_Corrected_External_Ist_Temperature ' old flt_Delta_Temperature = Instance_TemperatureCalculation.SingleFctn_SpreizungValue(flt_Corrected_External_Ist_Temperature) ' 8 Okt. 2012 flt_MinBuffer_Soll_Temperature = flt_Supply_Minimum_Soll_Temperature + 3 'Call Instance_XY_Curves.fctnWriteXYPlotData(i_X_MinuteIndex, i_PLOTCORRECTED_EXTERNAL_TEMPERATURE.ToString, flt_Corrected_External_Ist_Temperature) ' in Plot1 ' +++13917+++++++++++++++++++++++++++++++++ Try 'Call Instance_XY_Curves.fctnWriteXYPlotData(i_X_MinuteIndex, i_PLOTCORRECTED_EXTERNAL_TEMPERATURE.ToString, flt_Corrected_External_Ist_Temperature) ' in Plot1 strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData(i_X_MinuteIndex, i_PLOTCORRECTED_EXTERNAL_TEMPERATURE.ToString, flt_Corrected_External_Ist_Temperature) ' in Plot1 Catch ex As Exception MessageBox.Show(ex.Message, "Warnung21 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'Call Instance_XY_Curves.fctnWriteXYPlotData(i_X_MinuteIndex, i_PLOTSUPPLY_TEMPERATURE.ToString, flt_Supply_Minimum_Soll_Temperature) ' in Plot1 ' +++13917+++++++++++++++++++++++++++++++++ Try 'Call Instance_XY_Curves.fctnWriteXYPlotData(i_X_MinuteIndex, i_PLOTSUPPLY_TEMPERATURE.ToString, flt_Supply_Minimum_Soll_Temperature) ' in Plot1 strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData(i_X_MinuteIndex, i_PLOTSUPPLY_TEMPERATURE.ToString, flt_Supply_Minimum_Soll_Temperature) ' in Plot1 Catch ex As Exception MessageBox.Show(ex.Message, "Warnung22 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'Call Instance_XY_Curves.fctnWriteXYPlotData(i_X_MinuteIndex, i_PLOTMINBUFSOLLTEMPERATURE.ToString, flt_MinBuffer_Soll_Temperature) ' in Plot1 ' +++13917+++++++++++++++++++++++++++++++++ Try 'Call Instance_XY_Curves.fctnWriteXYPlotData(i_X_MinuteIndex, i_PLOTMINBUFSOLLTEMPERATURE.ToString, flt_MinBuffer_Soll_Temperature) ' in Plot1 'If (i_X_MinuteIndex >= 390) And (i_X_MinuteIndex <= 540) Then ' 6:30h bis 9:00h If (i_X_MinuteIndex >= i_SIX_THIRTY) And (i_X_MinuteIndex <= i_NINE_O_CLOCK) Then ' 6:30h bis 9:00h 'If flt_MinBuffer_Soll_Temperature < 45.0 Then flt_MinBuffer_Soll_Temperature = 45.0 If flt_MinBuffer_Soll_Temperature < flt_MINBUFFERSOLLTEMPERATURE Then flt_MinBuffer_Soll_Temperature = flt_MINBUFFERSOLLTEMPERATURE ' 43.0 End If strBuffer = Instance_XY_Curves.strfctn_WriteXYPlotData(i_X_MinuteIndex, i_PLOTMINBUFSOLLTEMPERATURE.ToString, flt_MinBuffer_Soll_Temperature) ' in Plot1 'Instance_TECS_Display.txt_MinSollPufferTempr.Text = Format(Convert.ToString(flt_MinBuffer_Soll_Temperature), 2) Instance_TECS_Display.txt_MinSollPufferTempr.Text = (FormatNumber(flt_MinBuffer_Soll_Temperature, 1) & " C") Catch ex As Exception MessageBox.Show(ex.Message, "Warnung23 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ ' ############################################# ' ########################## flt_Supply_Ist_Temperature = sgl_ActualThermalValue(i_Ch_SECUNDARYSOURCE_TEMPERATURE) flt_Supply_Minimum_Soll_Temperature = Instance_TemperatureCalculation.SingleFctn_VorlaufValue(flt_Corrected_External_Ist_Temperature) ' 31.5 - 0.425 * flt_Corrected_External_Ist_Temperature ' old str_Supply_Minimum_Soll_Temperature = FormatNumber(flt_Supply_Minimum_Soll_Temperature, 1) & " C" 'str_DiagnosticBufferTwo = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox(i_SHOW_SOLLSEKUNDAERYVORLAUF, str_Supply_Minimum_Soll_Temperature) ' +++13917+++++++++++++++++++++++++++++++++ Try str_DiagnosticBufferTwo = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox(i_SHOW_SOLLSEKUNDAERYVORLAUF, str_Supply_Minimum_Soll_Temperature) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung24 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ flt_PufferAverageTemp = (sgl_ActualThermalValue(i_Ch_BUFTOP_TEMPERATURE) + sgl_ActualThermalValue(i_Ch_BUFMID_TEMPERATURE)) / 2 ' ########################### strfctn_CalculateDiverseTemperatures = "More to do" End Function ' ########################################################### Private Function strfctn_BurnerHeaterControl() As String Dim str_HeaterDummy As String Me.Cursor = Cursors.AppStarting If (i_X_MinuteIndex >= i_SIX_THIRTY) And (i_X_MinuteIndex <= i_NINE_O_CLOCK) Then ' between 6:30 O'Clock and 9 O'Clock 'If flt_MinBuffer_Soll_Temperature < 45.0 Then flt_MinBuffer_Soll_Temperature = 45.0 moved to >strfctn_CalculateDiverseTemperatures()< If (flt_BufMid_Ist_Temperature < flt_MinBuffer_Soll_Temperature) Then str_HeaterDummy = strfctn_TurnHeaterOn() 'str_EWFE_ThermeStatus = str_HeaterDummy ' not here because >flt_BufTop_Ist_Temperature< is still high enough !!! End If Else If (flt_BufTop_Ist_Temperature < flt_MinBuffer_Soll_Temperature) Then str_HeaterDummy = strfctn_TurnHeaterOn() str_EWFE_ThermeStatus = str_HeaterDummy End If End If If (flt_BufBot_Ist_Temperature > flt_MinBuffer_Soll_Temperature) Then str_HeaterDummy = strfctn_TurnHeaterOff() str_EWFE_ThermeStatus = str_HeaterDummy End If Me.Cursor = Cursors.Default Timer_AuxiliaryTaskManager.Enabled = False strfctn_BurnerHeaterControl = "FourthTask" ' SecondEchelon End Function ' ########################################################### Private Function strfctn_TurnHeaterOn() As String strCommand = "S1P" ' ON str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strPowSwiModuleAddress(i_POWMODONE), strCommand) 'str_DiagnosticBufferTwo = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox(17, "An") ' +++13917+++++++++++++++++++++++++++++++++ Try str_DiagnosticBufferTwo = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox(17, "An") Catch ex As Exception MessageBox.Show(ex.Message, "Warnung25 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ Instance_TECS_Display.txt_Brenner.Backcolor = Color.Green Instance_TECS_Display.txt_Brenner.Forecolor = Color.White strProtocolMessage = strPowSwiModuleAddress(i_POWMODONE) & " " & strCommand & vbCrLf strfctn_TurnHeaterOn = "Heater in ON" End Function ' ########################################################### Private Function strfctn_TurnHeaterOff() As String strCommand = "S1N" ' OFF str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand(strPowSwiModuleAddress(i_POWMODONE), strCommand) 'str_DiagnosticBufferTwo = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox(17, "Aus") ' +++13917+++++++++++++++++++++++++++++++++ Try str_DiagnosticBufferTwo = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox(17, "Aus") Catch ex As Exception MessageBox.Show(ex.Message, "Warnung26 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ Instance_TECS_Display.txt_Brenner.Backcolor = Color.Red Instance_TECS_Display.txt_Brenner.Forecolor = Color.Yellow strProtocolMessage = strPowSwiModuleAddress(i_POWMODONE) & " " & strCommand & vbCrLf strfctn_TurnHeaterOff = "Heater in OFF" End Function ' ########################################################### ' ########################################################### Private Function strfctn_SendSingleEzBusCommand(ByVal str_EzBusAddress As String, ByVal str_EzBusCommand As String) strfctn_SendSingleEzBusCommand = String.Empty Instance_EzSloBus.I_EzBusBusyFlag = 1 Instance_EzSloBus.strCommunicationFlag() = "Send" Instance_EzSloBus.txt_AddressOne.Text = str_EzBusAddress ' Control-Mirror on Ez.Bus_Test_Form Instance_EzSloBus.txt_CommandOne.Text = str_EzBusCommand ' Control-Mirror on Ez.Bus_Test_Form str_DiagnosticBufferOne = Instance_EzSloBus.strfctn_SendSingleMessage(str_EzBusAddress, str_EzBusCommand) ' 04.03.2013 str_EzBusAddress = String.Empty str_EzBusCommand = String.Empty strfctn_SendSingleEzBusCommand = "finished SendSingleEzBusCommand" End Function ' ########################################################### ' ########################################################### Private Function strfctn_SendDoubleEzBusCommand(ByVal str_EzBusAddressOne As String, ByVal str_EzBusCommandOne As String, _ ByVal str_EzBusAddressTwo As String, ByVal str_EzBusCommandTwo As String) strfctn_SendDoubleEzBusCommand = String.Empty Instance_EzSloBus.I_EzBusBusyFlag = 1 Instance_EzSloBus.strCommunicationFlag() = "Send" Instance_EzSloBus.txt_AddressOne.Text = str_EzBusAddressOne ' Control-Mirror on Ez.Bus_Test_Form Instance_EzSloBus.txt_AddressTwo.Text = str_EzBusAddressTwo ' Control-Mirror on Ez.Bus_Test_Form Instance_EzSloBus.txt_CommandOne.Text = str_EzBusCommandOne ' Control-Mirror on Ez.Bus_Test_Form Instance_EzSloBus.txt_CommandTwo.Text = str_EzBusCommandTwo ' Control-Mirror on Ez.Bus_Test_Form str_DiagnosticBufferOne = Instance_EzSloBus.strfctn_SendDoubleMessage(str_EzBusAddressOne, str_EzBusCommandOne, _ str_EzBusAddressTwo, str_EzBusCommandTwo) ' 12.04.2013 str_EzBusAddressOne = String.Empty str_EzBusAddressTwo = String.Empty str_EzBusCommandOne = String.Empty str_EzBusCommandTwo = String.Empty strfctn_SendDoubleEzBusCommand = "finished SendDoubleEzBusCommand" End Function ' ########################################################### ' ########################################################### Private Sub ResetEzBusToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ResetEzBusToolStripMenuItem.Click str_DiagnosticBufferTwo = strfctn_SendSingleEzBusCommand("?", "") ' Tests also RS232 Communication End Sub ' ########################################################### ' ########################################################### Private Sub Timer_PumpController_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_PumpController.Tick Dim str_AnswerTwlf As String If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then ' waiting - do nothing Else str_AnswerTwlf = strfctn_DisplayPumpControllerLeftSide() Timer_PumpController.Enabled = False End If End Sub ' ########################################################### Private Sub Timer_PowerSwitch_Tick(sender As System.Object, e As System.EventArgs) Handles Timer_PowerSwitch.Tick Dim str_AnswerSix As String If Instance_EzSloBus.I_EzBusBusyFlag = 1 Then ' waiting - do nothing Else 'Call Task_Fill_PowerSwitchDisplay() str_AnswerSix = strfctn_FillPowerSwitchDisplay() Timer_PowerSwitch.Enabled = False End If End Sub ' ########################################################### Private Sub btn_MinuteBeginning_Click(sender As System.Object, e As System.EventArgs) Handles btn_MinuteBeginning.Click Date_PresentTime = Now txt_MinuteIndex.Text = ((Date_PresentTime.Hour * 60) + Date_PresentTime.Minute).ToString 'Call Method_MinuteBeginning() str_DiagnosticBufferTwo = strfctn_MinuteBeginning() End Sub ' ########################################################### Private Sub btn_SetValvePattern_Click(sender As System.Object, e As System.EventArgs) Handles btn_SetValvePattern.Click 'Call Task_AutomaticSetValvePosition() str_DiagnosticBufferZer = strfctn_AutomaticSetValvePosition() End Sub ' ########################################################### Private Sub ValveServiceToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ValveServiceToolStripMenuItem.Click Dim str_AnswerAit As String If ValveServiceToolStripMenuItem.Checked = False Then ValveServiceToolStripMenuItem.Checked = True pnl_ValveService.Visible = True If iHeatValveCntrModuleAddressIndex = 0 Then MessageBox.Show("No Valves are registered", "Warning") Else 'Call Method_SetValveServiceButtons() str_AnswerAit = strfctn_SetHeatValveServiceButtons() End If Else ValveServiceToolStripMenuItem.Checked = False pnl_ValveService.Visible = False End If End Sub ' ########################################################### Private Function strfctn_SetHeatValveServiceButtons() As String Dim str_DummyText As String Dim i_TextPosition As Integer i_TextPosition = InStr(btn_SetValvePosition.Text, "ition") str_DummyText = Mid(btn_SetValvePosition.Text, 1, (i_TextPosition + 6)) str_DummyText &= iHeatValveCntrModuleAddressIndex.ToString & ")" btn_SetValvePosition.Text = str_DummyText i_TextPosition = InStr(btn_ManualGetValveStatus.Text, "tatus") str_DummyText = Mid(btn_ManualGetValveStatus.Text, 1, (i_TextPosition + 6)) str_DummyText &= iHeatValveCntrModuleAddressIndex.ToString & ")" btn_ManualGetValveStatus.Text = str_DummyText strfctn_SetHeatValveServiceButtons = "Buttons are set" End Function ' ########################################################### ' ########################################################### Private Sub TemperatureCalculationToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TemperatureCalculationToolStripMenuItem.Click If TemperatureCalculationToolStripMenuItem.Checked = True Then TemperatureCalculationToolStripMenuItem.Checked = False Instance_TemperatureCalculation.Visible = False Instance_TemperatureCalculation.ControlBox = True Else TemperatureCalculationToolStripMenuItem.Checked = True Instance_TemperatureCalculation.Visible = True Instance_TemperatureCalculation.ControlBox = False End If End Sub ' ########################################################### Private Sub SetIEXPECTEDTEMPRMODULESToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SetIEXPECTEDTEMPRMODULESToolStripMenuItem.Click txt_ExpTemprModule.Text = i_EXPECTEDTEMPRMODULES.ToString If SetIEXPECTEDTEMPRMODULESToolStripMenuItem.Checked = False Then SetIEXPECTEDTEMPRMODULESToolStripMenuItem.Checked = True txt_ExpTemprModule.Visible = True lbl_ExpTemprModule.Visible = True Else SetIEXPECTEDTEMPRMODULESToolStripMenuItem.Checked = False txt_ExpTemprModule.Visible = False lbl_ExpTemprModule.Visible = False End If End Sub ' ########################################################### Private Sub txt_ExpTemprModule_TextChanged(sender As Object, e As System.EventArgs) Handles txt_ExpTemprModule.TextChanged i_EXPECTEDTEMPRMODULES = CInt(txt_ExpTemprModule.Text) End Sub ' ########################################################### ' ########################################################### Private Sub ScanLoopToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ScanLoopToolStripMenuItem.Click If ScanLoopToolStripMenuItem.Checked = False Then ScanLoopToolStripMenuItem.Checked = True ScanLoopToolStripMenuItem.Text = "Scan Loop is enabled" i_ScanLoopEnabled = 1 Else ScanLoopToolStripMenuItem.Checked = False ScanLoopToolStripMenuItem.Text = "Scan Loop is disabled" i_ScanLoopEnabled = 0 End If End Sub ' ########################################################### ' ########################################################### Private Sub ProtocolToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles ProtocolToolStripMenuItem.Click Dim str_AnswerTwo As String If ProtocolToolStripMenuItem.Checked = True Then str_AnswerTwo = strfctn_CreateProtocolFolderandFile() Else End If End Sub ' ########################################################### Private Function strfctn_CreateProtocolFolderandFile() As String Try My.Computer.FileSystem.CreateDirectory(str_CurrentDirectory & "\" & strProtocolFolderName) Catch ex As Exception MessageBox.Show(ex.Message) End Try Try My.Computer.FileSystem.WriteAllText(strProtocolFilePathName, vbCrLf & "Mowast Engineering Command Protocol" & vbCrLf, False) Catch ex As Exception MessageBox.Show(ex.Message, My.Application.Info.Title, _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try strfctn_CreateProtocolFolderandFile = "Created Protocolfolder and file" End Function ' ########################################################### ' ########################################################### ' ########################################################### Private Sub DisplaySystemToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles DisplaySystemToolStripMenuItem.Click Instance_TECS_Display.ControlBox = False 'Instance_TECS_Display.txt_AußenTemperatur.Text = "1" 'Instance_TECS_Display.txt_PufferTop.Text = "2" 'Instance_TECS_Display.txt_PufferMitte.Text = "3" 'Instance_TECS_Display.txt_PufferUnten.Text = "4" 'Instance_TECS_Display.txt_PufferRücklauf.Text = "5" 'Instance_TECS_Display.txt_PrimRücklauf.Text = "6" 'Instance_TECS_Display.txt_SekundärVorlauf.Text = "7" 'Instance_TECS_Display.txt_SekundärRücklauf.Text = "8" 'Instance_TECS_Display.txt_SolarHot.Text = "9" 'Instance_TECS_Display.txt_SolarCold.Text = "10" 'Instance_TECS_Display.txt_GeothermieVorlauf.Text = "11" 'Instance_TECS_Display.txt_GeothermieRücklauf.Text = "12" 'Instance_TECS_Display.txt_SolarPumpe.Text = "13" ' 1 'Instance_TECS_Display.txt_PrimärPumpe.Text = "14" ' 2 'Instance_TECS_Display.txt_SekundärPumpe.Text = "15" ' 3 'Instance_TECS_Display.txt_GeoPumpe.Text = "16" ' 4 'Instance_TECS_Display.txt_Brenner.Text = "17" 'Instance_TECS_Display.txt_GeothermieFluß.Text = "18" 'Instance_TECS_Display.txt_SollSekundärVorlauf.Text = "19" If DisplaySystemToolStripMenuItem.Checked = True Then Try Instance_TECS_Display.Enabled = True Instance_TECS_Display.Visible = True Catch ex As Exception MessageBox.Show(ex.Message, "Display System") End Try Else Try Instance_TECS_Display.Enabled = False Instance_TECS_Display.Visible = False Catch ex As Exception MessageBox.Show(ex.Message, "Display System") End Try End If End Sub ' ########################################################### ' ########################################################### Private Sub HeatingPumpServiceToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles HeatingPumpServiceToolStripMenuItem.Click 'MessageBox.Show("Not yet programmed", "Warning") If HeatingPumpServiceToolStripMenuItem.Checked = False Then HeatingPumpServiceToolStripMenuItem.Checked = True pnl_TestingHeatingPumps.Visible = True Else HeatingPumpServiceToolStripMenuItem.Checked = False pnl_TestingHeatingPumps.Visible = False End If End Sub ' ########################################################### ' ########################################################### Private Sub SolarServiceToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SolarServiceToolStripMenuItem.Click If SolarServiceToolStripMenuItem.Checked = False Then SolarServiceToolStripMenuItem.Checked = True pnl_SolarService.Visible = True Else SolarServiceToolStripMenuItem.Checked = False pnl_SolarService.Visible = False End If End Sub ' ########################################################### ' ########################################################### Private Sub btn_SetSpeedofHeatingPumps_Click(sender As System.Object, e As System.EventArgs) Handles btn_SetSpeedofHeatingPumps.Click Dim i_TestOneFlag As Integer Dim i_TestTwoFlag As Integer Dim i_OkayFlag As Integer = 0 Dim str_FunctionReply As String Try i_TestOneFlag = Convert.ToInt16(txt_PrimaryPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "btn_SetPrimaryHeatingPumpSpeed") End Try If i_TestOneFlag < 0 Or i_TestOneFlag > 44 Then ' 1 ==> 0 and 45 ==> 44 V14806a txt_PrimaryPumpSpeed.BackColor = Color.Red txt_PrimaryPumpSpeed.ForeColor = Color.Yellow Else txt_PrimaryPumpSpeed.BackColor = Color.White txt_PrimaryPumpSpeed.ForeColor = Color.Black i_OkayFlag += 1 End If Try i_TestTwoFlag = Convert.ToInt16(txt_SecundaryPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "btn_SetPrimaryHeatingPumpSpeed") End Try If i_TestTwoFlag < 0 Or i_TestTwoFlag > 44 Then ' 1 ==> 0 and 45 ==> 44 V14806a txt_SecundaryPumpSpeed.BackColor = Color.Red txt_SecundaryPumpSpeed.ForeColor = Color.Yellow Else txt_SecundaryPumpSpeed.BackColor = Color.White txt_SecundaryPumpSpeed.ForeColor = Color.Black i_OkayFlag += 1 End If If i_OkayFlag = 2 Then str_DiagnosticBufferZer = strfctn_SendDoubleEzBusCommand(strPumpCntrModuleAddress(I_PRIMARYHEATINGPUMP), ("S" & txt_PrimaryPumpSpeed.Text), _ strPumpCntrModuleAddress(I_SECUNDARYHEATINGPUMP), ("S" & txt_SecundaryPumpSpeed.Text)) 'str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), txt_PrimaryPumpSpeed.Text) ' +++13917+++++++++++++++++++++++++++++++++ Try str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), txt_PrimaryPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung27 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), txt_SecundaryPumpSpeed.Text) ' +++13917+++++++++++++++++++++++++++++++++ Try str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), txt_SecundaryPumpSpeed.Text) Catch ex As Exception MessageBox.Show(ex.Message, "Warnung28 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ Else 'str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), "?") ' +++13917+++++++++++++++++++++++++++++++++ Try str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_PRIMARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), "?") Catch ex As Exception MessageBox.Show(ex.Message, "Warnung29 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ 'str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), "??") ' +++13917+++++++++++++++++++++++++++++++++ Try str_FunctionReply = Instance_TECS_Display.strfctn_FillinPumpExtraTextBox((I_SECUNDARYHEATINGPUMP + I_NUMBEROFTHERMALSENSORS), "??") Catch ex As Exception MessageBox.Show(ex.Message, "Warnung30 >Try< " & txt_Datum.Text & " " & txt_Zeitpunkt.Text) End Try ' +++++++++++++++++++++++++++++++++++++++++ End If End Sub ' ########################################################### ' ########################################################### Private Sub btn_StatusUpdate_Click(sender As System.Object, e As System.EventArgs) Handles btn_StatusUpdate.Click Instance_EzSloBus.txt_Received_Data.Text = String.Empty Instance_EzSloBus.str_EzSloBusInfo = String.Empty str_DiagnosticBufferTre = strfctn_ModuleStatusInquiry(strModuleAddress) Me.Cursor = Cursors.Default End Sub ' ########################################################### ' ########################################################### Private Sub txt_Default_Cold_Start_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_Default_Cold_Start.TextChanged If txt_Default_Cold_Start.Text = "-" Or txt_Default_Cold_Start.Text = "+" Then Else If CInt(txt_Default_Cold_Start.Text) > 20 Then txt_Default_Cold_Start.Text = "20" If CInt(txt_Default_Cold_Start.Text) < 3 Then txt_Default_Cold_Start.Text = "3" End If End Sub ' ########################################################### ' ########################################################### Private Sub txt_Default_StartingUp_TextChanged(sender As System.Object, e As System.EventArgs) Handles txt_Default_StartingUp.TextChanged If txt_Default_StartingUp.Text = "-" Or txt_Default_StartingUp.Text = "+" Then Else If CInt(txt_Default_StartingUp.Text) > 20 Then txt_Default_StartingUp.Text = "20" If CInt(txt_Default_StartingUp.Text) < 3 Then txt_Default_StartingUp.Text = "3" End If End Sub Private Sub btn_ToggleCoolingFlag_Click(sender As Object, e As EventArgs) Handles btn_ToggleCoolingFlag.Click If txt_CoolingFlag.Text = "OFF" Then txt_CoolingFlag.Text = "ON" txt_CoolingFlag.ForeColor = Color.White txt_CoolingFlag.BackColor = Color.Green txt_SecundaryPumpSpeed.Text = txt_PrimaryCoolingValue.Text Else txt_CoolingFlag.Text = "OFF" txt_CoolingFlag.ForeColor = Color.Yellow txt_CoolingFlag.BackColor = Color.Red txt_SecundaryPumpSpeed.Text = "-1" ' obvious error !! End If End Sub End Class