Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit cf74fd4f authored by Franz KOBER josef's avatar Franz KOBER josef
Browse files

added additional checks

parent 2c140b44
Branches
Tags
No related merge requests found
...@@ -17,13 +17,7 @@ Public Class IHPCForm ...@@ -17,13 +17,7 @@ Public Class IHPCForm
#Region "Set JSON Data" #Region "Set JSON Data"
Public Sub ReadIHPCFile(file As String) Public Sub ReadIHPCFile(file As String)
Dim ihpcData = JSONInputDataFactory.ReadIHPCEngineeringInputData(file, True)
Dim inputProvider = New JSONComponentInputData(file, Nothing)
Dim ihpcData = inputProvider.ElectricMachines.Entries.First().ElectricMachine
If IsNothing(ihpcData) Then
Return
End If
tbModel.Text = ihpcData.Model tbModel.Text = ihpcData.Model
tbInertia.Text = ihpcData.Inertia.ToGUIFormat() tbInertia.Text = ihpcData.Inertia.ToGUIFormat()
......
...@@ -684,8 +684,6 @@ Public Class VehicleForm ...@@ -684,8 +684,6 @@ Public Class VehicleForm
tcVehicleComponents.TabPages.Remove(tpElectricMachine) tcVehicleComponents.TabPages.Remove(tpElectricMachine)
tcVehicleComponents.TabPages.Remove(tpGensetComponents) tcVehicleComponents.TabPages.Remove(tpGensetComponents)
'IEPC
tcVehicleComponents.TabPages.Remove(tpIEPC) tcVehicleComponents.TabPages.Remove(tpIEPC)
Case Else Case Else
...@@ -1538,6 +1536,14 @@ Public Class VehicleForm ...@@ -1538,6 +1536,14 @@ Public Class VehicleForm
Dim f = FileRepl(tbIEPCFilePath.Text, GetPath(_vehFile)) Dim f = FileRepl(tbIEPCFilePath.Text, GetPath(_vehFile))
IEPCForm.JobDir = GetPath(_vehFile) IEPCForm.JobDir = GetPath(_vehFile)
If Not Trim(f) = "" Then
If Not File.Exists(f) Then
MsgBox("File not found!")
Exit Sub
End If
End If
If Not IEPCForm.Visible Then If Not IEPCForm.Visible Then
IEPCForm.NewIEPC() IEPCForm.NewIEPC()
IEPCForm.Show() IEPCForm.Show()
...@@ -1565,6 +1571,13 @@ Public Class VehicleForm ...@@ -1565,6 +1571,13 @@ Public Class VehicleForm
Dim f = FileRepl(tbIHPCFilePath.Text, GetPath(_vehFile)) Dim f = FileRepl(tbIHPCFilePath.Text, GetPath(_vehFile))
IHPCForm.JobDir = GetPath(_vehFile) IHPCForm.JobDir = GetPath(_vehFile)
If Not Trim(f) = "" Then
If Not File.Exists(f) Then
MsgBox("File not found!")
Exit Sub
End If
End If
If Not IHPCForm.Visible Then If Not IHPCForm.Visible Then
IHPCForm.ClearIHPC() IHPCForm.ClearIHPC()
IHPCForm.Show() IHPCForm.Show()
......
...@@ -258,5 +258,19 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON ...@@ -258,5 +258,19 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON
throw new VectoException("Engineering IEPC: Unsupported FileVersion. Got {0}", version); throw new VectoException("Engineering IEPC: Unsupported FileVersion. Got {0}", version);
} }
} }
public static IElectricMotorEngineeringInputData ReadIHPCEngineeringInputData(string filename,
bool tolerateMissing = false)
{
var json = ReadFile(filename);
var version = ReadVersion(json);
switch (version)
{
case 5:
return ReadElectricMotorData(filename, tolerateMissing);
default:
throw new VectoException("Engineering IHPC: Unsupported FileVersion. Got {0}", version);
}
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment