diff --git a/CSE/Calculation/Signal_identification.vb b/CSE/Calculation/Signal_identification.vb index c20ebde1088ad550dee320fed69eb38984497d16..16480128fae966419d26e27ccd99a88481ae329b 100644 --- a/CSE/Calculation/Signal_identification.vb +++ b/CSE/Calculation/Signal_identification.vb @@ -387,8 +387,8 @@ Module Signal_identification ' Calculate the section average values For i = 0 To CalcData(tCompCali.SecID).Count - 1 - CalcData(tCompCali.vair_ic).Add(InputData(tComp.vair_ar)(i) * Job.Anemometer(0) + Job.Anemometer(1)) - CalcData(tCompCali.beta_ic).Add(InputData(tComp.beta_ar)(i) * Job.Anemometer(2) + Job.Anemometer(3)) + CalcData(tCompCali.vair_ic).Add(InputData(tComp.vair_ar)(i) * Job.v_air_f + Job.v_air_d) + CalcData(tCompCali.beta_ic).Add(InputData(tComp.beta_ar)(i) * Job.beta_f + Job.beta_d) For Each sKVC In CalcData If CalcData(sKVC.Key).Count <= i Then CalcData(sKVC.Key).Add(0) diff --git a/CSE/GUI/F_Main.Designer.vb b/CSE/GUI/F_Main.Designer.vb index 2c66811ab363872cb1fd906a49575733cae40cb5..138d10168a2b48b343bcdedb333dc9a805aa957e 100644 --- a/CSE/GUI/F_Main.Designer.vb +++ b/CSE/GUI/F_Main.Designer.vb @@ -24,9 +24,7 @@ Partial Class F_Main Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(F_Main)) Me.MenuStrip1 = New System.Windows.Forms.MenuStrip() - Me.MenuItemFile = New System.Windows.Forms.ToolStripMenuItem() - Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator() - Me.ToolStripMenuItemExit = New System.Windows.Forms.ToolStripMenuItem() + Me.MenuItemExit = New System.Windows.Forms.ToolStripMenuItem() Me.MenuItemNewJob = New System.Windows.Forms.ToolStripMenuItem() Me.MenuItemLoadJob = New System.Windows.Forms.ToolStripMenuItem() Me.MenuItemReloadJob = New System.Windows.Forms.ToolStripMenuItem() @@ -52,7 +50,7 @@ Partial Class F_Main Me.GB_hz_out = New System.Windows.Forms.GroupBox() Me.RB100Hz = New System.Windows.Forms.RadioButton() Me.RB1Hz = New System.Windows.Forms.RadioButton() - Me.GroupBox2 = New System.Windows.Forms.GroupBox() + Me.GB_Anemometer = New System.Windows.Forms.GroupBox() Me.Label13 = New System.Windows.Forms.Label() Me.Label12 = New System.Windows.Forms.Label() Me.Label11 = New System.Windows.Forms.Label() @@ -89,6 +87,9 @@ Partial Class F_Main Me.TextBoxDataC = New System.Windows.Forms.TextBox() Me.ButtonDataC = New System.Windows.Forms.Button() Me.ButtonSelectDataC = New System.Windows.Forms.Button() + Me.TextBoxMSCC = New System.Windows.Forms.TextBox() + Me.ButtonMSCC = New System.Windows.Forms.Button() + Me.ButtonSelectMSCC = New System.Windows.Forms.Button() Me.GroupBox3 = New System.Windows.Forms.GroupBox() Me.Label17 = New System.Windows.Forms.Label() Me.Label16 = New System.Windows.Forms.Label() @@ -99,9 +100,6 @@ Partial Class F_Main Me.TextBoxRAirPos = New System.Windows.Forms.TextBox() Me.Label7 = New System.Windows.Forms.Label() Me.TextBoxRVeh = New System.Windows.Forms.TextBox() - Me.TextBoxMSCC = New System.Windows.Forms.TextBox() - Me.ButtonMSCC = New System.Windows.Forms.Button() - Me.ButtonSelectMSCC = New System.Windows.Forms.Button() Me.TabControlOutMsg = New System.Windows.Forms.TabControl() Me.TabPageMSG = New System.Windows.Forms.TabPage() Me.ListBoxMSG = New System.Windows.Forms.ListBox() @@ -112,6 +110,8 @@ Partial Class F_Main Me.TextBoxVeh = New System.Windows.Forms.TextBox() Me.TabControl1 = New System.Windows.Forms.TabControl() Me.TPMain = New System.Windows.Forms.TabPage() + Me.TBInfoMain = New System.Windows.Forms.TextBox() + Me.PbInfoIconMain = New System.Windows.Forms.PictureBox() Me.TPCriteria = New System.Windows.Forms.TabPage() Me.GroupBox7 = New System.Windows.Forms.GroupBox() Me.Label26 = New System.Windows.Forms.Label() @@ -191,8 +191,8 @@ Partial Class F_Main Me.Label42 = New System.Windows.Forms.Label() Me.TB_v_wind_1s_max_CAL = New System.Windows.Forms.TextBox() Me.LBetaAveCALMax = New System.Windows.Forms.Label() - Me.TBInfo = New System.Windows.Forms.TextBox() - Me.PBInfoIcon = New System.Windows.Forms.PictureBox() + Me.TBInfoCrt = New System.Windows.Forms.TextBox() + Me.PBInfoIconCrt = New System.Windows.Forms.PictureBox() Me.GroupBox14 = New System.Windows.Forms.GroupBox() Me.Label82 = New System.Windows.Forms.Label() Me.LB_t_amb_tarmac = New System.Windows.Forms.Label() @@ -231,7 +231,7 @@ Partial Class F_Main Me.MenuStrip1.SuspendLayout() Me.GroupBoxJob.SuspendLayout() Me.GB_hz_out.SuspendLayout() - Me.GroupBox2.SuspendLayout() + Me.GB_Anemometer.SuspendLayout() Me.GroupBoxInput.SuspendLayout() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -243,6 +243,7 @@ Partial Class F_Main Me.TabPageErr.SuspendLayout() Me.TabControl1.SuspendLayout() Me.TPMain.SuspendLayout() + CType(Me.PbInfoIconMain, System.ComponentModel.ISupportInitialize).BeginInit() Me.TPCriteria.SuspendLayout() Me.GroupBox7.SuspendLayout() Me.GroupBox8.SuspendLayout() @@ -251,38 +252,26 @@ Partial Class F_Main Me.GroupBox12.SuspendLayout() Me.GroupBox11.SuspendLayout() Me.GroupBox13.SuspendLayout() - CType(Me.PBInfoIcon, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.PBInfoIconCrt, System.ComponentModel.ISupportInitialize).BeginInit() Me.GroupBox14.SuspendLayout() Me.GroupBox10.SuspendLayout() Me.SuspendLayout() ' 'MenuStrip1 ' - Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.MenuItemFile, Me.MenuItemNewJob, Me.MenuItemLoadJob, Me.MenuItemReloadJob, Me.MenuItemSaveJob, Me.MenuItemSaveAsJob, Me.ToolsToolStripMenuItem, Me.InfoToolStripMenuItem}) + Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.MenuItemExit, Me.MenuItemNewJob, Me.MenuItemLoadJob, Me.MenuItemReloadJob, Me.MenuItemSaveJob, Me.MenuItemSaveAsJob, Me.ToolsToolStripMenuItem, Me.InfoToolStripMenuItem}) Me.MenuStrip1.Location = New System.Drawing.Point(0, 0) Me.MenuStrip1.Name = "MenuStrip1" Me.MenuStrip1.Size = New System.Drawing.Size(944, 24) Me.MenuStrip1.TabIndex = 0 Me.MenuStrip1.Text = "MenuStrip1" ' - 'MenuItemFile - ' - Me.MenuItemFile.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripSeparator2, Me.ToolStripMenuItemExit}) - Me.MenuItemFile.Name = "MenuItemFile" - Me.MenuItemFile.Size = New System.Drawing.Size(37, 20) - Me.MenuItemFile.Text = "File" - ' - 'ToolStripSeparator2 - ' - Me.ToolStripSeparator2.Name = "ToolStripSeparator2" - Me.ToolStripSeparator2.Size = New System.Drawing.Size(89, 6) - ' - 'ToolStripMenuItemExit + 'MenuItemExit ' - Me.ToolStripMenuItemExit.Image = Global.CSE.My.Resources.Resources.Beenden - Me.ToolStripMenuItemExit.Name = "ToolStripMenuItemExit" - Me.ToolStripMenuItemExit.Size = New System.Drawing.Size(92, 22) - Me.ToolStripMenuItemExit.Text = "Exit" + Me.MenuItemExit.Image = Global.CSE.My.Resources.Resources.Beenden + Me.MenuItemExit.Name = "MenuItemExit" + Me.MenuItemExit.Size = New System.Drawing.Size(53, 20) + Me.MenuItemExit.Text = "Exit" ' 'MenuItemNewJob ' @@ -502,26 +491,26 @@ Partial Class F_Main Me.RB1Hz.Text = "1Hz" Me.RB1Hz.UseVisualStyleBackColor = True ' - 'GroupBox2 - ' - Me.GroupBox2.Controls.Add(Me.Label13) - Me.GroupBox2.Controls.Add(Me.Label12) - Me.GroupBox2.Controls.Add(Me.Label11) - Me.GroupBox2.Controls.Add(Me.Label10) - Me.GroupBox2.Controls.Add(Me.Label6) - Me.GroupBox2.Controls.Add(Me.Label5) - Me.GroupBox2.Controls.Add(Me.Label4) - Me.GroupBox2.Controls.Add(Me.Label3) - Me.GroupBox2.Controls.Add(Me.TextBoxbetaf) - Me.GroupBox2.Controls.Add(Me.TextBoxbetad) - Me.GroupBox2.Controls.Add(Me.TextBoxAirf) - Me.GroupBox2.Controls.Add(Me.TextBoxAird) - Me.GroupBox2.Location = New System.Drawing.Point(144, 72) - Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.Size = New System.Drawing.Size(463, 57) - Me.GroupBox2.TabIndex = 23 - Me.GroupBox2.TabStop = False - Me.GroupBox2.Text = "Anemometer instrument calibration" + 'GB_Anemometer + ' + Me.GB_Anemometer.Controls.Add(Me.Label13) + Me.GB_Anemometer.Controls.Add(Me.Label12) + Me.GB_Anemometer.Controls.Add(Me.Label11) + Me.GB_Anemometer.Controls.Add(Me.Label10) + Me.GB_Anemometer.Controls.Add(Me.Label6) + Me.GB_Anemometer.Controls.Add(Me.Label5) + Me.GB_Anemometer.Controls.Add(Me.Label4) + Me.GB_Anemometer.Controls.Add(Me.Label3) + Me.GB_Anemometer.Controls.Add(Me.TextBoxbetaf) + Me.GB_Anemometer.Controls.Add(Me.TextBoxbetad) + Me.GB_Anemometer.Controls.Add(Me.TextBoxAirf) + Me.GB_Anemometer.Controls.Add(Me.TextBoxAird) + Me.GB_Anemometer.Location = New System.Drawing.Point(335, 72) + Me.GB_Anemometer.Name = "GB_Anemometer" + Me.GB_Anemometer.Size = New System.Drawing.Size(463, 57) + Me.GB_Anemometer.TabIndex = 23 + Me.GB_Anemometer.TabStop = False + Me.GB_Anemometer.Text = "Anemometer instrument calibration" ' 'Label13 ' @@ -861,7 +850,7 @@ Partial Class F_Main Me.ButtonCalC.Location = New System.Drawing.Point(837, 18) Me.ButtonCalC.Margin = New System.Windows.Forms.Padding(2) Me.ButtonCalC.Name = "ButtonCalC" - Me.ButtonCalC.Size = New System.Drawing.Size(60, 163) + Me.ButtonCalC.Size = New System.Drawing.Size(60, 111) Me.ButtonCalC.TabIndex = 12 Me.ButtonCalC.Text = "Calibrate" Me.ButtonCalC.TextAlign = System.Drawing.ContentAlignment.BottomCenter @@ -875,15 +864,14 @@ Partial Class F_Main Me.GroupBox1.Controls.Add(Me.TextBoxDataC) Me.GroupBox1.Controls.Add(Me.ButtonDataC) Me.GroupBox1.Controls.Add(Me.ButtonSelectDataC) - Me.GroupBox1.Controls.Add(Me.GroupBox2) - Me.GroupBox1.Controls.Add(Me.GroupBox3) + Me.GroupBox1.Controls.Add(Me.GB_Anemometer) Me.GroupBox1.Controls.Add(Me.TextBoxMSCC) Me.GroupBox1.Controls.Add(Me.ButtonMSCC) Me.GroupBox1.Controls.Add(Me.ButtonSelectMSCC) Me.GroupBox1.Controls.Add(Me.ButtonCalC) Me.GroupBox1.Location = New System.Drawing.Point(6, 81) Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(906, 188) + Me.GroupBox1.Size = New System.Drawing.Size(906, 138) Me.GroupBox1.TabIndex = 33 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Calibration test" @@ -921,6 +909,39 @@ Partial Class F_Main Me.ButtonSelectDataC.Text = "..." Me.ButtonSelectDataC.UseVisualStyleBackColor = True ' + 'TextBoxMSCC + ' + Me.TextBoxMSCC.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxMSCC.Location = New System.Drawing.Point(144, 20) + Me.TextBoxMSCC.Margin = New System.Windows.Forms.Padding(2) + Me.TextBoxMSCC.Name = "TextBoxMSCC" + Me.TextBoxMSCC.Size = New System.Drawing.Size(654, 20) + Me.TextBoxMSCC.TabIndex = 4 + ' + 'ButtonMSCC + ' + Me.ButtonMSCC.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.ButtonMSCC.Location = New System.Drawing.Point(5, 18) + Me.ButtonMSCC.Margin = New System.Windows.Forms.Padding(2) + Me.ButtonMSCC.Name = "ButtonMSCC" + Me.ButtonMSCC.Size = New System.Drawing.Size(135, 23) + Me.ButtonMSCC.TabIndex = 18 + Me.ButtonMSCC.Text = "CalibrationTrack" + Me.ButtonMSCC.UseVisualStyleBackColor = True + ' + 'ButtonSelectMSCC + ' + Me.ButtonSelectMSCC.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonSelectMSCC.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.ButtonSelectMSCC.Location = New System.Drawing.Point(802, 18) + Me.ButtonSelectMSCC.Margin = New System.Windows.Forms.Padding(2) + Me.ButtonSelectMSCC.Name = "ButtonSelectMSCC" + Me.ButtonSelectMSCC.Size = New System.Drawing.Size(31, 23) + Me.ButtonSelectMSCC.TabIndex = 5 + Me.ButtonSelectMSCC.Text = "..." + Me.ButtonSelectMSCC.UseVisualStyleBackColor = True + ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.Label17) @@ -932,7 +953,7 @@ Partial Class F_Main Me.GroupBox3.Controls.Add(Me.TextBoxRAirPos) Me.GroupBox3.Controls.Add(Me.Label7) Me.GroupBox3.Controls.Add(Me.TextBoxRVeh) - Me.GroupBox3.Location = New System.Drawing.Point(144, 135) + Me.GroupBox3.Location = New System.Drawing.Point(341, 225) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(463, 46) Me.GroupBox3.TabIndex = 31 @@ -1023,39 +1044,6 @@ Partial Class F_Main Me.TextBoxRVeh.TabIndex = 0 Me.TextBoxRVeh.TextAlign = System.Windows.Forms.HorizontalAlignment.Right ' - 'TextBoxMSCC - ' - Me.TextBoxMSCC.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxMSCC.Location = New System.Drawing.Point(144, 20) - Me.TextBoxMSCC.Margin = New System.Windows.Forms.Padding(2) - Me.TextBoxMSCC.Name = "TextBoxMSCC" - Me.TextBoxMSCC.Size = New System.Drawing.Size(654, 20) - Me.TextBoxMSCC.TabIndex = 4 - ' - 'ButtonMSCC - ' - Me.ButtonMSCC.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.ButtonMSCC.Location = New System.Drawing.Point(5, 18) - Me.ButtonMSCC.Margin = New System.Windows.Forms.Padding(2) - Me.ButtonMSCC.Name = "ButtonMSCC" - Me.ButtonMSCC.Size = New System.Drawing.Size(135, 23) - Me.ButtonMSCC.TabIndex = 18 - Me.ButtonMSCC.Text = "CalibrationTrack" - Me.ButtonMSCC.UseVisualStyleBackColor = True - ' - 'ButtonSelectMSCC - ' - Me.ButtonSelectMSCC.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonSelectMSCC.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.ButtonSelectMSCC.Location = New System.Drawing.Point(802, 18) - Me.ButtonSelectMSCC.Margin = New System.Windows.Forms.Padding(2) - Me.ButtonSelectMSCC.Name = "ButtonSelectMSCC" - Me.ButtonSelectMSCC.Size = New System.Drawing.Size(31, 23) - Me.ButtonSelectMSCC.TabIndex = 5 - Me.ButtonSelectMSCC.Text = "..." - Me.ButtonSelectMSCC.UseVisualStyleBackColor = True - ' 'TabControlOutMsg ' Me.TabControlOutMsg.Alignment = System.Windows.Forms.TabAlignment.Bottom @@ -1097,7 +1085,8 @@ Partial Class F_Main Me.ListBoxMSG.Location = New System.Drawing.Point(2, 4) Me.ListBoxMSG.Margin = New System.Windows.Forms.Padding(2) Me.ListBoxMSG.Name = "ListBoxMSG" - Me.ListBoxMSG.Size = New System.Drawing.Size(915, 147) + Me.ListBoxMSG.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple + Me.ListBoxMSG.Size = New System.Drawing.Size(913, 160) Me.ListBoxMSG.TabIndex = 23 ' 'TabPageWar @@ -1123,7 +1112,8 @@ Partial Class F_Main Me.ListBoxWar.Location = New System.Drawing.Point(2, 4) Me.ListBoxWar.Margin = New System.Windows.Forms.Padding(2) Me.ListBoxWar.Name = "ListBoxWar" - Me.ListBoxWar.Size = New System.Drawing.Size(946, 147) + Me.ListBoxWar.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple + Me.ListBoxWar.Size = New System.Drawing.Size(915, 160) Me.ListBoxWar.TabIndex = 26 ' 'TabPageErr @@ -1148,7 +1138,8 @@ Partial Class F_Main Me.ListBoxErr.Location = New System.Drawing.Point(2, 4) Me.ListBoxErr.Margin = New System.Windows.Forms.Padding(2) Me.ListBoxErr.Name = "ListBoxErr" - Me.ListBoxErr.Size = New System.Drawing.Size(946, 147) + Me.ListBoxErr.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple + Me.ListBoxErr.Size = New System.Drawing.Size(913, 160) Me.ListBoxErr.TabIndex = 27 ' 'TextBoxVeh @@ -1175,6 +1166,9 @@ Partial Class F_Main ' 'TPMain ' + Me.TPMain.Controls.Add(Me.PbInfoIconMain) + Me.TPMain.Controls.Add(Me.TBInfoMain) + Me.TPMain.Controls.Add(Me.GroupBox3) Me.TPMain.Controls.Add(Me.GroupBoxJob) Me.TPMain.Controls.Add(Me.GroupBox1) Me.TPMain.Controls.Add(Me.GroupBoxInput) @@ -1186,13 +1180,30 @@ Partial Class F_Main Me.TPMain.Text = "Main" Me.TPMain.UseVisualStyleBackColor = True ' + 'TBInfoMain + ' + Me.TBInfoMain.Location = New System.Drawing.Point(43, 176) + Me.TBInfoMain.Multiline = True + Me.TBInfoMain.Name = "TBInfoMain" + Me.TBInfoMain.Size = New System.Drawing.Size(282, 78) + Me.TBInfoMain.TabIndex = 85 + ' + 'PbInfoIconMain + ' + Me.PbInfoIconMain.Image = Global.CSE.My.Resources.Resources.Info + Me.PbInfoIconMain.Location = New System.Drawing.Point(12, 204) + Me.PbInfoIconMain.Name = "PbInfoIconMain" + Me.PbInfoIconMain.Size = New System.Drawing.Size(25, 30) + Me.PbInfoIconMain.TabIndex = 84 + Me.PbInfoIconMain.TabStop = False + ' 'TPCriteria ' Me.TPCriteria.Controls.Add(Me.GroupBox7) Me.TPCriteria.Controls.Add(Me.GroupBox8) Me.TPCriteria.Controls.Add(Me.GroupBox9) - Me.TPCriteria.Controls.Add(Me.TBInfo) - Me.TPCriteria.Controls.Add(Me.PBInfoIcon) + Me.TPCriteria.Controls.Add(Me.TBInfoCrt) + Me.TPCriteria.Controls.Add(Me.PBInfoIconCrt) Me.TPCriteria.Controls.Add(Me.GroupBox14) Me.TPCriteria.Controls.Add(Me.GroupBox10) Me.TPCriteria.Location = New System.Drawing.Point(4, 22) @@ -1311,7 +1322,7 @@ Partial Class F_Main Me.GroupBox8.Controls.Add(Me.TB_segruns_min_CAL) Me.GroupBox8.Location = New System.Drawing.Point(6, 180) Me.GroupBox8.Name = "GroupBox8" - Me.GroupBox8.Size = New System.Drawing.Size(219, 137) + Me.GroupBox8.Size = New System.Drawing.Size(219, 161) Me.GroupBox8.TabIndex = 43 Me.GroupBox8.TabStop = False Me.GroupBox8.Text = "Requirements on number of valid datasets" @@ -1961,22 +1972,22 @@ Partial Class F_Main Me.LBetaAveCALMax.TabIndex = 60 Me.LBetaAveCALMax.Text = "beta_avg_CAL_max" ' - 'TBInfo + 'TBInfoCrt ' - Me.TBInfo.Location = New System.Drawing.Point(37, 347) - Me.TBInfo.Multiline = True - Me.TBInfo.Name = "TBInfo" - Me.TBInfo.Size = New System.Drawing.Size(413, 64) - Me.TBInfo.TabIndex = 83 + Me.TBInfoCrt.Location = New System.Drawing.Point(37, 347) + Me.TBInfoCrt.Multiline = True + Me.TBInfoCrt.Name = "TBInfoCrt" + Me.TBInfoCrt.Size = New System.Drawing.Size(413, 64) + Me.TBInfoCrt.TabIndex = 83 ' - 'PBInfoIcon + 'PBInfoIconCrt ' - Me.PBInfoIcon.Image = Global.CSE.My.Resources.Resources.Info - Me.PBInfoIcon.Location = New System.Drawing.Point(6, 363) - Me.PBInfoIcon.Name = "PBInfoIcon" - Me.PBInfoIcon.Size = New System.Drawing.Size(25, 30) - Me.PBInfoIcon.TabIndex = 81 - Me.PBInfoIcon.TabStop = False + Me.PBInfoIconCrt.Image = Global.CSE.My.Resources.Resources.Info + Me.PBInfoIconCrt.Location = New System.Drawing.Point(6, 363) + Me.PBInfoIconCrt.Name = "PBInfoIconCrt" + Me.PBInfoIconCrt.Size = New System.Drawing.Size(25, 30) + Me.PBInfoIconCrt.TabIndex = 81 + Me.PBInfoIconCrt.TabStop = False ' 'GroupBox14 ' @@ -2342,8 +2353,8 @@ Partial Class F_Main Me.GroupBoxJob.PerformLayout() Me.GB_hz_out.ResumeLayout(False) Me.GB_hz_out.PerformLayout() - Me.GroupBox2.ResumeLayout(False) - Me.GroupBox2.PerformLayout() + Me.GB_Anemometer.ResumeLayout(False) + Me.GB_Anemometer.PerformLayout() Me.GroupBoxInput.ResumeLayout(False) Me.GroupBoxInput.PerformLayout() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() @@ -2358,6 +2369,8 @@ Partial Class F_Main Me.TabPageErr.ResumeLayout(False) Me.TabControl1.ResumeLayout(False) Me.TPMain.ResumeLayout(False) + Me.TPMain.PerformLayout() + CType(Me.PbInfoIconMain, System.ComponentModel.ISupportInitialize).EndInit() Me.TPCriteria.ResumeLayout(False) Me.TPCriteria.PerformLayout() Me.GroupBox7.ResumeLayout(False) @@ -2374,7 +2387,7 @@ Partial Class F_Main Me.GroupBox11.PerformLayout() Me.GroupBox13.ResumeLayout(False) Me.GroupBox13.PerformLayout() - CType(Me.PBInfoIcon, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.PBInfoIconCrt, System.ComponentModel.ISupportInitialize).EndInit() Me.GroupBox14.ResumeLayout(False) Me.GroupBox14.PerformLayout() Me.GroupBox10.ResumeLayout(False) @@ -2384,9 +2397,6 @@ Partial Class F_Main End Sub Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip - Friend WithEvents MenuItemFile As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents ToolStripSeparator2 As System.Windows.Forms.ToolStripSeparator - Friend WithEvents ToolStripMenuItemExit As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolsToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripMenuItemLog As System.Windows.Forms.ToolStripMenuItem Friend WithEvents ToolStripSeparator3 As System.Windows.Forms.ToolStripSeparator @@ -2415,7 +2425,7 @@ Partial Class F_Main Friend WithEvents TextBoxAird As System.Windows.Forms.TextBox Friend WithEvents TextBoxbetaf As System.Windows.Forms.TextBox Friend WithEvents TextBoxbetad As System.Windows.Forms.TextBox - Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox + Friend WithEvents GB_Anemometer As System.Windows.Forms.GroupBox Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label @@ -2509,8 +2519,8 @@ Partial Class F_Main Friend WithEvents TB_t_amb_tarmac As System.Windows.Forms.TextBox Friend WithEvents LB_t_amb_min As System.Windows.Forms.Label Friend WithEvents CreatActivationFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents PBInfoIcon As System.Windows.Forms.PictureBox - Friend WithEvents TBInfo As System.Windows.Forms.TextBox + Friend WithEvents PBInfoIconCrt As System.Windows.Forms.PictureBox + Friend WithEvents TBInfoCrt As System.Windows.Forms.TextBox Friend WithEvents GroupBox9 As System.Windows.Forms.GroupBox Friend WithEvents LDistFloat As System.Windows.Forms.Label Friend WithEvents TB_dist_float As System.Windows.Forms.TextBox @@ -2588,5 +2598,8 @@ Partial Class F_Main Friend WithEvents MenuItemSaveJob As System.Windows.Forms.ToolStripMenuItem Friend WithEvents MenuItemSaveAsJob As System.Windows.Forms.ToolStripMenuItem Friend WithEvents MenuItemClearLog As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents TBInfoMain As System.Windows.Forms.TextBox + Friend WithEvents PbInfoIconMain As System.Windows.Forms.PictureBox + Friend WithEvents MenuItemExit As System.Windows.Forms.ToolStripMenuItem End Class diff --git a/CSE/GUI/F_Main.vb b/CSE/GUI/F_Main.vb index f871cda374bcdd98a08b9b11186791a80170cbe6..2841a6de06e76df9c66a8e60db1ae29d2ce9bd7f 100644 --- a/CSE/GUI/F_Main.vb +++ b/CSE/GUI/F_Main.vb @@ -7,7 +7,7 @@ Public Class F_Main Private Formname As String = "Job configurations" ' Load the GUI - Private Sub CSEMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load + Private Sub FormLoadHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load ' Declarations Dim configL As Boolean = True Dim NoLegFile As Boolean = False @@ -15,9 +15,11 @@ Public Class F_Main ' Initialisation Crt.hz_out = 1 - PBInfoIcon.Visible = False - TBInfo.Visible = False - TBInfo.BackColor = System.Drawing.Color.LightYellow + PBInfoIconCrt.Visible = False + TBInfoMain.Visible = False + TBInfoMain.BackColor = System.Drawing.Color.LightYellow + TBInfoCrt.Visible = False + TBInfoCrt.BackColor = System.Drawing.Color.LightYellow setupInfoBox() ' Connect the Backgroundworker with the GUI @@ -42,9 +44,13 @@ Public Class F_Main End Try ' Load the generic shape curve file - If Not fGenShpLoad() Then + Dim genShpFile = joinPaths(MyPath, "Declaration", "GenShape.shp") + Try + fGenShpLoad(genShpFile) + Catch ex As Exception + logme(9, True, format("Failed loading Declaration ShapeFile({0}) \n due to: {1}", genShpFile, ex.Message), ex) Me.Close() - End If + End Try '' Create working dir if not exists. '' @@ -71,8 +77,11 @@ Public Class F_Main End If End Sub - ' Close the GUI - Private Sub FormClosedHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed + Private Sub ClickExitHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemExit.Click + Me.Close() + End Sub + + Private Sub AppExitedHandler(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed ' Write the end into the Log fWriteLog(3) End Sub @@ -88,150 +97,88 @@ Public Class F_Main -#Region "Main tab" -#Region "Job IO" - ' Menu New - Private Sub NewJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemNewJob.Click - fClear_VECTO_Form(True) - End Sub +#Region "AsynJob" - Private Sub ReloadJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemReloadJob.Click - Dim reload = True - doLoadJob(reload) - End Sub - Private Sub LoadJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemLoadJob.Click - Dim reload = False - doLoadJob(reload) - End Sub - Private Sub doLoadJob(ByVal isReload As Boolean) - Dim jobFileToLoad As String = Nothing + Private Enum OpType + Calibration + Evaluation + End Enum - If isReload Then - jobFileToLoad = JobFile - Else - ' Open the filebrowser with the *.csjob parameter - If fbVECTO.OpenDialog(Prefs.workingDir, False) Then + ''' <summary>The Datum exchanged in the 3 AsyncWorked methods</summary> + Private Class cAsyncJob - jobFileToLoad = fbVECTO.Files(0) - If (jobFileToLoad <> Nothing) Then - ' Clear the GUI - fClear_VECTO_Form(False) - OutFolder = joinPaths(fPath(jobFileToLoad), "Results\") - End If - End If - End If + Public ReadOnly Operation As OpType - If jobFileToLoad Is Nothing Then Return + Sub New(ByVal type As OpType) + Me.Operation = type + End Sub - '' Read Jobfile according to its version and - '' populate GUI. - '' - Try - Dim newJob As cJob - If jobFileToLoad.EndsWith(".csjob.json") Then - newJob = New cJob(jobFileToLoad) - Else - newJob = New cJob(True) - newJob.fReadOldJobFile(jobFileToLoad) - End If - newJob.Validate() + Public ReadOnly Property IsCalibration As Boolean + Get + Return Me.Operation = OpType.Calibration + End Get + End Property - JobFile = jobFileToLoad - installJob(newJob) - UI_PopulateFromJob() - UI_PopulateFromCriteria() - Catch ex As Exception - logme(9, False, format("Failed reading Job-file({0}) due to: {1}", JobFile, ex.Message), ex) - End Try - End Sub + End Class - Private Sub SaveJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSaveJob.Click - Dim saveAs = False - doSaveJob(saveAs) - End Sub - Private Sub SaveJobAsHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSaveAsJob.Click - Dim saveAs = True - doSaveJob(saveAs) - End Sub + '*********Backgroundworker********* - Private Sub doSaveJob(ByVal isSaveAs As Boolean) - ' Identify if the file should save under a new name - If JobFile = Nothing Or isSaveAs Then - ' Open the filebrowser to select the folder and name of the Jobfile - If fbVECTO.SaveDialog(JobFile) Then - JobFile = fbVECTO.Files(0) - OutFolder = joinPaths(fPath(JobFile), "Results\") - Me.Text = Formname & " " & JobFile - End If - If (JobFile = Nothing) Then - Exit Sub - End If - End If + ' Backgroundworker for the calculation in the background + Private Sub BackgroundWorkerVECTO_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) _ + Handles BackgroundWorkerVECTO.DoWork - ' Get all data from the GUI - UI_PopulateToJob() - UI_PopulateToCriteria() + Dim asyncJob As cAsyncJob = e.Argument + '' Pass the async-job datum down the road. + e.Result = asyncJob - ' Write the file - If Not JobFile.EndsWith(".csjob.json", StringComparison.OrdinalIgnoreCase) Then - JobFile = joinPaths(fPath(JobFile), fName(JobFile, False) & ".csjob.json") - End If - Job.Store(JobFile) - End Sub + '##### START THE CALCULATION ##### + '################################# + calculation(asyncJob.IsCalibration) + '################################# - ' Menu Exit - Private Sub ToolStripMenuItemExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemExit.Click - ' Close the GUI - Me.Close() - End Sub -#End Region ' Job IO + ' Cancel if cancel requested... + If Me.BackgroundWorkerVECTO.CancellationPending Then e.Cancel = True + End Sub -#Region "Vehicle" + ' Output from messages with the Backgroundworker + Private Sub BackgroundWorkerVECTO_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) _ + Handles BackgroundWorkerVECTO.ProgressChanged - ' Open the filebrowser for the selection of the vehiclefile - Private Sub ButtonSelectVeh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectVeh.Click - ' Open the filebrowser with the *.csveh parameter - If fbVEH.OpenDialog(Prefs.workingDir, False) Then - If (fbVEH.Files(0) <> Nothing) Then - Me.TextBoxVeh1.Text = fbVEH.Files(0) - End If + Dim workerMsg As cLogMsg = e.UserState + If workerMsg IsNot Nothing Then + workerMsg.forwardLog() End If End Sub - ' Open the vehiclefile in the Notepad - Private Sub ButtonVeh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVeh.Click - If IO.File.Exists(Me.TextBoxVeh1.Text) Then - System.Diagnostics.Process.Start(Prefs.editor, Me.TextBoxVeh1.Text) + ' Identify the ending from the backgroundworker + Private Sub BackgroundWorkerVECTO_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) _ + Handles BackgroundWorkerVECTO.RunWorkerCompleted + ' If an Error is detected + If e.Error IsNot Nothing Then + logme(8, False, format("Backround operation ended with exception: {0}", e.Error.Message), e.Error) + ElseIf e.Cancelled Then + logme(7, False, "Backround operation aborted by user.") Else - logme(9, True, "No such Inputfile: " & Me.TextBoxVeh1.Text) + logme(7, False, "Backround operation ended OK.") + Dim asyncJob As cAsyncJob = e.Result + If asyncJob.IsCalibration Then Me.ButtonEval.Enabled = True End If - End Sub - ' Open the filebrowser for the selection of the weatherfile - Private Sub ButtonSelectWeather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectWeather.Click - ' Open the filebrowser with the *.cswea parameter - If fbAMB.OpenDialog(Prefs.workingDir, False) Then - If (fbAMB.Files(0) <> Nothing) Then - Me.TextBoxWeather.Text = fbAMB.Files(0) - End If - End If - End Sub + FileBlock = False - ' Open the weatherfile in the Notepad - Private Sub ButtonWeather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonWeather.Click - If IO.File.Exists(Me.TextBoxWeather.Text) Then - System.Diagnostics.Process.Start(Prefs.editor, Me.TextBoxWeather.Text) - Else - logme(9, True, "No such Inputfile: " & Me.TextBoxWeather.Text) - End If - End Sub + '' Re-enable all "Exec" buttons + CalibrationState = False + EvaluationState = False -#End Region ' Vehicle + Me.TextBoxRVeh.Text = Math.Round(fv_veh, 3).ToString + Me.TextBoxRAirPos.Text = Math.Round(fv_pe, 3).ToString + Me.TextBoxRBetaMis.Text = Math.Round(beta_ame, 2).ToString -#Region "Calibration" + End Sub + '#################################################################### '#### Only HERE manage "Exec" button's state (Text, Image, etc). #### @@ -255,54 +202,6 @@ Public Class F_Main End Property - ' Open the filebrowser for the selection of the datafile from the calibration run - Private Sub ButtonSelectDataC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataC.Click - ' Open the filebrowser with the *.csdat parameter - If fbVEL.OpenDialog(Prefs.workingDir, False) Then - If (fbVEL.Files(0) <> Nothing) Then - Me.TextBoxDataC.Text = fbVEL.Files(0) - End If - End If - End Sub - - ' Open the datafile from the calibration test in Excel - Private Sub ButtonDataC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataC.Click - ' Declarations - Dim PSI As New ProcessStartInfo - - ' Exit the sub if no value is selected - If Not Me.TextBoxDataC.Text.Count > 0 Then Exit Sub - - ' Open the File in Excel - PSI.FileName = "excel" - PSI.Arguments = ChrW(34) & Me.TextBoxDataC.Text & ChrW(34) - Process.Start(PSI) - End Sub - - ' Open the filebrowser for the selection of the measure section config file (MSC) - Private Sub ButtonSelectMSCC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectMSCC.Click - ' Open the filebrowser with the *.csmsc parameter - If fbMSC.OpenDialog(Prefs.workingDir, False) Then - If (fbMSC.Files(0) <> Nothing) Then - Me.TextBoxMSCC.Text = fbMSC.Files(0) - End If - End If - End Sub - - ' Open the measure section config file (MSC) in Excel - Private Sub ButtonMSCC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMSCC.Click - ' Declarations - Dim PSI As New ProcessStartInfo - - ' Exit the sub if no value is selected - If Not Me.TextBoxMSCC.Text.Count > 0 Then Exit Sub - - ' Open the File in Excel - PSI.FileName = "excel" - PSI.Arguments = ChrW(34) & Me.TextBoxMSCC.Text & ChrW(34) - Process.Start(PSI) - End Sub - ' Calculate button calibration test Private Sub CalibrationHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCalC.Click ' Generate cancel butten if the backgroundworker is busy @@ -361,10 +260,7 @@ Public Class F_Main If Not ok Then CalibrationState = False End Try End Sub -#End Region ' Calibration - -#Region "Evaluation" '#################################################################### '#### Only HERE manage "Exec" button's state (Text, Image, etc). #### '#################################################################### @@ -387,115 +283,19 @@ Public Class F_Main End Property - ' Open the filebrowser for the selection of the measure section file from the test run - Private Sub ButtonSelectMSCT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectMSCT.Click - ' Open the filebrowser with the *.csmsc parameter - If fbMSC.OpenDialog(Prefs.workingDir, False) Then - If (fbMSC.Files(0) <> Nothing) Then - Me.TextBoxMSCT.Text = fbMSC.Files(0) - End If + ' Evaluate button test run + Private Sub EvaluationHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEval.Click + ' Generate cancel butten if the backgroundworker is busy + If BWorker.IsBusy Then + BWorker.CancelAsync() + logme(8, False, "Cancel requested for background-operation...") + + Return End If - End Sub - ' Open the measure section config file (MSC) in Excel - Private Sub ButtonMSCT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMSCT.Click - ' Declarations - Dim PSI As New ProcessStartInfo - - ' Exit the sub if no value is selected - If Not Me.TextBoxMSCT.Text.Count > 0 Then Exit Sub - - ' Open the File in Excel - PSI.FileName = "excel" - PSI.Arguments = ChrW(34) & Me.TextBoxMSCT.Text & ChrW(34) - Process.Start(PSI) - End Sub - - ' Open the filebrowser for the selection of the first low speed data file from the test run - Private Sub ButtonSelectDataLS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataLS1.Click - ' Open the filebrowser with the *.csdat parameter - If fbVEL.OpenDialog(Prefs.workingDir, False) Then - If (fbVEL.Files(0) <> Nothing) Then - Me.TextBoxDataLS1.Text = fbVEL.Files(0) - End If - End If - End Sub - - ' Open the first low speed data file in Excel - Private Sub ButtonDataLS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataLS1.Click - ' Declarations - Dim PSI As New ProcessStartInfo - - ' Exit the sub if no value is selected - If Not Me.TextBoxDataLS1.Text.Count > 0 Then Exit Sub - - ' Open the File in Excel - PSI.FileName = "excel" - PSI.Arguments = ChrW(34) & Me.TextBoxDataLS1.Text & ChrW(34) - Process.Start(PSI) - End Sub - - ' Open the filebrowser for the selection of the high speed data file from the test run - Private Sub ButtonSelectDataHS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataHS.Click - ' Open the filebrowser with the *.csdat parameter - If fbVEL.OpenDialog(Prefs.workingDir, False) Then - If (fbVEL.Files(0) <> Nothing) Then - Me.TextBoxDataHS.Text = fbVEL.Files(0) - End If - End If - End Sub - - ' Open the high speed data file in Excel - Private Sub ButtonDataHS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataHS.Click - ' Declarations - Dim PSI As New ProcessStartInfo - - ' Exit the sub if no value is selected - If Not Me.TextBoxDataHS.Text.Count > 0 Then Exit Sub - - ' Open the File in Excel - PSI.FileName = "excel" - PSI.Arguments = ChrW(34) & Me.TextBoxDataHS.Text & ChrW(34) - Process.Start(PSI) - End Sub - - ' Open the filebrowser for the selection of the second low speed data file from the test run - Private Sub ButtonSelectDataLS2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataLS2.Click - ' Open the filebrowser with the *.csdat parameter - If fbVEL.OpenDialog(Prefs.workingDir, False) Then - If (fbVEL.Files(0) <> Nothing) Then - Me.TextBoxDataLS2.Text = fbVEL.Files(0) - End If - End If - End Sub - - ' Open the second low speed data file in Excel - Private Sub ButtonDataLS2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataLS2.Click - ' Declarations - Dim PSI As New ProcessStartInfo - - ' Exit the sub if no value is selected - If Not Me.TextBoxDataLS2.Text.Count > 0 Then Exit Sub - - ' Open the File in Excel - PSI.FileName = "excel" - PSI.Arguments = ChrW(34) & Me.TextBoxDataLS2.Text & ChrW(34) - Process.Start(PSI) - End Sub - - ' Evaluate button test run - Private Sub EvaluationHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonEval.Click - ' Generate cancel butten if the backgroundworker is busy - If BWorker.IsBusy Then - BWorker.CancelAsync() - logme(8, False, "Cancel requested for background-operation...") - - Return - End If - - ' Read the data from the GUI - UI_PopulateToJob(True) - UI_PopulateToCriteria() + ' Read the data from the GUI + UI_PopulateToJob(True) + UI_PopulateToCriteria() ' Check if outfolder exist. If not then generate the folder If Not System.IO.Directory.Exists(OutFolder) Then @@ -541,211 +341,102 @@ Public Class F_Main If Not ok Then EvaluationState = False End Try End Sub -#End Region ' Evaluation +#End Region ' AsynJob -#Region "Tools menu" - ' Menu open the Log - Private Sub ToolStripMenuItemLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemLog.Click - System.Diagnostics.Process.Start(Prefs.editor, joinPaths(MyPath, "log.txt")) - End Sub - - ' Menu open the config file - Private Sub ToolStripMenuItemOption_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemOption.Click - ' Show the confic GUI - F_Preferences.Show() - End Sub -#End Region ' Tools menu +#Region "Main tab" -#Region "Infos menu" - ' Create activation file - Private Sub CreatActivationFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreatActivationFileToolStripMenuItem.Click - Lic.CreateActFile(MyPath & "ActivationCode.dat") - logme(7, True, "Activation code created under: " & MyPath & "ActivationCode.dat") +#Region "Job IO" + ' Menu New + Private Sub NewJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemNewJob.Click + fClear_VECTO_Form(True) End Sub - ' Menu open the Infobox - Private Sub ToolStripMenuItemAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemAbout.Click - ' Show the info GUI - F_About.Show() + Private Sub ReloadJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemReloadJob.Click + Dim reload = True + doLoadJob(reload) End Sub - - ' Menu open the user manual - Private Sub ToolStripMenuItemManu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemManu.Click - Dim manual_fname As String = joinPaths(MyPath, "Docs", "VECTO_CSE-User Manual.pdf") - Try - System.Diagnostics.Process.Start(manual_fname) - Catch ex As Exception - logme(8, False, format("Failed opening User Manual({0}) due to: {1}", manual_fname, ex.Message), ex) - End Try + Private Sub LoadJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemLoadJob.Click + Dim reload = False + doLoadJob(reload) End Sub -#End Region ' Infos menu - -#End Region ' Main tab + Private Sub doLoadJob(ByVal isReload As Boolean) + Dim jobFileToLoad As String = Nothing + If isReload Then + jobFileToLoad = JobFile + Else + ' Open the filebrowser with the *.csjob parameter + If fbVECTO.OpenDialog(Prefs.workingDir, False) Then -#Region "Options tab" + jobFileToLoad = fbVECTO.Files(0) + If (jobFileToLoad <> Nothing) Then + ' Clear the GUI + fClear_VECTO_Form(False) + OutFolder = joinPaths(fPath(jobFileToLoad), "Results\") + End If + End If + End If - ' Check if the input is a number - Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TB_delta_t_tyre_max.KeyPress, TB_delta_rr_corr_max.KeyPress, TB_t_amb_var.KeyPress, _ - TB_t_amb_tarmac.KeyPress, TB_t_amb_max.KeyPress, TB_t_amb_min.KeyPress, TB_delta_Hz_max.KeyPress, TB_roh_air_ref.KeyPress, TB_acc_corr_avg.KeyPress, TB_delta_parallel_max.KeyPress, TB_trigger_delta_x_max.KeyPress, TB_trigger_delta_y_max.KeyPress, _ - TB_delta_head_max.KeyPress, TB_segruns_min_CAL.KeyPress, TB_segruns_min_LS.KeyPress, TB_segruns_min_HS.KeyPress, TB_segruns_min_head_MS.KeyPress, TB_tq_sum_1s_delta_HS.KeyPress, TB_v_veh_1s_delta_HS.KeyPress, TB_beta_avg_max_HS.KeyPress, TB_v_veh_avg_min_HS.KeyPress, _ - TB_v_wind_1s_max_HS.KeyPress, TB_v_wind_avg_max_HS.KeyPress, TB_tq_sum_float_delta_LS.KeyPress, TB_v_veh_float_delta_LS.KeyPress, TB_v_veh_avg_max_LS.KeyPress, TB_v_veh_avg_min_LS.KeyPress, TB_v_wind_1s_max_LS.KeyPress, TB_v_wind_avg_max_LS.KeyPress, _ - TB_leng_crit.KeyPress, TB_beta_avg_max_CAL.KeyPress, TB_v_wind_1s_max_CAL.KeyPress, TB_v_wind_avg_max_CAL.KeyPress, TB_dist_float.KeyPress - Select Case Asc(e.KeyChar) - Case 48 To 57, 46 ' Zahlen zulassen (ASCII) - Case Else ' Alles andere Unterdrücken - e.Handled = True - End Select - End Sub + If jobFileToLoad Is Nothing Then Return - ' Set all textboxes to standard - Private Sub doResetCriteria(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCrtReset.Click - ' Set the parameter to standard + '' Read Jobfile according to its version and + '' populate GUI. + '' + Try + Dim newJob As cJob + If jobFileToLoad.EndsWith(".csjob.json") Then + newJob = New cJob(jobFileToLoad) + Else + newJob = New cJob(True) + newJob.fReadOldJobFile(jobFileToLoad) + End If + newJob.Validate() - installJob(New cJob()) - UI_PopulateFromJob() - UI_PopulateFromCriteria() + JobFile = jobFileToLoad + installJob(newJob) + UI_PopulateFromJob() + UI_PopulateFromCriteria() + Catch ex As Exception + logme(9, False, format("Failed reading Job-file({0}) due to: {1}", JobFile, ex.Message), ex) + End Try End Sub - ' Set all textboxes to standard - Private Sub doExportCriteria(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCrtExport.Click - UI_PopulateToJob(False) - UI_PopulateToCriteria() - If fbCRT.SaveDialog(Prefs.workingDir) Then - Dim fname = fbCRT.Files(0) - If fname Is Nothing Then Return - Crt.Store(fname) - End If + Private Sub SaveJobHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSaveJob.Click + Dim saveAs = False + doSaveJob(saveAs) + End Sub + Private Sub SaveJobAsHandler(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemSaveAsJob.Click + Dim saveAs = True + doSaveJob(saveAs) End Sub - ' Set all textboxes to standard - Private Sub doImportCriteria(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCrtImport.Click - If fbCRT.OpenDialog(Prefs.workingDir) Then - Dim fname = fbCRT.Files(0) - If fname Is Nothing Then - Return + Private Sub doSaveJob(ByVal isSaveAs As Boolean) + ' Identify if the file should save under a new name + If JobFile = Nothing Or isSaveAs Then + ' Open the filebrowser to select the folder and name of the Jobfile + If fbVECTO.SaveDialog(JobFile) Then + JobFile = fbVECTO.Files(0) + OutFolder = joinPaths(fPath(JobFile), "Results\") + Me.Text = Formname & " " & JobFile + End If + If (JobFile = Nothing) Then + Exit Sub End If - Dim newCrt = New cCriteria(fname) - Job.Criteria = newCrt - Crt = newCrt End If - UI_PopulateFromJob() - UI_PopulateFromCriteria() - End Sub - ' CheckBox for the acceleration calibration - Private Sub CheckBoxAcc_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB_accel_correction.CheckedChanged - Crt.accel_correction = CB_accel_correction.Checked - End Sub - - ' Checkbox for the gradient correction - Private Sub CheckBoxGrd_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB_gradient_correction.CheckedChanged - Crt.gradient_correction = CB_gradient_correction.Checked - End Sub + ' Get all data from the GUI + UI_PopulateToJob() + UI_PopulateToCriteria() - ' Change in the 1Hz radio button - Private Sub RB1Hz_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RB1Hz.CheckedChanged - If RB1Hz.Checked Then - Crt.hz_out = 1 - Else - Crt.hz_out = 100 + ' Write the file + If Not JobFile.EndsWith(".csjob.json", StringComparison.OrdinalIgnoreCase) Then + JobFile = joinPaths(fPath(JobFile), fName(JobFile, False) & ".csjob.json") End If + Job.Store(JobFile) End Sub - ' Change in the 100Hz radio button - Private Sub RB100Hz_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RB100Hz.CheckedChanged - If RB100Hz.Checked Then - Crt.hz_out = 100 - Else - Crt.hz_out = 1 - End If - End Sub -#End Region 'Options tab - - -#Region "AsynJob" - - Private Enum OpType - Calibration - Evaluation - End Enum - - ''' <summary>The Datum exchanged in the 3 AsyncWorked methods</summary> - Private Class cAsyncJob - - Public ReadOnly Operation As OpType - - Sub New(ByVal type As OpType) - Me.Operation = type - End Sub - - Public ReadOnly Property IsCalibration As Boolean - Get - Return Me.Operation = OpType.Calibration - End Get - End Property - - End Class - - '*********Backgroundworker********* - - ' Backgroundworker for the calculation in the background - Private Sub BackgroundWorkerVECTO_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) _ - Handles BackgroundWorkerVECTO.DoWork - - Dim asyncJob As cAsyncJob = e.Argument - '' Pass the async-job datum down the road. - e.Result = asyncJob - - '##### START THE CALCULATION ##### - '################################# - calculation(asyncJob.IsCalibration) - '################################# - - ' Cancel if cancel requested... - If Me.BackgroundWorkerVECTO.CancellationPending Then e.Cancel = True - - End Sub - - ' Output from messages with the Backgroundworker - Private Sub BackgroundWorkerVECTO_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) _ - Handles BackgroundWorkerVECTO.ProgressChanged - - Dim workerMsg As cLogMsg = e.UserState - If workerMsg IsNot Nothing Then - workerMsg.forwardLog() - End If - End Sub - - ' Identify the ending from the backgroundworker - Private Sub BackgroundWorkerVECTO_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) _ - Handles BackgroundWorkerVECTO.RunWorkerCompleted - ' If an Error is detected - If e.Error IsNot Nothing Then - logme(8, False, format("Backround operation ended with exception: {0}", e.Error.Message), e.Error) - ElseIf e.Cancelled Then - logme(7, False, "Backround operation aborted by user.") - Else - logme(7, False, "Backround operation ended OK.") - Dim asyncJob As cAsyncJob = e.Result - If asyncJob.IsCalibration Then Me.ButtonEval.Enabled = True - End If - - FileBlock = False - - '' Re-enable all "Exec" buttons - CalibrationState = False - EvaluationState = False - - Me.TextBoxRVeh.Text = Math.Round(fv_veh, 3).ToString - Me.TextBoxRAirPos.Text = Math.Round(fv_pe, 3).ToString - Me.TextBoxRBetaMis.Text = Math.Round(beta_ame, 2).ToString - - - End Sub -#End Region ' AsynJob #Region "UI populate" @@ -754,12 +445,12 @@ Public Class F_Main ' Read the data from the textboxes (General) Job.vehicle_fpath = TextBoxVeh1.Text Job.ambient_fpath = TextBoxWeather.Text - If UBound(Job.Anemometer) = 3 Then - Job.Anemometer(0) = TextBoxAirf.Text - Job.Anemometer(1) = TextBoxAird.Text - Job.Anemometer(2) = TextBoxbetaf.Text - Job.Anemometer(3) = TextBoxbetad.Text - End If + + Job.v_air_f = TextBoxAirf.Text + Job.v_air_d = TextBoxAird.Text + Job.beta_f = TextBoxbetaf.Text + Job.beta_d = TextBoxbetad.Text + ' Appropriate the inputfiles from calibration run Job.calib_run_fpath = TextBoxDataC.Text Job.calib_track_fpath = TextBoxMSCC.Text @@ -838,10 +529,10 @@ Public Class F_Main ' Transfer the data to the GUI ' General TextBoxVeh1.Text = Job.vehicle_fpath - TextBoxAirf.Text = Job.Anemometer(0) - TextBoxAird.Text = Job.Anemometer(1) - TextBoxbetaf.Text = Job.Anemometer(2) - TextBoxbetad.Text = Job.Anemometer(3) + TextBoxAirf.Text = Job.v_air_f + TextBoxAird.Text = Job.v_air_d + TextBoxbetaf.Text = Job.beta_f + TextBoxbetad.Text = Job.beta_d TextBoxWeather.Text = Job.ambient_fpath ' Calibration TextBoxMSCC.Text = Job.calib_track_fpath @@ -954,23 +645,349 @@ Public Class F_Main UI_PopulateFromCriteria() End If - ' Clear the Warning and Error box - ListBoxWar.Items.Clear() - ListBoxErr.Items.Clear() - TabControlOutMsg.SelectTab(0) - TabPageErr.Text = "Errors (0)" - TabPageWar.Text = "Warnings (0)" Return True End Function #End Region ' UI populate +#End Region ' Job IO + + +#Region "Vehicle" + + ' Open the filebrowser for the selection of the vehiclefile + Private Sub ButtonSelectVeh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectVeh.Click + ' Open the filebrowser with the *.csveh parameter + If fbVEH.OpenDialog(Prefs.workingDir, False) Then + If (fbVEH.Files(0) <> Nothing) Then + Me.TextBoxVeh1.Text = fbVEH.Files(0) + End If + End If + End Sub + + ' Open the vehiclefile in the Notepad + Private Sub ButtonVeh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonVeh.Click + If IO.File.Exists(Me.TextBoxVeh1.Text) Then + System.Diagnostics.Process.Start(Prefs.editor, Me.TextBoxVeh1.Text) + Else + logme(9, True, "No such Inputfile: " & Me.TextBoxVeh1.Text) + End If + End Sub + + ' Open the filebrowser for the selection of the weatherfile + Private Sub ButtonSelectWeather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectWeather.Click + ' Open the filebrowser with the *.cswea parameter + If fbAMB.OpenDialog(Prefs.workingDir, False) Then + If (fbAMB.Files(0) <> Nothing) Then + Me.TextBoxWeather.Text = fbAMB.Files(0) + End If + End If + End Sub + + ' Open the weatherfile in the Notepad + Private Sub ButtonWeather_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonWeather.Click + If IO.File.Exists(Me.TextBoxWeather.Text) Then + System.Diagnostics.Process.Start(Prefs.editor, Me.TextBoxWeather.Text) + Else + logme(9, True, "No such Inputfile: " & Me.TextBoxWeather.Text) + End If + End Sub + +#End Region ' Vehicle + + +#Region "Calibration" + + ' Open the filebrowser for the selection of the datafile from the calibration run + Private Sub ButtonSelectDataC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataC.Click + ' Open the filebrowser with the *.csdat parameter + If fbVEL.OpenDialog(Prefs.workingDir, False) Then + If (fbVEL.Files(0) <> Nothing) Then + Me.TextBoxDataC.Text = fbVEL.Files(0) + End If + End If + End Sub + + ' Open the datafile from the calibration test in Excel + Private Sub ButtonDataC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataC.Click + ' Declarations + Dim PSI As New ProcessStartInfo + + ' Exit the sub if no value is selected + If Not Me.TextBoxDataC.Text.Count > 0 Then Exit Sub + + ' Open the File in Excel + PSI.FileName = "excel" + PSI.Arguments = ChrW(34) & Me.TextBoxDataC.Text & ChrW(34) + Process.Start(PSI) + End Sub + + ' Open the filebrowser for the selection of the measure section config file (MSC) + Private Sub ButtonSelectMSCC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectMSCC.Click + ' Open the filebrowser with the *.csmsc parameter + If fbMSC.OpenDialog(Prefs.workingDir, False) Then + If (fbMSC.Files(0) <> Nothing) Then + Me.TextBoxMSCC.Text = fbMSC.Files(0) + End If + End If + End Sub + + ' Open the measure section config file (MSC) in Excel + Private Sub ButtonMSCC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMSCC.Click + ' Declarations + Dim PSI As New ProcessStartInfo + + ' Exit the sub if no value is selected + If Not Me.TextBoxMSCC.Text.Count > 0 Then Exit Sub + + ' Open the File in Excel + PSI.FileName = "excel" + PSI.Arguments = ChrW(34) & Me.TextBoxMSCC.Text & ChrW(34) + Process.Start(PSI) + End Sub + +#End Region ' Calibration + + +#Region "Evaluation" + + ' Open the filebrowser for the selection of the measure section file from the test run + Private Sub ButtonSelectMSCT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectMSCT.Click + ' Open the filebrowser with the *.csmsc parameter + If fbMSC.OpenDialog(Prefs.workingDir, False) Then + If (fbMSC.Files(0) <> Nothing) Then + Me.TextBoxMSCT.Text = fbMSC.Files(0) + End If + End If + End Sub + + ' Open the measure section config file (MSC) in Excel + Private Sub ButtonMSCT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMSCT.Click + ' Declarations + Dim PSI As New ProcessStartInfo + + ' Exit the sub if no value is selected + If Not Me.TextBoxMSCT.Text.Count > 0 Then Exit Sub + + ' Open the File in Excel + PSI.FileName = "excel" + PSI.Arguments = ChrW(34) & Me.TextBoxMSCT.Text & ChrW(34) + Process.Start(PSI) + End Sub + + ' Open the filebrowser for the selection of the first low speed data file from the test run + Private Sub ButtonSelectDataLS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataLS1.Click + ' Open the filebrowser with the *.csdat parameter + If fbVEL.OpenDialog(Prefs.workingDir, False) Then + If (fbVEL.Files(0) <> Nothing) Then + Me.TextBoxDataLS1.Text = fbVEL.Files(0) + End If + End If + End Sub + + ' Open the first low speed data file in Excel + Private Sub ButtonDataLS1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataLS1.Click + ' Declarations + Dim PSI As New ProcessStartInfo + + ' Exit the sub if no value is selected + If Not Me.TextBoxDataLS1.Text.Count > 0 Then Exit Sub + + ' Open the File in Excel + PSI.FileName = "excel" + PSI.Arguments = ChrW(34) & Me.TextBoxDataLS1.Text & ChrW(34) + Process.Start(PSI) + End Sub + + ' Open the filebrowser for the selection of the high speed data file from the test run + Private Sub ButtonSelectDataHS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataHS.Click + ' Open the filebrowser with the *.csdat parameter + If fbVEL.OpenDialog(Prefs.workingDir, False) Then + If (fbVEL.Files(0) <> Nothing) Then + Me.TextBoxDataHS.Text = fbVEL.Files(0) + End If + End If + End Sub + + ' Open the high speed data file in Excel + Private Sub ButtonDataHS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataHS.Click + ' Declarations + Dim PSI As New ProcessStartInfo + + ' Exit the sub if no value is selected + If Not Me.TextBoxDataHS.Text.Count > 0 Then Exit Sub + + ' Open the File in Excel + PSI.FileName = "excel" + PSI.Arguments = ChrW(34) & Me.TextBoxDataHS.Text & ChrW(34) + Process.Start(PSI) + End Sub + + ' Open the filebrowser for the selection of the second low speed data file from the test run + Private Sub ButtonSelectDataLS2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSelectDataLS2.Click + ' Open the filebrowser with the *.csdat parameter + If fbVEL.OpenDialog(Prefs.workingDir, False) Then + If (fbVEL.Files(0) <> Nothing) Then + Me.TextBoxDataLS2.Text = fbVEL.Files(0) + End If + End If + End Sub + + ' Open the second low speed data file in Excel + Private Sub ButtonDataLS2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDataLS2.Click + ' Declarations + Dim PSI As New ProcessStartInfo + + ' Exit the sub if no value is selected + If Not Me.TextBoxDataLS2.Text.Count > 0 Then Exit Sub + + ' Open the File in Excel + PSI.FileName = "excel" + PSI.Arguments = ChrW(34) & Me.TextBoxDataLS2.Text & ChrW(34) + Process.Start(PSI) + End Sub + +#End Region ' Evaluation + + +#Region "Tools menu" + ' Menu open the Log + Private Sub ToolStripMenuItemLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemLog.Click + System.Diagnostics.Process.Start(Prefs.editor, joinPaths(MyPath, "log.txt")) + End Sub + + ' Menu open the config file + Private Sub ToolStripMenuItemOption_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemOption.Click + ' Show the confic GUI + F_Preferences.Show() + End Sub +#End Region ' Tools menu + + +#Region "Infos menu" + ' Create activation file + Private Sub CreatActivationFileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreatActivationFileToolStripMenuItem.Click + Lic.CreateActFile(MyPath & "ActivationCode.dat") + logme(7, True, "Activation code created under: " & MyPath & "ActivationCode.dat") + End Sub + + ' Menu open the Infobox + Private Sub ToolStripMenuItemAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemAbout.Click + ' Show the info GUI + F_About.Show() + End Sub + + ' Menu open the user manual + Private Sub ToolStripMenuItemManu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItemManu.Click + Dim manual_fname As String = joinPaths(MyPath, "Docs", "VECTO_CSE-User Manual.pdf") + Try + System.Diagnostics.Process.Start(manual_fname) + Catch ex As Exception + logme(8, False, format("Failed opening User Manual({0}) due to: {1}", manual_fname, ex.Message), ex) + End Try + End Sub +#End Region ' Infos menu + +#End Region ' Main tab + + +#Region "Options tab" + + ' Check if the input is a number + Private Sub TextBox_TextChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TB_delta_t_tyre_max.KeyPress, TB_delta_rr_corr_max.KeyPress, TB_t_amb_var.KeyPress, _ + TB_t_amb_tarmac.KeyPress, TB_t_amb_max.KeyPress, TB_t_amb_min.KeyPress, TB_delta_Hz_max.KeyPress, TB_roh_air_ref.KeyPress, TB_acc_corr_avg.KeyPress, TB_delta_parallel_max.KeyPress, TB_trigger_delta_x_max.KeyPress, TB_trigger_delta_y_max.KeyPress, _ + TB_delta_head_max.KeyPress, TB_segruns_min_CAL.KeyPress, TB_segruns_min_LS.KeyPress, TB_segruns_min_HS.KeyPress, TB_segruns_min_head_MS.KeyPress, TB_tq_sum_1s_delta_HS.KeyPress, TB_v_veh_1s_delta_HS.KeyPress, TB_beta_avg_max_HS.KeyPress, TB_v_veh_avg_min_HS.KeyPress, _ + TB_v_wind_1s_max_HS.KeyPress, TB_v_wind_avg_max_HS.KeyPress, TB_tq_sum_float_delta_LS.KeyPress, TB_v_veh_float_delta_LS.KeyPress, TB_v_veh_avg_max_LS.KeyPress, TB_v_veh_avg_min_LS.KeyPress, TB_v_wind_1s_max_LS.KeyPress, TB_v_wind_avg_max_LS.KeyPress, _ + TB_leng_crit.KeyPress, TB_beta_avg_max_CAL.KeyPress, TB_v_wind_1s_max_CAL.KeyPress, TB_v_wind_avg_max_CAL.KeyPress, TB_dist_float.KeyPress + Select Case Asc(e.KeyChar) + Case 48 To 57, 46 ' Zahlen zulassen (ASCII) + Case Else ' Alles andere Unterdrücken + e.Handled = True + End Select + End Sub + + ' Set all textboxes to standard + Private Sub doResetCriteria(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCrtReset.Click + ' Set the parameter to standard + + installJob(New cJob()) + UI_PopulateFromJob() + UI_PopulateFromCriteria() + End Sub + + ' Set all textboxes to standard + Private Sub doExportCriteria(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCrtExport.Click + UI_PopulateToJob(False) + UI_PopulateToCriteria() + If fbCRT.SaveDialog(Prefs.workingDir) Then + Dim fname = fbCRT.Files(0) + If fname Is Nothing Then Return + Crt.Store(fname) + End If + End Sub + + ' Set all textboxes to standard + Private Sub doImportCriteria(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonCrtImport.Click + If fbCRT.OpenDialog(Prefs.workingDir) Then + Dim fname = fbCRT.Files(0) + If fname Is Nothing Then + Return + End If + Dim newCrt = New cCriteria(fname) + Job.Criteria = newCrt + Crt = newCrt + End If + UI_PopulateFromJob() + UI_PopulateFromCriteria() + End Sub + + ' CheckBox for the acceleration calibration + Private Sub CheckBoxAcc_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB_accel_correction.CheckedChanged + Crt.accel_correction = CB_accel_correction.Checked + End Sub + + ' Checkbox for the gradient correction + Private Sub CheckBoxGrd_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CB_gradient_correction.CheckedChanged + Crt.gradient_correction = CB_gradient_correction.Checked + End Sub + + ' Change in the 1Hz radio button + Private Sub RB1Hz_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RB1Hz.CheckedChanged + If RB1Hz.Checked Then + Crt.hz_out = 1 + Else + Crt.hz_out = 100 + End If + End Sub + + ' Change in the 100Hz radio button + Private Sub RB100Hz_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RB100Hz.CheckedChanged + If RB100Hz.Checked Then + Crt.hz_out = 100 + Else + Crt.hz_out = 1 + End If + End Sub +#End Region 'Options tab + #Region "Infobox" ''' <summary>NOTE that the name of the controls below after the 3rd char is equal to the schema-property</summary> Private Sub setupInfoBox() - Dim processingControls = New Control() { + Dim isStrict = False + + Dim schema As JObject + Dim controls As Control() + + controls = New Control() { + Me.GB_Anemometer, Nothing + } + schema = JObject.Parse(cJob.JSchemaStr(isStrict)) + armControlsWithInfoBox(schema, controls, AddressOf showInfoBox_main, AddressOf hideInfoBox_main) + + + controls = New Control() { Me.TB_roh_air_ref, LRhoAirRef, _ Me.CB_accel_correction, Nothing, _ Me.CB_gradient_correction, Nothing, _ @@ -979,7 +996,11 @@ Public Class F_Main Me.TB_acc_corr_avg, Me.LAccCorrAve, _ Me.TB_dist_float, Me.LDistFloat } - Dim validationControls = New Control() { + schema = New cCriteria(True).BodySchema.SelectToken("properties.Processing") + armControlsWithInfoBox(schema, controls, AddressOf showInfoBox_crt, AddressOf hideInfoBox_crt) + + + controls = New Control() { TB_trigger_delta_x_max, LDeltaXMax, _ TB_trigger_delta_y_max, LDeltaYMax, _ TB_delta_head_max, LContAng, _ @@ -1011,27 +1032,31 @@ Public Class F_Main TB_t_amb_max, LB_t_amb_max, _ TB_t_amb_var, LB_t_amb_var, _ TB_t_amb_tarmac, LB_t_amb_tarmac _ - } - - - Dim schema As JObject + } + schema = New cCriteria(True).BodySchema.SelectToken("properties.Validation") + armControlsWithInfoBox(schema, controls, AddressOf showInfoBox_crt, AddressOf hideInfoBox_crt) + End Sub - schema = New cCriteria(True).BodySchema.SelectToken("properties.Processing") - armControlsWithInfoBox(schema, processingControls, AddressOf showInfoBox, AddressOf hideInfoBox) + Private Sub showInfoBox_main(ByVal sender As Object, ByVal e As System.EventArgs) + TBInfoMain.Text = sender.Tag + TBInfoMain.Visible = True + PbInfoIconMain.Visible = True + End Sub - schema = New cCriteria(True).BodySchema.SelectToken("properties.Validation") - armControlsWithInfoBox(schema, validationControls, AddressOf showInfoBox, AddressOf hideInfoBox) + Private Sub hideInfoBox_main(ByVal sender As Object, ByVal e As System.EventArgs) + TBInfoMain.Visible = False + PbInfoIconMain.Visible = False End Sub - Private Sub showInfoBox(ByVal sender As Object, ByVal e As System.EventArgs) - TBInfo.Text = sender.Tag - TBInfo.Visible = True - PBInfoIcon.Visible = True + Private Sub showInfoBox_crt(ByVal sender As Object, ByVal e As System.EventArgs) + TBInfoCrt.Text = sender.Tag + TBInfoCrt.Visible = True + PBInfoIconCrt.Visible = True End Sub - Private Sub hideInfoBox(ByVal sender As Object, ByVal e As System.EventArgs) - TBInfo.Visible = False - PBInfoIcon.Visible = False + Private Sub hideInfoBox_crt(ByVal sender As Object, ByVal e As System.EventArgs) + TBInfoCrt.Visible = False + PBInfoIconCrt.Visible = False End Sub diff --git a/CSE/IO/cCriteria.vb b/CSE/IO/cCriteria.vb index a4e0810777c2b869f5726c0c70422a933ab46f4d..52f0225d1f2fc8cc310f6c25f148a3dec8b72224 100644 --- a/CSE/IO/cCriteria.vb +++ b/CSE/IO/cCriteria.vb @@ -73,10 +73,9 @@ Public Class cCriteria Return b End Function - ''' <param name="allowAdditionalProps">when false, more strict validation</param> - Public Shared Function JSchemaStr(Optional ByVal allowAdditionalProps As Boolean = True) As String - allowAdditionalProps = True - Dim allowAdditionalProps_str As String = allowAdditionalProps.ToString.ToLower + ''' <param name="isStrictBody">when true, more strict validation</param> + Public Shared Function JSchemaStr(Optional ByVal isStrictBody As Boolean = False) As String + Dim allowAdditionalProps_str As String = (Not isStrictBody).ToString.ToLower Return <json>{ "title": "Schema for vecto-cse CRITERIA", "type": "object", "additionalProperties": <%= allowAdditionalProps_str %>, @@ -253,17 +252,17 @@ Public Class cCriteria ''' <remarks>See cJsonFile() constructor</remarks> Sub New(Optional ByVal skipValidation As Boolean = False) MyBase.New(BuildBody, skipValidation) - PopulateApp() + PopulateFields() End Sub ''' <summary>Reads from file or creates defaults</summary> ''' <param name="inputFilePath">the fpath of the file to read data from</param> Sub New(ByVal inputFilePath As String, Optional ByVal skipValidation As Boolean = False) MyBase.New(inputFilePath, skipValidation) - PopulateApp() + PopulateFields() End Sub Sub New(ByVal foreignBody As JToken, Optional ByVal skipValidation As Boolean = False) MyBase.New(foreignBody, skipValidation) - PopulateApp() + PopulateFields() End Sub @@ -272,8 +271,8 @@ Public Class cCriteria End Function ''' <exception cref="SystemException">includes all validation errors</exception> - ''' <param name="strictBody">when true, no additional json-properties allowed in the data, when nothing, use value from Header</param> - Protected Overrides Sub ValidateBody(ByVal strictBody As Boolean, ByVal validateMsgs As IList(Of String)) + ''' <param name="isStrictBody">when true, no additional json-properties allowed in the data, when nothing, use value from Header</param> + Protected Overrides Sub ValidateBody(ByVal isStrictBody As Boolean, ByVal validateMsgs As IList(Of String)) '' Check version '' Dim fromVersion = "1.0.0--" @@ -285,7 +284,7 @@ Public Class cCriteria '' Check schema '' - Dim schema = JsonSchema.Parse(JSchemaStr(Not strictBody)) + Dim schema = JsonSchema.Parse(JSchemaStr(isStrictBody)) ValidateJson(Body, schema, validateMsgs) If validateMsgs.Any() Then Return @@ -296,48 +295,49 @@ Public Class cCriteria #Region "json props" ' Processing params - Public rr_corr_factor As Double ' Rolling resistance correction factor - Public accel_correction As Boolean = False ' Variable for the acceleration correction - Public gradient_correction As Boolean = False ' Variable for the gradient correction - Public hz_out As Integer = 1 ' Hz result file output - Public acc_corr_avg As Single ' [s] averaging of vehicle speed for correction of acceleration forces - Public dist_float As Single ' [m]; Distance used for calculation of floatinig average signal used for stabilitay criteria in low speeds - Public roh_air_ref As Single ' [kg/m^3] Reference air density + Public rr_corr_factor As Double + Public accel_correction As Boolean = False + Public gradient_correction As Boolean = False + Public hz_out As Integer = 1 + Public acc_corr_avg As Single + Public dist_float As Single + Public roh_air_ref As Single ' Criteria - Public trigger_delta_x_max As Single ' [m]; +/- size of the control area around a MS start/end point where a trigger signal is valid (driving direction) - Public trigger_delta_y_max As Single ' [m]; +/- size of the control area around a MS start/end point where a trigger signal is valid (perpendicular to driving direction) - Public delta_head_max As Single ' [°]; +/- maximum deviation from heading as read from the csdat-file to the heading from csms-file for a valid dataset - Public segruns_min_CAL As Integer ' [#]; Minimum number of valid datasets required for the calibration test (per combination of MS ID and DIR ID) - Public segruns_min_LS As Integer ' [#]; Minimum number of valid datasets required for the low speed (per combination of MS ID and DIR ID) - Public segruns_min_HS As Integer ' [#]; Minimum number of valid datasets required for the high speed (per combination of MS ID and DIR ID) - Public segruns_min_head_MS As Integer ' [#]; Minimum TOTAL number of valid datasets required for the high speed per heading - Public delta_Hz_max As Single ' [%]; maximum allowed deviation of timestep-size in csdat-file from 100Hz - Public delta_parallel_max As Single ' [°]; maximum heading difference for measurement section (parallelism criteria for test track layout) - Public leng_crit As Single ' [m]; maximum absolute difference of distance driven with lenght of section as specified in configuration - Public v_wind_avg_max_CAL As Single ' [m/s]; maximum average wind speed during calibration test - Public v_wind_1s_max_CAL As Single ' [m/s]; maximum gust wind speed during calibration test - Public beta_avg_max_CAL As Single ' [°]; maximum average beta during calibration test - Public v_wind_avg_max_LS As Single ' [m/s]; maximum average wind speed during low speed - Public v_wind_1s_max_LS As Single ' [m/s]; maximum gust wind speed during low speed - Public v_veh_avg_max_LS As Single ' [km/h]; maximum average vehicle speed for low speed - Public v_veh_avg_min_LS As Single ' [km/h]; minimum average vehicle speed for low speed - Public v_veh_float_delta_LS As Single ' [km/h]; +/- maximum deviation of floating average vehicle speed from average vehicle speed over entire section (low speed) - Public tq_sum_float_delta_LS As Single ' [-]; +/- maximum relative deviation of floating average torque from average torque over entire section (low speed) - Public v_wind_avg_max_HS As Single ' [m/s]; maximum average wind speed during high speed - Public v_wind_1s_max_HS As Single ' [m/s]; maximum gust wind speed during high speed - Public v_veh_avg_min_HS As Single ' [km/h]; minimum average vehicle speed for high speed - Public beta_avg_max_HS As Single ' [°]; maximum average beta during high speed - Public v_veh_1s_delta_HS As Single ' [km/h]; +/- maximum deviation of 1s average vehicle speed from average vehicle speed over entire section (high speed) - Public tq_sum_1s_delta_HS As Single ' [-]; +/- maximum relative deviation of 1s average torque from average torque over entire section (high speed) - Public delta_t_tyre_max As Single ' [°C]; maximum variation of tyre temperature between high speeds and low speeds - Public delta_rr_corr_max As Single ' [kg/t]; maximum difference of RRC from the two low speed runs - Public t_amb_min As Single ' [°C]; Minimum ambient temperature (measured at the vehicle) during the tests (evaluated based on the used datasets only) - Public t_amb_max As Single ' [°C]; Maximum ambient temperature (measured at the vehicle) during the tests (evaluated based on the used datasets only) - Public t_amb_var As Single ' [°C]; maximum variation of ambient temperature (measured at the vehicle) during the tests (evaluated based on the used datasets only) - Public t_amb_tarmac As Single ' [°C]; Maximum temperature below which no documentation of tarmac conditions is necessary - - + Public trigger_delta_x_max As Single + Public trigger_delta_y_max As Single + Public delta_head_max As Single + Public segruns_min_CAL As Integer + Public segruns_min_LS As Integer + Public segruns_min_HS As Integer + Public segruns_min_head_MS As Integer + Public delta_Hz_max As Single + Public delta_parallel_max As Single + Public leng_crit As Single + Public v_wind_avg_max_CAL As Single + Public v_wind_1s_max_CAL As Single + Public beta_avg_max_CAL As Single + Public v_wind_avg_max_LS As Single + Public v_wind_1s_max_LS As Single + Public v_veh_avg_max_LS As Single + Public v_veh_avg_min_LS As Single + Public v_veh_float_delta_LS As Single + Public tq_sum_float_delta_LS As Single + Public v_wind_avg_max_HS As Single + Public v_wind_1s_max_HS As Single + Public v_veh_avg_min_HS As Single + Public beta_avg_max_HS As Single + Public v_veh_1s_delta_HS As Single + Public tq_sum_1s_delta_HS As Single + Public delta_t_tyre_max As Single + Public delta_rr_corr_max As Single + Public t_amb_min As Single + Public t_amb_max As Single + Public t_amb_var As Single + Public t_amb_tarmac As Single + + + ''' <summary>Override it to set custome fields</summary> Overrides Sub Store(ByVal fpath As String, Optional ByVal prefs As cPreferences = Nothing) Dim g, b As Object b = Me.Body @@ -392,7 +392,7 @@ Public Class cCriteria MyBase.Store(fpath, prefs) End Sub - Sub PopulateApp() + Private Sub PopulateFields() Dim g, p As Object p = Me.Body diff --git a/CSE/IO/cJob.vb b/CSE/IO/cJob.vb index c34730d29307ebb373334ddd2ceba02bde013ef9..f4ae487764179f88b5cf4bd8bef49b944b9d813e 100644 --- a/CSE/IO/cJob.vb +++ b/CSE/IO/cJob.vb @@ -17,7 +17,7 @@ Public Class cJob Dim b As Object = New JObject() b.vehicle_fpath = "" b.ambient_fpath = "" - b.Anemometer = New JArray(0, 0, 0, 0) + 'b.Anemometer = Nothing 'JObject.Parse(<json>{'v_air_f':0, 'v_air_d': 0, beta_f':0, 'beta_d': 0}</json>) b.calib_track_fpath = "" b.calib_run_fpath = "" b.coast_track_fpath = "" @@ -44,13 +44,9 @@ Public Class cJob "description": "File-path to Vehicle file (*.csveh)", }, "Anemometer": { - "type": "array", - "required": true, - "items": { - "type": "number" - }, - "minItems": 4, "maxItems": 4, - "description": "The 4 Anemomenter instrument calibration factors in this order: v_air f, v_air d, beta f, beta d", + "type": "object", + "description": "The Anemometer calibration factors (floats).", + 'default': {'v_air_f':1, 'v_air_d': 0, 'beta_f':1, 'beta_d': 0}, }, "ambient_fpath": { "type": ["null", "string"], @@ -87,7 +83,7 @@ Public Class cJob <%= IIf(requireFPathExts, "'pattern': '^\\s*$|\\.csdat$', ", "") %> "description": "File-path to a measurement-file (*.csdat)", }, - "Criteria": <%= cCriteria.JSchemaStr(Not isStrictBody) %>, + "Criteria": <%= cCriteria.JSchemaStr(isStrictBody) %>, } }</json>.Value '"": { @@ -102,11 +98,13 @@ Public Class cJob ''' <remarks>See cJsonFile() constructor</remarks> Sub New(Optional ByVal skipValidation As Boolean = False) MyBase.New(BuildBody, skipValidation) + PopulateFields() End Sub ''' <summary>Reads from file or creates defaults</summary> ''' <param name="inputFilePath">the fpath of the file to read data from</param> Sub New(ByVal inputFilePath As String, Optional ByVal skipValidation As Boolean = False) MyBase.New(inputFilePath, skipValidation) + PopulateFields() End Sub @@ -114,8 +112,8 @@ Public Class cJob Return JSchemaStr() End Function - ''' <param name="strictBody">when true, no additional json-properties allowed in the data, when nothing, use value from Header</param> - Protected Overrides Sub ValidateBody(ByVal strictBody As Boolean, ByVal validateMsgs As IList(Of String)) + ''' <param name="isStrictBody">when true, no additional json-properties allowed in the data, when nothing, use value from Header</param> + Protected Overrides Sub ValidateBody(ByVal isStrictBody As Boolean, ByVal validateMsgs As IList(Of String)) '' Check version '' Dim fromVersion = "1.0.0--" @@ -127,7 +125,7 @@ Public Class cJob '' Check schema '' - Dim schema = JsonSchema.Parse(JSchemaStr(strictBody)) + Dim schema = JsonSchema.Parse(JSchemaStr(isStrictBody)) ValidateJson(Body, schema, validateMsgs) If validateMsgs.Any() Then Return @@ -139,6 +137,31 @@ Public Class cJob #Region "json props" + Public v_air_f As Double + Public v_air_d As Double + Public beta_f As Double + Public beta_d As Double + + Private Sub PopulateFields() + Dim anem = PropOrDefault(".Anemometer") + Me.v_air_f = anem("v_air_f") + Me.v_air_d = anem("v_air_d") + Me.beta_f = anem("beta_f") + Me.beta_d = anem("beta_d") + End Sub + + ''' <summary>Override it to set custome fields</summary> + Overrides Sub Store(ByVal fpath As String, Optional ByVal prefs As cPreferences = Nothing) + Dim b As Object = Me.Body + + b.v_air_f = Me.v_air_f + b.v_air_d = Me.v_air_d + b.beta_f = Me.beta_f + b.beta_d = Me.beta_d + + MyBase.Store(fpath, prefs) + End Sub + Public Property vehicle_fpath As String Get @@ -151,14 +174,6 @@ Public Class cJob If value Is Nothing Then Me.Body("vehicle_fpath") = Nothing Else Me.Body("vehicle_fpath") = value End Set End Property - Public Property Anemometer As Single() - Get - Return (From i In Me.Body("Anemometer") Select (Single.Parse(i))).ToArray - End Get - Set(ByVal value As Single()) - Me.Body("Anemometer") = New JArray(value.ToList()) - End Set - End Property @@ -281,7 +296,10 @@ Public Class cJob For i = 0 To UBound(factors) - 1 factors(i) = Line(i) Next i - Anemometer = factors + Job.v_air_f = factors(0) + Job.v_air_d = factors(1) + Job.beta_f = factors(2) + Job.beta_d = factors(3) ' Calibration test files calib_track_fpath = FileInVECTO.ReadLine(0) diff --git a/CSE/IO/cJsonFile.vb b/CSE/IO/cJsonFile.vb index cc69b79e7e3419f0db67cc2960d45dcb0ba03e6a..bb012c92fb6501efca6ef5539826a294f9fab4ae 100644 --- a/CSE/IO/cJsonFile.vb +++ b/CSE/IO/cJsonFile.vb @@ -285,7 +285,7 @@ When False, it overrides Application's choice and is not replaced ever.", End Function ''' <summary>Reads value found by XPath and if nothing there, fetches default-value schema.</summary> - ''' <param name="propPath">The JSON.net's XPath for a Body property, including the starting dot('.'). + ''' <param name="propPath">The JSON.net's XPath for a Body property, which must start with a starting dot('.')!!! ''' ''' Examples: ''' PROP REQUESTED 'propPath' ARGUMENT @@ -294,7 +294,7 @@ When False, it overrides Application's choice and is not replaced ever.", ''' /Body/someGroup/somePropName --> .someGroup.somePropName'. ''' </param> ''' <remarks>Used by sublasses to implement Propety-Get with defaults when non-existent</remarks> - Protected Function BodyGetter(ByVal propPath As String) As JToken + Protected Function PropOrDefault(ByVal propPath As String) As JToken Dim value As JToken = Me.Body.SelectToken(propPath) If value Is Nothing Then '' No prop existed '' Return a default from schema (if any). diff --git a/CSE/IO/cPreferences.vb b/CSE/IO/cPreferences.vb index 3b5b24a666e41c54288166b164fbd69f7357661e..803fdf194c63063a6f5c9397335b24cf49082b21 100644 --- a/CSE/IO/cPreferences.vb +++ b/CSE/IO/cPreferences.vb @@ -27,9 +27,9 @@ Public Class cPreferences ' }</json>.Value) End Function - ''' <param name="allowAdditionalProps">when false, more strict validation</param> - Public Shared Function JSchemaStr(Optional ByVal allowAdditionalProps As Boolean = True) As String - Dim allowAdditionalProps_str As String = allowAdditionalProps.ToString.ToLower + ''' <param name="isStrictBody">when false, more strict validation</param> + Public Shared Function JSchemaStr(Optional ByVal isStrictBody As Boolean = False) As String + Dim allowAdditionalProps_str As String = (Not isStrictBody).ToString.ToLower Return <json>{ "title": "Schema for vecto-cse PREFERENCES", "type": "object", "additionalProperties": <%= allowAdditionalProps_str %>, @@ -119,8 +119,8 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", End Function ''' <exception cref="SystemException">includes all validation errors</exception> - ''' <param name="strictBody">when True, no additional json-properties allowed in the data, when nothing, use value from Header</param> - Protected Overrides Sub ValidateBody(ByVal strictBody As Boolean, ByVal validateMsgs As IList(Of String)) + ''' <param name="isStrictBody">when True, no additional json-properties allowed in the data, when nothing, use value from Header</param> + Protected Overrides Sub ValidateBody(ByVal isStrictBody As Boolean, ByVal validateMsgs As IList(Of String)) '' Check version '' Dim fromVersion = "1.0.0--" @@ -132,7 +132,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", '' Check schema '' - Dim schema = JsonSchema.Parse(JSchemaStr(Not strictBody)) + Dim schema = JsonSchema.Parse(JSchemaStr(isStrictBody)) ValidateJson(Me.Body, schema, validateMsgs) End Sub @@ -155,7 +155,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property writeLog As Boolean Get - Return BodyGetter(".writeLog") + Return PropOrDefault(".writeLog") End Get Set(ByVal value As Boolean) Me.Body("writeLog") = value @@ -164,7 +164,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property logSize As Integer Get - Return BodyGetter(".logSize") + Return PropOrDefault(".logSize") End Get Set(ByVal value As Integer) Me.Body("logSize") = value @@ -173,7 +173,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property logLevel As Integer Get - Return BodyGetter(".logLevel") + Return PropOrDefault(".logLevel") End Get Set(ByVal value As Integer) Me.Body("logLevel") = value @@ -182,7 +182,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property editor As String Get - Return BodyGetter(".editor") + Return PropOrDefault(".editor") End Get Set(ByVal value As String) Me.Body("editor") = value @@ -191,7 +191,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property strictBodies As Boolean Get - Return BodyGetter(".strictBodies") + Return PropOrDefault(".strictBodies") End Get Set(ByVal value As Boolean) Me.Body("strictBodies") = value @@ -200,7 +200,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property includeSchemas As Boolean Get - Return BodyGetter(".includeSchemas") + Return PropOrDefault(".includeSchemas") End Get Set(ByVal value As Boolean) Me.Body("includeSchemas") = value @@ -209,7 +209,7 @@ in the `/Header/CreatedBy` property of JSON-files, for protecting its privacy.", Public Property hideUsername As Boolean Get - Return BodyGetter(".hideUsername") + Return PropOrDefault(".hideUsername") End Get Set(ByVal value As Boolean) Me.Body("hideUsername") = value diff --git a/CSE/IO/cVehicle.vb b/CSE/IO/cVehicle.vb index 5baf1dfc15e897bf9651479feac4fd8421f0ba98..41dd8c69f7fb022329590caf688662b17c647c25 100644 --- a/CSE/IO/cVehicle.vb +++ b/CSE/IO/cVehicle.vb @@ -33,9 +33,9 @@ Public Class cVehicle }</json>.Value) End Function - ''' <param name="allowAdditionalProps">when false, more strict validation</param> - Public Shared Function JSchemaStr(Optional ByVal allowAdditionalProps As Boolean = True) As String - Dim allowAdditionalProps_str As String = allowAdditionalProps.ToString.ToLower + ''' <param name="isStrictBody">when true, more strict validation</param> + Public Shared Function JSchemaStr(Optional ByVal isStrictBody As Boolean = False) As String + Dim allowAdditionalProps_str As String = (Not isStrictBody).ToString.ToLower Return <json>{ "title": "Schema for vecto-cse VEHICLE", "type": "object", "additionalProperties": <%= allowAdditionalProps_str %>, @@ -116,8 +116,8 @@ The generic parameters for classes are stored in the GenShape.shp", End Function ''' <exception cref="SystemException">includes all validation errors</exception> - ''' <param name="strictBody">when true, no additional json-properties allowed in the data, when nothing, use value from Header</param> - Protected Overrides Sub ValidateBody(ByVal strictBody As Boolean, ByVal validateMsgs As IList(Of String)) + ''' <param name="isStrictBody">when true, no additional json-properties allowed in the data, when nothing, use value from Header</param> + Protected Overrides Sub ValidateBody(ByVal isStrictBody As Boolean, ByVal validateMsgs As IList(Of String)) '' Check version '' Dim fromVersion = "1.0.0--" @@ -129,7 +129,7 @@ The generic parameters for classes are stored in the GenShape.shp", '' Check schema '' - Dim schema = JsonSchema.Parse(JSchemaStr(Not strictBody)) + Dim schema = JsonSchema.Parse(JSchemaStr(isStrictBody)) ValidateJson(Body, schema, validateMsgs) If validateMsgs.Any() Then Return diff --git a/CSE/IO/input.vb b/CSE/IO/input.vb index 0da2e8f754a901a78bb244dc0cc774ab485201f3..0c5d850a5ccf661e3b01001a77333e7ac68f982b 100644 --- a/CSE/IO/input.vb +++ b/CSE/IO/input.vb @@ -459,23 +459,14 @@ Public Module input ' Function to read the generic shape file - Function fGenShpLoad() As Boolean + Sub fGenShpLoad(ByVal genShpFile As String) ' Declarations Dim i, j, anz, pos, num As Integer Dim Info As String = "" - Dim Line(), Line2(), Line3(), GenShpFile As String + Dim Line(), Line2(), Line3() As String Dim XVal(,), YVal(,), XClone(), YClone() As Double Using FileInGenShp As New cFile_V3 - - ' Initialisation - GenShpFile = joinPaths(MyPath, "Declaration", "GenShape.shp") - - ' Open the shape generic file - If Not FileInGenShp.OpenRead(GenShpFile) Then - ' Falls File nicht vorhanden, abbrechen mit Fehler - logme(9, True, "Can´t find the generic shape file: " & GenShpFile) - Return False - End If + FileInGenShp.OpenReadWithEx(genShpFile) ' Read the line Line = FileInGenShp.ReadLine() @@ -495,8 +486,7 @@ Public Module input If GenShape.veh_class.Contains(Line(pos)) Then For j = 0 To GenShape.veh_class.Count - 1 If GenShape.veh_class(j) = Line(pos) And GenShape.veh_conf(j) = Line2(pos) Then - logme(9, True, "The vehicle class with this configuration is already defined. Please control your generic shape file!") - Return False + Throw New ArgumentException("Invalid The vehicle-class({0}) with this configuration({0}) is already defined. Please control your generic ShapeFile({0})!") End If Next End If @@ -538,7 +528,6 @@ Public Module input Next i End Using - Return True - End Function + End Sub End Module diff --git a/DemoData/EvaluationDemo.csjob.json b/DemoData/EvaluationDemo.csjob.json index fb212e2fadfac8cd984085b433e93dd353b27956..58c5208f7880db8d9e594b092564c1f96c4d5139 100644 --- a/DemoData/EvaluationDemo.csjob.json +++ b/DemoData/EvaluationDemo.csjob.json @@ -3,20 +3,20 @@ "Title": "vecto-cse JOB", "FileVersion": "1.0.0", "AppVersion": "2.0.1-pre2", - "ModifiedDate": "2014/06/04 17:42:29 +02:00", - "CreatedBy": "JRC(lic: 04c137c0-24df-4d90-a3e2-b02fe3dba8ea)", + "ModifiedDate": "2014/06/05 03:57:58 +02:00", + "CreatedBy": "ISIS\\anastkn@JRC(lic: 04c137c0-24df-4d90-a3e2-b02fe3dba8ea)", "StrictBody": false, "BodySchema": null }, "Body": { "vehicle_fpath": "VehicleDemo.csveh.json", "ambient_fpath": "AmbientConditionsDemo.csamb", - "Anemometer": [ - 1.0, - 0.0, - 1.0, - 0.0 - ], + "Anemometer": { + "v_air_f": "2", + "v_air_d": "0", + "beta_f": "1", + "beta_d": "0" + }, "calib_track_fpath": "CalibrationTrackDemo.csms", "calib_run_fpath": "DataDemo_CAL.csdat", "coast_track_fpath": "CoastingTrackDemo.csms", @@ -66,6 +66,10 @@ "t_amb_var": 3, "t_amb_tarmac": 25 } - } + }, + "v_air_f": 2.0, + "v_air_d": 0.0, + "beta_f": 1.0, + "beta_d": 0.0 } } \ No newline at end of file