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

Skip to content
Snippets Groups Projects
Commit c9ab05be authored by Kostis ANAGNOSTOPOULOS's avatar Kostis ANAGNOSTOPOULOS
Browse files

Prepare for release, as v2.0.1-beta0

* Removed unused cResults class.
* Minor fix in logging-window.
parent 6dfb7a30
No related branches found
No related tags found
No related merge requests found
......@@ -2,11 +2,11 @@ VECTO-CSE: Changes
===================
TODO: 2014-06-??: v2.0.1
TODO: 2014-06-25: v2.0.1
--------------------
Mostly JRC contributions (see VECTO-29 & VECTO-35):
* IO: JSON-ize preferences, vehicle, job & criteria-files EXCEPT from Track-file and Output-values.
* IO: JSON-ize preferences, vehicle, job & criteria-files EXCEPT from Track-file.
* IO: CSVize all the rest files with a single header line and use '#' for comment lines.
* IO: Separate config/ from Declaration/ folders.
* UI: Provide default-values and help-messages in GUI/files with infos fetched from JSON-schemas.
......@@ -30,11 +30,14 @@ Mostly JRC contributions (see VECTO-29 & VECTO-35):
More analytically:
#### 2014-06-23: v2.0.1-pre3 ####
#### 2014-06-23: v2.0.1-beta0 ####
TUG & JRC improvements:
* Changed comment symbol in CSV files from 'c' --> '#'
* Unify hunits into header labels.
* json: Store run-results within the Job-file.
* csv: Ensure result-files are valid CSVs.
* csv: Changed comment symbol in CSV files from 'c' --> '#'
* csv: Unify hunits into header labels.
##### Internal:
* Use Exceptions instead of CancelAsync() and error-flags in calc-routines and input.vb.
* Remove unused distVincenty() func.
......
......@@ -116,7 +116,6 @@
<Compile Include="Classes\cValidSec.vb" />
<Compile Include="IO\cVehicle.vb" />
<Compile Include="Classes\cVirtMSC.vb" />
<Compile Include="IO\cResults.vb" />
<Compile Include="IO\output.vb" />
<Compile Include="IO\OutputTest.vb" />
<Compile Include="Calculation\Minor_routines_calculate.vb" />
......
......@@ -19,6 +19,17 @@ Imports System.Globalization
''' • /Header/BodySchema: The JSON-schema of the body will be placed HERE, for documenting file.
''' When true, it is always replaced by the Body's schema on the next save. When false, it overrides
''' application's choice and is not replaced ever.
'''
'''
''' How to Override:
''' ----------------
''' You can extend it to add Body-content in 2 ways (and a combination o0f both is possible):
''' • With Properties: Add Properties that on Get/Set write/read directly from the body-content,
''' so the object is always in sync with the JSON-content.
''' • With public fields: Add fields that do not have any side-effect, but then the JSON-content
''' needs to get synced with those fields. This is achieved by overriding thefollowing 2 methods:
'''
''' In any case,
''' </remarks>
Public MustInherit Class cJsonFile
Implements ICloneable
......@@ -109,8 +120,11 @@ When False, it overrides Application's choice and is not replaced ever.",
''' <remarks>To signify validation-failure it can throw an exception or add err-messages into the supplied list</remarks>
Protected MustOverride Sub ValidateBody(ByVal isStrict As Boolean, ByVal validateMsgs As IList(Of String))
''' <summary>Override this to read the JSON-content and update any fields on this instance</summary>
Protected Overridable Sub OnContentUpdated()
End Sub
''' <summary>Override this to update the JSON-content from any fields on this instance before storing it</summary>
Protected Overridable Sub OnBeforeContentStored()
End Sub
......
Imports Newtonsoft.Json.Linq
Imports Newtonsoft.Json.Schema
Public Class cResults
Inherits cJsonFile
Protected Overrides Function HeaderOverlay() As JObject
Return JObject.Parse(<json>{
"Title": "vecto-cse RESULTS",
"FileVersion": "1.0.0",
}</json>.Value)
End Function
'' Default values are Decleration
Private Shared Function BuildBody() As JObject
Dim b, g As Object
b = New JObject()
g = New JObject()
b.Calibration = g
g.fv_veh = 0
g.fa_pe = 1
g.fv_pe = 0
g.beta_ame = 0
g = New JObject()
b.Evaluation = g
g.CdxA = 0
g.beta = 0
g.delta_CdxA = 0
g.CdxA0 = 0
g.CdxA0_opt2 = 0
g = New JObject()
b.Validity = g
g.valid_t_tire = True
g.valid_t_amb = True
g.valid_RRC = True
Return b
End Function
''' <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 RESULTS",
"type": "object", "additionalProperties": <%= allowAdditionalProps_str %>,
"required": true,
"properties": {
"Calibration": {
"type": "object",
"required": true,
"additionalProperties": <%= allowAdditionalProps_str %>,
"properties": {
"fv_veh": {"type": "number", "required": true,
"description": "Calibration factor for vehicle speed.",
},
"fv_pe": {"type": "number", "required": true,
"description": "Calibration factor for air speed (position error).",
},
"fa_pe": {"type": "number", "required": true,
"description": "Position error correction factor for measured air inflow angle (beta).",
},
"beta_ame": {"type": "number", "required": true,
"description": "Calibration factor for beta (misalignment).",
"units": "°",
},
}
},
"Evaluation": {
"type": "object",
"required": true,
"additionalProperties": <%= allowAdditionalProps_str %>,
"properties": {
"CdxA": {"type": "number", "required": true,
"description": "Average CdxA before yaw angle correction",
"units": "m^2",
},
"beta": {"type": "number", "required": true,
"description": "Average absolute yaw angle from high speed tests.",
"units": "m^2",
},
"delta_CdxA": {"type": "number", "required": true,
"description": "Correction of CdxA for yaw angle.",
"units": "m^2",
},
"CdxA0": {"type": "number", "required": true,
"description": "Correction of CdxA for zero yaw angle.",
"units": "m^2",
},
"CdxA0_opt2": {"type": "number", "required": true,
"description": "Average CdxA for zero yaw angle (yaw angle correction performed before averaging of measurement sections).",
"units": "m^2",
},
}
},
"Validity": {
"type": "object",
"required": true,
"additionalProperties": <%= allowAdditionalProps_str %>,
"properties": {
"valid_t_tire": {"type": "boolean", "required": true,
"description": "Invalid if the maximum ambient temperature exceeded.",
},
"valid_t_amb": {"type": "boolean", "required": true,
"description": "Invalid if the ambient temperature fallen below minimum.",
},
"valid_RRC": {"type": "boolean", "required": true,
"description": "Invalid if the ambient temperature higher than allowed.",
},
}
},
},
}</json>.Value
End Function
''' <summary>creates defaults</summary>
''' <remarks>See cJsonFile() constructor</remarks>
Sub New(Optional ByVal skipValidation As Boolean = False)
MyBase.New(BuildBody, skipValidation)
End Sub
''' <summary>Reads from file or creates defaults</summary>
Sub New(ByVal foreignBody As JToken, Optional ByVal skipValidation As Boolean = False)
MyBase.New(foreignBody, skipValidation)
End Sub
Protected Overrides Function BodySchemaStr() As String
Return JSchemaStr()
End Function
''' <exception cref="SystemException">includes all validation errors</exception>
''' <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
''
Const fromVersion = "1.0.0--"
Const toVersion = "2.0.0--" ' The earliest pre-release.
If Not IsSemanticVersionsSupported(Me.FileVersion, fromVersion, toVersion) Then
validateMsgs.Add(format("Unsupported FileVersion({0}, was not in between [{1}, {2})", Me.FileVersion, fromVersion, toVersion))
Return
End If
'' Check schema
''
Dim schema = JsonSchema.Parse(JSchemaStr(isStrictBody))
ValidateJson(Body, schema, validateMsgs)
If validateMsgs.Any() Then Return
'' Check others
''
End Sub
#Region "json props"
''' <summary>Override it to set custome fields</summary>
Protected Overrides Sub OnBeforeContentStored()
Dim g, b As Object
b = Me.Body
g = b("Calibration")
g.fv_veh = Job.fv_veh
g.fa_pe = Job.fa_pe
g.fv_pe = Job.fv_pe
g.beta_ame = Job.beta_ame
g = b("Evaluation")
g.CdxA = Job.CdxA
g.beta = Job.beta
g.delta_CdxA = Job.delta_CdxA
g.CdxA0 = Job.CdxA0
g.CdxA0_opt2 = Job.CdxA0_opt2
g = b("Validity")
g.valid_t_tire = Job.valid_t_tire
g.valid_t_amb = Job.valid_t_amb
g.valid_RRC = Job.valid_RRC
End Sub
''' <summary>Do not invoke this method in vain...</summary>
Property Results As cResults
Get
Return New cResults(Me.Body("Results"), True)
End Get
Set(ByVal value As cResults)
Me.Body("Results") = value.Body
End Set
End Property
#End Region ' json props
End Class
......@@ -2,7 +2,7 @@
' Description of the form
Public Const AppName As String = "VECTO_CSE" ' Name of the programm
Public Const AppVers As String = "2.0.1-pre3" ' Version of the Programm
Public Const AppVers As String = "2.0.1-beta0" ' Version of the Programm
Public AppDate As String ' Date of the compilation of the programm
' Control variables
......
......@@ -263,15 +263,16 @@ Module utils
Dim printEx = False
Dim lbox As ListBox
Dim mtext = text
If (ex IsNot Nothing) Then
printEx = (logFileLevel > 1 AndAlso Prefs.logLevel <= 2)
text = format("{0} (Check {1} for details)", text, IIf(printEx, "error/warn tab", "log-file"))
mtext = format("{0} (Check {1} for details)", text, IIf(printEx, "error/warn tab", "log-file"))
End If
' Always write to log-msg tab.
''
lbox = F_Main.ListBoxMSG
lbox.Items.Add(text)
lbox.Items.Add(mtext)
F_Main.TabPageMSG.Text = format("Messages({0})", lbox.Items.Count)
' Set the Scrollbars in the Listboxes at the end
lbox.TopIndex = lbox.Items.Count - 1
......@@ -295,9 +296,7 @@ Module utils
End If
lbox.TopIndex = lbox.Items.Count - 1
F_Main.TabPageWar.Text = format("Warnings({0})", lbox.Items.Count)
lbox.Text = format("{0}({1})", label, lbox.Items.Count)
End Sub
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment