diff --git a/HashingCmd/Program.cs b/HashingCmd/Program.cs index b26375e7636e70701effed9dfdaa3794d15a1563..3fca5f6f7700b66656e8323f20113d478e0a8997 100644 --- a/HashingCmd/Program.cs +++ b/HashingCmd/Program.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/HashingCmd/Properties/AssemblyInfo.cs b/HashingCmd/Properties/AssemblyInfo.cs index 8c0968988b997940e7bf4808a9afa17b7f5ffa2b..4feefe77cba0a77c2b31ab9cdc69e4f7cd199bc2 100644 --- a/HashingCmd/Properties/AssemblyInfo.cs +++ b/HashingCmd/Properties/AssemblyInfo.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/HashingCmd/Properties/Version.cs b/HashingCmd/Properties/Version.cs index 256603680a52f95c88ed2cb7a462d385ed6889c3..42e64f40089351cd75dc6d307d819b5cea3f8a78 100644 --- a/HashingCmd/Properties/Version.cs +++ b/HashingCmd/Properties/Version.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; [assembly: AssemblyVersion("0.1.0.127")] [assembly: AssemblyFileVersion("0.1.0.127")] diff --git a/HashingTool/App.xaml.cs b/HashingTool/App.xaml.cs index 810fa2a70f71ebc9bb1d1065fd1a0db3f8c63b49..24098e400a481d98ecf0397149d508e2ccd7d9c9 100644 --- a/HashingTool/App.xaml.cs +++ b/HashingTool/App.xaml.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace HashingTool { /// <summary> diff --git a/HashingTool/MainWindow.xaml.cs b/HashingTool/MainWindow.xaml.cs index ebdebd827e35326cb6052b51a116e60eb1b255bb..b93eb08e8ef75636c8f9c9f17904002e49914ce0 100644 --- a/HashingTool/MainWindow.xaml.cs +++ b/HashingTool/MainWindow.xaml.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace HashingTool { /// <summary> diff --git a/HashingTool/Properties/AssemblyInfo.cs b/HashingTool/Properties/AssemblyInfo.cs index be03aa00edada0191def470609435986d71217cc..262a43291ca674a8a49aed69d6148bd55ef8ceb6 100644 --- a/HashingTool/Properties/AssemblyInfo.cs +++ b/HashingTool/Properties/AssemblyInfo.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; diff --git a/HashingTool/Properties/Resources.Designer.cs b/HashingTool/Properties/Resources.Designer.cs index 3a7ee2b38acc8cb4eaa7fe10488ab0a3bd12b1cf..b28b9153b2f9bb292d8bf3efbe411ac1f599d265 100644 --- a/HashingTool/Properties/Resources.Designer.cs +++ b/HashingTool/Properties/Resources.Designer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace HashingTool.Properties { diff --git a/HashingTool/Properties/Settings.Designer.cs b/HashingTool/Properties/Settings.Designer.cs index 2278b7c4f7e702b360f598ac73ed649e8e00e868..4e701dcb062818da69b8a36378a9c5d76242f275 100644 --- a/HashingTool/Properties/Settings.Designer.cs +++ b/HashingTool/Properties/Settings.Designer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace HashingTool.Properties { diff --git a/HashingTool/Properties/Version.cs b/HashingTool/Properties/Version.cs index 256603680a52f95c88ed2cb7a462d385ed6889c3..42e64f40089351cd75dc6d307d819b5cea3f8a78 100644 --- a/HashingTool/Properties/Version.cs +++ b/HashingTool/Properties/Version.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; [assembly: AssemblyVersion("0.1.0.127")] [assembly: AssemblyFileVersion("0.1.0.127")] diff --git a/Tools/AddLic/lic_vb.txt b/Tools/AddLic/lic_vb.txt index 6391307c4251781f9e9a5e474c1a3b2b248d14ad..ce7177deb86e512dc030f3147f15e5367d727a70 100644 --- a/Tools/AddLic/lic_vb.txt +++ b/Tools/AddLic/lic_vb.txt @@ -1,10 +1,10 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. diff --git a/Tools/DeclarationCycleZip/Program.cs b/Tools/DeclarationCycleZip/Program.cs index 4ffa9847a296f27ef6e648ea45b763aec404f83c..c4a495b1b6fddc86b662adcaaac79f0a06dabb58 100644 --- a/Tools/DeclarationCycleZip/Program.cs +++ b/Tools/DeclarationCycleZip/Program.cs @@ -1,78 +1,78 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; -using System.Globalization; -using System.IO; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Utils; - -namespace DeclarationCycleZip -{ - internal class Program - { - private static void Main(string[] args) - { - var cycleData = DrivingCycleDataReader.ReadFromFile(args[0], CycleType.DistanceBased, false); - - var table = new DataTable(); - table.Columns.Add("<s>"); - table.Columns.Add("<v>"); - table.Columns.Add("<grad>"); - table.Columns.Add("<stop>"); - - var lastDistance = cycleData.Entries.First().Distance - 1.SI<Meter>(); - DrivingCycleData.DrivingCycleEntry prevEntry = null; - foreach (var x in cycleData.Entries) { - if (x.Distance.IsEqual(lastDistance)) { - if (prevEntry != null && prevEntry.VehicleTargetSpeed.IsEqual(0.SI<MeterPerSecond>())) { - x.Distance = x.Distance + 1.SI<Meter>(); - } else { - continue; - } - } - var row = table.NewRow(); - row["<s>"] = x.Distance.Value().ToString(CultureInfo.InvariantCulture); - row["<v>"] = x.VehicleTargetSpeed.ConvertTo().Kilo.Meter.Per.Hour.Value().ToString(CultureInfo.InvariantCulture); - row["<grad>"] = x.RoadGradientPercent.Value().ToString(CultureInfo.InvariantCulture); - row["<stop>"] = x.StoppingTime.Value().ToString(CultureInfo.InvariantCulture); - table.Rows.Add(row); - lastDistance = x.Distance; - prevEntry = x; - } - - VectoCSVFile.Write(Path.GetFileName(args[0]), table); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; +using System.Globalization; +using System.IO; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Utils; + +namespace DeclarationCycleZip +{ + internal class Program + { + private static void Main(string[] args) + { + var cycleData = DrivingCycleDataReader.ReadFromFile(args[0], CycleType.DistanceBased, false); + + var table = new DataTable(); + table.Columns.Add("<s>"); + table.Columns.Add("<v>"); + table.Columns.Add("<grad>"); + table.Columns.Add("<stop>"); + + var lastDistance = cycleData.Entries.First().Distance - 1.SI<Meter>(); + DrivingCycleData.DrivingCycleEntry prevEntry = null; + foreach (var x in cycleData.Entries) { + if (x.Distance.IsEqual(lastDistance)) { + if (prevEntry != null && prevEntry.VehicleTargetSpeed.IsEqual(0.SI<MeterPerSecond>())) { + x.Distance = x.Distance + 1.SI<Meter>(); + } else { + continue; + } + } + var row = table.NewRow(); + row["<s>"] = x.Distance.Value().ToString(CultureInfo.InvariantCulture); + row["<v>"] = x.VehicleTargetSpeed.ConvertTo().Kilo.Meter.Per.Hour.Value().ToString(CultureInfo.InvariantCulture); + row["<grad>"] = x.RoadGradientPercent.Value().ToString(CultureInfo.InvariantCulture); + row["<stop>"] = x.StoppingTime.Value().ToString(CultureInfo.InvariantCulture); + table.Rows.Add(row); + lastDistance = x.Distance; + prevEntry = x; + } + + VectoCSVFile.Write(Path.GetFileName(args[0]), table); + } + } } \ No newline at end of file diff --git a/Tools/DeclarationCycleZip/Properties/AssemblyInfo.cs b/Tools/DeclarationCycleZip/Properties/AssemblyInfo.cs index 643e0583307ad806b6239b69915befce930e6ca3..bde3771b20f57830df58004359700fdd07c56292 100644 --- a/Tools/DeclarationCycleZip/Properties/AssemblyInfo.cs +++ b/Tools/DeclarationCycleZip/Properties/AssemblyInfo.cs @@ -1,66 +1,66 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("DeclarationCycleZip")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DeclarationCycleZip")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b8f01491-78a5-4d78-a575-3e6d1eed6e7e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DeclarationCycleZip")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DeclarationCycleZip")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b8f01491-78a5-4d78-a575-3e6d1eed6e7e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tools/GraphDrawer/Program.cs b/Tools/GraphDrawer/Program.cs index 81b9d3dffe88a8920675e49a6727d40efaa3cfc0..a9d9aa0946b5c13e272643386a65a8a382a9cfc0 100644 --- a/Tools/GraphDrawer/Program.cs +++ b/Tools/GraphDrawer/Program.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Linq; using TUGraz.VectoCore.Tests.Utils; diff --git a/Tools/GraphDrawer/Properties/AssemblyInfo.cs b/Tools/GraphDrawer/Properties/AssemblyInfo.cs index 0b00f25553c8f59c46dd54839f684ebf2db0c71b..65e08df3366bc794fe667e039f3979c6328d0392 100644 --- a/Tools/GraphDrawer/Properties/AssemblyInfo.cs +++ b/Tools/GraphDrawer/Properties/AssemblyInfo.cs @@ -1,66 +1,66 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GraphDrawer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GraphDrawer")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c2e9ae54-7f74-4372-aeba-9ed8d81501c5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("GraphDrawer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("GraphDrawer")] +[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c2e9ae54-7f74-4372-aeba-9ed8d81501c5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tools/LicenceHeader/Program.cs b/Tools/LicenceHeader/Program.cs index b0d34707c3118d6d7e440adab685377d452b7ac5..11bd0926044bf5b641bc8fb2e7a493215a8082e7 100644 --- a/Tools/LicenceHeader/Program.cs +++ b/Tools/LicenceHeader/Program.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Linq; diff --git a/Tools/LicenceHeader/Properties/AssemblyInfo.cs b/Tools/LicenceHeader/Properties/AssemblyInfo.cs index 0c281df26e7024ae8cad90a1d82e876a673f3420..5f3dd212b78e023aee5b5faaaf7e1109b12aa2c3 100644 --- a/Tools/LicenceHeader/Properties/AssemblyInfo.cs +++ b/Tools/LicenceHeader/Properties/AssemblyInfo.cs @@ -1,46 +1,46 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("LicenceHeader")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LicenceHeader")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("90e6bcfe-f3da-4689-b4cd-b191771f1d1b")] -[assembly: AssemblyVersion("1.0.0.0")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("LicenceHeader")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("LicenceHeader")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("90e6bcfe-f3da-4689-b4cd-b191771f1d1b")] +[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Tools/LicenceHeader/header.txt b/Tools/LicenceHeader/header.txt index ae62a01598b3a8a32e3809375079f169bf66ac83..b674670baa9ede04157b2cd7cda11d24cd1ce205 100644 --- a/Tools/LicenceHeader/header.txt +++ b/Tools/LicenceHeader/header.txt @@ -1,31 +1,31 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + diff --git a/Tools/VectoLegacyTests/Properties/AssemblyInfo.cs b/Tools/VectoLegacyTests/Properties/AssemblyInfo.cs index c387b786c6d3393f9c74d5900248b04705fd4b63..58e7f35b1c77b008bfb7aad82949bf40fa26fbf2 100644 --- a/Tools/VectoLegacyTests/Properties/AssemblyInfo.cs +++ b/Tools/VectoLegacyTests/Properties/AssemblyInfo.cs @@ -1,67 +1,67 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Allgemeine Informationen über eine Assembly werden über folgende -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("VectoLegacyTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("VectoLegacyTests")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("25b42ace-0f92-4e46-80b1-12f5927f51f8")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern -// durch Einsatz von '*', wie in nachfolgendem Beispiel: -// [Assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über folgende +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("VectoLegacyTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VectoLegacyTests")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("25b42ace-0f92-4e46-80b1-12f5927f51f8")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// durch Einsatz von '*', wie in nachfolgendem Beispiel: +// [Assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tools/VectoLegacyTests/TorqueConverterTest.cs b/Tools/VectoLegacyTests/TorqueConverterTest.cs index 65686a4609e9f47d9471bac3bd70aeb246127c44..64a4cbe3c8e1b69262833ab77615c1ff88ce668c 100644 --- a/Tools/VectoLegacyTests/TorqueConverterTest.cs +++ b/Tools/VectoLegacyTests/TorqueConverterTest.cs @@ -1,56 +1,56 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Diagnostics; -using System.Globalization; -using System.Threading; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VECTO; - -namespace VectoLegacyTests -{ - [TestClass] - public class TorqueConverterTest - { - [ClassInitialize] - public static void InitTests(TestContext ctx) - { - if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ".") { - return; - } - try { - Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); - Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); - } catch (Exception) {} - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Diagnostics; +using System.Globalization; +using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VECTO; + +namespace VectoLegacyTests +{ + [TestClass] + public class TorqueConverterTest + { + [ClassInitialize] + public static void InitTests(TestContext ctx) + { + if (CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ".") { + return; + } + try { + Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); + Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); + } catch (Exception) {} + } + } } \ No newline at end of file diff --git a/VECTO/ApplicationEvents.vb b/VECTO/ApplicationEvents.vb index 0b6971c6923812106ae58d46a4e7d84d24d2ac66..d9f9810ace7256300e540c2366792bc588c45a85 100644 --- a/VECTO/ApplicationEvents.vb +++ b/VECTO/ApplicationEvents.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/Configuration.vb b/VECTO/Configuration.vb index ddbff60825b231f8aa1da3673fbba5b8a1e7729d..6e17884ecd1711446ff31a8bcdb45bab677c03f5 100644 --- a/VECTO/Configuration.vb +++ b/VECTO/Configuration.vb @@ -1,4 +1,4 @@ -' Copyright 2016 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/File Browser/FileBrowser.vb b/VECTO/File Browser/FileBrowser.vb index 36c2693ecf50aa138c54c6cf0477c8bfd234add2..01983ca224e9e95a425b87337079bc52e0aad5dd 100644 --- a/VECTO/File Browser/FileBrowser.vb +++ b/VECTO/File Browser/FileBrowser.vb @@ -1,162 +1,162 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -''' <summary> -''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. -''' </summary> -''' <remarks> -''' Usage: -''' 1. Create new instance, preferably in FB_Global, e.g. fbTXT = New cFileBrowser("txt") -''' 2. Define extensions, e.g. fbTXT.Extensions = New String() {"txt","log"} -''' 3. Use OpenDialog, SaveDialog, etc. -''' 4. Call Close method when closing application to write file history, e.g. fbTXT.Close -''' File history is unique for each ID. Folder history is global. -''' </remarks> -Public Class FileBrowser - Private _initialized As Boolean - Private ReadOnly _id As String - Private _extensionList As String() - Private _dialog As FileBrowserDialog - Private _noExtension As Boolean - Private ReadOnly _folderBrowser As Boolean - Private ReadOnly _lightMode As Boolean - - ''' <summary> - ''' New cFileBrowser instance - ''' </summary> - ''' <param name="id">Needed to save the file history when not using LightMode.</param> - ''' <param name="folderBrowser">Browse folders instead of files.</param> - ''' <param name="lightMode">If enabled file history is not saved.</param> - ''' <remarks></remarks> - Public Sub New(id As String, Optional ByVal folderBrowser As Boolean = False, - Optional ByVal lightMode As Boolean = False) - _initialized = False - _id = ID - _noExtension = True - _folderBrowser = folderBrowser - _lightMode = lightMode - End Sub - - ''' <summary> - ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="multiFile">Allow selecting multiple files.</param> - ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function OpenDialog(path As String, Optional ByVal multiFile As Boolean = False, - Optional ByVal ext As String = "") As Boolean - Return CustomDialog(path, True, False, FileBrowserFileExtensionMode.MultiExt, multiFile, ext, "Open") - End Function - - ''' <summary> - ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="forceExt">Force predefined file extension.</param> - ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function SaveDialog(path As String, Optional ByVal forceExt As Boolean = True, Optional ByVal ext As String = "") _ - As Boolean - Dim x As FileBrowserFileExtensionMode - If forceExt Then - x = FileBrowserFileExtensionMode.ForceExt - Else - x = FileBrowserFileExtensionMode.SingleExt - End If - Return CustomDialog(path, False, True, x, False, ext, "Save As") - End Function - - ''' <summary> - ''' Custom open/save dialog. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="fileMustExist">Selected file must exist.</param> - ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> - ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> - ''' <param name="multiFile">Allow to select multiple files.</param> - ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <param name="title">Dialog title.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function CustomDialog(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, extMode As FileBrowserFileExtensionMode, - multiFile As Boolean, ext As String, Optional title As String = "File Browser") As Boolean - If Not _initialized Then Init() - Return _dialog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, ext, title) - End Function - - 'Manually update File History - ''' <summary> - ''' Add file to file history. - ''' </summary> - ''' <param name="path">File to be added to file history.</param> - ''' <remarks></remarks> - Public Sub UpdateHistory(path As String) - If Not _initialized Then Init() - _dialog.UpdateHistory(path) - End Sub - - ''' <summary> - ''' Save file history (if not LightMode) and global folder history. - ''' </summary> - ''' <remarks></remarks> - Public Sub Close() - If _initialized Then - _dialog.SaveAndClose() - _initialized = False - End If - _dialog = Nothing - End Sub - - Private Sub Init() - _dialog = New FileBrowserDialog(_lightMode) - _dialog.ID = _id - If Not _noExtension Then _dialog.Extensions = _extensionList - If _folderBrowser Then _dialog.SetFolderBrowser() - _initialized = True - End Sub - - ''' <summary> - ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property Extensions As String() - Get - Return _extensionList - End Get - Set(value As String()) - _extensionList = value - _noExtension = False - End Set - End Property - - ''' <summary> - ''' Selected file(s) oder folder (if FolderBrowser) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public ReadOnly Property Files As String() - Get - If _initialized Then - Return _dialog.Files - Else - Return New String() {""} - End If - End Get - End Property -End Class - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +''' <summary> +''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. +''' </summary> +''' <remarks> +''' Usage: +''' 1. Create new instance, preferably in FB_Global, e.g. fbTXT = New cFileBrowser("txt") +''' 2. Define extensions, e.g. fbTXT.Extensions = New String() {"txt","log"} +''' 3. Use OpenDialog, SaveDialog, etc. +''' 4. Call Close method when closing application to write file history, e.g. fbTXT.Close +''' File history is unique for each ID. Folder history is global. +''' </remarks> +Public Class FileBrowser + Private _initialized As Boolean + Private ReadOnly _id As String + Private _extensionList As String() + Private _dialog As FileBrowserDialog + Private _noExtension As Boolean + Private ReadOnly _folderBrowser As Boolean + Private ReadOnly _lightMode As Boolean + + ''' <summary> + ''' New cFileBrowser instance + ''' </summary> + ''' <param name="id">Needed to save the file history when not using LightMode.</param> + ''' <param name="folderBrowser">Browse folders instead of files.</param> + ''' <param name="lightMode">If enabled file history is not saved.</param> + ''' <remarks></remarks> + Public Sub New(id As String, Optional ByVal folderBrowser As Boolean = False, + Optional ByVal lightMode As Boolean = False) + _initialized = False + _id = ID + _noExtension = True + _folderBrowser = folderBrowser + _lightMode = lightMode + End Sub + + ''' <summary> + ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="multiFile">Allow selecting multiple files.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function OpenDialog(path As String, Optional ByVal multiFile As Boolean = False, + Optional ByVal ext As String = "") As Boolean + Return CustomDialog(path, True, False, FileBrowserFileExtensionMode.MultiExt, multiFile, ext, "Open") + End Function + + ''' <summary> + ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="forceExt">Force predefined file extension.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function SaveDialog(path As String, Optional ByVal forceExt As Boolean = True, Optional ByVal ext As String = "") _ + As Boolean + Dim x As FileBrowserFileExtensionMode + If forceExt Then + x = FileBrowserFileExtensionMode.ForceExt + Else + x = FileBrowserFileExtensionMode.SingleExt + End If + Return CustomDialog(path, False, True, x, False, ext, "Save As") + End Function + + ''' <summary> + ''' Custom open/save dialog. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="fileMustExist">Selected file must exist.</param> + ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> + ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> + ''' <param name="multiFile">Allow to select multiple files.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <param name="title">Dialog title.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function CustomDialog(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, extMode As FileBrowserFileExtensionMode, + multiFile As Boolean, ext As String, Optional title As String = "File Browser") As Boolean + If Not _initialized Then Init() + Return _dialog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, ext, title) + End Function + + 'Manually update File History + ''' <summary> + ''' Add file to file history. + ''' </summary> + ''' <param name="path">File to be added to file history.</param> + ''' <remarks></remarks> + Public Sub UpdateHistory(path As String) + If Not _initialized Then Init() + _dialog.UpdateHistory(path) + End Sub + + ''' <summary> + ''' Save file history (if not LightMode) and global folder history. + ''' </summary> + ''' <remarks></remarks> + Public Sub Close() + If _initialized Then + _dialog.SaveAndClose() + _initialized = False + End If + _dialog = Nothing + End Sub + + Private Sub Init() + _dialog = New FileBrowserDialog(_lightMode) + _dialog.ID = _id + If Not _noExtension Then _dialog.Extensions = _extensionList + If _folderBrowser Then _dialog.SetFolderBrowser() + _initialized = True + End Sub + + ''' <summary> + ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property Extensions As String() + Get + Return _extensionList + End Get + Set(value As String()) + _extensionList = value + _noExtension = False + End Set + End Property + + ''' <summary> + ''' Selected file(s) oder folder (if FolderBrowser) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public ReadOnly Property Files As String() + Get + If _initialized Then + Return _dialog.Files + Else + Return New String() {""} + End If + End Get + End Property +End Class + + diff --git a/VECTO/File Browser/FileBrowserDialog.designer.vb b/VECTO/File Browser/FileBrowserDialog.designer.vb index 606eed1f37b6f9de4794329f08b48465ad3975f2..796f7facac9494ee286ecbef2d722f2dec3c6caf 100644 --- a/VECTO/File Browser/FileBrowserDialog.designer.vb +++ b/VECTO/File Browser/FileBrowserDialog.designer.vb @@ -1,456 +1,456 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.ComponentModel -Imports Microsoft.VisualBasic.CompilerServices - -<DesignerGenerated()> _ -Partial Class FileBrowserDialog - Inherits Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - <DebuggerNonUserCode()> _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - <DebuggerStepThrough()> _ - Private Sub InitializeComponent() - Me.components = New Container() - Dim resources As ComponentResourceManager = New ComponentResourceManager(GetType(FileBrowserDialog)) - Me.SplitContainer1 = New SplitContainer() - Me.Label1 = New Label() - Me.ButtonNewDir = New Button() - Me.ButtonDesktop = New Button() - Me.ButtonHisFolder = New Button() - Me.ButtonFolderBack = New Button() - Me.TextBoxSearchFolder = New TextBox() - Me.ListViewFolder = New ListView() - Me.ColumnHeader3 = CType(New ColumnHeader(), ColumnHeader) - Me.ImageList1 = New ImageList(Me.components) - Me.ComboBoxDrive = New ComboBox() - Me.Label5 = New Label() - Me.Label2 = New Label() - Me.ButtonAll = New Button() - Me.ComboBoxExt = New ComboBox() - Me.ButtonHisFile = New Button() - Me.TextBoxSearchFile = New TextBox() - Me.ListViewFiles = New ListView() - Me.ColumnHeader1 = CType(New ColumnHeader(), ColumnHeader) - Me.ContextMenuFile = New ContextMenuStrip(Me.components) - Me.RenameFileToolStripMenuItem = New ToolStripMenuItem() - Me.DeleteFileToolStripMenuItem = New ToolStripMenuItem() - Me.TextBoxPath = New TextBox() - Me.ContextMenuHisFolder = New ContextMenuStrip(Me.components) - Me.ContextMenuHisFile = New ContextMenuStrip(Me.components) - Me.ButtonOK = New Button() - Me.ButtonCancel = New Button() - Me.TextBoxCurrent = New TextBox() - Me.Label3 = New Label() - Me.Label4 = New Label() - Me.ToolTip1 = New ToolTip(Me.components) - CType(Me.SplitContainer1, ISupportInitialize).BeginInit() - Me.SplitContainer1.Panel1.SuspendLayout() - Me.SplitContainer1.Panel2.SuspendLayout() - Me.SplitContainer1.SuspendLayout() - Me.ContextMenuFile.SuspendLayout() - Me.SuspendLayout() - ' - 'SplitContainer1 - ' - Me.SplitContainer1.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ - Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.SplitContainer1.BorderStyle = BorderStyle.Fixed3D - Me.SplitContainer1.Location = New Point(0, 46) - Me.SplitContainer1.Name = "SplitContainer1" - ' - 'SplitContainer1.Panel1 - ' - Me.SplitContainer1.Panel1.Controls.Add(Me.Label1) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) - Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ListViewFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxDrive) - ' - 'SplitContainer1.Panel2 - ' - Me.SplitContainer1.Panel2.Controls.Add(Me.Label5) - Me.SplitContainer1.Panel2.Controls.Add(Me.Label2) - Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonAll) - Me.SplitContainer1.Panel2.Controls.Add(Me.ComboBoxExt) - Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonHisFile) - Me.SplitContainer1.Panel2.Controls.Add(Me.TextBoxSearchFile) - Me.SplitContainer1.Panel2.Controls.Add(Me.ListViewFiles) - Me.SplitContainer1.Size = New Size(663, 308) - Me.SplitContainer1.SplitterDistance = 329 - Me.SplitContainer1.TabIndex = 5 - Me.SplitContainer1.TabStop = False - ' - 'Label1 - ' - Me.Label1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) - Me.Label1.AutoSize = True - Me.Label1.Location = New Point(3, 284) - Me.Label1.Name = "Label1" - Me.Label1.Size = New Size(32, 13) - Me.Label1.TabIndex = 28 - Me.Label1.Text = "Filter:" - ' - 'ButtonNewDir - ' - Me.ButtonNewDir.Image = My.Resources.Resources.new_dir - Me.ButtonNewDir.Location = New Point(119, 1) - Me.ButtonNewDir.Name = "ButtonNewDir" - Me.ButtonNewDir.Size = New Size(26, 25) - Me.ButtonNewDir.TabIndex = 21 - Me.ButtonNewDir.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonNewDir, "Create new Directory") - Me.ButtonNewDir.UseVisualStyleBackColor = True - ' - 'ButtonDesktop - ' - Me.ButtonDesktop.Image = My.Resources.Resources.desktop - Me.ButtonDesktop.Location = New Point(90, 1) - Me.ButtonDesktop.Name = "ButtonDesktop" - Me.ButtonDesktop.Size = New Size(26, 25) - Me.ButtonDesktop.TabIndex = 22 - Me.ButtonDesktop.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonDesktop, "Go to Desktop") - Me.ButtonDesktop.UseVisualStyleBackColor = True - ' - 'ButtonHisFolder - ' - Me.ButtonHisFolder.Anchor = CType((AnchorStyles.Top Or AnchorStyles.Right), AnchorStyles) - Me.ButtonHisFolder.Image = My.Resources.Resources.file_history - Me.ButtonHisFolder.Location = New Point(298, 1) - Me.ButtonHisFolder.Name = "ButtonHisFolder" - Me.ButtonHisFolder.Size = New Size(26, 25) - Me.ButtonHisFolder.TabIndex = 24 - Me.ButtonHisFolder.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonHisFolder, "History / Favorites") - Me.ButtonHisFolder.UseVisualStyleBackColor = True - ' - 'ButtonFolderBack - ' - Me.ButtonFolderBack.Image = CType(resources.GetObject("ButtonFolderBack.Image"), Image) - Me.ButtonFolderBack.Location = New Point(61, 1) - Me.ButtonFolderBack.Name = "ButtonFolderBack" - Me.ButtonFolderBack.Size = New Size(26, 25) - Me.ButtonFolderBack.TabIndex = 20 - Me.ButtonFolderBack.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonFolderBack, "Move up one directory") - Me.ButtonFolderBack.UseVisualStyleBackColor = True - ' - 'TextBoxSearchFolder - ' - Me.TextBoxSearchFolder.Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.TextBoxSearchFolder.Location = New Point(37, 281) - Me.TextBoxSearchFolder.Name = "TextBoxSearchFolder" - Me.TextBoxSearchFolder.Size = New Size(288, 20) - Me.TextBoxSearchFolder.TabIndex = 15 - Me.ToolTip1.SetToolTip(Me.TextBoxSearchFolder, "Filter the directories") - ' - 'ListViewFolder - ' - Me.ListViewFolder.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ - Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.ListViewFolder.Columns.AddRange(New ColumnHeader() {Me.ColumnHeader3}) - Me.ListViewFolder.FullRowSelect = True - Me.ListViewFolder.GridLines = True - Me.ListViewFolder.HideSelection = False - Me.ListViewFolder.Location = New Point(-2, 27) - Me.ListViewFolder.MultiSelect = False - Me.ListViewFolder.Name = "ListViewFolder" - Me.ListViewFolder.Size = New Size(327, 253) - Me.ListViewFolder.SmallImageList = Me.ImageList1 - Me.ListViewFolder.TabIndex = 10 - Me.ListViewFolder.UseCompatibleStateImageBehavior = False - Me.ListViewFolder.View = View.Details - ' - 'ColumnHeader3 - ' - Me.ColumnHeader3.Text = "Sub-Directories:" - Me.ColumnHeader3.Width = 368 - ' - 'ImageList1 - ' - Me.ImageList1.ColorDepth = ColorDepth.Depth32Bit - Me.ImageList1.ImageSize = New Size(16, 16) - Me.ImageList1.TransparentColor = Color.Transparent - ' - 'ComboBoxDrive - ' - Me.ComboBoxDrive.DropDownStyle = ComboBoxStyle.DropDownList - Me.ComboBoxDrive.FormattingEnabled = True - Me.ComboBoxDrive.Location = New Point(3, 3) - Me.ComboBoxDrive.Name = "ComboBoxDrive" - Me.ComboBoxDrive.Size = New Size(54, 21) - Me.ComboBoxDrive.TabIndex = 5 - ' - 'Label5 - ' - Me.Label5.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) - Me.Label5.AutoSize = True - Me.Label5.Location = New Point(256, 284) - Me.Label5.Name = "Label5" - Me.Label5.Size = New Size(10, 13) - Me.Label5.TabIndex = 30 - Me.Label5.Text = "." - ' - 'Label2 - ' - Me.Label2.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) - Me.Label2.AutoSize = True - Me.Label2.Location = New Point(3, 284) - Me.Label2.Name = "Label2" - Me.Label2.Size = New Size(32, 13) - Me.Label2.TabIndex = 29 - Me.Label2.Text = "Filter:" - ' - 'ButtonAll - ' - Me.ButtonAll.Location = New Point(2, 2) - Me.ButtonAll.Name = "ButtonAll" - Me.ButtonAll.Size = New Size(71, 23) - Me.ButtonAll.TabIndex = 19 - Me.ButtonAll.Text = "Select All" - Me.ToolTip1.SetToolTip(Me.ButtonAll, "Select all shown files") - Me.ButtonAll.UseVisualStyleBackColor = True - ' - 'ComboBoxExt - ' - Me.ComboBoxExt.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) - Me.ComboBoxExt.FormattingEnabled = True - Me.ComboBoxExt.Location = New Point(268, 281) - Me.ComboBoxExt.Name = "ComboBoxExt" - Me.ComboBoxExt.Size = New Size(57, 21) - Me.ComboBoxExt.TabIndex = 20 - Me.ToolTip1.SetToolTip(Me.ComboBoxExt, "Filter the file type") - ' - 'ButtonHisFile - ' - Me.ButtonHisFile.Anchor = CType((AnchorStyles.Top Or AnchorStyles.Right), AnchorStyles) - Me.ButtonHisFile.Image = My.Resources.Resources.file_history - Me.ButtonHisFile.Location = New Point(299, 1) - Me.ButtonHisFile.Name = "ButtonHisFile" - Me.ButtonHisFile.Size = New Size(26, 25) - Me.ButtonHisFile.TabIndex = 24 - Me.ButtonHisFile.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonHisFile, "History") - Me.ButtonHisFile.UseVisualStyleBackColor = True - ' - 'TextBoxSearchFile - ' - Me.TextBoxSearchFile.Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.TextBoxSearchFile.Location = New Point(36, 281) - Me.TextBoxSearchFile.Name = "TextBoxSearchFile" - Me.TextBoxSearchFile.Size = New Size(218, 20) - Me.TextBoxSearchFile.TabIndex = 15 - Me.ToolTip1.SetToolTip(Me.TextBoxSearchFile, "Filter the files") - ' - 'ListViewFiles - ' - Me.ListViewFiles.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ - Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.ListViewFiles.Columns.AddRange(New ColumnHeader() {Me.ColumnHeader1}) - Me.ListViewFiles.ContextMenuStrip = Me.ContextMenuFile - Me.ListViewFiles.FullRowSelect = True - Me.ListViewFiles.GridLines = True - Me.ListViewFiles.HideSelection = False - Me.ListViewFiles.Location = New Point(0, 27) - Me.ListViewFiles.Name = "ListViewFiles" - Me.ListViewFiles.Size = New Size(328, 253) - Me.ListViewFiles.SmallImageList = Me.ImageList1 - Me.ListViewFiles.TabIndex = 10 - Me.ListViewFiles.UseCompatibleStateImageBehavior = False - Me.ListViewFiles.View = View.Details - ' - 'ColumnHeader1 - ' - Me.ColumnHeader1.Text = "Files:" - Me.ColumnHeader1.Width = 367 - ' - 'ContextMenuFile - ' - Me.ContextMenuFile.Items.AddRange(New ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) - Me.ContextMenuFile.Name = "ContextMenuFile" - Me.ContextMenuFile.Size = New Size(148, 48) - ' - 'RenameFileToolStripMenuItem - ' - Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" - Me.RenameFileToolStripMenuItem.Size = New Size(147, 22) - Me.RenameFileToolStripMenuItem.Text = "Rename File..." - ' - 'DeleteFileToolStripMenuItem - ' - Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" - Me.DeleteFileToolStripMenuItem.Size = New Size(147, 22) - Me.DeleteFileToolStripMenuItem.Text = "Delete File..." - ' - 'TextBoxPath - ' - Me.TextBoxPath.Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.TextBoxPath.Location = New Point(47, 370) - Me.TextBoxPath.Name = "TextBoxPath" - Me.TextBoxPath.Size = New Size(609, 20) - Me.TextBoxPath.TabIndex = 15 - ' - 'ContextMenuHisFolder - ' - Me.ContextMenuHisFolder.Name = "ContextMenuFolderHis" - Me.ContextMenuHisFolder.Size = New Size(61, 4) - ' - 'ContextMenuHisFile - ' - Me.ContextMenuHisFile.Name = "ContextMenuFileHis" - Me.ContextMenuHisFile.Size = New Size(61, 4) - ' - 'ButtonOK - ' - Me.ButtonOK.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) - Me.ButtonOK.DialogResult = DialogResult.OK - Me.ButtonOK.Location = New Point(503, 399) - Me.ButtonOK.Name = "ButtonOK" - Me.ButtonOK.Size = New Size(75, 23) - Me.ButtonOK.TabIndex = 20 - Me.ButtonOK.TabStop = False - Me.ButtonOK.Text = "OK" - Me.ButtonOK.UseVisualStyleBackColor = True - ' - 'ButtonCancel - ' - Me.ButtonCancel.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) - Me.ButtonCancel.DialogResult = DialogResult.Cancel - Me.ButtonCancel.Location = New Point(581, 399) - Me.ButtonCancel.Name = "ButtonCancel" - Me.ButtonCancel.Size = New Size(75, 23) - Me.ButtonCancel.TabIndex = 25 - Me.ButtonCancel.TabStop = False - Me.ButtonCancel.Text = "Cancel" - Me.ButtonCancel.UseVisualStyleBackColor = True - ' - 'TextBoxCurrent - ' - Me.TextBoxCurrent.Anchor = CType(((AnchorStyles.Top Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.TextBoxCurrent.Cursor = Cursors.Hand - Me.TextBoxCurrent.Location = New Point(5, 17) - Me.TextBoxCurrent.Name = "TextBoxCurrent" - Me.TextBoxCurrent.ReadOnly = True - Me.TextBoxCurrent.Size = New Size(651, 20) - Me.TextBoxCurrent.TabIndex = 0 - Me.TextBoxCurrent.TabStop = False - Me.ToolTip1.SetToolTip(Me.TextBoxCurrent, "Click for changing the directory") - ' - 'Label3 - ' - Me.Label3.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) - Me.Label3.AutoSize = True - Me.Label3.Location = New Point(5, 373) - Me.Label3.Name = "Label3" - Me.Label3.Size = New Size(38, 13) - Me.Label3.TabIndex = 29 - Me.Label3.Text = "Name:" - ' - 'Label4 - ' - Me.Label4.AutoSize = True - Me.Label4.Location = New Point(4, 3) - Me.Label4.Name = "Label4" - Me.Label4.Size = New Size(89, 13) - Me.Label4.TabIndex = 30 - Me.Label4.Text = "Current Directory:" - ' - 'FB_Dialog - ' - Me.AutoScaleDimensions = New SizeF(6.0!, 13.0!) - Me.AutoScaleMode = AutoScaleMode.Font - Me.CancelButton = Me.ButtonCancel - Me.ClientSize = New Size(663, 428) - Me.Controls.Add(Me.Label4) - Me.Controls.Add(Me.Label3) - Me.Controls.Add(Me.TextBoxCurrent) - Me.Controls.Add(Me.ButtonCancel) - Me.Controls.Add(Me.ButtonOK) - Me.Controls.Add(Me.TextBoxPath) - Me.Controls.Add(Me.SplitContainer1) - Me.MinimizeBox = False - Me.MinimumSize = New Size(341, 272) - Me.Name = "FileBrowserDialog" - Me.ShowIcon = False - Me.ShowInTaskbar = False - Me.StartPosition = FormStartPosition.CenterParent - Me.Text = "File Browser" - Me.SplitContainer1.Panel1.ResumeLayout(False) - Me.SplitContainer1.Panel1.PerformLayout() - Me.SplitContainer1.Panel2.ResumeLayout(False) - Me.SplitContainer1.Panel2.PerformLayout() - CType(Me.SplitContainer1, ISupportInitialize).EndInit() - Me.SplitContainer1.ResumeLayout(False) - Me.ContextMenuFile.ResumeLayout(False) - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - Friend WithEvents SplitContainer1 As SplitContainer - Friend WithEvents ComboBoxDrive As ComboBox - Friend WithEvents ListViewFolder As ListView - Friend WithEvents ListViewFiles As ListView - Friend WithEvents ColumnHeader1 As ColumnHeader - Friend WithEvents TextBoxSearchFolder As TextBox - Friend WithEvents TextBoxPath As TextBox - Friend WithEvents ButtonFolderBack As Button - Friend WithEvents ContextMenuHisFolder As ContextMenuStrip - Friend WithEvents ContextMenuHisFile As ContextMenuStrip - Friend WithEvents ButtonHisFolder As Button - Friend WithEvents ButtonHisFile As Button - Friend WithEvents ButtonOK As Button - Friend WithEvents ButtonCancel As Button - Friend WithEvents TextBoxCurrent As TextBox - Friend WithEvents ColumnHeader3 As ColumnHeader - Friend WithEvents ButtonDesktop As Button - Friend WithEvents ContextMenuFile As ContextMenuStrip - Friend WithEvents RenameFileToolStripMenuItem As ToolStripMenuItem - Friend WithEvents DeleteFileToolStripMenuItem As ToolStripMenuItem - Friend WithEvents ButtonNewDir As Button - Friend WithEvents ButtonAll As Button - Friend WithEvents Label1 As Label - Friend WithEvents Label3 As Label - Friend WithEvents Label4 As Label - Friend WithEvents ImageList1 As ImageList - Friend WithEvents ToolTip1 As ToolTip - Friend WithEvents Label5 As Label - Friend WithEvents Label2 As Label - Friend WithEvents ComboBoxExt As ComboBox - Friend WithEvents TextBoxSearchFile As TextBox - -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.ComponentModel +Imports Microsoft.VisualBasic.CompilerServices + +<DesignerGenerated()> _ +Partial Class FileBrowserDialog + Inherits Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.components = New Container() + Dim resources As ComponentResourceManager = New ComponentResourceManager(GetType(FileBrowserDialog)) + Me.SplitContainer1 = New SplitContainer() + Me.Label1 = New Label() + Me.ButtonNewDir = New Button() + Me.ButtonDesktop = New Button() + Me.ButtonHisFolder = New Button() + Me.ButtonFolderBack = New Button() + Me.TextBoxSearchFolder = New TextBox() + Me.ListViewFolder = New ListView() + Me.ColumnHeader3 = CType(New ColumnHeader(), ColumnHeader) + Me.ImageList1 = New ImageList(Me.components) + Me.ComboBoxDrive = New ComboBox() + Me.Label5 = New Label() + Me.Label2 = New Label() + Me.ButtonAll = New Button() + Me.ComboBoxExt = New ComboBox() + Me.ButtonHisFile = New Button() + Me.TextBoxSearchFile = New TextBox() + Me.ListViewFiles = New ListView() + Me.ColumnHeader1 = CType(New ColumnHeader(), ColumnHeader) + Me.ContextMenuFile = New ContextMenuStrip(Me.components) + Me.RenameFileToolStripMenuItem = New ToolStripMenuItem() + Me.DeleteFileToolStripMenuItem = New ToolStripMenuItem() + Me.TextBoxPath = New TextBox() + Me.ContextMenuHisFolder = New ContextMenuStrip(Me.components) + Me.ContextMenuHisFile = New ContextMenuStrip(Me.components) + Me.ButtonOK = New Button() + Me.ButtonCancel = New Button() + Me.TextBoxCurrent = New TextBox() + Me.Label3 = New Label() + Me.Label4 = New Label() + Me.ToolTip1 = New ToolTip(Me.components) + CType(Me.SplitContainer1, ISupportInitialize).BeginInit() + Me.SplitContainer1.Panel1.SuspendLayout() + Me.SplitContainer1.Panel2.SuspendLayout() + Me.SplitContainer1.SuspendLayout() + Me.ContextMenuFile.SuspendLayout() + Me.SuspendLayout() + ' + 'SplitContainer1 + ' + Me.SplitContainer1.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ + Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.SplitContainer1.BorderStyle = BorderStyle.Fixed3D + Me.SplitContainer1.Location = New Point(0, 46) + Me.SplitContainer1.Name = "SplitContainer1" + ' + 'SplitContainer1.Panel1 + ' + Me.SplitContainer1.Panel1.Controls.Add(Me.Label1) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) + Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ListViewFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxDrive) + ' + 'SplitContainer1.Panel2 + ' + Me.SplitContainer1.Panel2.Controls.Add(Me.Label5) + Me.SplitContainer1.Panel2.Controls.Add(Me.Label2) + Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonAll) + Me.SplitContainer1.Panel2.Controls.Add(Me.ComboBoxExt) + Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonHisFile) + Me.SplitContainer1.Panel2.Controls.Add(Me.TextBoxSearchFile) + Me.SplitContainer1.Panel2.Controls.Add(Me.ListViewFiles) + Me.SplitContainer1.Size = New Size(663, 308) + Me.SplitContainer1.SplitterDistance = 329 + Me.SplitContainer1.TabIndex = 5 + Me.SplitContainer1.TabStop = False + ' + 'Label1 + ' + Me.Label1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) + Me.Label1.AutoSize = True + Me.Label1.Location = New Point(3, 284) + Me.Label1.Name = "Label1" + Me.Label1.Size = New Size(32, 13) + Me.Label1.TabIndex = 28 + Me.Label1.Text = "Filter:" + ' + 'ButtonNewDir + ' + Me.ButtonNewDir.Image = My.Resources.Resources.new_dir + Me.ButtonNewDir.Location = New Point(119, 1) + Me.ButtonNewDir.Name = "ButtonNewDir" + Me.ButtonNewDir.Size = New Size(26, 25) + Me.ButtonNewDir.TabIndex = 21 + Me.ButtonNewDir.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonNewDir, "Create new Directory") + Me.ButtonNewDir.UseVisualStyleBackColor = True + ' + 'ButtonDesktop + ' + Me.ButtonDesktop.Image = My.Resources.Resources.desktop + Me.ButtonDesktop.Location = New Point(90, 1) + Me.ButtonDesktop.Name = "ButtonDesktop" + Me.ButtonDesktop.Size = New Size(26, 25) + Me.ButtonDesktop.TabIndex = 22 + Me.ButtonDesktop.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonDesktop, "Go to Desktop") + Me.ButtonDesktop.UseVisualStyleBackColor = True + ' + 'ButtonHisFolder + ' + Me.ButtonHisFolder.Anchor = CType((AnchorStyles.Top Or AnchorStyles.Right), AnchorStyles) + Me.ButtonHisFolder.Image = My.Resources.Resources.file_history + Me.ButtonHisFolder.Location = New Point(298, 1) + Me.ButtonHisFolder.Name = "ButtonHisFolder" + Me.ButtonHisFolder.Size = New Size(26, 25) + Me.ButtonHisFolder.TabIndex = 24 + Me.ButtonHisFolder.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonHisFolder, "History / Favorites") + Me.ButtonHisFolder.UseVisualStyleBackColor = True + ' + 'ButtonFolderBack + ' + Me.ButtonFolderBack.Image = CType(resources.GetObject("ButtonFolderBack.Image"), Image) + Me.ButtonFolderBack.Location = New Point(61, 1) + Me.ButtonFolderBack.Name = "ButtonFolderBack" + Me.ButtonFolderBack.Size = New Size(26, 25) + Me.ButtonFolderBack.TabIndex = 20 + Me.ButtonFolderBack.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonFolderBack, "Move up one directory") + Me.ButtonFolderBack.UseVisualStyleBackColor = True + ' + 'TextBoxSearchFolder + ' + Me.TextBoxSearchFolder.Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.TextBoxSearchFolder.Location = New Point(37, 281) + Me.TextBoxSearchFolder.Name = "TextBoxSearchFolder" + Me.TextBoxSearchFolder.Size = New Size(288, 20) + Me.TextBoxSearchFolder.TabIndex = 15 + Me.ToolTip1.SetToolTip(Me.TextBoxSearchFolder, "Filter the directories") + ' + 'ListViewFolder + ' + Me.ListViewFolder.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ + Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.ListViewFolder.Columns.AddRange(New ColumnHeader() {Me.ColumnHeader3}) + Me.ListViewFolder.FullRowSelect = True + Me.ListViewFolder.GridLines = True + Me.ListViewFolder.HideSelection = False + Me.ListViewFolder.Location = New Point(-2, 27) + Me.ListViewFolder.MultiSelect = False + Me.ListViewFolder.Name = "ListViewFolder" + Me.ListViewFolder.Size = New Size(327, 253) + Me.ListViewFolder.SmallImageList = Me.ImageList1 + Me.ListViewFolder.TabIndex = 10 + Me.ListViewFolder.UseCompatibleStateImageBehavior = False + Me.ListViewFolder.View = View.Details + ' + 'ColumnHeader3 + ' + Me.ColumnHeader3.Text = "Sub-Directories:" + Me.ColumnHeader3.Width = 368 + ' + 'ImageList1 + ' + Me.ImageList1.ColorDepth = ColorDepth.Depth32Bit + Me.ImageList1.ImageSize = New Size(16, 16) + Me.ImageList1.TransparentColor = Color.Transparent + ' + 'ComboBoxDrive + ' + Me.ComboBoxDrive.DropDownStyle = ComboBoxStyle.DropDownList + Me.ComboBoxDrive.FormattingEnabled = True + Me.ComboBoxDrive.Location = New Point(3, 3) + Me.ComboBoxDrive.Name = "ComboBoxDrive" + Me.ComboBoxDrive.Size = New Size(54, 21) + Me.ComboBoxDrive.TabIndex = 5 + ' + 'Label5 + ' + Me.Label5.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.Label5.AutoSize = True + Me.Label5.Location = New Point(256, 284) + Me.Label5.Name = "Label5" + Me.Label5.Size = New Size(10, 13) + Me.Label5.TabIndex = 30 + Me.Label5.Text = "." + ' + 'Label2 + ' + Me.Label2.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) + Me.Label2.AutoSize = True + Me.Label2.Location = New Point(3, 284) + Me.Label2.Name = "Label2" + Me.Label2.Size = New Size(32, 13) + Me.Label2.TabIndex = 29 + Me.Label2.Text = "Filter:" + ' + 'ButtonAll + ' + Me.ButtonAll.Location = New Point(2, 2) + Me.ButtonAll.Name = "ButtonAll" + Me.ButtonAll.Size = New Size(71, 23) + Me.ButtonAll.TabIndex = 19 + Me.ButtonAll.Text = "Select All" + Me.ToolTip1.SetToolTip(Me.ButtonAll, "Select all shown files") + Me.ButtonAll.UseVisualStyleBackColor = True + ' + 'ComboBoxExt + ' + Me.ComboBoxExt.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.ComboBoxExt.FormattingEnabled = True + Me.ComboBoxExt.Location = New Point(268, 281) + Me.ComboBoxExt.Name = "ComboBoxExt" + Me.ComboBoxExt.Size = New Size(57, 21) + Me.ComboBoxExt.TabIndex = 20 + Me.ToolTip1.SetToolTip(Me.ComboBoxExt, "Filter the file type") + ' + 'ButtonHisFile + ' + Me.ButtonHisFile.Anchor = CType((AnchorStyles.Top Or AnchorStyles.Right), AnchorStyles) + Me.ButtonHisFile.Image = My.Resources.Resources.file_history + Me.ButtonHisFile.Location = New Point(299, 1) + Me.ButtonHisFile.Name = "ButtonHisFile" + Me.ButtonHisFile.Size = New Size(26, 25) + Me.ButtonHisFile.TabIndex = 24 + Me.ButtonHisFile.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonHisFile, "History") + Me.ButtonHisFile.UseVisualStyleBackColor = True + ' + 'TextBoxSearchFile + ' + Me.TextBoxSearchFile.Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.TextBoxSearchFile.Location = New Point(36, 281) + Me.TextBoxSearchFile.Name = "TextBoxSearchFile" + Me.TextBoxSearchFile.Size = New Size(218, 20) + Me.TextBoxSearchFile.TabIndex = 15 + Me.ToolTip1.SetToolTip(Me.TextBoxSearchFile, "Filter the files") + ' + 'ListViewFiles + ' + Me.ListViewFiles.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ + Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.ListViewFiles.Columns.AddRange(New ColumnHeader() {Me.ColumnHeader1}) + Me.ListViewFiles.ContextMenuStrip = Me.ContextMenuFile + Me.ListViewFiles.FullRowSelect = True + Me.ListViewFiles.GridLines = True + Me.ListViewFiles.HideSelection = False + Me.ListViewFiles.Location = New Point(0, 27) + Me.ListViewFiles.Name = "ListViewFiles" + Me.ListViewFiles.Size = New Size(328, 253) + Me.ListViewFiles.SmallImageList = Me.ImageList1 + Me.ListViewFiles.TabIndex = 10 + Me.ListViewFiles.UseCompatibleStateImageBehavior = False + Me.ListViewFiles.View = View.Details + ' + 'ColumnHeader1 + ' + Me.ColumnHeader1.Text = "Files:" + Me.ColumnHeader1.Width = 367 + ' + 'ContextMenuFile + ' + Me.ContextMenuFile.Items.AddRange(New ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) + Me.ContextMenuFile.Name = "ContextMenuFile" + Me.ContextMenuFile.Size = New Size(148, 48) + ' + 'RenameFileToolStripMenuItem + ' + Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" + Me.RenameFileToolStripMenuItem.Size = New Size(147, 22) + Me.RenameFileToolStripMenuItem.Text = "Rename File..." + ' + 'DeleteFileToolStripMenuItem + ' + Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" + Me.DeleteFileToolStripMenuItem.Size = New Size(147, 22) + Me.DeleteFileToolStripMenuItem.Text = "Delete File..." + ' + 'TextBoxPath + ' + Me.TextBoxPath.Anchor = CType(((AnchorStyles.Bottom Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.TextBoxPath.Location = New Point(47, 370) + Me.TextBoxPath.Name = "TextBoxPath" + Me.TextBoxPath.Size = New Size(609, 20) + Me.TextBoxPath.TabIndex = 15 + ' + 'ContextMenuHisFolder + ' + Me.ContextMenuHisFolder.Name = "ContextMenuFolderHis" + Me.ContextMenuHisFolder.Size = New Size(61, 4) + ' + 'ContextMenuHisFile + ' + Me.ContextMenuHisFile.Name = "ContextMenuFileHis" + Me.ContextMenuHisFile.Size = New Size(61, 4) + ' + 'ButtonOK + ' + Me.ButtonOK.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.ButtonOK.DialogResult = DialogResult.OK + Me.ButtonOK.Location = New Point(503, 399) + Me.ButtonOK.Name = "ButtonOK" + Me.ButtonOK.Size = New Size(75, 23) + Me.ButtonOK.TabIndex = 20 + Me.ButtonOK.TabStop = False + Me.ButtonOK.Text = "OK" + Me.ButtonOK.UseVisualStyleBackColor = True + ' + 'ButtonCancel + ' + Me.ButtonCancel.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.ButtonCancel.DialogResult = DialogResult.Cancel + Me.ButtonCancel.Location = New Point(581, 399) + Me.ButtonCancel.Name = "ButtonCancel" + Me.ButtonCancel.Size = New Size(75, 23) + Me.ButtonCancel.TabIndex = 25 + Me.ButtonCancel.TabStop = False + Me.ButtonCancel.Text = "Cancel" + Me.ButtonCancel.UseVisualStyleBackColor = True + ' + 'TextBoxCurrent + ' + Me.TextBoxCurrent.Anchor = CType(((AnchorStyles.Top Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.TextBoxCurrent.Cursor = Cursors.Hand + Me.TextBoxCurrent.Location = New Point(5, 17) + Me.TextBoxCurrent.Name = "TextBoxCurrent" + Me.TextBoxCurrent.ReadOnly = True + Me.TextBoxCurrent.Size = New Size(651, 20) + Me.TextBoxCurrent.TabIndex = 0 + Me.TextBoxCurrent.TabStop = False + Me.ToolTip1.SetToolTip(Me.TextBoxCurrent, "Click for changing the directory") + ' + 'Label3 + ' + Me.Label3.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Left), AnchorStyles) + Me.Label3.AutoSize = True + Me.Label3.Location = New Point(5, 373) + Me.Label3.Name = "Label3" + Me.Label3.Size = New Size(38, 13) + Me.Label3.TabIndex = 29 + Me.Label3.Text = "Name:" + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New Point(4, 3) + Me.Label4.Name = "Label4" + Me.Label4.Size = New Size(89, 13) + Me.Label4.TabIndex = 30 + Me.Label4.Text = "Current Directory:" + ' + 'FB_Dialog + ' + Me.AutoScaleDimensions = New SizeF(6.0!, 13.0!) + Me.AutoScaleMode = AutoScaleMode.Font + Me.CancelButton = Me.ButtonCancel + Me.ClientSize = New Size(663, 428) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.TextBoxCurrent) + Me.Controls.Add(Me.ButtonCancel) + Me.Controls.Add(Me.ButtonOK) + Me.Controls.Add(Me.TextBoxPath) + Me.Controls.Add(Me.SplitContainer1) + Me.MinimizeBox = False + Me.MinimumSize = New Size(341, 272) + Me.Name = "FileBrowserDialog" + Me.ShowIcon = False + Me.ShowInTaskbar = False + Me.StartPosition = FormStartPosition.CenterParent + Me.Text = "File Browser" + Me.SplitContainer1.Panel1.ResumeLayout(False) + Me.SplitContainer1.Panel1.PerformLayout() + Me.SplitContainer1.Panel2.ResumeLayout(False) + Me.SplitContainer1.Panel2.PerformLayout() + CType(Me.SplitContainer1, ISupportInitialize).EndInit() + Me.SplitContainer1.ResumeLayout(False) + Me.ContextMenuFile.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents SplitContainer1 As SplitContainer + Friend WithEvents ComboBoxDrive As ComboBox + Friend WithEvents ListViewFolder As ListView + Friend WithEvents ListViewFiles As ListView + Friend WithEvents ColumnHeader1 As ColumnHeader + Friend WithEvents TextBoxSearchFolder As TextBox + Friend WithEvents TextBoxPath As TextBox + Friend WithEvents ButtonFolderBack As Button + Friend WithEvents ContextMenuHisFolder As ContextMenuStrip + Friend WithEvents ContextMenuHisFile As ContextMenuStrip + Friend WithEvents ButtonHisFolder As Button + Friend WithEvents ButtonHisFile As Button + Friend WithEvents ButtonOK As Button + Friend WithEvents ButtonCancel As Button + Friend WithEvents TextBoxCurrent As TextBox + Friend WithEvents ColumnHeader3 As ColumnHeader + Friend WithEvents ButtonDesktop As Button + Friend WithEvents ContextMenuFile As ContextMenuStrip + Friend WithEvents RenameFileToolStripMenuItem As ToolStripMenuItem + Friend WithEvents DeleteFileToolStripMenuItem As ToolStripMenuItem + Friend WithEvents ButtonNewDir As Button + Friend WithEvents ButtonAll As Button + Friend WithEvents Label1 As Label + Friend WithEvents Label3 As Label + Friend WithEvents Label4 As Label + Friend WithEvents ImageList1 As ImageList + Friend WithEvents ToolTip1 As ToolTip + Friend WithEvents Label5 As Label + Friend WithEvents Label2 As Label + Friend WithEvents ComboBoxExt As ComboBox + Friend WithEvents TextBoxSearchFile As TextBox + +End Class diff --git a/VECTO/File Browser/FileBrowserDialog.vb b/VECTO/File Browser/FileBrowserDialog.vb index d5a31cbd3a6840c5b7c1a122381daa5d564faf07..175ad7f8f44913bd2709a46926f9bf1adb8b156e 100644 --- a/VECTO/File Browser/FileBrowserDialog.vb +++ b/VECTO/File Browser/FileBrowserDialog.vb @@ -1,952 +1,952 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Option Infer On - -Imports System.IO -Imports System.Text -Imports Microsoft.VisualBasic.FileIO -Imports System.Runtime.InteropServices - - -''' <summary> -''' File Browser dialog. Entirely controlled by cFilebrowser class. -''' </summary> -Public Class FileBrowserDialog - Private _myFolder As String - Private _myFiles() As String - Private _myDrive As String - Private _updateLock As Boolean - Private _initialized As Boolean - Private _myId As String - Private _myExt() As String - Private _lastFile As String - Private _bFileMustExist As Boolean - Private _bOverwriteCheck As Boolean - Private _bMultiFiles As Boolean - Private _noExt As Boolean - Private _bBrowseFolder As Boolean - Private _bForceExt As Boolean - Private _extListSingle As ArrayList - Private _extListMulti As ArrayList - Private _lastExt As String - Private ReadOnly _bLightMode As Boolean - - Private Const FavText As String = "Edit Favorites..." - Private Const EmptyText As String = " " - Private Const NoFavString As String = "<undefined>" - - 'New - Public Sub New(lightMode As Boolean) - ' This call is required by the Windows Form Designer. - InitializeComponent() - ' Append any initialization after the InitializeComponent() call. - _myId = "Default" - _updateLock = False - _initialized = False - _myFolder = "." - _myDrive = "" - _lastFile = "" - _bOverwriteCheck = False - _bFileMustExist = False - _bMultiFiles = False - _noExt = True - _bBrowseFolder = False - _bLightMode = lightMode - ButtonHisFile.Enabled = Not _bLightMode - End Sub - - 'Resize - Private Sub FB_Dialog_Resize(sender As Object, e As EventArgs) Handles Me.ResizeEnd - Resized() - End Sub - - 'Shown - Private Sub FileBrowser_Shown(sender As Object, e As EventArgs) Handles Me.Shown - Resized() - TextBoxPath.Focus() - TextBoxPath.SelectAll() - End Sub - - 'Resized ListView Format - Private Sub Resized() - 'To autosize to the width of the column heading, set the Width property to -2 - ListViewFolder.Columns(0).Width = -2 - 'ListViewFolder.Columns(0).Width -= 1 - ListViewFiles.Columns(0).Width = -2 - 'ListViewFiles.Columns(0).Width -= 1 - End Sub - - 'SplitterMoved - Private Sub SplitContainer1_SplitterMoved(sender As Object, e As SplitterEventArgs) _ - Handles SplitContainer1.SplitterMoved - If _initialized Then Resized() - End Sub - - 'Closing (Overwrite-Check etc) - Private Sub FileBrowser_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - Dim x As Int32 - Dim path As String - Dim ext As String - Dim hasExt As Boolean - If DialogResult = DialogResult.OK Then - If _bBrowseFolder Then - path = Trim(TextBoxPath.Text) - 'If empty path: use the Current-folder(MyFolder) - If path = "" Then - path = _myFolder - Else - If Mid(path, 2, 1) <> ":" Then path = _myFolder & path - End If - If Not Directory.Exists(path) Then - MsgBox("Directory " & path & " does not exist!", MsgBoxStyle.Critical) - e.Cancel = True - Exit Sub - End If - If Microsoft.VisualBasic.Right(path, 1) <> "\" Then path &= "\" - ReDim _myFiles(0) - _myFiles(0) = path - Else - 'Stop if empty path - If Trim(TextBoxPath.Text) = "" Then - e.Cancel = True - Exit Sub - End If - _lastExt = Trim(ComboBoxExt.Text) - 'Assume Files in array - If Microsoft.VisualBasic.Left(TextBoxPath.Text, 1) = "<" And ListViewFiles.SelectedItems.Count > 0 Then - 'Multiple files selected - ReDim _myFiles(ListViewFiles.SelectedItems.Count - 1) - x = -1 - For Each lv0 As ListViewItem In ListViewFiles.Items - If lv0.Selected Then - x += 1 - _myFiles(x) = _myFolder & lv0.SubItems(0).Text - End If - Next - _bMultiFiles = True - Else - 'Single File - path = Trim(TextBoxPath.Text) - 'Primary extension (eg for bForceExt) - ext = Trim(ComboBoxExt.Text.Split(","c)(0)) - 'If file without path then append path - If Mid(path, 2, 1) <> ":" Then path = _myFolder & path - 'If instead of File a Folder is entered: Switch to Folder and Abort - If Directory.Exists(path) Then - SetFolder(path) - e.Cancel = True - Exit Sub - End If - 'Force Extension - If _bForceExt Then - If UCase(IO.Path.GetExtension(path)) <> "." & UCase(ext) Then path &= "." & ext - hasExt = True - Else - 'Check whether specified a File with Ext - hasExt = (Microsoft.VisualBasic.Len(IO.Path.GetExtension(path)) > 1) - End If - 'If File without Extension (after bForceExt question) and it does not exist, then add primary Extension - If Not hasExt Then - If ext <> "*" And ext <> "" Then - If Not File.Exists(path) Then path &= "." & ext - End If - End If - 'Check that File exists - If File.Exists(path) Then - 'Yes: when bOverwriteCheck, check for Overwrite - If _bOverwriteCheck Then - If MsgBox("Overwrite " & path & " ?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then - e.Cancel = True - Exit Sub - End If - End If - Else - 'No: abort if bFileMustExist - If _bFileMustExist Then - MsgBox("The file " & path & " does not exist!", MsgBoxStyle.Critical) - e.Cancel = True - Exit Sub - End If - End If - 'Define MyFiles - ReDim _myFiles(0) - _myFiles(0) = path - _bMultiFiles = False - End If - End If - End If - End Sub - - 'Browse - Custom Dialog - Public Function Browse(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, - extMode As FileBrowserFileExtensionMode, - multiFile As Boolean, ext As String, caption As String) As Boolean - If Not _initialized Then Init() - - 'Load Folder History ContextMenu - For x = 0 To 9 - ContextMenuHisFolder.Items(x).Text = FileBrowserFolderHistory(x) - Next - For x = 10 To 19 - ContextMenuHisFolder.Items(x + 1).Text = FileBrowserFolderHistory(x) - Next - - 'Options - _bOverwriteCheck = overwriteCheck - _bFileMustExist = fileMustExist - _bForceExt = (extMode = FileBrowserFileExtensionMode.ForceExt) - - 'Form Config - ListViewFiles.MultiSelect = multiFile - ButtonAll.Visible = multiFile - _title = caption - Text = caption - - 'Ext-Combobox - ComboBoxExt.Items.Clear() - If _noExt Then - ComboBoxExt.Items.Add("*") - ComboBoxExt.SelectedIndex = 0 - Else - Select Case extMode - Case FileBrowserFileExtensionMode.ForceExt - If ext = "" Then ext = _extListSingle(0).ToString - ComboBoxExt.Items.AddRange(_extListSingle.ToArray) - ComboBoxExt.Text = ext - ComboBoxExt.Enabled = False - Case FileBrowserFileExtensionMode.MultiExt, FileBrowserFileExtensionMode.SingleExt - If extMode = FileBrowserFileExtensionMode.MultiExt Then - ComboBoxExt.Items.AddRange(_extListMulti.ToArray) - Else - ComboBoxExt.Items.AddRange(_extListSingle.ToArray) - End If - If ext <> "" Then - ComboBoxExt.Text = ext - Else - ComboBoxExt.Text = _lastExt - End If - ComboBoxExt.Enabled = True - End Select - End If - - - 'Define Path - ' If no path is specified: Last folder, no file name - If path = "" Then path = FileBrowserFolderHistory(0) - - ' If path-length too small (Path is invalid): Last File - If path.Length < 2 Then path = _lastFile - - 'Open Folder - If no folder in the path: Last folder - If fPATH(path) = "" Then - 'If given a file without path - If Trim(FileBrowserFolderHistory(0)) = "" Then - SetFolder("C:\") - Else - SetFolder(FileBrowserFolderHistory(0)) - End If - Else - '...Otherwise: - SetFolder(fPATH(path)) - End If - If _bBrowseFolder Then - FolderUp() - TextBoxPath.Text = path - Else - TextBoxPath.Text = IO.Path.GetFileName(path) - End If - - 'Show form ------------------------------------------------ ---- - ShowDialog() - If DialogResult = DialogResult.OK Then - 'File / Folder History - If _bMultiFiles Then - _lastFile = _myFolder - UpdateHisFolder(_myFolder) - Else - _lastFile = _myFiles(0) - UpdateHisFolder(fPATH(_lastFile)) - If Not _bBrowseFolder Then UpdateHisFile(_lastFile) - End If - 'Update Global History Folder - For x = 0 To 9 - FileBrowserFolderHistory(x) = ContextMenuHisFolder.Items(x).Text - Next - For x = 10 To 19 - FileBrowserFolderHistory(x) = ContextMenuHisFolder.Items(x + 1).Text - Next - Return True - Else - Return False - End If - End Function - - Private _title As String - - 'Close and save File / Folder History - Public Sub SaveAndClose() - 'Folder History - If FileBrowserFolderHistoryIninialized Then - Try - Dim f = My.Computer.FileSystem.OpenTextFileWriter(FileHistoryPath & "Directories.txt", False, Encoding.UTF8) - For x = 0 To 19 - f.WriteLine(FileBrowserFolderHistory(x)) - Next - f.Close() - f.Dispose() - Catch ex As Exception - End Try - FileBrowserFolderHistoryIninialized = False - End If - 'File History - If _initialized And Not _bLightMode Then - If Not _bBrowseFolder Then - Try - Dim f = My.Computer.FileSystem.OpenTextFileWriter(FileHistoryPath & _myId & ".txt", False, Encoding.UTF8) - For x = 0 To 9 - f.WriteLine(ContextMenuHisFile.Items(x).Text) - Next - f.Close() - f.Dispose() - Catch ex As Exception - End Try - End If - _initialized = False - End If - - 'Close - Close() - End Sub - - 'Switching to FolderBrowser - Public Sub SetFolderBrowser() - If _initialized Then Exit Sub - - _bBrowseFolder = True - Width = 500 - ListViewFiles.Enabled = False - ButtonHisFile.Enabled = False - TextBoxSearchFile.Enabled = False - SplitContainer1.Panel2Collapsed = True - Text = "Directory Browser" - End Sub - - 'Initialize - Private Sub Init() - _updateLock = True - - 'Initialization for Global File Browser - If Not FileBrowserFolderHistoryIninialized Then GlobalInit() - - 'Load Drive ComboBox - For x = 0 To UBound(Drives) - ComboBoxDrive.Items.Add(Drives(x)) - Next - - 'FolderHistory ContextMenu - ContextMenuHisFolder.Items.Clear() - For x = 0 To 9 - ContextMenuHisFolder.Items.Add("") - Next - ContextMenuHisFolder.Items.Add("-") - For x = 10 To 19 - ContextMenuHisFolder.Items.Add("") - Next - ContextMenuHisFolder.Items.Add("-") - ContextMenuHisFolder.Items.Add(FavText) - - 'FileHistory ContextMenu - If _bBrowseFolder Then - _lastFile = FileBrowserFolderHistory(0) - ElseIf Not _bLightMode Then - For x = 0 To 9 - ContextMenuHisFile.Items.Add("") - Next - If File.Exists(FileHistoryPath & _myId & ".txt") Then - Dim f = New StreamReader(FileHistoryPath & _myId & ".txt") - Dim x = -1 - Do While Not f.EndOfStream And x < 9 - x += 1 - Dim line = f.ReadLine - ContextMenuHisFile.Items(x).Text = line - If x = 0 Then _lastFile = line - Loop - f.Close() - f.Dispose() - End If - End If - - 'Extension-ComboBox - If Not _noExt Then - _extListSingle = New ArrayList - _extListMulti = New ArrayList - For x = 0 To UBound(_myExt) - _extListMulti.Add(_myExt(x)) - For Each line In _myExt(x).Split(","c) - _extListSingle.Add(Trim(line)) - Next - Next - _extListMulti.Add("*") - _extListSingle.Add("*") - End If - - _initialized = True - _updateLock = False - End Sub - - Private Sub GlobalInit() - - 'Create Drive List - ReDim Drives(UBound(Directory.GetLogicalDrives())) - Dim x = -1 - For Each drive In Directory.GetLogicalDrives() - x += 1 - Drives(x) = Microsoft.VisualBasic.Left(drive, 2) - Next - - 'Read Folder History - For x = 0 To 19 - FileBrowserFolderHistory(x) = EmptyText - Next - If File.Exists(FileHistoryPath & "Directories.txt") Then - Dim f = New StreamReader(FileHistoryPath & "Directories.txt") - x = -1 - Do While Not f.EndOfStream And x < 19 - x += 1 - FileBrowserFolderHistory(x) = f.ReadLine() - Loop - f.Dispose() - f.Close() - End If - - FileBrowserFolderHistoryIninialized = True - End Sub - - 'ComboBoxDrive_SelectedIndexChanged - Private Sub ComboBoxDrive_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles ComboBoxDrive.SelectedIndexChanged - If Not _updateLock Then SetFolder(ComboBoxDrive.SelectedItem.ToString) - End Sub - - - 'ButtonFolderBack_Click - Private Sub ButtonFolderBack_Click(sender As Object, e As EventArgs) Handles ButtonFolderBack.Click - FolderUp() - End Sub - - 'TextBoxPath_KeyDown (ENTER) - Private Sub TextBoxPath_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxPath.KeyDown - If e.KeyCode = Keys.Enter Then - Dim path = TextBoxPath.Text - If Directory.Exists(path) Then - If _bBrowseFolder Then - DialogResult = DialogResult.OK - Close() - Else - SetFolder(path) - End If - Else - DialogResult = DialogResult.OK - Close() - End If - End If - End Sub - - 'ListViewFolder_SelectedIndexChanged - Private Sub ListViewFolder_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles ListViewFolder.SelectedIndexChanged - If _bBrowseFolder Then - _updateLock = True - If ListViewFolder.SelectedItems.Count > 0 Then - TextBoxPath.Text = ListViewFolder.SelectedItems.Item(0).Text & "\" - End If - _updateLock = False - End If - End Sub - - 'ListViewFolder_MouseDoubleClick - Private Sub ListViewFolder_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ - Handles ListViewFolder.MouseDoubleClick - If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub - SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) - End Sub - - 'ListViewFolder_KeyDown - Private Sub ListViewFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFolder.KeyDown - If e.KeyCode = Keys.Enter Then - If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub - SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) - End If - End Sub - - 'ListViewFiles_SelectedIndexChanged - Private Sub ListViewFiles_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles ListViewFiles.SelectedIndexChanged - _updateLock = True - If ListViewFiles.SelectedItems.Count = 0 Then - TextBoxPath.Text = "" - Else - If ListViewFiles.SelectedItems.Count > 1 Then - TextBoxPath.Text = String.Format("<{0} Files selected>", ListViewFiles.SelectedItems.Count) - Else - TextBoxPath.Text = ListViewFiles.SelectedItems.Item(0).Text - TextBoxPath.SelectionStart = TextBoxPath.Text.Length - End If - End If - _updateLock = False - End Sub - - 'ListViewFiles_MouseDoubleClick - Private Sub ListViewFiles_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ - Handles ListViewFiles.MouseDoubleClick - If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub - - DialogResult = DialogResult.OK - Close() - End Sub - - 'ListViewFiles_KeyDown - Private Sub ListViewFiles_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFiles.KeyDown - If e.KeyCode = Keys.Enter Then - If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub - DialogResult = DialogResult.OK - Close() - End If - End Sub - - 'TextBoxSearchFolder_KeyDown - Private Sub TextBoxSearchFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFolder.KeyDown - Dim itemCount = ListViewFolder.Items.Count - Dim noItem = (itemCount = 0) - - Dim selIndex As Integer - If Not noItem Then - If ListViewFolder.SelectedItems.Count = 0 Then - selIndex = -1 - Else - selIndex = ListViewFolder.SelectedIndices(0) - End If - End If - Select Case e.KeyCode - Case Keys.Enter - If noItem Then Exit Sub - If ListViewFolder.SelectedItems.Count = 0 Then ListViewFolder.SelectedIndices.Add(0) - SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) - Case Keys.Up - If Not noItem Then - If selIndex < 1 Then - selIndex = 1 - Else - ListViewFolder.Items(selIndex).Selected = False - End If - ListViewFolder.Items(selIndex - 1).Selected = True - ListViewFolder.Items(selIndex - 1).EnsureVisible() - End If - Case Keys.Down - If Not noItem And selIndex < itemCount - 1 Then - If Not selIndex = -1 Then ListViewFolder.Items(selIndex).Selected = False - ListViewFolder.Items(selIndex + 1).Selected = True - ListViewFolder.Items(selIndex + 1).EnsureVisible() - End If - Case Keys.Back - If TextBoxSearchFolder.Text = "" Then FolderUp() - End Select - End Sub - - 'TextBoxSearchFolder_TextChanged - Private Sub TextBoxSearchFolder_TextChanged(sender As Object, e As EventArgs) Handles TextBoxSearchFolder.TextChanged - If Not _updateLock Then LoadListFolder() - End Sub - - 'TextBoxSearchFile_KeyDown - Private Sub TextBoxSearchFile_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFile.KeyDown - Dim selIndex As Integer - - Dim itemCount = ListViewFiles.Items.Count - Dim noItem = (itemCount = 0) - If Not noItem Then - If ListViewFiles.SelectedItems.Count = 0 Then - selIndex = -1 - Else - selIndex = ListViewFiles.SelectedIndices(0) - End If - End If - Select Case e.KeyCode - Case Keys.Enter - If noItem Then Exit Sub - If ListViewFiles.SelectedItems.Count = 0 Then ListViewFiles.SelectedIndices.Add(0) - DialogResult = DialogResult.OK - Close() - Case Keys.Up - If Not noItem Then - If selIndex < 1 Then - selIndex = 1 - Else - ListViewFiles.Items(selIndex).Selected = False - End If - ListViewFiles.Items(selIndex - 1).Selected = True - ListViewFiles.Items(selIndex - 1).EnsureVisible() - End If - Case Keys.Down - If Not noItem And selIndex < itemCount - 1 Then - If Not selIndex = -1 Then ListViewFiles.Items(selIndex).Selected = False - ListViewFiles.Items(selIndex + 1).Selected = True - ListViewFiles.Items(selIndex + 1).EnsureVisible() - End If - End Select - End Sub - - Private Sub TextBoxSearchFile_TextChanged(sender As Object, e As EventArgs) _ - Handles TextBoxSearchFile.TextChanged, ComboBoxExt.TextChanged - If Not _updateLock Then LoadListFiles() - End Sub - - Private Sub ButtonHisFolder_Click(sender As Object, e As EventArgs) Handles ButtonHisFolder.Click - ContextMenuHisFolder.Show(MousePosition) - End Sub - - - Private Sub ButtonHisFile_Click(sender As Object, e As EventArgs) Handles ButtonHisFile.Click - ContextMenuHisFile.Show(MousePosition) - End Sub - - Private Sub ButtonAll_Click(sender As Object, e As EventArgs) Handles ButtonAll.Click - ListViewFiles.BeginUpdate() - For i = 0 To ListViewFiles.Items.Count - 1 - ListViewFiles.Items(i).Selected = True - Next - ListViewFiles.EndUpdate() - End Sub - - Private Sub ContextMenuHisFile_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ - Handles ContextMenuHisFile.ItemClicked - Dim path = e.ClickedItem.Text.ToString - If path = EmptyText Then Exit Sub - SetFolder(fPATH(path)) - TextBoxPath.Text = IO.Path.GetFileName(path) - End Sub - - Private Sub ContextMenuHisFolder_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ - Handles ContextMenuHisFolder.ItemClicked - - Dim path = e.ClickedItem.Text.ToString - - If path = EmptyText Then Exit Sub - - If path = FavText Then - Dim favdlog = New FileBrowserFavoritesDialog - If favdlog.ShowDialog(Me) = DialogResult.OK Then - For x As Integer = 10 To 19 - path = favdlog.ListBox1.Items(x - 10).ToString() - If path = NoFavString Then - FileBrowserFolderHistory(x) = EmptyText - Else - FileBrowserFolderHistory(x) = path - End If - ContextMenuHisFolder.Items(x + 1).Text = FileBrowserFolderHistory(x) - Next - End If - Else - SetFolder(path) - End If - End Sub - - Private Sub TextBoxCurrent_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBoxCurrent.MouseClick - Dim newpath = "" - Dim x = TextBoxCurrent.SelectionStart - Dim path = TextBoxCurrent.Text - Dim x1 = path.Length - If x = x1 Then Exit Sub - If x < 4 Then - SetFolder(Microsoft.VisualBasic.Left(path, 2)) - Exit Sub - End If - Do While x1 > x - newpath = path - 'path = Microsoft.VisualBasic.Left(path, x1 - 1) - path = Microsoft.VisualBasic.Left(path, path.LastIndexOf("\", StringComparison.Ordinal)) - x1 = path.Length - Loop - SetFolder(newpath) - End Sub - - Private Sub ButtonDesktop_Click(sender As Object, e As EventArgs) Handles ButtonDesktop.Click - SetFolder(SpecialDirectories.Desktop.ToString) - End Sub - - Private Sub UpdateHisFile(path As String) - If _bLightMode Then Exit Sub - - Dim x As Integer - For x = 0 To 8 - If UCase(ContextMenuHisFile.Items(x).Text.ToString) = UCase(path) Then Exit For - Next - For y = x To 1 Step -1 - ContextMenuHisFile.Items(y).Text = ContextMenuHisFile.Items(y - 1).Text - Next - ContextMenuHisFile.Items(0).Text = path - End Sub - - Private Sub UpdateHisFolder(path As String) - Dim x As Integer - For x = 0 To 8 - If UCase(ContextMenuHisFolder.Items(x).Text.ToString) = UCase(path) Then Exit For - Next - For y = x To 1 Step -1 - ContextMenuHisFolder.Items(y).Text = ContextMenuHisFolder.Items(y - 1).Text - Next - ContextMenuHisFolder.Items(0).Text = path - End Sub - - Public Sub UpdateHistory(path As String) - If Not _initialized Then Init() - UpdateHisFile(path) - path = fPATH(path) - Dim x As Integer - For x = 0 To 8 - If UCase(FileBrowserFolderHistory(x)) = UCase(path) Then Exit For - Next - For y = x To 1 Step -1 - FileBrowserFolderHistory(y) = FileBrowserFolderHistory(y - 1) - Next - FileBrowserFolderHistory(0) = path - End Sub - - 'Change folder - Private Sub SetFolder(path As String) - - 'Abort if no drive specified - If Mid(path, 2, 1) <> ":" Then Exit Sub - - _updateLock = True - - 'Delete Search-fields - TextBoxSearchFile.Text = "" - TextBoxSearchFolder.Text = "" - - 'Set Drive - If _myDrive <> Microsoft.VisualBasic.Left(path, 2) Then - _myDrive = UCase(Microsoft.VisualBasic.Left(path, 2)) - ComboBoxDrive.SelectedItem = _myDrive - End If - - 'Set Folder - _myFolder = path - If Microsoft.VisualBasic.Right(_myFolder, 1) <> "\" Then _myFolder &= "\" - - Text = _title & " " & _myFolder - - LoadListFolder() - LoadListFiles() - - If _bBrowseFolder Then TextBoxPath.Text = "" - - TextBoxCurrent.Text = _myFolder - - 'TextBoxPath.SelectionStart = TextBoxPath.Text.Length - _updateLock = False - End Sub - - 'Folder one level up - Private Sub FolderUp() - If _myFolder <> "" Then - Dim path = Microsoft.VisualBasic.Left(_myFolder, _myFolder.Length - 1) - Dim x = path.LastIndexOf("\", StringComparison.Ordinal) - If x > 0 Then SetFolder(Microsoft.VisualBasic.Left(path, x)) - End If - End Sub - - - Private Structure SHFILEINFO - Public hIcon As IntPtr ' : icon - Public iIcon As Integer ' : icondex - Public dwAttributes As Integer ' : SFGAO_ flags - <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDisplayName As String - <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public szTypeName As String - End Structure - - Private Const SHGFI_ICON = &H100 - Private Const SHGFI_SMALLICON = &H1 - Private Declare Ansi Function SHGetFileInfo Lib "shell32.dll" (pszPath As String, dwFileAttributes As Integer, - ByRef psfi As SHFILEINFO, cbFileInfo As Integer, uFlags As Integer) As IntPtr - - 'Load Folder-List - Private Sub LoadListFolder() - 'Delete Folder-List - ListViewFolder.Items.Clear() - Dim searchPat = "*" & TextBoxSearchFolder.Text & "*" - Try - 'Add Folder - Dim di As New DirectoryInfo(_myFolder) - Dim aryFi = di.GetDirectories(searchPat) - ImageList1.Images.Clear() - Dim shinfo = New SHFILEINFO() - shinfo.szDisplayName = New String(Chr(0), 260) - shinfo.szTypeName = New String(Chr(0), 80) - SHGetFileInfo(_myFolder, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON) - Dim myIcon = Icon.FromHandle(shinfo.hIcon) - ImageList1.Images.Add(myIcon) - For Each fi In aryFi - ListViewFolder.Items.Add(fi.ToString, 0) - Next - Catch ex As Exception - ListViewFolder.Items.Add("<ERROR: " & ex.Message.ToString & ">") - End Try - End Sub - - 'Load File-list - Private Sub LoadListFiles() - 'Abort if bBrowseFolder - If _bBrowseFolder Then Exit Sub - - 'Define Extension-filter - Dim extStr As String() - If Trim(ComboBoxExt.Text.ToString) = "" Then - extStr = New String() {"*"} - Else - extStr = ComboBoxExt.Text.ToString.Split(","c) - End If - - 'Delete File-List - ListViewFiles.Items.Clear() - - Dim searchFile = TextBoxSearchFile.Text - - ListViewFiles.BeginUpdate() - Try - 'Add Folder - Dim di As New DirectoryInfo(_myFolder) - Dim aryFi As FileInfo() - Dim fi As FileInfo - Dim x = -1 - For Each SearchExt In extStr - Dim searchPat = "*" & Trim(searchFile) & "*." & Trim(SearchExt) - aryFi = di.GetFiles(searchPat) - For Each fi In aryFi - x += 1 - Dim shinfo = New SHFILEINFO() - shinfo.szDisplayName = New String(Chr(0), 260) - shinfo.szTypeName = New String(Chr(0), 80) - SHGetFileInfo(Path.Combine(_myFolder, fi.ToString), 0, shinfo, Marshal.SizeOf(shinfo), - SHGFI_ICON Or SHGFI_SMALLICON) - Dim myIcon = Icon.FromHandle(shinfo.hIcon) - ImageList1.Images.Add(myIcon) - ListViewFiles.Items.Add(fi.ToString, x + 1) - Next - Next - Catch ex As Exception - ListViewFiles.Items.Add("<ERROR: " & ex.Message.ToString & ">") - End Try - - ListViewFiles.EndUpdate() - End Sub - - 'Rename File - Private Sub RenameFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ - Handles RenameFileToolStripMenuItem.Click - - If ListViewFiles.SelectedItems.Count = 1 Then - Dim file0 = ListViewFiles.SelectedItems(0).Text - Dim file = file0 -lb1: - file = InputBox("New Filename", "Rename " & file0, file) - If file <> "" Then - If IO.File.Exists(_myFolder & file) Then - MsgBox("File " & file & " already exists!") - GoTo lb1 - End If - Try - My.Computer.FileSystem.RenameFile(_myFolder & file0, file) - LoadListFiles() - Catch ex As Exception - MsgBox("Cannot rename " & file0 & "!") - End Try - End If - End If - End Sub - - 'Delete File - Private Sub DeleteFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ - Handles DeleteFileToolStripMenuItem.Click - Dim c = ListViewFiles.SelectedItems.Count - If c > 0 Then - If c = 1 Then - If MsgBox("Delete " & _myFolder & ListViewFiles.SelectedItems(0).Text & "?", MsgBoxStyle.YesNo) = MsgBoxResult.No _ - Then Exit Sub - Else - If MsgBox("Delete " & c & " files?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub - End If - For x = 0 To c - 1 - Try - File.Delete(_myFolder & ListViewFiles.SelectedItems(x).Text) - Catch ex As Exception - End Try - Next - LoadListFiles() - End If - End Sub - - 'Neuer Ordner - Private Sub ButtonNewDir_Click(sender As Object, e As EventArgs) Handles ButtonNewDir.Click - Dim f = "New Folder" -lb10: - f = InputBox("Create New Folder", "New Folder", f) - If f <> "" Then - If Directory.Exists(_myFolder & f) Then - MsgBox("Folder " & _myFolder & f & " already exists!") - GoTo lb10 - End If - Try - Directory.CreateDirectory(_myFolder & f) - SetFolder(_myFolder & f) - Catch ex As Exception - MsgBox("Cannot create " & f & "!") - End Try - End If - End Sub - - Private Shared Function fPATH(path As String) As String - Dim x = path.LastIndexOf("\", StringComparison.Ordinal) - If x = -1 Then - Return Microsoft.VisualBasic.Left(path, 0) - Else - Return Microsoft.VisualBasic.Left(path, x + 1) - End If - End Function - - Public ReadOnly Property Files As String() - Get - Return _myFiles - End Get - End Property - - Public Property ID As String - Get - Return _myId - End Get - Set(value As String) - _myId = value - End Set - End Property - - Public Property Extensions As String() - Get - Return _myExt - End Get - Set(value As String()) - _myExt = value - _lastExt = _myExt(0) - _noExt = False - End Set - End Property -End Class - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Option Infer On + +Imports System.IO +Imports System.Text +Imports Microsoft.VisualBasic.FileIO +Imports System.Runtime.InteropServices + + +''' <summary> +''' File Browser dialog. Entirely controlled by cFilebrowser class. +''' </summary> +Public Class FileBrowserDialog + Private _myFolder As String + Private _myFiles() As String + Private _myDrive As String + Private _updateLock As Boolean + Private _initialized As Boolean + Private _myId As String + Private _myExt() As String + Private _lastFile As String + Private _bFileMustExist As Boolean + Private _bOverwriteCheck As Boolean + Private _bMultiFiles As Boolean + Private _noExt As Boolean + Private _bBrowseFolder As Boolean + Private _bForceExt As Boolean + Private _extListSingle As ArrayList + Private _extListMulti As ArrayList + Private _lastExt As String + Private ReadOnly _bLightMode As Boolean + + Private Const FavText As String = "Edit Favorites..." + Private Const EmptyText As String = " " + Private Const NoFavString As String = "<undefined>" + + 'New + Public Sub New(lightMode As Boolean) + ' This call is required by the Windows Form Designer. + InitializeComponent() + ' Append any initialization after the InitializeComponent() call. + _myId = "Default" + _updateLock = False + _initialized = False + _myFolder = "." + _myDrive = "" + _lastFile = "" + _bOverwriteCheck = False + _bFileMustExist = False + _bMultiFiles = False + _noExt = True + _bBrowseFolder = False + _bLightMode = lightMode + ButtonHisFile.Enabled = Not _bLightMode + End Sub + + 'Resize + Private Sub FB_Dialog_Resize(sender As Object, e As EventArgs) Handles Me.ResizeEnd + Resized() + End Sub + + 'Shown + Private Sub FileBrowser_Shown(sender As Object, e As EventArgs) Handles Me.Shown + Resized() + TextBoxPath.Focus() + TextBoxPath.SelectAll() + End Sub + + 'Resized ListView Format + Private Sub Resized() + 'To autosize to the width of the column heading, set the Width property to -2 + ListViewFolder.Columns(0).Width = -2 + 'ListViewFolder.Columns(0).Width -= 1 + ListViewFiles.Columns(0).Width = -2 + 'ListViewFiles.Columns(0).Width -= 1 + End Sub + + 'SplitterMoved + Private Sub SplitContainer1_SplitterMoved(sender As Object, e As SplitterEventArgs) _ + Handles SplitContainer1.SplitterMoved + If _initialized Then Resized() + End Sub + + 'Closing (Overwrite-Check etc) + Private Sub FileBrowser_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing + Dim x As Int32 + Dim path As String + Dim ext As String + Dim hasExt As Boolean + If DialogResult = DialogResult.OK Then + If _bBrowseFolder Then + path = Trim(TextBoxPath.Text) + 'If empty path: use the Current-folder(MyFolder) + If path = "" Then + path = _myFolder + Else + If Mid(path, 2, 1) <> ":" Then path = _myFolder & path + End If + If Not Directory.Exists(path) Then + MsgBox("Directory " & path & " does not exist!", MsgBoxStyle.Critical) + e.Cancel = True + Exit Sub + End If + If Microsoft.VisualBasic.Right(path, 1) <> "\" Then path &= "\" + ReDim _myFiles(0) + _myFiles(0) = path + Else + 'Stop if empty path + If Trim(TextBoxPath.Text) = "" Then + e.Cancel = True + Exit Sub + End If + _lastExt = Trim(ComboBoxExt.Text) + 'Assume Files in array + If Microsoft.VisualBasic.Left(TextBoxPath.Text, 1) = "<" And ListViewFiles.SelectedItems.Count > 0 Then + 'Multiple files selected + ReDim _myFiles(ListViewFiles.SelectedItems.Count - 1) + x = -1 + For Each lv0 As ListViewItem In ListViewFiles.Items + If lv0.Selected Then + x += 1 + _myFiles(x) = _myFolder & lv0.SubItems(0).Text + End If + Next + _bMultiFiles = True + Else + 'Single File + path = Trim(TextBoxPath.Text) + 'Primary extension (eg for bForceExt) + ext = Trim(ComboBoxExt.Text.Split(","c)(0)) + 'If file without path then append path + If Mid(path, 2, 1) <> ":" Then path = _myFolder & path + 'If instead of File a Folder is entered: Switch to Folder and Abort + If Directory.Exists(path) Then + SetFolder(path) + e.Cancel = True + Exit Sub + End If + 'Force Extension + If _bForceExt Then + If UCase(IO.Path.GetExtension(path)) <> "." & UCase(ext) Then path &= "." & ext + hasExt = True + Else + 'Check whether specified a File with Ext + hasExt = (Microsoft.VisualBasic.Len(IO.Path.GetExtension(path)) > 1) + End If + 'If File without Extension (after bForceExt question) and it does not exist, then add primary Extension + If Not hasExt Then + If ext <> "*" And ext <> "" Then + If Not File.Exists(path) Then path &= "." & ext + End If + End If + 'Check that File exists + If File.Exists(path) Then + 'Yes: when bOverwriteCheck, check for Overwrite + If _bOverwriteCheck Then + If MsgBox("Overwrite " & path & " ?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then + e.Cancel = True + Exit Sub + End If + End If + Else + 'No: abort if bFileMustExist + If _bFileMustExist Then + MsgBox("The file " & path & " does not exist!", MsgBoxStyle.Critical) + e.Cancel = True + Exit Sub + End If + End If + 'Define MyFiles + ReDim _myFiles(0) + _myFiles(0) = path + _bMultiFiles = False + End If + End If + End If + End Sub + + 'Browse - Custom Dialog + Public Function Browse(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, + extMode As FileBrowserFileExtensionMode, + multiFile As Boolean, ext As String, caption As String) As Boolean + If Not _initialized Then Init() + + 'Load Folder History ContextMenu + For x = 0 To 9 + ContextMenuHisFolder.Items(x).Text = FileBrowserFolderHistory(x) + Next + For x = 10 To 19 + ContextMenuHisFolder.Items(x + 1).Text = FileBrowserFolderHistory(x) + Next + + 'Options + _bOverwriteCheck = overwriteCheck + _bFileMustExist = fileMustExist + _bForceExt = (extMode = FileBrowserFileExtensionMode.ForceExt) + + 'Form Config + ListViewFiles.MultiSelect = multiFile + ButtonAll.Visible = multiFile + _title = caption + Text = caption + + 'Ext-Combobox + ComboBoxExt.Items.Clear() + If _noExt Then + ComboBoxExt.Items.Add("*") + ComboBoxExt.SelectedIndex = 0 + Else + Select Case extMode + Case FileBrowserFileExtensionMode.ForceExt + If ext = "" Then ext = _extListSingle(0).ToString + ComboBoxExt.Items.AddRange(_extListSingle.ToArray) + ComboBoxExt.Text = ext + ComboBoxExt.Enabled = False + Case FileBrowserFileExtensionMode.MultiExt, FileBrowserFileExtensionMode.SingleExt + If extMode = FileBrowserFileExtensionMode.MultiExt Then + ComboBoxExt.Items.AddRange(_extListMulti.ToArray) + Else + ComboBoxExt.Items.AddRange(_extListSingle.ToArray) + End If + If ext <> "" Then + ComboBoxExt.Text = ext + Else + ComboBoxExt.Text = _lastExt + End If + ComboBoxExt.Enabled = True + End Select + End If + + + 'Define Path + ' If no path is specified: Last folder, no file name + If path = "" Then path = FileBrowserFolderHistory(0) + + ' If path-length too small (Path is invalid): Last File + If path.Length < 2 Then path = _lastFile + + 'Open Folder - If no folder in the path: Last folder + If fPATH(path) = "" Then + 'If given a file without path + If Trim(FileBrowserFolderHistory(0)) = "" Then + SetFolder("C:\") + Else + SetFolder(FileBrowserFolderHistory(0)) + End If + Else + '...Otherwise: + SetFolder(fPATH(path)) + End If + If _bBrowseFolder Then + FolderUp() + TextBoxPath.Text = path + Else + TextBoxPath.Text = IO.Path.GetFileName(path) + End If + + 'Show form ------------------------------------------------ ---- + ShowDialog() + If DialogResult = DialogResult.OK Then + 'File / Folder History + If _bMultiFiles Then + _lastFile = _myFolder + UpdateHisFolder(_myFolder) + Else + _lastFile = _myFiles(0) + UpdateHisFolder(fPATH(_lastFile)) + If Not _bBrowseFolder Then UpdateHisFile(_lastFile) + End If + 'Update Global History Folder + For x = 0 To 9 + FileBrowserFolderHistory(x) = ContextMenuHisFolder.Items(x).Text + Next + For x = 10 To 19 + FileBrowserFolderHistory(x) = ContextMenuHisFolder.Items(x + 1).Text + Next + Return True + Else + Return False + End If + End Function + + Private _title As String + + 'Close and save File / Folder History + Public Sub SaveAndClose() + 'Folder History + If FileBrowserFolderHistoryIninialized Then + Try + Dim f = My.Computer.FileSystem.OpenTextFileWriter(FileHistoryPath & "Directories.txt", False, Encoding.UTF8) + For x = 0 To 19 + f.WriteLine(FileBrowserFolderHistory(x)) + Next + f.Close() + f.Dispose() + Catch ex As Exception + End Try + FileBrowserFolderHistoryIninialized = False + End If + 'File History + If _initialized And Not _bLightMode Then + If Not _bBrowseFolder Then + Try + Dim f = My.Computer.FileSystem.OpenTextFileWriter(FileHistoryPath & _myId & ".txt", False, Encoding.UTF8) + For x = 0 To 9 + f.WriteLine(ContextMenuHisFile.Items(x).Text) + Next + f.Close() + f.Dispose() + Catch ex As Exception + End Try + End If + _initialized = False + End If + + 'Close + Close() + End Sub + + 'Switching to FolderBrowser + Public Sub SetFolderBrowser() + If _initialized Then Exit Sub + + _bBrowseFolder = True + Width = 500 + ListViewFiles.Enabled = False + ButtonHisFile.Enabled = False + TextBoxSearchFile.Enabled = False + SplitContainer1.Panel2Collapsed = True + Text = "Directory Browser" + End Sub + + 'Initialize + Private Sub Init() + _updateLock = True + + 'Initialization for Global File Browser + If Not FileBrowserFolderHistoryIninialized Then GlobalInit() + + 'Load Drive ComboBox + For x = 0 To UBound(Drives) + ComboBoxDrive.Items.Add(Drives(x)) + Next + + 'FolderHistory ContextMenu + ContextMenuHisFolder.Items.Clear() + For x = 0 To 9 + ContextMenuHisFolder.Items.Add("") + Next + ContextMenuHisFolder.Items.Add("-") + For x = 10 To 19 + ContextMenuHisFolder.Items.Add("") + Next + ContextMenuHisFolder.Items.Add("-") + ContextMenuHisFolder.Items.Add(FavText) + + 'FileHistory ContextMenu + If _bBrowseFolder Then + _lastFile = FileBrowserFolderHistory(0) + ElseIf Not _bLightMode Then + For x = 0 To 9 + ContextMenuHisFile.Items.Add("") + Next + If File.Exists(FileHistoryPath & _myId & ".txt") Then + Dim f = New StreamReader(FileHistoryPath & _myId & ".txt") + Dim x = -1 + Do While Not f.EndOfStream And x < 9 + x += 1 + Dim line = f.ReadLine + ContextMenuHisFile.Items(x).Text = line + If x = 0 Then _lastFile = line + Loop + f.Close() + f.Dispose() + End If + End If + + 'Extension-ComboBox + If Not _noExt Then + _extListSingle = New ArrayList + _extListMulti = New ArrayList + For x = 0 To UBound(_myExt) + _extListMulti.Add(_myExt(x)) + For Each line In _myExt(x).Split(","c) + _extListSingle.Add(Trim(line)) + Next + Next + _extListMulti.Add("*") + _extListSingle.Add("*") + End If + + _initialized = True + _updateLock = False + End Sub + + Private Sub GlobalInit() + + 'Create Drive List + ReDim Drives(UBound(Directory.GetLogicalDrives())) + Dim x = -1 + For Each drive In Directory.GetLogicalDrives() + x += 1 + Drives(x) = Microsoft.VisualBasic.Left(drive, 2) + Next + + 'Read Folder History + For x = 0 To 19 + FileBrowserFolderHistory(x) = EmptyText + Next + If File.Exists(FileHistoryPath & "Directories.txt") Then + Dim f = New StreamReader(FileHistoryPath & "Directories.txt") + x = -1 + Do While Not f.EndOfStream And x < 19 + x += 1 + FileBrowserFolderHistory(x) = f.ReadLine() + Loop + f.Dispose() + f.Close() + End If + + FileBrowserFolderHistoryIninialized = True + End Sub + + 'ComboBoxDrive_SelectedIndexChanged + Private Sub ComboBoxDrive_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles ComboBoxDrive.SelectedIndexChanged + If Not _updateLock Then SetFolder(ComboBoxDrive.SelectedItem.ToString) + End Sub + + + 'ButtonFolderBack_Click + Private Sub ButtonFolderBack_Click(sender As Object, e As EventArgs) Handles ButtonFolderBack.Click + FolderUp() + End Sub + + 'TextBoxPath_KeyDown (ENTER) + Private Sub TextBoxPath_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxPath.KeyDown + If e.KeyCode = Keys.Enter Then + Dim path = TextBoxPath.Text + If Directory.Exists(path) Then + If _bBrowseFolder Then + DialogResult = DialogResult.OK + Close() + Else + SetFolder(path) + End If + Else + DialogResult = DialogResult.OK + Close() + End If + End If + End Sub + + 'ListViewFolder_SelectedIndexChanged + Private Sub ListViewFolder_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles ListViewFolder.SelectedIndexChanged + If _bBrowseFolder Then + _updateLock = True + If ListViewFolder.SelectedItems.Count > 0 Then + TextBoxPath.Text = ListViewFolder.SelectedItems.Item(0).Text & "\" + End If + _updateLock = False + End If + End Sub + + 'ListViewFolder_MouseDoubleClick + Private Sub ListViewFolder_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ + Handles ListViewFolder.MouseDoubleClick + If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub + SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) + End Sub + + 'ListViewFolder_KeyDown + Private Sub ListViewFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFolder.KeyDown + If e.KeyCode = Keys.Enter Then + If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub + SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) + End If + End Sub + + 'ListViewFiles_SelectedIndexChanged + Private Sub ListViewFiles_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles ListViewFiles.SelectedIndexChanged + _updateLock = True + If ListViewFiles.SelectedItems.Count = 0 Then + TextBoxPath.Text = "" + Else + If ListViewFiles.SelectedItems.Count > 1 Then + TextBoxPath.Text = String.Format("<{0} Files selected>", ListViewFiles.SelectedItems.Count) + Else + TextBoxPath.Text = ListViewFiles.SelectedItems.Item(0).Text + TextBoxPath.SelectionStart = TextBoxPath.Text.Length + End If + End If + _updateLock = False + End Sub + + 'ListViewFiles_MouseDoubleClick + Private Sub ListViewFiles_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ + Handles ListViewFiles.MouseDoubleClick + If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub + + DialogResult = DialogResult.OK + Close() + End Sub + + 'ListViewFiles_KeyDown + Private Sub ListViewFiles_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFiles.KeyDown + If e.KeyCode = Keys.Enter Then + If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub + DialogResult = DialogResult.OK + Close() + End If + End Sub + + 'TextBoxSearchFolder_KeyDown + Private Sub TextBoxSearchFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFolder.KeyDown + Dim itemCount = ListViewFolder.Items.Count + Dim noItem = (itemCount = 0) + + Dim selIndex As Integer + If Not noItem Then + If ListViewFolder.SelectedItems.Count = 0 Then + selIndex = -1 + Else + selIndex = ListViewFolder.SelectedIndices(0) + End If + End If + Select Case e.KeyCode + Case Keys.Enter + If noItem Then Exit Sub + If ListViewFolder.SelectedItems.Count = 0 Then ListViewFolder.SelectedIndices.Add(0) + SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) + Case Keys.Up + If Not noItem Then + If selIndex < 1 Then + selIndex = 1 + Else + ListViewFolder.Items(selIndex).Selected = False + End If + ListViewFolder.Items(selIndex - 1).Selected = True + ListViewFolder.Items(selIndex - 1).EnsureVisible() + End If + Case Keys.Down + If Not noItem And selIndex < itemCount - 1 Then + If Not selIndex = -1 Then ListViewFolder.Items(selIndex).Selected = False + ListViewFolder.Items(selIndex + 1).Selected = True + ListViewFolder.Items(selIndex + 1).EnsureVisible() + End If + Case Keys.Back + If TextBoxSearchFolder.Text = "" Then FolderUp() + End Select + End Sub + + 'TextBoxSearchFolder_TextChanged + Private Sub TextBoxSearchFolder_TextChanged(sender As Object, e As EventArgs) Handles TextBoxSearchFolder.TextChanged + If Not _updateLock Then LoadListFolder() + End Sub + + 'TextBoxSearchFile_KeyDown + Private Sub TextBoxSearchFile_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFile.KeyDown + Dim selIndex As Integer + + Dim itemCount = ListViewFiles.Items.Count + Dim noItem = (itemCount = 0) + If Not noItem Then + If ListViewFiles.SelectedItems.Count = 0 Then + selIndex = -1 + Else + selIndex = ListViewFiles.SelectedIndices(0) + End If + End If + Select Case e.KeyCode + Case Keys.Enter + If noItem Then Exit Sub + If ListViewFiles.SelectedItems.Count = 0 Then ListViewFiles.SelectedIndices.Add(0) + DialogResult = DialogResult.OK + Close() + Case Keys.Up + If Not noItem Then + If selIndex < 1 Then + selIndex = 1 + Else + ListViewFiles.Items(selIndex).Selected = False + End If + ListViewFiles.Items(selIndex - 1).Selected = True + ListViewFiles.Items(selIndex - 1).EnsureVisible() + End If + Case Keys.Down + If Not noItem And selIndex < itemCount - 1 Then + If Not selIndex = -1 Then ListViewFiles.Items(selIndex).Selected = False + ListViewFiles.Items(selIndex + 1).Selected = True + ListViewFiles.Items(selIndex + 1).EnsureVisible() + End If + End Select + End Sub + + Private Sub TextBoxSearchFile_TextChanged(sender As Object, e As EventArgs) _ + Handles TextBoxSearchFile.TextChanged, ComboBoxExt.TextChanged + If Not _updateLock Then LoadListFiles() + End Sub + + Private Sub ButtonHisFolder_Click(sender As Object, e As EventArgs) Handles ButtonHisFolder.Click + ContextMenuHisFolder.Show(MousePosition) + End Sub + + + Private Sub ButtonHisFile_Click(sender As Object, e As EventArgs) Handles ButtonHisFile.Click + ContextMenuHisFile.Show(MousePosition) + End Sub + + Private Sub ButtonAll_Click(sender As Object, e As EventArgs) Handles ButtonAll.Click + ListViewFiles.BeginUpdate() + For i = 0 To ListViewFiles.Items.Count - 1 + ListViewFiles.Items(i).Selected = True + Next + ListViewFiles.EndUpdate() + End Sub + + Private Sub ContextMenuHisFile_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ + Handles ContextMenuHisFile.ItemClicked + Dim path = e.ClickedItem.Text.ToString + If path = EmptyText Then Exit Sub + SetFolder(fPATH(path)) + TextBoxPath.Text = IO.Path.GetFileName(path) + End Sub + + Private Sub ContextMenuHisFolder_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ + Handles ContextMenuHisFolder.ItemClicked + + Dim path = e.ClickedItem.Text.ToString + + If path = EmptyText Then Exit Sub + + If path = FavText Then + Dim favdlog = New FileBrowserFavoritesDialog + If favdlog.ShowDialog(Me) = DialogResult.OK Then + For x As Integer = 10 To 19 + path = favdlog.ListBox1.Items(x - 10).ToString() + If path = NoFavString Then + FileBrowserFolderHistory(x) = EmptyText + Else + FileBrowserFolderHistory(x) = path + End If + ContextMenuHisFolder.Items(x + 1).Text = FileBrowserFolderHistory(x) + Next + End If + Else + SetFolder(path) + End If + End Sub + + Private Sub TextBoxCurrent_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBoxCurrent.MouseClick + Dim newpath = "" + Dim x = TextBoxCurrent.SelectionStart + Dim path = TextBoxCurrent.Text + Dim x1 = path.Length + If x = x1 Then Exit Sub + If x < 4 Then + SetFolder(Microsoft.VisualBasic.Left(path, 2)) + Exit Sub + End If + Do While x1 > x + newpath = path + 'path = Microsoft.VisualBasic.Left(path, x1 - 1) + path = Microsoft.VisualBasic.Left(path, path.LastIndexOf("\", StringComparison.Ordinal)) + x1 = path.Length + Loop + SetFolder(newpath) + End Sub + + Private Sub ButtonDesktop_Click(sender As Object, e As EventArgs) Handles ButtonDesktop.Click + SetFolder(SpecialDirectories.Desktop.ToString) + End Sub + + Private Sub UpdateHisFile(path As String) + If _bLightMode Then Exit Sub + + Dim x As Integer + For x = 0 To 8 + If UCase(ContextMenuHisFile.Items(x).Text.ToString) = UCase(path) Then Exit For + Next + For y = x To 1 Step -1 + ContextMenuHisFile.Items(y).Text = ContextMenuHisFile.Items(y - 1).Text + Next + ContextMenuHisFile.Items(0).Text = path + End Sub + + Private Sub UpdateHisFolder(path As String) + Dim x As Integer + For x = 0 To 8 + If UCase(ContextMenuHisFolder.Items(x).Text.ToString) = UCase(path) Then Exit For + Next + For y = x To 1 Step -1 + ContextMenuHisFolder.Items(y).Text = ContextMenuHisFolder.Items(y - 1).Text + Next + ContextMenuHisFolder.Items(0).Text = path + End Sub + + Public Sub UpdateHistory(path As String) + If Not _initialized Then Init() + UpdateHisFile(path) + path = fPATH(path) + Dim x As Integer + For x = 0 To 8 + If UCase(FileBrowserFolderHistory(x)) = UCase(path) Then Exit For + Next + For y = x To 1 Step -1 + FileBrowserFolderHistory(y) = FileBrowserFolderHistory(y - 1) + Next + FileBrowserFolderHistory(0) = path + End Sub + + 'Change folder + Private Sub SetFolder(path As String) + + 'Abort if no drive specified + If Mid(path, 2, 1) <> ":" Then Exit Sub + + _updateLock = True + + 'Delete Search-fields + TextBoxSearchFile.Text = "" + TextBoxSearchFolder.Text = "" + + 'Set Drive + If _myDrive <> Microsoft.VisualBasic.Left(path, 2) Then + _myDrive = UCase(Microsoft.VisualBasic.Left(path, 2)) + ComboBoxDrive.SelectedItem = _myDrive + End If + + 'Set Folder + _myFolder = path + If Microsoft.VisualBasic.Right(_myFolder, 1) <> "\" Then _myFolder &= "\" + + Text = _title & " " & _myFolder + + LoadListFolder() + LoadListFiles() + + If _bBrowseFolder Then TextBoxPath.Text = "" + + TextBoxCurrent.Text = _myFolder + + 'TextBoxPath.SelectionStart = TextBoxPath.Text.Length + _updateLock = False + End Sub + + 'Folder one level up + Private Sub FolderUp() + If _myFolder <> "" Then + Dim path = Microsoft.VisualBasic.Left(_myFolder, _myFolder.Length - 1) + Dim x = path.LastIndexOf("\", StringComparison.Ordinal) + If x > 0 Then SetFolder(Microsoft.VisualBasic.Left(path, x)) + End If + End Sub + + + Private Structure SHFILEINFO + Public hIcon As IntPtr ' : icon + Public iIcon As Integer ' : icondex + Public dwAttributes As Integer ' : SFGAO_ flags + <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDisplayName As String + <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public szTypeName As String + End Structure + + Private Const SHGFI_ICON = &H100 + Private Const SHGFI_SMALLICON = &H1 + Private Declare Ansi Function SHGetFileInfo Lib "shell32.dll" (pszPath As String, dwFileAttributes As Integer, + ByRef psfi As SHFILEINFO, cbFileInfo As Integer, uFlags As Integer) As IntPtr + + 'Load Folder-List + Private Sub LoadListFolder() + 'Delete Folder-List + ListViewFolder.Items.Clear() + Dim searchPat = "*" & TextBoxSearchFolder.Text & "*" + Try + 'Add Folder + Dim di As New DirectoryInfo(_myFolder) + Dim aryFi = di.GetDirectories(searchPat) + ImageList1.Images.Clear() + Dim shinfo = New SHFILEINFO() + shinfo.szDisplayName = New String(Chr(0), 260) + shinfo.szTypeName = New String(Chr(0), 80) + SHGetFileInfo(_myFolder, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON) + Dim myIcon = Icon.FromHandle(shinfo.hIcon) + ImageList1.Images.Add(myIcon) + For Each fi In aryFi + ListViewFolder.Items.Add(fi.ToString, 0) + Next + Catch ex As Exception + ListViewFolder.Items.Add("<ERROR: " & ex.Message.ToString & ">") + End Try + End Sub + + 'Load File-list + Private Sub LoadListFiles() + 'Abort if bBrowseFolder + If _bBrowseFolder Then Exit Sub + + 'Define Extension-filter + Dim extStr As String() + If Trim(ComboBoxExt.Text.ToString) = "" Then + extStr = New String() {"*"} + Else + extStr = ComboBoxExt.Text.ToString.Split(","c) + End If + + 'Delete File-List + ListViewFiles.Items.Clear() + + Dim searchFile = TextBoxSearchFile.Text + + ListViewFiles.BeginUpdate() + Try + 'Add Folder + Dim di As New DirectoryInfo(_myFolder) + Dim aryFi As FileInfo() + Dim fi As FileInfo + Dim x = -1 + For Each SearchExt In extStr + Dim searchPat = "*" & Trim(searchFile) & "*." & Trim(SearchExt) + aryFi = di.GetFiles(searchPat) + For Each fi In aryFi + x += 1 + Dim shinfo = New SHFILEINFO() + shinfo.szDisplayName = New String(Chr(0), 260) + shinfo.szTypeName = New String(Chr(0), 80) + SHGetFileInfo(Path.Combine(_myFolder, fi.ToString), 0, shinfo, Marshal.SizeOf(shinfo), + SHGFI_ICON Or SHGFI_SMALLICON) + Dim myIcon = Icon.FromHandle(shinfo.hIcon) + ImageList1.Images.Add(myIcon) + ListViewFiles.Items.Add(fi.ToString, x + 1) + Next + Next + Catch ex As Exception + ListViewFiles.Items.Add("<ERROR: " & ex.Message.ToString & ">") + End Try + + ListViewFiles.EndUpdate() + End Sub + + 'Rename File + Private Sub RenameFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ + Handles RenameFileToolStripMenuItem.Click + + If ListViewFiles.SelectedItems.Count = 1 Then + Dim file0 = ListViewFiles.SelectedItems(0).Text + Dim file = file0 +lb1: + file = InputBox("New Filename", "Rename " & file0, file) + If file <> "" Then + If IO.File.Exists(_myFolder & file) Then + MsgBox("File " & file & " already exists!") + GoTo lb1 + End If + Try + My.Computer.FileSystem.RenameFile(_myFolder & file0, file) + LoadListFiles() + Catch ex As Exception + MsgBox("Cannot rename " & file0 & "!") + End Try + End If + End If + End Sub + + 'Delete File + Private Sub DeleteFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ + Handles DeleteFileToolStripMenuItem.Click + Dim c = ListViewFiles.SelectedItems.Count + If c > 0 Then + If c = 1 Then + If MsgBox("Delete " & _myFolder & ListViewFiles.SelectedItems(0).Text & "?", MsgBoxStyle.YesNo) = MsgBoxResult.No _ + Then Exit Sub + Else + If MsgBox("Delete " & c & " files?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub + End If + For x = 0 To c - 1 + Try + File.Delete(_myFolder & ListViewFiles.SelectedItems(x).Text) + Catch ex As Exception + End Try + Next + LoadListFiles() + End If + End Sub + + 'Neuer Ordner + Private Sub ButtonNewDir_Click(sender As Object, e As EventArgs) Handles ButtonNewDir.Click + Dim f = "New Folder" +lb10: + f = InputBox("Create New Folder", "New Folder", f) + If f <> "" Then + If Directory.Exists(_myFolder & f) Then + MsgBox("Folder " & _myFolder & f & " already exists!") + GoTo lb10 + End If + Try + Directory.CreateDirectory(_myFolder & f) + SetFolder(_myFolder & f) + Catch ex As Exception + MsgBox("Cannot create " & f & "!") + End Try + End If + End Sub + + Private Shared Function fPATH(path As String) As String + Dim x = path.LastIndexOf("\", StringComparison.Ordinal) + If x = -1 Then + Return Microsoft.VisualBasic.Left(path, 0) + Else + Return Microsoft.VisualBasic.Left(path, x + 1) + End If + End Function + + Public ReadOnly Property Files As String() + Get + Return _myFiles + End Get + End Property + + Public Property ID As String + Get + Return _myId + End Get + Set(value As String) + _myId = value + End Set + End Property + + Public Property Extensions As String() + Get + Return _myExt + End Get + Set(value As String()) + _myExt = value + _lastExt = _myExt(0) + _noExt = False + End Set + End Property +End Class + + diff --git a/VECTO/File Browser/FileBrowserFavoritesDialog.designer.vb b/VECTO/File Browser/FileBrowserFavoritesDialog.designer.vb index 4f768bb217bacb204b339538e7cc2f3281f123d8..cb0378458b0ee3233ae563369c438bcef251aed0 100644 --- a/VECTO/File Browser/FileBrowserFavoritesDialog.designer.vb +++ b/VECTO/File Browser/FileBrowserFavoritesDialog.designer.vb @@ -1,132 +1,132 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.ComponentModel -Imports Microsoft.VisualBasic.CompilerServices - - -<DesignerGenerated()> _ -Partial Class FileBrowserFavoritesDialog - Inherits Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - <DebuggerNonUserCode()> _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - <DebuggerStepThrough()> _ - Private Sub InitializeComponent() - Me.TableLayoutPanel1 = New TableLayoutPanel() - Me.OK_Button = New Button() - Me.Cancel_Button = New Button() - Me.ListBox1 = New ListBox() - Me.Label1 = New Label() - Me.TableLayoutPanel1.SuspendLayout() - Me.SuspendLayout() - ' - 'TableLayoutPanel1 - ' - Me.TableLayoutPanel1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) - Me.TableLayoutPanel1.ColumnCount = 2 - Me.TableLayoutPanel1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) - Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New Point(326, 173) - Me.TableLayoutPanel1.Name = "TableLayoutPanel1" - Me.TableLayoutPanel1.RowCount = 1 - Me.TableLayoutPanel1.RowStyles.Add(New RowStyle(SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Size = New Size(146, 29) - Me.TableLayoutPanel1.TabIndex = 0 - ' - 'OK_Button - ' - Me.OK_Button.Anchor = AnchorStyles.None - Me.OK_Button.Location = New Point(3, 3) - Me.OK_Button.Name = "OK_Button" - Me.OK_Button.Size = New Size(67, 23) - Me.OK_Button.TabIndex = 0 - Me.OK_Button.Text = "OK" - ' - 'Cancel_Button - ' - Me.Cancel_Button.Anchor = AnchorStyles.None - Me.Cancel_Button.DialogResult = DialogResult.Cancel - Me.Cancel_Button.Location = New Point(76, 3) - Me.Cancel_Button.Name = "Cancel_Button" - Me.Cancel_Button.Size = New Size(67, 23) - Me.Cancel_Button.TabIndex = 1 - Me.Cancel_Button.Text = "Cancel" - ' - 'ListBox1 - ' - Me.ListBox1.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ - Or AnchorStyles.Left) _ - Or AnchorStyles.Right), AnchorStyles) - Me.ListBox1.FormattingEnabled = True - Me.ListBox1.Location = New Point(12, 12) - Me.ListBox1.Name = "ListBox1" - Me.ListBox1.Size = New Size(460, 134) - Me.ListBox1.TabIndex = 1 - ' - 'Label1 - ' - Me.Label1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) - Me.Label1.AutoSize = True - Me.Label1.Location = New Point(369, 147) - Me.Label1.Name = "Label1" - Me.Label1.Size = New Size(106, 13) - Me.Label1.TabIndex = 2 - Me.Label1.Text = "(Double-Click to Edit)" - ' - 'FB_FavDlog - ' - Me.AcceptButton = Me.OK_Button - Me.AutoScaleMode = AutoScaleMode.Inherit - Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New Size(484, 208) - Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.ListBox1) - Me.Controls.Add(Me.TableLayoutPanel1) - Me.FormBorderStyle = FormBorderStyle.SizableToolWindow - Me.MaximizeBox = False - Me.MaximumSize = New Size(5000, 242) - Me.MinimizeBox = False - Me.MinimumSize = New Size(0, 242) - Me.Name = "FileBrowserFavoritesDialog" - Me.ShowIcon = False - Me.ShowInTaskbar = False - Me.StartPosition = FormStartPosition.CenterParent - Me.Text = "Edit Favorites" - Me.TableLayoutPanel1.ResumeLayout(False) - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - Friend WithEvents TableLayoutPanel1 As TableLayoutPanel - Friend WithEvents OK_Button As Button - Friend WithEvents Cancel_Button As Button - Friend WithEvents ListBox1 As ListBox - Friend WithEvents Label1 As Label - -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.ComponentModel +Imports Microsoft.VisualBasic.CompilerServices + + +<DesignerGenerated()> _ +Partial Class FileBrowserFavoritesDialog + Inherits Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.TableLayoutPanel1 = New TableLayoutPanel() + Me.OK_Button = New Button() + Me.Cancel_Button = New Button() + Me.ListBox1 = New ListBox() + Me.Label1 = New Label() + Me.TableLayoutPanel1.SuspendLayout() + Me.SuspendLayout() + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.TableLayoutPanel1.ColumnCount = 2 + Me.TableLayoutPanel1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New ColumnStyle(SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) + Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) + Me.TableLayoutPanel1.Location = New Point(326, 173) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 1 + Me.TableLayoutPanel1.RowStyles.Add(New RowStyle(SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Size = New Size(146, 29) + Me.TableLayoutPanel1.TabIndex = 0 + ' + 'OK_Button + ' + Me.OK_Button.Anchor = AnchorStyles.None + Me.OK_Button.Location = New Point(3, 3) + Me.OK_Button.Name = "OK_Button" + Me.OK_Button.Size = New Size(67, 23) + Me.OK_Button.TabIndex = 0 + Me.OK_Button.Text = "OK" + ' + 'Cancel_Button + ' + Me.Cancel_Button.Anchor = AnchorStyles.None + Me.Cancel_Button.DialogResult = DialogResult.Cancel + Me.Cancel_Button.Location = New Point(76, 3) + Me.Cancel_Button.Name = "Cancel_Button" + Me.Cancel_Button.Size = New Size(67, 23) + Me.Cancel_Button.TabIndex = 1 + Me.Cancel_Button.Text = "Cancel" + ' + 'ListBox1 + ' + Me.ListBox1.Anchor = CType((((AnchorStyles.Top Or AnchorStyles.Bottom) _ + Or AnchorStyles.Left) _ + Or AnchorStyles.Right), AnchorStyles) + Me.ListBox1.FormattingEnabled = True + Me.ListBox1.Location = New Point(12, 12) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New Size(460, 134) + Me.ListBox1.TabIndex = 1 + ' + 'Label1 + ' + Me.Label1.Anchor = CType((AnchorStyles.Bottom Or AnchorStyles.Right), AnchorStyles) + Me.Label1.AutoSize = True + Me.Label1.Location = New Point(369, 147) + Me.Label1.Name = "Label1" + Me.Label1.Size = New Size(106, 13) + Me.Label1.TabIndex = 2 + Me.Label1.Text = "(Double-Click to Edit)" + ' + 'FB_FavDlog + ' + Me.AcceptButton = Me.OK_Button + Me.AutoScaleMode = AutoScaleMode.Inherit + Me.CancelButton = Me.Cancel_Button + Me.ClientSize = New Size(484, 208) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.ListBox1) + Me.Controls.Add(Me.TableLayoutPanel1) + Me.FormBorderStyle = FormBorderStyle.SizableToolWindow + Me.MaximizeBox = False + Me.MaximumSize = New Size(5000, 242) + Me.MinimizeBox = False + Me.MinimumSize = New Size(0, 242) + Me.Name = "FileBrowserFavoritesDialog" + Me.ShowIcon = False + Me.ShowInTaskbar = False + Me.StartPosition = FormStartPosition.CenterParent + Me.Text = "Edit Favorites" + Me.TableLayoutPanel1.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents TableLayoutPanel1 As TableLayoutPanel + Friend WithEvents OK_Button As Button + Friend WithEvents Cancel_Button As Button + Friend WithEvents ListBox1 As ListBox + Friend WithEvents Label1 As Label + +End Class diff --git a/VECTO/File Browser/FileBrowserFavoritesDialog.vb b/VECTO/File Browser/FileBrowserFavoritesDialog.vb index 8f5dc727112d996be621469d42e05b18f83590fd..3146f9826f5d2cae8a84f6ad13cfbea8046bcf67 100644 --- a/VECTO/File Browser/FileBrowserFavoritesDialog.vb +++ b/VECTO/File Browser/FileBrowserFavoritesDialog.vb @@ -1,62 +1,62 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Option Infer On - -Imports System.Windows.Forms - - -''' <summary> -''' Sub-dialog for File Browser. Entirely controlled by cFilebrowser class (via FB_Dialog). -''' </summary> -''' <remarks></remarks> -Public Class FileBrowserFavoritesDialog - Private Const NoFavString As String = "<empty favorite slot>" - Private Const EmptyText As String = " " - - Private Sub FB_FavDlog_Load(sender As Object, e As EventArgs) Handles Me.Load - For x = 10 To 19 - Dim txt = FileBrowserFolderHistory(x) - If txt = EmptyText Then - ListBox1.Items.Add(NoFavString) - Else - ListBox1.Items.Add(txt) - End If - Next - End Sub - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - Close() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub - - Private Sub ListBox1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ListBox1.MouseDoubleClick - Dim i = ListBox1.SelectedIndex - Dim txt = ListBox1.Items(i).ToString - - If txt = NoFavString Then txt = "" - - Dim fb = New FileBrowser("DirBr", True, True) - - If fb.OpenDialog(txt) Then - txt = fb.Files(0) - ListBox1.Items.Insert(i, txt) - ListBox1.Items.RemoveAt(i + 1) - End If - End Sub - - Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged - End Sub -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Option Infer On + +Imports System.Windows.Forms + + +''' <summary> +''' Sub-dialog for File Browser. Entirely controlled by cFilebrowser class (via FB_Dialog). +''' </summary> +''' <remarks></remarks> +Public Class FileBrowserFavoritesDialog + Private Const NoFavString As String = "<empty favorite slot>" + Private Const EmptyText As String = " " + + Private Sub FB_FavDlog_Load(sender As Object, e As EventArgs) Handles Me.Load + For x = 10 To 19 + Dim txt = FileBrowserFolderHistory(x) + If txt = EmptyText Then + ListBox1.Items.Add(NoFavString) + Else + ListBox1.Items.Add(txt) + End If + Next + End Sub + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + Close() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub + + Private Sub ListBox1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ListBox1.MouseDoubleClick + Dim i = ListBox1.SelectedIndex + Dim txt = ListBox1.Items(i).ToString + + If txt = NoFavString Then txt = "" + + Dim fb = New FileBrowser("DirBr", True, True) + + If fb.OpenDialog(txt) Then + txt = fb.Files(0) + ListBox1.Items.Insert(i, txt) + ListBox1.Items.RemoveAt(i + 1) + End If + End Sub + + Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged + End Sub +End Class diff --git a/VECTO/File Browser/FileBrowserModule.vb b/VECTO/File Browser/FileBrowserModule.vb index 9a89afff553d5d9116d64963799a85fdd1fb41e5..c035d47776058e87ba801ff6a1928063005d4005 100644 --- a/VECTO/File Browser/FileBrowserModule.vb +++ b/VECTO/File Browser/FileBrowserModule.vb @@ -1,47 +1,47 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -''' <summary> -''' Global File Brower properties and cFilebrowser instances. -''' </summary> -''' <remarks></remarks> -Public Module FileBrowserModule - Public ReadOnly FileBrowserFolderHistory(19) As String - Public Drives() As String - Public FileBrowserFolderHistoryIninialized As Boolean - Public FileHistoryPath As String - '----------------------------- - Public FolderFileBrowser As FileBrowser - Public JobfileFileBrowser As FileBrowser - Public TextFileBrowser As FileBrowser - Public VehicleFileBrowser As FileBrowser - Public DrivingCycleFileBrowser As FileBrowser - Public PTODrivingCycleFileBrowser As FileBrowser - Public FuelConsumptionMapFileBrowser As FileBrowser - Public FullLoadCurveFileBrowser As FileBrowser - - Public EngineFileBrowser As FileBrowser - Public GearboxFileBrowser As FileBrowser - Public DriverAccelerationFileBrowser As FileBrowser - Public DriverDecisionFactorTargetSpeedFileBrowser As FileBrowser - Public DriverDecisionFactorVelocityDropFileBrowser As FileBrowser - Public AuxFileBrowser As FileBrowser - - Public GearboxShiftPolygonFileBrowser As FileBrowser - Public TransmissionLossMapFileBrowser As FileBrowser - Public PtoLossMapFileBrowser As FileBrowser - Public RetarderLossMapFileBrowser As FileBrowser - Public TorqueConverterFileBrowser As FileBrowser - Public TorqueConverterShiftPolygonFileBrowser As FileBrowser - Public CrossWindCorrectionFileBrowser As FileBrowser - - Public ModalResultsFileBrowser As FileBrowser -End Module +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +''' <summary> +''' Global File Brower properties and cFilebrowser instances. +''' </summary> +''' <remarks></remarks> +Public Module FileBrowserModule + Public ReadOnly FileBrowserFolderHistory(19) As String + Public Drives() As String + Public FileBrowserFolderHistoryIninialized As Boolean + Public FileHistoryPath As String + '----------------------------- + Public FolderFileBrowser As FileBrowser + Public JobfileFileBrowser As FileBrowser + Public TextFileBrowser As FileBrowser + Public VehicleFileBrowser As FileBrowser + Public DrivingCycleFileBrowser As FileBrowser + Public PTODrivingCycleFileBrowser As FileBrowser + Public FuelConsumptionMapFileBrowser As FileBrowser + Public FullLoadCurveFileBrowser As FileBrowser + + Public EngineFileBrowser As FileBrowser + Public GearboxFileBrowser As FileBrowser + Public DriverAccelerationFileBrowser As FileBrowser + Public DriverDecisionFactorTargetSpeedFileBrowser As FileBrowser + Public DriverDecisionFactorVelocityDropFileBrowser As FileBrowser + Public AuxFileBrowser As FileBrowser + + Public GearboxShiftPolygonFileBrowser As FileBrowser + Public TransmissionLossMapFileBrowser As FileBrowser + Public PtoLossMapFileBrowser As FileBrowser + Public RetarderLossMapFileBrowser As FileBrowser + Public TorqueConverterFileBrowser As FileBrowser + Public TorqueConverterShiftPolygonFileBrowser As FileBrowser + Public CrossWindCorrectionFileBrowser As FileBrowser + + Public ModalResultsFileBrowser As FileBrowser +End Module diff --git a/VECTO/GUI/AboutBox.Designer.vb b/VECTO/GUI/AboutBox.Designer.vb index 0fad78eab49d8941ae7b3ecff8bc02b74e9b74f7..6f121f1bf1f1ec066f785f1b07741cb858b9b009 100644 --- a/VECTO/GUI/AboutBox.Designer.vb +++ b/VECTO/GUI/AboutBox.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/AboutBox.vb b/VECTO/GUI/AboutBox.vb index bf00e39bc42b93679b12c6e1b02cef03a6981dec..a1c1b8ac13b0e759af8c25ca8edc49eef5a4326c 100644 --- a/VECTO/GUI/AboutBox.vb +++ b/VECTO/GUI/AboutBox.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/EngineForm.Designer.vb b/VECTO/GUI/EngineForm.Designer.vb index 4fbc991ddcede0ddfba0a74a5acdfc18312aea73..51792047955dbf27a5d387722761bb006b25d7d3 100644 --- a/VECTO/GUI/EngineForm.Designer.vb +++ b/VECTO/GUI/EngineForm.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/EngineForm.vb b/VECTO/GUI/EngineForm.vb index 938b1e7276700a8b8dd9cc7427ddcf13e1841a83..109373d6ee7e0240baff799979364110a18cb8a7 100644 --- a/VECTO/GUI/EngineForm.vb +++ b/VECTO/GUI/EngineForm.vb @@ -15,7 +15,7 @@ Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.Models.SimulationComponent.Data.Engine Imports TUGraz.VectoCore.Utils Imports VectoAuxiliaries -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. @@ -55,7 +55,7 @@ Public Class EngineForm cbFuelType.ValueMember = "Value" cbFuelType.DisplayMember = "Label" cbFuelType.DataSource = - [Enum].GetValues(GetType(TUGraz.VectoCommon.Models.FuelType)).Cast(Of TUGraz.VectoCommon.Models.FuelType).Select( + [Enum].GetValues(GetType(TUGraz.VectoCommon.Models.FuelType)).Cast (Of TUGraz.VectoCommon.Models.FuelType).Select( Function(type) New With {Key .Value = type, .Label = type.GetLabel()}).ToList() _changed = False @@ -67,7 +67,7 @@ Public Class EngineForm If Not Cfg.DeclMode Then Exit Sub - TbInertia.Text = DeclarationData.Engine.EngineInertia((TbDispl.Text.ToDouble(0.0) / 1000.0 / 1000.0).SI(Of CubicMeter), + TbInertia.Text = DeclarationData.Engine.EngineInertia((TbDispl.Text.ToDouble(0.0)/1000.0/1000.0).SI (Of CubicMeter), GearboxType.AMT).ToGUIFormat() End Sub @@ -166,7 +166,7 @@ Public Class EngineForm If ChangeCheckCancel() Then Exit Sub - Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), + Dim inputData As IEngineeringInputDataProvider = TryCast(JSONInputDataFactory.ReadComponentData(file), IEngineeringInputDataProvider) engine = inputData.EngineInputData @@ -178,14 +178,14 @@ Public Class EngineForm Close() MainForm.RbDecl.Checked = Not MainForm.RbDecl.Checked MainForm.OpenVectoFile(file) - Case -1 + Case - 1 Exit Sub End Select End If Dim basePath As String = Path.GetDirectoryName(file) TbName.Text = engine.Model - TbDispl.Text = (engine.Displacement * 1000 * 1000).ToGUIFormat() + TbDispl.Text = (engine.Displacement*1000*1000).ToGUIFormat() TbInertia.Text = engine.Inertia.ToGUIFormat() TbNleerl.Text = engine.IdleSpeed.AsRPM.ToGUIFormat() @@ -199,7 +199,7 @@ Public Class EngineForm tbNCVCorrFactor.Text = engine.CorrectionFactorNCV.ToGUIFormat() tbRegPerCorrFactor.Text = engine.CorrectionFactorRegPer.ToGUIFormat() tbMaxTorque.Text = engine.MaxTorqueDeclared.ToGUIFormat() - tbRatedPower.Text = (engine.RatedPowerDeclared.Value() / 1000).ToGUIFormat() + tbRatedPower.Text = (engine.RatedPowerDeclared.Value()/1000).ToGUIFormat() tbRatedSpeed.Text = engine.RatedSpeedDeclared.AsRPM.ToGUIFormat() cbFuelType.SelectedValue = engine.FuelType @@ -253,9 +253,9 @@ Public Class EngineForm engine.ColdHotBalancingFactorInput = TbColdHotFactor.Text.ToDouble(0) - engine.ratedPowerInput = (tbRatedPower.Text.ToDouble(0) * 1000).SI(Of Watt)() + engine.ratedPowerInput = (tbRatedPower.Text.ToDouble(0)*1000).SI (Of Watt)() engine.ratedSpeedInput = tbRatedSpeed.Text.ToDouble(0).RPMtoRad() - engine.maxTorqueInput = tbMaxTorque.Text.ToDouble(0).SI(Of NewtonMeter)() + engine.maxTorqueInput = tbMaxTorque.Text.ToDouble(0).SI (Of NewtonMeter)() engine.FuelTypeInput = CType(cbFuelType.SelectedValue, TUGraz.VectoCommon.Models.FuelType) diff --git a/VECTO/GUI/GUI_Subs.vb b/VECTO/GUI/GUI_Subs.vb index cac6fccedca58d1e7023a27ad86f2c7e5956655e..def388ef19c57a3a34d926fcccdcb75164eb4f5d 100644 --- a/VECTO/GUI/GUI_Subs.vb +++ b/VECTO/GUI/GUI_Subs.vb @@ -1,154 +1,154 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -''' <summary> -''' Methods for GUI interaction -''' </summary> -''' <remarks></remarks> -Public Module GUI_Subs - -#Region "GUI control via background worker" - - 'Status Message => Msg-Listview - Public Sub WorkerMsg(ByVal id As MessageType, ByVal msg As String, ByVal source As String, - Optional ByVal link As String = "") - Dim workProg As New BackgroundWorkerMessage(WorkerMessageType.StatusListBox) - workProg.ID = id - Select Case id - Case MessageType.Err - Case MessageType.Warn - End Select - workProg.Msg = msg - workProg.Source = source - Try - 'VECTOworker.ReportProgress(0, WorkProg) - Catch ex As Exception - GUIMsg(id, msg) - End Try - End Sub - -#End Region - -#Region "Direct GUI control - Cannot be called by background worker!" - - 'Status message - ' ReSharper disable once InconsistentNaming - Public Sub GUIMsg(ByVal id As MessageType, ByVal msg As String) - MainForm.MSGtoForm(id, msg, "", "") - End Sub - - 'Statusbar - Public Sub Status(ByVal txt As String) - MainForm.ToolStripLbStatus.Text = txt - End Sub - - 'Status form reset - Public Sub ClearMsg() - MainForm.LvMsg.Items.Clear() - End Sub - -#End Region - - 'Class used to pass Messages from BackgroundWorker to GUI - Private Class BackgroundWorkerMessage - Public Sub New(msgTarget As WorkerMessageType) - Source = "" - End Sub - - - Public Property Source As String - - Public Property ID As MessageType - - Public Property Msg As String - End Class - - 'Progress bar control - Public Class ProgressbarControl - Public ProgOverallStartInt As Integer = -1 - Public PgroOverallEndInt As Integer = -1 - Public ProgJobInt As Integer = -1 - Public ProgLock As Boolean = False - End Class - -#Region "Textbox text conversion for file open/save operations" - - 'Text-to-number - 'Public Function ParseNumber(txt As String) As Double - ' If Not IsNumeric(txt) Then - ' Return 0 - ' End If - ' Return Double.Parse(txt, CultureInfo.InvariantCulture) - 'End Function - - -#End Region - - 'Open File with software defined in Config - Public Function FileOpenAlt(ByVal file As String) As Boolean - Dim psi As New ProcessStartInfo - - If Not IO.File.Exists(file) Then Return False - - psi.FileName = Cfg.OpenCmd - psi.Arguments = ChrW(34) & file & ChrW(34) - Try - Process.Start(psi) - Return True - Catch ex As Exception - Return False - End Try - End Function - - Public Function WrongMode() As Integer - - If Cfg.DeclMode Then - - Select Case _ - MsgBox( - "This file was created in Engineering Mode! Opening in Declaration Mode will overwrite some parameters with generic values." & - vbCrLf & vbCrLf & "Do you want to switch to Engineering Mode?" & vbCrLf & vbCrLf & - "[Yes] Switch mode and open file" & vbCrLf & "[No] Open file without changing mode" & vbCrLf & - "[Cancel] Abort opening file", MsgBoxStyle.YesNoCancel, "Warning") - Case MsgBoxResult.Yes - Return 1 - - Case (MsgBoxResult.No) - Return 0 - - Case Else - Return -1 - - End Select - - Else - - Select Case _ - MsgBox( - "This file was created in Declaration Mode! For use in Engineering Mode missing parameters must be defined." & - vbCrLf & vbCrLf & "Do you want to switch to Declaration Mode?" & vbCrLf & vbCrLf & - "[Yes] Switch mode and open file" & vbCrLf & "[No] Open file without changing mode" & vbCrLf & - "[Cancel] Abort opening file", MsgBoxStyle.YesNoCancel, "Warning") - Case MsgBoxResult.Yes - Return 1 - - Case (MsgBoxResult.No) - Return 0 - - Case Else - Return -1 - - End Select - - End If - End Function -End Module +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +''' <summary> +''' Methods for GUI interaction +''' </summary> +''' <remarks></remarks> +Public Module GUI_Subs + +#Region "GUI control via background worker" + + 'Status Message => Msg-Listview + Public Sub WorkerMsg(ByVal id As MessageType, ByVal msg As String, ByVal source As String, + Optional ByVal link As String = "") + Dim workProg As New BackgroundWorkerMessage(WorkerMessageType.StatusListBox) + workProg.ID = id + Select Case id + Case MessageType.Err + Case MessageType.Warn + End Select + workProg.Msg = msg + workProg.Source = source + Try + 'VECTOworker.ReportProgress(0, WorkProg) + Catch ex As Exception + GUIMsg(id, msg) + End Try + End Sub + +#End Region + +#Region "Direct GUI control - Cannot be called by background worker!" + + 'Status message + ' ReSharper disable once InconsistentNaming + Public Sub GUIMsg(ByVal id As MessageType, ByVal msg As String) + MainForm.MSGtoForm(id, msg, "", "") + End Sub + + 'Statusbar + Public Sub Status(ByVal txt As String) + MainForm.ToolStripLbStatus.Text = txt + End Sub + + 'Status form reset + Public Sub ClearMsg() + MainForm.LvMsg.Items.Clear() + End Sub + +#End Region + + 'Class used to pass Messages from BackgroundWorker to GUI + Private Class BackgroundWorkerMessage + Public Sub New(msgTarget As WorkerMessageType) + Source = "" + End Sub + + + Public Property Source As String + + Public Property ID As MessageType + + Public Property Msg As String + End Class + + 'Progress bar control + Public Class ProgressbarControl + Public ProgOverallStartInt As Integer = -1 + Public PgroOverallEndInt As Integer = -1 + Public ProgJobInt As Integer = -1 + Public ProgLock As Boolean = False + End Class + +#Region "Textbox text conversion for file open/save operations" + + 'Text-to-number + 'Public Function ParseNumber(txt As String) As Double + ' If Not IsNumeric(txt) Then + ' Return 0 + ' End If + ' Return Double.Parse(txt, CultureInfo.InvariantCulture) + 'End Function + + +#End Region + + 'Open File with software defined in Config + Public Function FileOpenAlt(ByVal file As String) As Boolean + Dim psi As New ProcessStartInfo + + If Not IO.File.Exists(file) Then Return False + + psi.FileName = Cfg.OpenCmd + psi.Arguments = ChrW(34) & file & ChrW(34) + Try + Process.Start(psi) + Return True + Catch ex As Exception + Return False + End Try + End Function + + Public Function WrongMode() As Integer + + If Cfg.DeclMode Then + + Select Case _ + MsgBox( + "This file was created in Engineering Mode! Opening in Declaration Mode will overwrite some parameters with generic values." & + vbCrLf & vbCrLf & "Do you want to switch to Engineering Mode?" & vbCrLf & vbCrLf & + "[Yes] Switch mode and open file" & vbCrLf & "[No] Open file without changing mode" & vbCrLf & + "[Cancel] Abort opening file", MsgBoxStyle.YesNoCancel, "Warning") + Case MsgBoxResult.Yes + Return 1 + + Case (MsgBoxResult.No) + Return 0 + + Case Else + Return -1 + + End Select + + Else + + Select Case _ + MsgBox( + "This file was created in Declaration Mode! For use in Engineering Mode missing parameters must be defined." & + vbCrLf & vbCrLf & "Do you want to switch to Declaration Mode?" & vbCrLf & vbCrLf & + "[Yes] Switch mode and open file" & vbCrLf & "[No] Open file without changing mode" & vbCrLf & + "[Cancel] Abort opening file", MsgBoxStyle.YesNoCancel, "Warning") + Case MsgBoxResult.Yes + Return 1 + + Case (MsgBoxResult.No) + Return 0 + + Case Else + Return -1 + + End Select + + End If + End Function +End Module diff --git a/VECTO/GUI/GearboxForm.Designer.vb b/VECTO/GUI/GearboxForm.Designer.vb index 6181ea768631ef36e69778e3963e5de0102bb544..c89fef41700568bacdd8c8c0bd8077b3dfeb9100 100644 --- a/VECTO/GUI/GearboxForm.Designer.vb +++ b/VECTO/GUI/GearboxForm.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index e3f15ef78e66dafce6c44f3f08a90e28c285642b..ec30e800ba9b54d203e952b82495838c511e5f7e 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/GearboxGearDialog.vb b/VECTO/GUI/GearboxGearDialog.vb index c3f8789340b14310d2cf6948516e3d344689aebd..737c8617397d363c8d041cebe93a2914defdc217 100644 --- a/VECTO/GUI/GearboxGearDialog.vb +++ b/VECTO/GUI/GearboxGearDialog.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/GraphEditChannelDialog.vb b/VECTO/GUI/GraphEditChannelDialog.vb index f8dc25a8679572d36b3f00106cd88737b6ad4057..c0070f9e4efb1d848016ef90fd482df25956252b 100644 --- a/VECTO/GUI/GraphEditChannelDialog.vb +++ b/VECTO/GUI/GraphEditChannelDialog.vb @@ -1,23 +1,23 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Public Class GraphEditChannelDialog - Private Sub OK_Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - Close() - End Sub - - Private Sub Cancel_Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Public Class GraphEditChannelDialog + Private Sub OK_Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + Close() + End Sub + + Private Sub Cancel_Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub +End Class diff --git a/VECTO/GUI/GraphForm.vb b/VECTO/GUI/GraphForm.vb index cf3bd2673f8451ac0654b88d7dbe0febfd0c0ef1..a15c9ed785aed9aeec57c14d796fd40632aad0c8 100644 --- a/VECTO/GUI/GraphForm.vb +++ b/VECTO/GUI/GraphForm.vb @@ -1,564 +1,564 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.Collections.Generic -Imports System.Drawing.Imaging -Imports System.IO -Imports System.Linq -Imports System.Text.RegularExpressions -Imports System.Windows.Forms.DataVisualization.Charting -Imports TUGraz.VectoCommon.InputData -Imports TUGraz.VectoCommon.Utils -Imports TUGraz.VectoCore.Utils - -Public Class GraphForm - Private _filepath As String - Private ReadOnly _channels As List(Of Channel) - Private _distanceList As List(Of Single) - Private _timeList As List(Of Single) - - Private _xMin As Double - Private _xMax As Double - - Private _xMax0 As Double - - - Public Sub New() - - ' Dieser Aufruf ist für den Designer erforderlich. - InitializeComponent() - - ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. - _channels = New List(Of Channel) - - Clear() - - CbXaxis.SelectedIndex = 0 - End Sub - - Private Sub ToolStripBtOpen_Click(sender As Object, e As EventArgs) Handles ToolStripBtOpen.Click - - If ModalResultsFileBrowser.OpenDialog(_filepath) Then - - LoadNewFile(ModalResultsFileBrowser.Files(0)) - - End If - End Sub - - - Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click - LoadFile() - End Sub - - Public Sub LoadNewFile(ByVal path As String) - Dim lv0 As ListViewItem - Dim i As Integer = 0 - - Clear() - - _filepath = path - - LoadFile() - - For Each channel As Channel In _channels - If (channel.Name = "v_act [km/h]" OrElse channel.Name = "v_targ [km/h]") Then - lv0 = New ListViewItem - lv0.Text = channel.Name - lv0.SubItems.Add("Left") - lv0.Tag = i - lv0.Checked = True - ListView1.Items.Add(lv0) - End If - i += 1 - Next - End Sub - - Private Sub LoadFile() - - Try - - _channels.Clear() - - Dim data As TableData = VectoCSVFile.Read(_filepath) - For Each column As DataColumn In data.Columns - Dim values As List(Of String) = New List(Of String) - For Each row As DataRow In data.Rows - values.Add(row(column).ToString()) - Next - _channels.Add(New Channel() With { - .Name = column.ColumnName, - .Values = values}) - Next - - - _timeList = Nothing - _distanceList = Nothing - - For Each channel As Channel In _channels - If (channel.Name = "time" AndAlso _timeList Is Nothing) Then - _timeList = channel.Values.Select(Function(x) CSng(x)).ToList() - End If - If (channel.Name = "dist" AndAlso _distanceList Is Nothing) Then - _distanceList = channel.Values.Select(Function(x) CSng(x)).ToList() - End If - Next - - SetxMax0() - - TbXmin.Text = 0.ToGUIFormat() - TbXmax.Text = _xMax0.ToGUIFormat() - - Text = GetFilenameWithoutPath(_filepath, True) - - Catch ex As Exception - - Exit Sub - End Try - - - UpdateGraph() - End Sub - - Private Sub SetxMax0() - - If _channels.Count = 0 Then Exit Sub - - If CbXaxis.SelectedIndex = 0 Then - _xMax0 = _distanceList(_distanceList.Count - 1) - Else - _xMax0 = _timeList(_timeList.Count - 1) - End If - End Sub - - Private Sub UpdateGraph() - Dim listViewItem As ListViewItem - Dim leftaxis As New List(Of String) - Dim rightaxis As New List(Of String) - Dim txt As String - Dim i As Integer - - If WindowState = FormWindowState.Minimized Then Exit Sub - - If ListView1.CheckedItems.Count = 0 Then - PictureBox1.Image = Nothing - Exit Sub - End If - - Dim overDist As Boolean = (CbXaxis.SelectedIndex = 0) - - SetxMax0() - - - Dim chart As Chart = New Chart - chart.Width = PictureBox1.Width - chart.Height = PictureBox1.Height - - Dim chartArea As ChartArea = New ChartArea - - - For Each listViewItem In ListView1.CheckedItems - - Dim isLeft As Boolean = (listViewItem.SubItems(1).Text = "Left") - - Dim chartSeries As Series = New Series - - If overDist Then - chartSeries.Points.DataBindXY(_distanceList, _channels(CType(listViewItem.Tag, Integer)).Values) - Else - chartSeries.Points.DataBindXY(_timeList, _channels(CType(listViewItem.Tag, Integer)).Values) - End If - - chartSeries.ChartType = SeriesChartType.FastLine - chartSeries.Name = listViewItem.Text - chartSeries.BorderWidth = 2 - - If isLeft Then - If Not leftaxis.Contains(listViewItem.SubItems(0).Text) Then leftaxis.Add(listViewItem.SubItems(0).Text) - Else - If Not rightaxis.Contains(listViewItem.SubItems(0).Text) Then rightaxis.Add(listViewItem.SubItems(0).Text) - chartSeries.YAxisType = AxisType.Secondary - End If - - chart.Series.Add(chartSeries) - - Next - - - chartArea.Name = "main" - - If overDist Then - chartArea.AxisX.Title = "distance [km]" - Else - chartArea.AxisX.Title = "time [s]" - End If - chartArea.AxisX.TitleFont = New Font("Helvetica", 10) - chartArea.AxisX.LabelStyle.Font = New Font("Helvetica", 8) - chartArea.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.None - chartArea.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot - - If _xMax > _xMin Then - chartArea.AxisX.Minimum = _xMin - chartArea.AxisX.Maximum = _xMax - chartArea.AxisX.Interval = AutoIntervalXAxis() - Else - chartArea.AxisX.Minimum = 0 - chartArea.AxisX.Maximum = _xMax0 - End If - - - If leftaxis.Count > 0 Then - - txt = leftaxis(0) - For i = 1 To leftaxis.Count - 1 - txt &= ", " & leftaxis(i) - Next - - chartArea.AxisY.Title = txt - chartArea.AxisY.TitleFont = New Font("Helvetica", 10) - chartArea.AxisY.LabelStyle.Font = New Font("Helvetica", 8) - chartArea.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None - - End If - - If rightaxis.Count > 0 Then - - txt = rightaxis(0) - For i = 1 To rightaxis.Count - 1 - txt &= ", " & rightaxis(i) - Next - - chartArea.AxisY2.Title = txt - chartArea.AxisY2.TitleFont = New Font("Helvetica", 10) - chartArea.AxisY2.LabelStyle.Font = New Font("Helvetica", 8) - chartArea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.None - chartArea.AxisY2.MinorGrid.Enabled = False - chartArea.AxisY2.MajorGrid.Enabled = False - - End If - - chartArea.BackColor = Color.GhostWhite - - chartArea.BorderDashStyle = ChartDashStyle.Solid - chartArea.BorderWidth = 1 - - chart.ChartAreas.Add(chartArea) - - With chart.ChartAreas(0) - .Position.X = 0 - .Position.Y = 0 - .Position.Width = 85 - .Position.Height = 100 - End With - - chart.Legends.Add("main") - chart.Legends(0).Font = New Font("Helvetica", 8) - chart.Legends(0).BorderColor = Color.Black - chart.Legends(0).BorderWidth = 1 - chart.Legends(0).Position.X = 86 - chart.Legends(0).Position.Y = 3 - chart.Legends(0).Position.Width = 13 - chart.Legends(0).Position.Height = 40 - - chart.Update() - - Dim img As Bitmap = New Bitmap(chart.Width, chart.Height, PixelFormat.Format32bppArgb) - chart.DrawToBitmap(img, New Rectangle(0, 0, PictureBox1.Width, PictureBox1.Height)) - - PictureBox1.Image = img - End Sub - - Private Function AutoIntervalXAxis() As Double - Dim xyd(3) As Double - Dim xya(3) As Double - Dim i As Int16 - - Dim inv As Double = (_xMax - _xMin) / 10 - - Dim grx As Long = 20 - Do While 10 ^ grx > inv - grx = grx - 1 - Loop - - xyd(0) = 1 * 10 ^ grx - xyd(1) = 2.5 * 10 ^ grx - xyd(2) = 5 * 10 ^ grx - xyd(3) = 10 * 10 ^ grx - For i = 0 To 3 - xya(i) = Math.Abs(inv - xyd(i)) - Next - - Dim xyamin As Double = xya(0) - Dim xydmin As Double = xyd(0) - For i = 1 To 3 - If xya(i) < xyamin Then - xyamin = xya(i) - xydmin = xyd(i) - End If - Next - - 'Intervall speichern - Return xydmin - End Function - - Private Sub Clear() - - _filepath = "" - - ListView1.Items.Clear() - - TbXmin.Text = "" - TbXmax.Text = "" - - PictureBox1.Image = Nothing - End Sub - - - Private Sub BtAddCh_Click(sender As Object, e As EventArgs) Handles BtAddCh.Click - Dim dlog As New GraphEditChannelDialog - Dim i As Integer - Dim lv0 As ListViewItem - - If _channels.Count = 0 Then Exit Sub - - For i = 0 To _channels.Count - 1 - dlog.ComboBox1.Items.Add(_channels(i).Name) - Next - - dlog.RbLeft.Checked = True - - dlog.ComboBox1.SelectedIndex = 0 - - If dlog.ShowDialog = DialogResult.OK Then - lv0 = New ListViewItem - i = dlog.ComboBox1.SelectedIndex - lv0.Text = _channels(i).Name - lv0.Tag = i - lv0.Checked = True - If dlog.RbLeft.Checked Then - lv0.SubItems.Add("Left") - Else - lv0.SubItems.Add("Right") - End If - - ListView1.Items.Add(lv0) - - UpdateGraph() - - End If - End Sub - - Private Sub EditChannel() - Dim dlog As New GraphEditChannelDialog - Dim i As Integer - Dim lv0 As ListViewItem - - If ListView1.SelectedItems.Count = 0 Or _channels.Count = 0 Then Exit Sub - - lv0 = ListView1.SelectedItems(0) - - For i = 0 To _channels.Count - 1 - dlog.ComboBox1.Items.Add(_channels(i).Name) - Next - - If lv0.SubItems(1).Text = "Left" Then - dlog.RbLeft.Checked = True - Else - dlog.RbRight.Checked = True - End If - - dlog.ComboBox1.SelectedIndex = CType(lv0.Tag, Integer) - - If dlog.ShowDialog = DialogResult.OK Then - i = dlog.ComboBox1.SelectedIndex - lv0.Text = _channels(i).Name - lv0.Tag = i - lv0.Checked = True - If dlog.RbLeft.Checked Then - lv0.SubItems(1).Text = "Left" - Else - lv0.SubItems(1).Text = "Right" - End If - - UpdateGraph() - - End If - End Sub - - Private Sub RemoveChannel() - Dim i0 As Integer - - If ListView1.Items.Count = 0 Then Exit Sub - - If ListView1.SelectedItems.Count = 0 Then ListView1.Items(ListView1.Items.Count - 1).Selected = True - - i0 = ListView1.SelectedItems(0).Index - - ListView1.SelectedItems(0).Remove() - - If i0 < ListView1.Items.Count Then - ListView1.Items(i0).Selected = True - ListView1.Items(i0).EnsureVisible() - End If - - UpdateGraph() - End Sub - - Private Sub ListView1_DoubleClick(sender As Object, e As EventArgs) Handles ListView1.DoubleClick - If ListView1.SelectedItems.Count > 0 Then - ListView1.SelectedItems(0).Checked = Not ListView1.SelectedItems(0).Checked - EditChannel() - End If - End Sub - - Private Sub BtRemCh_Click(sender As Object, e As EventArgs) Handles BtRemCh.Click - RemoveChannel() - End Sub - - Private Sub ListView1_ItemChecked(sender As Object, e As ItemCheckedEventArgs) _ - Handles ListView1.ItemChecked - UpdateGraph() - End Sub - - Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown - Select Case e.KeyCode - Case Keys.Delete, Keys.Back - RemoveChannel() - Case Keys.Enter - EditChannel() - End Select - End Sub - - Private Sub CbXaxis_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles CbXaxis.SelectedIndexChanged - SetxMax0() - TbXmin.Text = 0.ToGUIFormat() - TbXmax.Text = _xMax0.ToGUIFormat() - UpdateGraph() - End Sub - - Private Sub BtReset_Click(sender As Object, e As EventArgs) Handles BtReset.Click - _xMin = 0 - _xMax = _xMax0 - TbXmin.Text = 0.ToGUIFormat() - TbXmax.Text = _xMax0.ToGUIFormat() - End Sub - - Private Sub TbXmin_TextChanged(sender As Object, e As EventArgs) Handles TbXmin.TextChanged - If IsNumeric(TbXmin.Text) Then _xMin = TbXmin.Text.ToDouble() - UpdateGraph() - End Sub - - Private Sub TbXmax_TextChanged(sender As Object, e As EventArgs) Handles TbXmax.TextChanged - If IsNumeric(TbXmax.Text) Then _xMax = TbXmax.Text.ToDouble() - UpdateGraph() - End Sub - - Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click - Dim graph As New GraphForm - graph.Show() - End Sub - - Private Sub F_Graph_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged - UpdateGraph() - End Sub - - Private Sub BtZoomIn_Click(sender As Object, e As EventArgs) Handles BtZoomIn.Click - Dim d As Double - - d = (_xMax - _xMin) / 10 - - _xMin += 2 * 0.5 * d - _xMax -= 2 * (1 - 0.5) * d - - If _xMin > 1000 Then - _xMin = Math.Round(_xMin / 100, 0) * 100 - Else - _xMin = Math.Round(_xMin, 0) - End If - - TbXmin.Text = _xMin.ToGUIFormat() - TbXmax.Text = _xMax.ToGUIFormat() - End Sub - - Private Sub BtZoomOut_Click(sender As Object, e As EventArgs) Handles BtZoomOut.Click - Dim d As Double - - d = (_xMax - _xMin) / 10 - - _xMin -= 2 * 0.5 * d - _xMax += 2 * (1 - 0.5) * d - - If _xMin > 1000 Then - _xMin = Math.Round(_xMin / 100, 0) * 100 - Else - _xMin = Math.Round(_xMin, 0) - End If - - TbXmin.Text = _xMin.ToGUIFormat() - TbXmax.Text = _xMax.ToGUIFormat() - End Sub - - Private Sub BtMoveL_Click(sender As Object, e As EventArgs) Handles BtMoveL.Click - Dim d As Double - - If _xMin <= 0 Then Exit Sub - - d = (_xMax - _xMin) / 3 - _xMin -= d - _xMax -= d - - If _xMin > 1000 Then - _xMin = Math.Round(_xMin / 100, 0) * 100 - Else - _xMin = Math.Round(_xMin, 0) - End If - - TbXmin.Text = _xMin.ToGUIFormat() - TbXmax.Text = _xMax.ToGUIFormat() - End Sub - - Private Sub BtMoveR_Click(sender As Object, e As EventArgs) Handles BtMoveR.Click - Dim d As Double - - If _xMax >= _xMax0 Then Exit Sub - - d = (_xMax - _xMin) / 3 - _xMin += d - _xMax += d - - If _xMin > 1000 Then - _xMin = Math.Round(_xMin / 100, 0) * 100 - Else - _xMin = Math.Round(_xMin, 0) - End If - - TbXmin.Text = _xMin.ToGUIFormat() - TbXmax.Text = _xMax.ToGUIFormat() - End Sub - - Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click - If File.Exists(MyAppPath & "User Manual\help.html") Then - Dim browserRegistryString As String = - My.Computer.Registry.ClassesRoot.OpenSubKey("\http\shell\open\command\").GetValue("").ToString - Dim defaultBrowserPath As String = - Regex.Match(browserRegistryString, "(\"".*?\"")").Captures(0).ToString - Process.Start(defaultBrowserPath, - String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#graph-window")) - Else - MsgBox("User Manual not found!", MsgBoxStyle.Critical) - End If - End Sub - - Private Class Channel - Public Name As String - Public Values As List(Of String) - End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.Collections.Generic +Imports System.Drawing.Imaging +Imports System.IO +Imports System.Linq +Imports System.Text.RegularExpressions +Imports System.Windows.Forms.DataVisualization.Charting +Imports TUGraz.VectoCommon.InputData +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.Utils + +Public Class GraphForm + Private _filepath As String + Private ReadOnly _channels As List(Of Channel) + Private _distanceList As List(Of Single) + Private _timeList As List(Of Single) + + Private _xMin As Double + Private _xMax As Double + + Private _xMax0 As Double + + + Public Sub New() + + ' Dieser Aufruf ist für den Designer erforderlich. + InitializeComponent() + + ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + _channels = New List(Of Channel) + + Clear() + + CbXaxis.SelectedIndex = 0 + End Sub + + Private Sub ToolStripBtOpen_Click(sender As Object, e As EventArgs) Handles ToolStripBtOpen.Click + + If ModalResultsFileBrowser.OpenDialog(_filepath) Then + + LoadNewFile(ModalResultsFileBrowser.Files(0)) + + End If + End Sub + + + Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click + LoadFile() + End Sub + + Public Sub LoadNewFile(ByVal path As String) + Dim lv0 As ListViewItem + Dim i As Integer = 0 + + Clear() + + _filepath = path + + LoadFile() + + For Each channel As Channel In _channels + If (channel.Name = "v_act [km/h]" OrElse channel.Name = "v_targ [km/h]") Then + lv0 = New ListViewItem + lv0.Text = channel.Name + lv0.SubItems.Add("Left") + lv0.Tag = i + lv0.Checked = True + ListView1.Items.Add(lv0) + End If + i += 1 + Next + End Sub + + Private Sub LoadFile() + + Try + + _channels.Clear() + + Dim data As TableData = VectoCSVFile.Read(_filepath) + For Each column As DataColumn In data.Columns + Dim values As List(Of String) = New List(Of String) + For Each row As DataRow In data.Rows + values.Add(row(column).ToString()) + Next + _channels.Add(New Channel() With { + .Name = column.ColumnName, + .Values = values}) + Next + + + _timeList = Nothing + _distanceList = Nothing + + For Each channel As Channel In _channels + If (channel.Name = "time" AndAlso _timeList Is Nothing) Then + _timeList = channel.Values.Select(Function(x) CSng(x)).ToList() + End If + If (channel.Name = "dist" AndAlso _distanceList Is Nothing) Then + _distanceList = channel.Values.Select(Function(x) CSng(x)).ToList() + End If + Next + + SetxMax0() + + TbXmin.Text = 0.ToGUIFormat() + TbXmax.Text = _xMax0.ToGUIFormat() + + Text = GetFilenameWithoutPath(_filepath, True) + + Catch ex As Exception + + Exit Sub + End Try + + + UpdateGraph() + End Sub + + Private Sub SetxMax0() + + If _channels.Count = 0 Then Exit Sub + + If CbXaxis.SelectedIndex = 0 Then + _xMax0 = _distanceList(_distanceList.Count - 1) + Else + _xMax0 = _timeList(_timeList.Count - 1) + End If + End Sub + + Private Sub UpdateGraph() + Dim listViewItem As ListViewItem + Dim leftaxis As New List(Of String) + Dim rightaxis As New List(Of String) + Dim txt As String + Dim i As Integer + + If WindowState = FormWindowState.Minimized Then Exit Sub + + If ListView1.CheckedItems.Count = 0 Then + PictureBox1.Image = Nothing + Exit Sub + End If + + Dim overDist As Boolean = (CbXaxis.SelectedIndex = 0) + + SetxMax0() + + + Dim chart As Chart = New Chart + chart.Width = PictureBox1.Width + chart.Height = PictureBox1.Height + + Dim chartArea As ChartArea = New ChartArea + + + For Each listViewItem In ListView1.CheckedItems + + Dim isLeft As Boolean = (listViewItem.SubItems(1).Text = "Left") + + Dim chartSeries As Series = New Series + + If overDist Then + chartSeries.Points.DataBindXY(_distanceList, _channels(CType(listViewItem.Tag, Integer)).Values) + Else + chartSeries.Points.DataBindXY(_timeList, _channels(CType(listViewItem.Tag, Integer)).Values) + End If + + chartSeries.ChartType = SeriesChartType.FastLine + chartSeries.Name = listViewItem.Text + chartSeries.BorderWidth = 2 + + If isLeft Then + If Not leftaxis.Contains(listViewItem.SubItems(0).Text) Then leftaxis.Add(listViewItem.SubItems(0).Text) + Else + If Not rightaxis.Contains(listViewItem.SubItems(0).Text) Then rightaxis.Add(listViewItem.SubItems(0).Text) + chartSeries.YAxisType = AxisType.Secondary + End If + + chart.Series.Add(chartSeries) + + Next + + + chartArea.Name = "main" + + If overDist Then + chartArea.AxisX.Title = "distance [km]" + Else + chartArea.AxisX.Title = "time [s]" + End If + chartArea.AxisX.TitleFont = New Font("Helvetica", 10) + chartArea.AxisX.LabelStyle.Font = New Font("Helvetica", 8) + chartArea.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.None + chartArea.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot + + If _xMax > _xMin Then + chartArea.AxisX.Minimum = _xMin + chartArea.AxisX.Maximum = _xMax + chartArea.AxisX.Interval = AutoIntervalXAxis() + Else + chartArea.AxisX.Minimum = 0 + chartArea.AxisX.Maximum = _xMax0 + End If + + + If leftaxis.Count > 0 Then + + txt = leftaxis(0) + For i = 1 To leftaxis.Count - 1 + txt &= ", " & leftaxis(i) + Next + + chartArea.AxisY.Title = txt + chartArea.AxisY.TitleFont = New Font("Helvetica", 10) + chartArea.AxisY.LabelStyle.Font = New Font("Helvetica", 8) + chartArea.AxisY.LabelAutoFitStyle = LabelAutoFitStyles.None + + End If + + If rightaxis.Count > 0 Then + + txt = rightaxis(0) + For i = 1 To rightaxis.Count - 1 + txt &= ", " & rightaxis(i) + Next + + chartArea.AxisY2.Title = txt + chartArea.AxisY2.TitleFont = New Font("Helvetica", 10) + chartArea.AxisY2.LabelStyle.Font = New Font("Helvetica", 8) + chartArea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.None + chartArea.AxisY2.MinorGrid.Enabled = False + chartArea.AxisY2.MajorGrid.Enabled = False + + End If + + chartArea.BackColor = Color.GhostWhite + + chartArea.BorderDashStyle = ChartDashStyle.Solid + chartArea.BorderWidth = 1 + + chart.ChartAreas.Add(chartArea) + + With chart.ChartAreas(0) + .Position.X = 0 + .Position.Y = 0 + .Position.Width = 85 + .Position.Height = 100 + End With + + chart.Legends.Add("main") + chart.Legends(0).Font = New Font("Helvetica", 8) + chart.Legends(0).BorderColor = Color.Black + chart.Legends(0).BorderWidth = 1 + chart.Legends(0).Position.X = 86 + chart.Legends(0).Position.Y = 3 + chart.Legends(0).Position.Width = 13 + chart.Legends(0).Position.Height = 40 + + chart.Update() + + Dim img As Bitmap = New Bitmap(chart.Width, chart.Height, PixelFormat.Format32bppArgb) + chart.DrawToBitmap(img, New Rectangle(0, 0, PictureBox1.Width, PictureBox1.Height)) + + PictureBox1.Image = img + End Sub + + Private Function AutoIntervalXAxis() As Double + Dim xyd(3) As Double + Dim xya(3) As Double + Dim i As Int16 + + Dim inv As Double = (_xMax - _xMin) / 10 + + Dim grx As Long = 20 + Do While 10 ^ grx > inv + grx = grx - 1 + Loop + + xyd(0) = 1 * 10 ^ grx + xyd(1) = 2.5 * 10 ^ grx + xyd(2) = 5 * 10 ^ grx + xyd(3) = 10 * 10 ^ grx + For i = 0 To 3 + xya(i) = Math.Abs(inv - xyd(i)) + Next + + Dim xyamin As Double = xya(0) + Dim xydmin As Double = xyd(0) + For i = 1 To 3 + If xya(i) < xyamin Then + xyamin = xya(i) + xydmin = xyd(i) + End If + Next + + 'Intervall speichern + Return xydmin + End Function + + Private Sub Clear() + + _filepath = "" + + ListView1.Items.Clear() + + TbXmin.Text = "" + TbXmax.Text = "" + + PictureBox1.Image = Nothing + End Sub + + + Private Sub BtAddCh_Click(sender As Object, e As EventArgs) Handles BtAddCh.Click + Dim dlog As New GraphEditChannelDialog + Dim i As Integer + Dim lv0 As ListViewItem + + If _channels.Count = 0 Then Exit Sub + + For i = 0 To _channels.Count - 1 + dlog.ComboBox1.Items.Add(_channels(i).Name) + Next + + dlog.RbLeft.Checked = True + + dlog.ComboBox1.SelectedIndex = 0 + + If dlog.ShowDialog = DialogResult.OK Then + lv0 = New ListViewItem + i = dlog.ComboBox1.SelectedIndex + lv0.Text = _channels(i).Name + lv0.Tag = i + lv0.Checked = True + If dlog.RbLeft.Checked Then + lv0.SubItems.Add("Left") + Else + lv0.SubItems.Add("Right") + End If + + ListView1.Items.Add(lv0) + + UpdateGraph() + + End If + End Sub + + Private Sub EditChannel() + Dim dlog As New GraphEditChannelDialog + Dim i As Integer + Dim lv0 As ListViewItem + + If ListView1.SelectedItems.Count = 0 Or _channels.Count = 0 Then Exit Sub + + lv0 = ListView1.SelectedItems(0) + + For i = 0 To _channels.Count - 1 + dlog.ComboBox1.Items.Add(_channels(i).Name) + Next + + If lv0.SubItems(1).Text = "Left" Then + dlog.RbLeft.Checked = True + Else + dlog.RbRight.Checked = True + End If + + dlog.ComboBox1.SelectedIndex = CType(lv0.Tag, Integer) + + If dlog.ShowDialog = DialogResult.OK Then + i = dlog.ComboBox1.SelectedIndex + lv0.Text = _channels(i).Name + lv0.Tag = i + lv0.Checked = True + If dlog.RbLeft.Checked Then + lv0.SubItems(1).Text = "Left" + Else + lv0.SubItems(1).Text = "Right" + End If + + UpdateGraph() + + End If + End Sub + + Private Sub RemoveChannel() + Dim i0 As Integer + + If ListView1.Items.Count = 0 Then Exit Sub + + If ListView1.SelectedItems.Count = 0 Then ListView1.Items(ListView1.Items.Count - 1).Selected = True + + i0 = ListView1.SelectedItems(0).Index + + ListView1.SelectedItems(0).Remove() + + If i0 < ListView1.Items.Count Then + ListView1.Items(i0).Selected = True + ListView1.Items(i0).EnsureVisible() + End If + + UpdateGraph() + End Sub + + Private Sub ListView1_DoubleClick(sender As Object, e As EventArgs) Handles ListView1.DoubleClick + If ListView1.SelectedItems.Count > 0 Then + ListView1.SelectedItems(0).Checked = Not ListView1.SelectedItems(0).Checked + EditChannel() + End If + End Sub + + Private Sub BtRemCh_Click(sender As Object, e As EventArgs) Handles BtRemCh.Click + RemoveChannel() + End Sub + + Private Sub ListView1_ItemChecked(sender As Object, e As ItemCheckedEventArgs) _ + Handles ListView1.ItemChecked + UpdateGraph() + End Sub + + Private Sub ListView1_KeyDown(sender As Object, e As KeyEventArgs) Handles ListView1.KeyDown + Select Case e.KeyCode + Case Keys.Delete, Keys.Back + RemoveChannel() + Case Keys.Enter + EditChannel() + End Select + End Sub + + Private Sub CbXaxis_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles CbXaxis.SelectedIndexChanged + SetxMax0() + TbXmin.Text = 0.ToGUIFormat() + TbXmax.Text = _xMax0.ToGUIFormat() + UpdateGraph() + End Sub + + Private Sub BtReset_Click(sender As Object, e As EventArgs) Handles BtReset.Click + _xMin = 0 + _xMax = _xMax0 + TbXmin.Text = 0.ToGUIFormat() + TbXmax.Text = _xMax0.ToGUIFormat() + End Sub + + Private Sub TbXmin_TextChanged(sender As Object, e As EventArgs) Handles TbXmin.TextChanged + If IsNumeric(TbXmin.Text) Then _xMin = TbXmin.Text.ToDouble() + UpdateGraph() + End Sub + + Private Sub TbXmax_TextChanged(sender As Object, e As EventArgs) Handles TbXmax.TextChanged + If IsNumeric(TbXmax.Text) Then _xMax = TbXmax.Text.ToDouble() + UpdateGraph() + End Sub + + Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click + Dim graph As New GraphForm + graph.Show() + End Sub + + Private Sub F_Graph_SizeChanged(sender As Object, e As EventArgs) Handles Me.SizeChanged + UpdateGraph() + End Sub + + Private Sub BtZoomIn_Click(sender As Object, e As EventArgs) Handles BtZoomIn.Click + Dim d As Double + + d = (_xMax - _xMin) / 10 + + _xMin += 2 * 0.5 * d + _xMax -= 2 * (1 - 0.5) * d + + If _xMin > 1000 Then + _xMin = Math.Round(_xMin / 100, 0) * 100 + Else + _xMin = Math.Round(_xMin, 0) + End If + + TbXmin.Text = _xMin.ToGUIFormat() + TbXmax.Text = _xMax.ToGUIFormat() + End Sub + + Private Sub BtZoomOut_Click(sender As Object, e As EventArgs) Handles BtZoomOut.Click + Dim d As Double + + d = (_xMax - _xMin) / 10 + + _xMin -= 2 * 0.5 * d + _xMax += 2 * (1 - 0.5) * d + + If _xMin > 1000 Then + _xMin = Math.Round(_xMin / 100, 0) * 100 + Else + _xMin = Math.Round(_xMin, 0) + End If + + TbXmin.Text = _xMin.ToGUIFormat() + TbXmax.Text = _xMax.ToGUIFormat() + End Sub + + Private Sub BtMoveL_Click(sender As Object, e As EventArgs) Handles BtMoveL.Click + Dim d As Double + + If _xMin <= 0 Then Exit Sub + + d = (_xMax - _xMin) / 3 + _xMin -= d + _xMax -= d + + If _xMin > 1000 Then + _xMin = Math.Round(_xMin / 100, 0) * 100 + Else + _xMin = Math.Round(_xMin, 0) + End If + + TbXmin.Text = _xMin.ToGUIFormat() + TbXmax.Text = _xMax.ToGUIFormat() + End Sub + + Private Sub BtMoveR_Click(sender As Object, e As EventArgs) Handles BtMoveR.Click + Dim d As Double + + If _xMax >= _xMax0 Then Exit Sub + + d = (_xMax - _xMin) / 3 + _xMin += d + _xMax += d + + If _xMin > 1000 Then + _xMin = Math.Round(_xMin / 100, 0) * 100 + Else + _xMin = Math.Round(_xMin, 0) + End If + + TbXmin.Text = _xMin.ToGUIFormat() + TbXmax.Text = _xMax.ToGUIFormat() + End Sub + + Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click + If File.Exists(MyAppPath & "User Manual\help.html") Then + Dim browserRegistryString As String = + My.Computer.Registry.ClassesRoot.OpenSubKey("\http\shell\open\command\").GetValue("").ToString + Dim defaultBrowserPath As String = + Regex.Match(browserRegistryString, "(\"".*?\"")").Captures(0).ToString + Process.Start(defaultBrowserPath, + String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#graph-window")) + Else + MsgBox("User Manual not found!", MsgBoxStyle.Critical) + End If + End Sub + + Private Class Channel + Public Name As String + Public Values As List(Of String) + End Class End Class \ No newline at end of file diff --git a/VECTO/GUI/MainForm.Designer.vb b/VECTO/GUI/MainForm.Designer.vb index 3493d8c43bb013e8cb856f1e65b29e69b17a6701..74c4c9b3838a7b7c3d2d38c03c2a89a1caec507d 100644 --- a/VECTO/GUI/MainForm.Designer.vb +++ b/VECTO/GUI/MainForm.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/Settings.vb b/VECTO/GUI/Settings.vb index d379733cf07684e89bf0910629d4cbc7c9eddfce..1cffa4472ae3a05569b524dc2635de493cc23421 100644 --- a/VECTO/GUI/Settings.vb +++ b/VECTO/GUI/Settings.vb @@ -1,86 +1,86 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.IO -Imports System.Text.RegularExpressions -Imports TUGraz.VectoCommon.Utils - -''' <summary> -''' Settings form -''' </summary> -''' <remarks></remarks> -Public Class Settings - 'Initialize - load config - Private Sub F03_Options_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load - - LoadSettings() - End Sub - - Private Sub LoadSettings() - - TextBoxLogSize.Text = Cfg.LogSize.ToGUIFormat() - TbAirDensity.Text = CStr(Cfg.AirDensity) - TbOpenCmd.Text = Cfg.OpenCmd - TbOpenCmdName.Text = Cfg.OpenCmdName - TbFuelDens.Text = Cfg.FuelDens.ToString - TbCO2toFC.Text = Cfg.CO2perFC.ToString - - GrCalc.Enabled = Not Cfg.DeclMode - End Sub - - - 'Reset Button - Private Sub ButReset_Click(sender As Object, e As EventArgs) Handles ButReset.Click - If _ - MsgBox( - "This will reset all application settings including the Options Tab. Filehistory will not be deleted." & vbCrLf & - vbCrLf & "Continue ?", MsgBoxStyle.YesNo, "Reset Application Settings") = MsgBoxResult.Yes Then - Cfg.SetDefault() - If Cfg.DeclMode Then Cfg.DeclInit() - MainForm.LoadOptions() - LoadSettings() - Close() - End If - End Sub - - 'Save and close - Private Sub ButtonOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonOK.Click - Cfg.LogSize = CSng(TextBoxLogSize.Text) - Cfg.AirDensity = CSng(TbAirDensity.Text) - Cfg.OpenCmd = TbOpenCmd.Text - Cfg.OpenCmdName = TbOpenCmdName.Text - Cfg.FuelDens = CSng(TbFuelDens.Text) - Cfg.CO2perFC = CSng(TbCO2toFC.Text) - '---------------------------------------------------- - - Cfg.Save() - - Close() - End Sub - - 'Cancel - Private Sub ButtonCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonCancel.Click - Close() - End Sub - - 'Help button - Private Sub BtHelp_Click(sender As Object, e As EventArgs) Handles BtHelp.Click - If File.Exists(MyAppPath & "User Manual\help.html") Then - Dim browserRegistryString As String = - My.Computer.Registry.ClassesRoot.OpenSubKey("\http\shell\open\command\").GetValue("").ToString - Dim defaultBrowserPath As String = - Regex.Match(browserRegistryString, "(\"".*?\"")").Captures(0).ToString - Process.Start(defaultBrowserPath, - String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#settings")) - Else - MsgBox("User Manual not found!", MsgBoxStyle.Critical) - End If - End Sub -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.IO +Imports System.Text.RegularExpressions +Imports TUGraz.VectoCommon.Utils + +''' <summary> +''' Settings form +''' </summary> +''' <remarks></remarks> +Public Class Settings + 'Initialize - load config + Private Sub F03_Options_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load + + LoadSettings() + End Sub + + Private Sub LoadSettings() + + TextBoxLogSize.Text = Cfg.LogSize.ToGUIFormat() + TbAirDensity.Text = CStr(Cfg.AirDensity) + TbOpenCmd.Text = Cfg.OpenCmd + TbOpenCmdName.Text = Cfg.OpenCmdName + TbFuelDens.Text = Cfg.FuelDens.ToString + TbCO2toFC.Text = Cfg.CO2perFC.ToString + + GrCalc.Enabled = Not Cfg.DeclMode + End Sub + + + 'Reset Button + Private Sub ButReset_Click(sender As Object, e As EventArgs) Handles ButReset.Click + If _ + MsgBox( + "This will reset all application settings including the Options Tab. Filehistory will not be deleted." & vbCrLf & + vbCrLf & "Continue ?", MsgBoxStyle.YesNo, "Reset Application Settings") = MsgBoxResult.Yes Then + Cfg.SetDefault() + If Cfg.DeclMode Then Cfg.DeclInit() + MainForm.LoadOptions() + LoadSettings() + Close() + End If + End Sub + + 'Save and close + Private Sub ButtonOK_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonOK.Click + Cfg.LogSize = CSng(TextBoxLogSize.Text) + Cfg.AirDensity = CSng(TbAirDensity.Text) + Cfg.OpenCmd = TbOpenCmd.Text + Cfg.OpenCmdName = TbOpenCmdName.Text + Cfg.FuelDens = CSng(TbFuelDens.Text) + Cfg.CO2perFC = CSng(TbCO2toFC.Text) + '---------------------------------------------------- + + Cfg.Save() + + Close() + End Sub + + 'Cancel + Private Sub ButtonCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonCancel.Click + Close() + End Sub + + 'Help button + Private Sub BtHelp_Click(sender As Object, e As EventArgs) Handles BtHelp.Click + If File.Exists(MyAppPath & "User Manual\help.html") Then + Dim browserRegistryString As String = + My.Computer.Registry.ClassesRoot.OpenSubKey("\http\shell\open\command\").GetValue("").ToString + Dim defaultBrowserPath As String = + Regex.Match(browserRegistryString, "(\"".*?\"")").Captures(0).ToString + Process.Start(defaultBrowserPath, + String.Format("""{0}{1}""", MyAppPath, "User Manual\help.html#settings")) + Else + MsgBox("User Manual not found!", MsgBoxStyle.Critical) + End If + End Sub +End Class diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index ce2b03abbdff27287b6d501d5b4ca3e3e34dea92..e7e141275ad00f1431a97c1e07f8776fd0e7fb2b 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb b/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb index 137a529a43d8f76a68a0a058d82ef90323bfcdbb..97cf4ee37111f44c3ac9afce230b3039bb86b663 100644 --- a/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb +++ b/VECTO/GUI/VehicleAuxiliariesDialog.Designer.vb @@ -1,317 +1,317 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.ComponentModel -Imports Microsoft.VisualBasic.CompilerServices -Imports TUGraz.VECTO.My.Resources - -<DesignerGenerated()> _ -Partial Class VehicleAuxiliariesDialog - Inherits Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - <DebuggerNonUserCode()> _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - <DebuggerStepThrough()> _ - Private Sub InitializeComponent() - Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() - Me.OK_Button = New System.Windows.Forms.Button() - Me.Cancel_Button = New System.Windows.Forms.Button() - Me.Label1 = New System.Windows.Forms.Label() - Me.Label2 = New System.Windows.Forms.Label() - Me.Label3 = New System.Windows.Forms.Label() - Me.TbID = New System.Windows.Forms.TextBox() - Me.TbPath = New System.Windows.Forms.TextBox() - Me.BtBrowse = New System.Windows.Forms.Button() - Me.CbType = New System.Windows.Forms.ComboBox() - Me.LbIDhelp = New System.Windows.Forms.Label() - Me.Label4 = New System.Windows.Forms.Label() - Me.CbTech = New System.Windows.Forms.ComboBox() - Me.PnTech = New System.Windows.Forms.Panel() - Me.LbAxl4 = New System.Windows.Forms.Label() - Me.LbAxl3 = New System.Windows.Forms.Label() - Me.lbAxl2 = New System.Windows.Forms.Label() - Me.CbTech4 = New System.Windows.Forms.ComboBox() - Me.CbTech3 = New System.Windows.Forms.ComboBox() - Me.CbTech2 = New System.Windows.Forms.ComboBox() - Me.PnFile = New System.Windows.Forms.Panel() - Me.TableLayoutPanel1.SuspendLayout() - Me.PnTech.SuspendLayout() - Me.PnFile.SuspendLayout() - Me.SuspendLayout() - ' - 'TableLayoutPanel1 - ' - Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TableLayoutPanel1.ColumnCount = 2 - Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) - Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New System.Drawing.Point(301, 133) - Me.TableLayoutPanel1.Name = "TableLayoutPanel1" - Me.TableLayoutPanel1.RowCount = 1 - Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) - Me.TableLayoutPanel1.TabIndex = 25 - ' - 'OK_Button - ' - Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None - Me.OK_Button.DialogResult = System.Windows.Forms.DialogResult.OK - Me.OK_Button.Location = New System.Drawing.Point(3, 3) - Me.OK_Button.Name = "OK_Button" - Me.OK_Button.Size = New System.Drawing.Size(67, 23) - Me.OK_Button.TabIndex = 0 - Me.OK_Button.Text = "OK" - ' - 'Cancel_Button - ' - Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None - Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) - Me.Cancel_Button.Name = "Cancel_Button" - Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) - Me.Cancel_Button.TabIndex = 1 - Me.Cancel_Button.Text = "Cancel" - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(171, 10) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(18, 13) - Me.Label1.TabIndex = 1 - Me.Label1.Text = "ID" - ' - 'Label2 - ' - Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(9, 10) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(31, 13) - Me.Label2.TabIndex = 1 - Me.Label2.Text = "Type" - ' - 'Label3 - ' - Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(7, 39) - Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(50, 13) - Me.Label3.TabIndex = 1 - Me.Label3.Text = "Input File" - ' - 'TbID - ' - Me.TbID.Location = New System.Drawing.Point(195, 7) - Me.TbID.Name = "TbID" - Me.TbID.ReadOnly = True - Me.TbID.Size = New System.Drawing.Size(39, 20) - Me.TbID.TabIndex = 5 - ' - 'TbPath - ' - Me.TbPath.Location = New System.Drawing.Point(7, 55) - Me.TbPath.Name = "TbPath" - Me.TbPath.Size = New System.Drawing.Size(401, 20) - Me.TbPath.TabIndex = 10 - ' - 'BtBrowse - ' - Me.BtBrowse.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon - Me.BtBrowse.Location = New System.Drawing.Point(408, 53) - Me.BtBrowse.Name = "BtBrowse" - Me.BtBrowse.Size = New System.Drawing.Size(24, 24) - Me.BtBrowse.TabIndex = 15 - Me.BtBrowse.UseVisualStyleBackColor = True - ' - 'CbType - ' - Me.CbType.FormattingEnabled = True - Me.CbType.Location = New System.Drawing.Point(46, 7) - Me.CbType.Name = "CbType" - Me.CbType.Size = New System.Drawing.Size(109, 21) - Me.CbType.TabIndex = 0 - ' - 'LbIDhelp - ' - Me.LbIDhelp.AutoSize = True - Me.LbIDhelp.Location = New System.Drawing.Point(240, 10) - Me.LbIDhelp.Name = "LbIDhelp" - Me.LbIDhelp.Size = New System.Drawing.Size(0, 13) - Me.LbIDhelp.TabIndex = 26 - ' - 'Label4 - ' - Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(6, 9) - Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(63, 13) - Me.Label4.TabIndex = 1 - Me.Label4.Text = "Technology" - ' - 'CbTech - ' - Me.CbTech.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.CbTech.FormattingEnabled = True - Me.CbTech.Location = New System.Drawing.Point(75, 6) - Me.CbTech.Name = "CbTech" - Me.CbTech.Size = New System.Drawing.Size(352, 21) - Me.CbTech.TabIndex = 27 - ' - 'PnTech - ' - Me.PnTech.Controls.Add(Me.LbAxl4) - Me.PnTech.Controls.Add(Me.LbAxl3) - Me.PnTech.Controls.Add(Me.lbAxl2) - Me.PnTech.Controls.Add(Me.CbTech4) - Me.PnTech.Controls.Add(Me.CbTech3) - Me.PnTech.Controls.Add(Me.CbTech2) - Me.PnTech.Controls.Add(Me.CbTech) - Me.PnTech.Controls.Add(Me.Label4) - Me.PnTech.Location = New System.Drawing.Point(12, 12) - Me.PnTech.Name = "PnTech" - Me.PnTech.Size = New System.Drawing.Size(435, 119) - Me.PnTech.TabIndex = 28 - ' - 'LbAxl4 - ' - Me.LbAxl4.AutoSize = True - Me.LbAxl4.Location = New System.Drawing.Point(30, 90) - Me.LbAxl4.Name = "LbAxl4" - Me.LbAxl4.Size = New System.Drawing.Size(39, 13) - Me.LbAxl4.TabIndex = 33 - Me.LbAxl4.Text = "4. Axle" - ' - 'LbAxl3 - ' - Me.LbAxl3.AutoSize = True - Me.LbAxl3.Location = New System.Drawing.Point(30, 63) - Me.LbAxl3.Name = "LbAxl3" - Me.LbAxl3.Size = New System.Drawing.Size(39, 13) - Me.LbAxl3.TabIndex = 32 - Me.LbAxl3.Text = "3. Axle" - ' - 'lbAxl2 - ' - Me.lbAxl2.AutoSize = True - Me.lbAxl2.Location = New System.Drawing.Point(30, 36) - Me.lbAxl2.Name = "lbAxl2" - Me.lbAxl2.Size = New System.Drawing.Size(39, 13) - Me.lbAxl2.TabIndex = 31 - Me.lbAxl2.Text = "2. Axle" - ' - 'CbTech4 - ' - Me.CbTech4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.CbTech4.FormattingEnabled = True - Me.CbTech4.Location = New System.Drawing.Point(75, 87) - Me.CbTech4.Name = "CbTech4" - Me.CbTech4.Size = New System.Drawing.Size(352, 21) - Me.CbTech4.TabIndex = 30 - ' - 'CbTech3 - ' - Me.CbTech3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.CbTech3.FormattingEnabled = True - Me.CbTech3.Location = New System.Drawing.Point(75, 60) - Me.CbTech3.Name = "CbTech3" - Me.CbTech3.Size = New System.Drawing.Size(352, 21) - Me.CbTech3.TabIndex = 29 - ' - 'CbTech2 - ' - Me.CbTech2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.CbTech2.FormattingEnabled = True - Me.CbTech2.Location = New System.Drawing.Point(75, 33) - Me.CbTech2.Name = "CbTech2" - Me.CbTech2.Size = New System.Drawing.Size(352, 21) - Me.CbTech2.TabIndex = 28 - ' - 'PnFile - ' - Me.PnFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.PnFile.Controls.Add(Me.LbIDhelp) - Me.PnFile.Controls.Add(Me.BtBrowse) - Me.PnFile.Controls.Add(Me.CbType) - Me.PnFile.Controls.Add(Me.TbID) - Me.PnFile.Controls.Add(Me.TbPath) - Me.PnFile.Controls.Add(Me.Label2) - Me.PnFile.Controls.Add(Me.Label3) - Me.PnFile.Controls.Add(Me.Label1) - Me.PnFile.Location = New System.Drawing.Point(12, 12) - Me.PnFile.Name = "PnFile" - Me.PnFile.Size = New System.Drawing.Size(435, 118) - Me.PnFile.TabIndex = 29 - ' - 'VehicleAuxiliariesDialog - ' - Me.AcceptButton = Me.OK_Button - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(459, 174) - Me.Controls.Add(Me.PnFile) - Me.Controls.Add(Me.PnTech) - Me.Controls.Add(Me.TableLayoutPanel1) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "VehicleAuxiliariesDialog" - Me.ShowInTaskbar = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Auxiliary" - Me.TableLayoutPanel1.ResumeLayout(False) - Me.PnTech.ResumeLayout(False) - Me.PnTech.PerformLayout() - Me.PnFile.ResumeLayout(False) - Me.PnFile.PerformLayout() - Me.ResumeLayout(False) - - End Sub - Friend WithEvents TableLayoutPanel1 As TableLayoutPanel - Friend WithEvents OK_Button As Button - Friend WithEvents Cancel_Button As Button - Friend WithEvents Label1 As Label - Friend WithEvents Label2 As Label - Friend WithEvents Label3 As Label - Friend WithEvents TbID As TextBox - Friend WithEvents TbPath As TextBox - Friend WithEvents BtBrowse As Button - Friend WithEvents CbType As ComboBox - Friend WithEvents LbIDhelp As Label - Friend WithEvents Label4 As Label - Friend WithEvents CbTech As ComboBox - Friend WithEvents PnTech As Panel - Friend WithEvents PnFile As Panel - Friend WithEvents CbTech4 As System.Windows.Forms.ComboBox - Friend WithEvents CbTech3 As System.Windows.Forms.ComboBox - Friend WithEvents CbTech2 As System.Windows.Forms.ComboBox - Friend WithEvents LbAxl4 As System.Windows.Forms.Label - Friend WithEvents LbAxl3 As System.Windows.Forms.Label - Friend WithEvents lbAxl2 As System.Windows.Forms.Label - -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.ComponentModel +Imports Microsoft.VisualBasic.CompilerServices +Imports TUGraz.VECTO.My.Resources + +<DesignerGenerated()> _ +Partial Class VehicleAuxiliariesDialog + Inherits Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.OK_Button = New System.Windows.Forms.Button() + Me.Cancel_Button = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.TbID = New System.Windows.Forms.TextBox() + Me.TbPath = New System.Windows.Forms.TextBox() + Me.BtBrowse = New System.Windows.Forms.Button() + Me.CbType = New System.Windows.Forms.ComboBox() + Me.LbIDhelp = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.CbTech = New System.Windows.Forms.ComboBox() + Me.PnTech = New System.Windows.Forms.Panel() + Me.LbAxl4 = New System.Windows.Forms.Label() + Me.LbAxl3 = New System.Windows.Forms.Label() + Me.lbAxl2 = New System.Windows.Forms.Label() + Me.CbTech4 = New System.Windows.Forms.ComboBox() + Me.CbTech3 = New System.Windows.Forms.ComboBox() + Me.CbTech2 = New System.Windows.Forms.ComboBox() + Me.PnFile = New System.Windows.Forms.Panel() + Me.TableLayoutPanel1.SuspendLayout() + Me.PnTech.SuspendLayout() + Me.PnFile.SuspendLayout() + Me.SuspendLayout() + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TableLayoutPanel1.ColumnCount = 2 + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) + Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(301, 133) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 1 + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) + Me.TableLayoutPanel1.TabIndex = 25 + ' + 'OK_Button + ' + Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.OK_Button.DialogResult = System.Windows.Forms.DialogResult.OK + Me.OK_Button.Location = New System.Drawing.Point(3, 3) + Me.OK_Button.Name = "OK_Button" + Me.OK_Button.Size = New System.Drawing.Size(67, 23) + Me.OK_Button.TabIndex = 0 + Me.OK_Button.Text = "OK" + ' + 'Cancel_Button + ' + Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) + Me.Cancel_Button.Name = "Cancel_Button" + Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) + Me.Cancel_Button.TabIndex = 1 + Me.Cancel_Button.Text = "Cancel" + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(171, 10) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(18, 13) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "ID" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(9, 10) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(31, 13) + Me.Label2.TabIndex = 1 + Me.Label2.Text = "Type" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(7, 39) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(50, 13) + Me.Label3.TabIndex = 1 + Me.Label3.Text = "Input File" + ' + 'TbID + ' + Me.TbID.Location = New System.Drawing.Point(195, 7) + Me.TbID.Name = "TbID" + Me.TbID.ReadOnly = True + Me.TbID.Size = New System.Drawing.Size(39, 20) + Me.TbID.TabIndex = 5 + ' + 'TbPath + ' + Me.TbPath.Location = New System.Drawing.Point(7, 55) + Me.TbPath.Name = "TbPath" + Me.TbPath.Size = New System.Drawing.Size(401, 20) + Me.TbPath.TabIndex = 10 + ' + 'BtBrowse + ' + Me.BtBrowse.Image = Global.TUGraz.VECTO.My.Resources.Resources.Open_icon + Me.BtBrowse.Location = New System.Drawing.Point(408, 53) + Me.BtBrowse.Name = "BtBrowse" + Me.BtBrowse.Size = New System.Drawing.Size(24, 24) + Me.BtBrowse.TabIndex = 15 + Me.BtBrowse.UseVisualStyleBackColor = True + ' + 'CbType + ' + Me.CbType.FormattingEnabled = True + Me.CbType.Location = New System.Drawing.Point(46, 7) + Me.CbType.Name = "CbType" + Me.CbType.Size = New System.Drawing.Size(109, 21) + Me.CbType.TabIndex = 0 + ' + 'LbIDhelp + ' + Me.LbIDhelp.AutoSize = True + Me.LbIDhelp.Location = New System.Drawing.Point(240, 10) + Me.LbIDhelp.Name = "LbIDhelp" + Me.LbIDhelp.Size = New System.Drawing.Size(0, 13) + Me.LbIDhelp.TabIndex = 26 + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(6, 9) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(63, 13) + Me.Label4.TabIndex = 1 + Me.Label4.Text = "Technology" + ' + 'CbTech + ' + Me.CbTech.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech.FormattingEnabled = True + Me.CbTech.Location = New System.Drawing.Point(75, 6) + Me.CbTech.Name = "CbTech" + Me.CbTech.Size = New System.Drawing.Size(352, 21) + Me.CbTech.TabIndex = 27 + ' + 'PnTech + ' + Me.PnTech.Controls.Add(Me.LbAxl4) + Me.PnTech.Controls.Add(Me.LbAxl3) + Me.PnTech.Controls.Add(Me.lbAxl2) + Me.PnTech.Controls.Add(Me.CbTech4) + Me.PnTech.Controls.Add(Me.CbTech3) + Me.PnTech.Controls.Add(Me.CbTech2) + Me.PnTech.Controls.Add(Me.CbTech) + Me.PnTech.Controls.Add(Me.Label4) + Me.PnTech.Location = New System.Drawing.Point(12, 12) + Me.PnTech.Name = "PnTech" + Me.PnTech.Size = New System.Drawing.Size(435, 119) + Me.PnTech.TabIndex = 28 + ' + 'LbAxl4 + ' + Me.LbAxl4.AutoSize = True + Me.LbAxl4.Location = New System.Drawing.Point(30, 90) + Me.LbAxl4.Name = "LbAxl4" + Me.LbAxl4.Size = New System.Drawing.Size(39, 13) + Me.LbAxl4.TabIndex = 33 + Me.LbAxl4.Text = "4. Axle" + ' + 'LbAxl3 + ' + Me.LbAxl3.AutoSize = True + Me.LbAxl3.Location = New System.Drawing.Point(30, 63) + Me.LbAxl3.Name = "LbAxl3" + Me.LbAxl3.Size = New System.Drawing.Size(39, 13) + Me.LbAxl3.TabIndex = 32 + Me.LbAxl3.Text = "3. Axle" + ' + 'lbAxl2 + ' + Me.lbAxl2.AutoSize = True + Me.lbAxl2.Location = New System.Drawing.Point(30, 36) + Me.lbAxl2.Name = "lbAxl2" + Me.lbAxl2.Size = New System.Drawing.Size(39, 13) + Me.lbAxl2.TabIndex = 31 + Me.lbAxl2.Text = "2. Axle" + ' + 'CbTech4 + ' + Me.CbTech4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech4.FormattingEnabled = True + Me.CbTech4.Location = New System.Drawing.Point(75, 87) + Me.CbTech4.Name = "CbTech4" + Me.CbTech4.Size = New System.Drawing.Size(352, 21) + Me.CbTech4.TabIndex = 30 + ' + 'CbTech3 + ' + Me.CbTech3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech3.FormattingEnabled = True + Me.CbTech3.Location = New System.Drawing.Point(75, 60) + Me.CbTech3.Name = "CbTech3" + Me.CbTech3.Size = New System.Drawing.Size(352, 21) + Me.CbTech3.TabIndex = 29 + ' + 'CbTech2 + ' + Me.CbTech2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.CbTech2.FormattingEnabled = True + Me.CbTech2.Location = New System.Drawing.Point(75, 33) + Me.CbTech2.Name = "CbTech2" + Me.CbTech2.Size = New System.Drawing.Size(352, 21) + Me.CbTech2.TabIndex = 28 + ' + 'PnFile + ' + Me.PnFile.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.PnFile.Controls.Add(Me.LbIDhelp) + Me.PnFile.Controls.Add(Me.BtBrowse) + Me.PnFile.Controls.Add(Me.CbType) + Me.PnFile.Controls.Add(Me.TbID) + Me.PnFile.Controls.Add(Me.TbPath) + Me.PnFile.Controls.Add(Me.Label2) + Me.PnFile.Controls.Add(Me.Label3) + Me.PnFile.Controls.Add(Me.Label1) + Me.PnFile.Location = New System.Drawing.Point(12, 12) + Me.PnFile.Name = "PnFile" + Me.PnFile.Size = New System.Drawing.Size(435, 118) + Me.PnFile.TabIndex = 29 + ' + 'VehicleAuxiliariesDialog + ' + Me.AcceptButton = Me.OK_Button + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.CancelButton = Me.Cancel_Button + Me.ClientSize = New System.Drawing.Size(459, 174) + Me.Controls.Add(Me.PnFile) + Me.Controls.Add(Me.PnTech) + Me.Controls.Add(Me.TableLayoutPanel1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "VehicleAuxiliariesDialog" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Auxiliary" + Me.TableLayoutPanel1.ResumeLayout(False) + Me.PnTech.ResumeLayout(False) + Me.PnTech.PerformLayout() + Me.PnFile.ResumeLayout(False) + Me.PnFile.PerformLayout() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents TableLayoutPanel1 As TableLayoutPanel + Friend WithEvents OK_Button As Button + Friend WithEvents Cancel_Button As Button + Friend WithEvents Label1 As Label + Friend WithEvents Label2 As Label + Friend WithEvents Label3 As Label + Friend WithEvents TbID As TextBox + Friend WithEvents TbPath As TextBox + Friend WithEvents BtBrowse As Button + Friend WithEvents CbType As ComboBox + Friend WithEvents LbIDhelp As Label + Friend WithEvents Label4 As Label + Friend WithEvents CbTech As ComboBox + Friend WithEvents PnTech As Panel + Friend WithEvents PnFile As Panel + Friend WithEvents CbTech4 As System.Windows.Forms.ComboBox + Friend WithEvents CbTech3 As System.Windows.Forms.ComboBox + Friend WithEvents CbTech2 As System.Windows.Forms.ComboBox + Friend WithEvents LbAxl4 As System.Windows.Forms.Label + Friend WithEvents LbAxl3 As System.Windows.Forms.Label + Friend WithEvents lbAxl2 As System.Windows.Forms.Label + +End Class diff --git a/VECTO/GUI/VehicleAuxiliariesDialog.vb b/VECTO/GUI/VehicleAuxiliariesDialog.vb index aaf385dc1592937f2ccbbf16aacca28894a87c2d..b4bda4ff618b661e440fcd557289b4741435ee1c 100644 --- a/VECTO/GUI/VehicleAuxiliariesDialog.vb +++ b/VECTO/GUI/VehicleAuxiliariesDialog.vb @@ -1,190 +1,190 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Option Infer On - -Imports System.Linq -Imports System.Windows.Forms -Imports TUGraz.VectoCommon.Models -Imports TUGraz.VectoCommon.Utils -Imports TUGraz.VectoCore.Models.Declaration - - -''' <summary> -''' Aux Config Editor (Job Editor sub-dialog) -''' </summary> -Public Class VehicleAuxiliariesDialog - Public VehPath As String = "" - Public NumAxles As Integer - Public Const AxleNotSteered As String = "Not steered" - - Public Sub New() - InitializeComponent() - - CbType.DisplayMember = "Caption" - CbType.ValueMember = "Value" - - CbType.DataSource = - [Enum].GetValues(GetType(AuxiliaryType)).Cast(Of AuxiliaryType).Select( - Function(x) New With {Key .Caption = x.Name(), .Value = x.Key}).toarray() - - 'CbType.Items.Add("Fan") - 'CbType.Items.Add("Steering pump") - 'CbType.Items.Add("HVAC") - 'CbType.Items.Add("Electric System") - PnTech.Visible = Cfg.DeclMode - PnFile.Visible = Not Cfg.DeclMode - - CbTech.DisplayMember = "Caption" - CbTech.ValueMember = "Value" - CbTech2.DisplayMember = "Caption" - CbTech2.ValueMember = "Value" - CbTech3.DisplayMember = "Caption" - CbTech3.ValueMember = "Value" - CbTech4.DisplayMember = "Caption" - CbTech4.ValueMember = "Value" - End Sub - - 'Initialise form - Private Sub F_VEH_AuxDlog_Load(sender As Object, e As EventArgs) Handles Me.Load - Text = CbType.Text - End Sub - - 'Set generic values for Declaration mode - Private Sub DeclInit() - - CbTech2.Visible = NumAxles > 1 - CbTech3.Visible = NumAxles > 2 - CbTech4.Visible = NumAxles > 3 - lbAxl2.Visible = NumAxles > 1 - LbAxl3.Visible = NumAxles > 2 - LbAxl4.Visible = NumAxles > 3 - - If CbType.SelectedItem Is Nothing Then Exit Sub - - Select Case CbType.SelectedValue.ToString() - Case VectoCore.Configuration.Constants.Auxiliaries.IDs.Fan - CbTech.DataSource = - DeclarationData.Fan.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - Case VectoCore.Configuration.Constants.Auxiliaries.IDs.SteeringPump - Dim notSteered = (New String() {AxleNotSteered}).Concat(DeclarationData.SteeringPump.GetTechnologies()).ToArray() - CbTech.DataSource = - DeclarationData.SteeringPump.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - - CbTech2.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - CbTech3.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - CbTech4.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - Case VectoCore.Configuration.Constants.Auxiliaries.IDs.HeatingVentilationAirCondition - CbTech.DataSource = - DeclarationData.HeatingVentilationAirConditioning.GetTechnologies().Select( - Function(x) New With {.Caption = x, .Value = x}).ToArray() - Case VectoCore.Configuration.Constants.Auxiliaries.IDs.ElectricSystem - CbTech.DataSource = - DeclarationData.ElectricSystem.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - Case VectoCore.Configuration.Constants.Auxiliaries.IDs.PneumaticSystem - CbTech.DataSource = - DeclarationData.PneumaticSystem.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() - End Select - If CbTech.Items.Count > 0 Then - 'CbTech.SelectedIndex = 0 - PnTech.Enabled = True - Else - PnTech.Enabled = False - End If - End Sub - - 'Close form. Check if form is complete and valid - Private Sub F_VEH_AuxDlog_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - 'If e.CloseReason <> CloseReason.WindowsShutDown And DialogResult <> DialogResult.Cancel Then - - ' If Trim(TbID.Text) = "" Or Trim(CbType.Text) = "" Then - ' MsgBox("Form is incomplete!", MsgBoxStyle.Critical) - ' e.Cancel = True - ' End If - - ' If TbID.Text.Contains(",") Or CbType.Text.Contains(",") Or TbPath.Text.Contains(",") Then - ' MsgBox("',' is no valid character!", MsgBoxStyle.Critical) - ' e.Cancel = True - ' End If - - ' If Cfg.DeclMode Then - - ' If CbTech.Items.Count > 0 AndAlso CbTech.Text = "" Then - ' MsgBox("Form is incomplete!", MsgBoxStyle.Critical) - ' e.Cancel = True - ' End If - - ' Else - - ' If Trim(TbPath.Text) = "" Then - ' MsgBox("Form is incomplete!", MsgBoxStyle.Critical) - ' e.Cancel = True - ' End If - - ' End If - - 'End If - End Sub - - 'Browse for .vaux files - Private Sub BtBrowse_Click(sender As Object, e As EventArgs) Handles BtBrowse.Click - If AuxFileBrowser.OpenDialog(FileRepl(TbPath.Text, VehPath)) Then _ - TbPath.Text = GetFilenameWithoutDirectory(AuxFileBrowser.Files(0), VehPath) - End Sub - - 'Update ID when Aux Type was changed - Private Sub CbType_TextChanged(sender As Object, e As EventArgs) Handles CbType.TextChanged - - If CbType.Text = "" Then - TbID.Text = "" - Else - TbID.Text = CbType.SelectedValue.ToString() - 'If Cfg.DeclMode Then - ' 'Select Case CbType.SelectedIndex - ' ' Case 0 - ' ' TbID.Text = VectoCore.Configuration.Constants.Auxiliaries.IDs.Fan - ' ' Case 1 - ' ' TbID.Text = VectoCore.Configuration.Constants.Auxiliaries.IDs.SteeringPump - - ' ' Case Else '2 - ' ' TbID.Text = VectoCore.Configuration.Constants.Auxiliaries.IDs.HeatingVentilationAirCondition - - ' 'End Select - 'Else - ' 'TbID.Text = Trim(UCase(CbType.Text.Substring(0, CInt(Math.Min(CbType.Text.Length, 3))))) - 'End If - End If - End Sub - - 'Update help label if ID was changed - Private Sub TbID_TextChanged(sender As Object, e As EventArgs) Handles TbID.TextChanged - - DeclInit() - - If Trim(TbID.Text) = "" Or Cfg.DeclMode Then - LbIDhelp.Text = "" - Else - LbIDhelp.Text = String.Format("Header in Driving cycle: <AUX_{0}>", Trim(TbID.Text)) - End If - End Sub - - Private Sub CbTech_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech.SelectedIndexChanged - End Sub - - Private Sub CbTech2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech2.SelectedIndexChanged - CbTech3.Enabled = Not (CbTech2.SelectedValue.ToString() = AxleNotSteered) - If Not CbTech3.Enabled Then CbTech3.SelectedValue = AxleNotSteered - End Sub - - Private Sub CbTech3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech3.SelectedIndexChanged - CbTech4.Enabled = Not (CbTech3.SelectedValue.ToString() = AxleNotSteered) - If Not CbTech4.Enabled Then CbTech4.SelectedValue = AxleNotSteered - End Sub -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Option Infer On + +Imports System.Linq +Imports System.Windows.Forms +Imports TUGraz.VectoCommon.Models +Imports TUGraz.VectoCommon.Utils +Imports TUGraz.VectoCore.Models.Declaration + + +''' <summary> +''' Aux Config Editor (Job Editor sub-dialog) +''' </summary> +Public Class VehicleAuxiliariesDialog + Public VehPath As String = "" + Public NumAxles As Integer + Public Const AxleNotSteered As String = "Not steered" + + Public Sub New() + InitializeComponent() + + CbType.DisplayMember = "Caption" + CbType.ValueMember = "Value" + + CbType.DataSource = + [Enum].GetValues(GetType(AuxiliaryType)).Cast(Of AuxiliaryType).Select( + Function(x) New With {Key .Caption = x.Name(), .Value = x.Key}).toarray() + + 'CbType.Items.Add("Fan") + 'CbType.Items.Add("Steering pump") + 'CbType.Items.Add("HVAC") + 'CbType.Items.Add("Electric System") + PnTech.Visible = Cfg.DeclMode + PnFile.Visible = Not Cfg.DeclMode + + CbTech.DisplayMember = "Caption" + CbTech.ValueMember = "Value" + CbTech2.DisplayMember = "Caption" + CbTech2.ValueMember = "Value" + CbTech3.DisplayMember = "Caption" + CbTech3.ValueMember = "Value" + CbTech4.DisplayMember = "Caption" + CbTech4.ValueMember = "Value" + End Sub + + 'Initialise form + Private Sub F_VEH_AuxDlog_Load(sender As Object, e As EventArgs) Handles Me.Load + Text = CbType.Text + End Sub + + 'Set generic values for Declaration mode + Private Sub DeclInit() + + CbTech2.Visible = NumAxles > 1 + CbTech3.Visible = NumAxles > 2 + CbTech4.Visible = NumAxles > 3 + lbAxl2.Visible = NumAxles > 1 + LbAxl3.Visible = NumAxles > 2 + LbAxl4.Visible = NumAxles > 3 + + If CbType.SelectedItem Is Nothing Then Exit Sub + + Select Case CbType.SelectedValue.ToString() + Case VectoCore.Configuration.Constants.Auxiliaries.IDs.Fan + CbTech.DataSource = + DeclarationData.Fan.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + Case VectoCore.Configuration.Constants.Auxiliaries.IDs.SteeringPump + Dim notSteered = (New String() {AxleNotSteered}).Concat(DeclarationData.SteeringPump.GetTechnologies()).ToArray() + CbTech.DataSource = + DeclarationData.SteeringPump.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + + CbTech2.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + CbTech3.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + CbTech4.DataSource = notSteered.Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + Case VectoCore.Configuration.Constants.Auxiliaries.IDs.HeatingVentilationAirCondition + CbTech.DataSource = + DeclarationData.HeatingVentilationAirConditioning.GetTechnologies().Select( + Function(x) New With {.Caption = x, .Value = x}).ToArray() + Case VectoCore.Configuration.Constants.Auxiliaries.IDs.ElectricSystem + CbTech.DataSource = + DeclarationData.ElectricSystem.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + Case VectoCore.Configuration.Constants.Auxiliaries.IDs.PneumaticSystem + CbTech.DataSource = + DeclarationData.PneumaticSystem.GetTechnologies().Select(Function(x) New With {.Caption = x, .Value = x}).ToArray() + End Select + If CbTech.Items.Count > 0 Then + 'CbTech.SelectedIndex = 0 + PnTech.Enabled = True + Else + PnTech.Enabled = False + End If + End Sub + + 'Close form. Check if form is complete and valid + Private Sub F_VEH_AuxDlog_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing + 'If e.CloseReason <> CloseReason.WindowsShutDown And DialogResult <> DialogResult.Cancel Then + + ' If Trim(TbID.Text) = "" Or Trim(CbType.Text) = "" Then + ' MsgBox("Form is incomplete!", MsgBoxStyle.Critical) + ' e.Cancel = True + ' End If + + ' If TbID.Text.Contains(",") Or CbType.Text.Contains(",") Or TbPath.Text.Contains(",") Then + ' MsgBox("',' is no valid character!", MsgBoxStyle.Critical) + ' e.Cancel = True + ' End If + + ' If Cfg.DeclMode Then + + ' If CbTech.Items.Count > 0 AndAlso CbTech.Text = "" Then + ' MsgBox("Form is incomplete!", MsgBoxStyle.Critical) + ' e.Cancel = True + ' End If + + ' Else + + ' If Trim(TbPath.Text) = "" Then + ' MsgBox("Form is incomplete!", MsgBoxStyle.Critical) + ' e.Cancel = True + ' End If + + ' End If + + 'End If + End Sub + + 'Browse for .vaux files + Private Sub BtBrowse_Click(sender As Object, e As EventArgs) Handles BtBrowse.Click + If AuxFileBrowser.OpenDialog(FileRepl(TbPath.Text, VehPath)) Then _ + TbPath.Text = GetFilenameWithoutDirectory(AuxFileBrowser.Files(0), VehPath) + End Sub + + 'Update ID when Aux Type was changed + Private Sub CbType_TextChanged(sender As Object, e As EventArgs) Handles CbType.TextChanged + + If CbType.Text = "" Then + TbID.Text = "" + Else + TbID.Text = CbType.SelectedValue.ToString() + 'If Cfg.DeclMode Then + ' 'Select Case CbType.SelectedIndex + ' ' Case 0 + ' ' TbID.Text = VectoCore.Configuration.Constants.Auxiliaries.IDs.Fan + ' ' Case 1 + ' ' TbID.Text = VectoCore.Configuration.Constants.Auxiliaries.IDs.SteeringPump + + ' ' Case Else '2 + ' ' TbID.Text = VectoCore.Configuration.Constants.Auxiliaries.IDs.HeatingVentilationAirCondition + + ' 'End Select + 'Else + ' 'TbID.Text = Trim(UCase(CbType.Text.Substring(0, CInt(Math.Min(CbType.Text.Length, 3))))) + 'End If + End If + End Sub + + 'Update help label if ID was changed + Private Sub TbID_TextChanged(sender As Object, e As EventArgs) Handles TbID.TextChanged + + DeclInit() + + If Trim(TbID.Text) = "" Or Cfg.DeclMode Then + LbIDhelp.Text = "" + Else + LbIDhelp.Text = String.Format("Header in Driving cycle: <AUX_{0}>", Trim(TbID.Text)) + End If + End Sub + + Private Sub CbTech_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech.SelectedIndexChanged + End Sub + + Private Sub CbTech2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech2.SelectedIndexChanged + CbTech3.Enabled = Not (CbTech2.SelectedValue.ToString() = AxleNotSteered) + If Not CbTech3.Enabled Then CbTech3.SelectedValue = AxleNotSteered + End Sub + + Private Sub CbTech3_SelectedIndexChanged(sender As Object, e As EventArgs) Handles CbTech3.SelectedIndexChanged + CbTech4.Enabled = Not (CbTech3.SelectedValue.ToString() = AxleNotSteered) + If Not CbTech4.Enabled Then CbTech4.SelectedValue = AxleNotSteered + End Sub +End Class diff --git a/VECTO/GUI/VehicleAxleDialog.Designer.vb b/VECTO/GUI/VehicleAxleDialog.Designer.vb index a58d5ba7e96a450fd7fd4a6e50fd4f4f69888618..e52ce1856dbf713453287ca26dc0225ae40e70c2 100644 --- a/VECTO/GUI/VehicleAxleDialog.Designer.vb +++ b/VECTO/GUI/VehicleAxleDialog.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/VehicleAxleDialog.vb b/VECTO/GUI/VehicleAxleDialog.vb index 34a03ae6335a6629644dad351c369088626a8d2d..ed984500465a88d048c750810919fa4ef73b1bb2 100644 --- a/VECTO/GUI/VehicleAxleDialog.vb +++ b/VECTO/GUI/VehicleAxleDialog.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/VehicleForm.Designer.vb b/VECTO/GUI/VehicleForm.Designer.vb index 479b3923ddcf51629ea7aa8a7344d3d155767f06..434ffb244dd4b7cf63ca4b8d08389bc58cd12eb2 100644 --- a/VECTO/GUI/VehicleForm.Designer.vb +++ b/VECTO/GUI/VehicleForm.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 484dc90a8a31292ecd88f02646c76c859a645499..e958cd32dab216efe0cea421fceef8c8e7798625 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/VehicleTorqueLimitsDialog.Designer.vb b/VECTO/GUI/VehicleTorqueLimitsDialog.Designer.vb index f1591b402096e8ca3f5be6b948b0edb44a90124b..0e5ba01347f6b845ce8e2ef681ce150fc6582078 100644 --- a/VECTO/GUI/VehicleTorqueLimitsDialog.Designer.vb +++ b/VECTO/GUI/VehicleTorqueLimitsDialog.Designer.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/VehicleTorqueLimitsDialog.vb b/VECTO/GUI/VehicleTorqueLimitsDialog.vb index c2f88220627ed6c5bf02fd71f8617e4481f07271..13f325b38cabc324fd2712339cb600b5a254cabb 100644 --- a/VECTO/GUI/VehicleTorqueLimitsDialog.vb +++ b/VECTO/GUI/VehicleTorqueLimitsDialog.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/GUI/WelcomeDialog.Designer.vb b/VECTO/GUI/WelcomeDialog.Designer.vb index 5c16f49cb78fdbc6908c1d2a078098e9927da984..2bbed042e428372f41a63230801d09fb1aa76e66 100644 --- a/VECTO/GUI/WelcomeDialog.Designer.vb +++ b/VECTO/GUI/WelcomeDialog.Designer.vb @@ -1,108 +1,108 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.ComponentModel -Imports Microsoft.VisualBasic.CompilerServices - - -<DesignerGenerated()> _ -Partial Class WelcomeDialog - Inherits Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - <DebuggerNonUserCode()> _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - <DebuggerStepThrough()> _ - Private Sub InitializeComponent() - Me.Cancel_Button = New System.Windows.Forms.Button() - Me.Label1 = New System.Windows.Forms.Label() - Me.Button1 = New System.Windows.Forms.Button() - Me.Button2 = New System.Windows.Forms.Button() - Me.SuspendLayout() - ' - 'Cancel_Button - ' - Me.Cancel_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.Cancel_Button.Location = New System.Drawing.Point(239, 133) - Me.Cancel_Button.Name = "Cancel_Button" - Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) - Me.Cancel_Button.TabIndex = 1 - Me.Cancel_Button.Text = "Close" - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label1.Location = New System.Drawing.Point(123, 19) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(77, 16) - Me.Label1.TabIndex = 1 - Me.Label1.Text = "Welcome!" - ' - 'Button1 - ' - Me.Button1.Location = New System.Drawing.Point(12, 47) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(294, 37) - Me.Button1.TabIndex = 2 - Me.Button1.Text = "Open Release Notes (pdf)" - Me.Button1.UseVisualStyleBackColor = True - ' - 'Button2 - ' - Me.Button2.Location = New System.Drawing.Point(12, 90) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(294, 37) - Me.Button2.TabIndex = 2 - Me.Button2.Text = "Open User Manual (html)" - Me.Button2.UseVisualStyleBackColor = True - ' - 'WelcomeDialog - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(318, 168) - Me.Controls.Add(Me.Button2) - Me.Controls.Add(Me.Cancel_Button) - Me.Controls.Add(Me.Button1) - Me.Controls.Add(Me.Label1) - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "WelcomeDialog" - Me.ShowInTaskbar = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Welcome" - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - Friend WithEvents Cancel_Button As Button - Friend WithEvents Label1 As Label - Friend WithEvents Button1 As Button - Friend WithEvents Button2 As Button - -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.ComponentModel +Imports Microsoft.VisualBasic.CompilerServices + + +<DesignerGenerated()> _ +Partial Class WelcomeDialog + Inherits Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.Cancel_Button = New System.Windows.Forms.Button() + Me.Label1 = New System.Windows.Forms.Label() + Me.Button1 = New System.Windows.Forms.Button() + Me.Button2 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'Cancel_Button + ' + Me.Cancel_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Cancel_Button.Location = New System.Drawing.Point(239, 133) + Me.Cancel_Button.Name = "Cancel_Button" + Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) + Me.Cancel_Button.TabIndex = 1 + Me.Cancel_Button.Text = "Close" + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(123, 19) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(77, 16) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Welcome!" + ' + 'Button1 + ' + Me.Button1.Location = New System.Drawing.Point(12, 47) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(294, 37) + Me.Button1.TabIndex = 2 + Me.Button1.Text = "Open Release Notes (pdf)" + Me.Button1.UseVisualStyleBackColor = True + ' + 'Button2 + ' + Me.Button2.Location = New System.Drawing.Point(12, 90) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(294, 37) + Me.Button2.TabIndex = 2 + Me.Button2.Text = "Open User Manual (html)" + Me.Button2.UseVisualStyleBackColor = True + ' + 'WelcomeDialog + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.CancelButton = Me.Cancel_Button + Me.ClientSize = New System.Drawing.Size(318, 168) + Me.Controls.Add(Me.Button2) + Me.Controls.Add(Me.Cancel_Button) + Me.Controls.Add(Me.Button1) + Me.Controls.Add(Me.Label1) + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "WelcomeDialog" + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Welcome" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents Cancel_Button As Button + Friend WithEvents Label1 As Label + Friend WithEvents Button1 As Button + Friend WithEvents Button2 As Button + +End Class diff --git a/VECTO/GUI/WelcomeDialog.vb b/VECTO/GUI/WelcomeDialog.vb index 3cdcf0eec880dc3cc963adcfc65a0c836808b7a2..6f0edd7b2960d365b5252eda4a7ccdc96a9f3652 100644 --- a/VECTO/GUI/WelcomeDialog.vb +++ b/VECTO/GUI/WelcomeDialog.vb @@ -1,46 +1,46 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.IO - -''' <summary> -''' Welcome screen. Shows only on the first time application start -''' </summary> -''' <remarks></remarks> -Public Class WelcomeDialog - 'Close - Private Sub Cancel_Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub - - 'Init - Private Sub F_Welcome_Load(sender As Object, e As EventArgs) Handles Me.Load - Text = "VECTO " & VECTOvers & " / VectoCore " & COREvers - End Sub - - 'Open Release Notes - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - If File.Exists(MyAppPath & "User Manual\Release Notes.pdf") Then - Process.Start(MyAppPath & "User Manual\Release Notes.pdf") - Else - MsgBox("Release Notes not found!", MsgBoxStyle.Critical) - End If - End Sub - - 'Open Quick Start Guide - Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click - If File.Exists(MyAppPath & "User Manual\help.html") Then - Process.Start(MyAppPath & "User Manual\help.html") - Else - MsgBox("User manual not found!", MsgBoxStyle.Critical) - End If - End Sub -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.IO + +''' <summary> +''' Welcome screen. Shows only on the first time application start +''' </summary> +''' <remarks></remarks> +Public Class WelcomeDialog + 'Close + Private Sub Cancel_Button_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub + + 'Init + Private Sub F_Welcome_Load(sender As Object, e As EventArgs) Handles Me.Load + Text = "VECTO " & VECTOvers & " / VectoCore " & COREvers + End Sub + + 'Open Release Notes + Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click + If File.Exists(MyAppPath & "User Manual\Release Notes.pdf") Then + Process.Start(MyAppPath & "User Manual\Release Notes.pdf") + Else + MsgBox("Release Notes not found!", MsgBoxStyle.Critical) + End If + End Sub + + 'Open Quick Start Guide + Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click + If File.Exists(MyAppPath & "User Manual\help.html") Then + Process.Start(MyAppPath & "User Manual\help.html") + Else + MsgBox("User manual not found!", MsgBoxStyle.Critical) + End If + End Sub +End Class diff --git a/VECTO/Input Files/Engine.vb b/VECTO/Input Files/Engine.vb index 73e9e94c92796843087dff9ccd8d1e2f73ed8d0d..cc105e3beecde03d7813b6ab9ef4e98196c94138 100644 --- a/VECTO/Input Files/Engine.vb +++ b/VECTO/Input Files/Engine.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/Input Files/Gearbox.vb b/VECTO/Input Files/Gearbox.vb index 985ffd31b46ca79e163783d1f8921344a0ec04d4..ea09a39abca76e8e5863b706638cea97598767d2 100644 --- a/VECTO/Input Files/Gearbox.vb +++ b/VECTO/Input Files/Gearbox.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/Input Files/SubPath.vb b/VECTO/Input Files/SubPath.vb index 24c7cdf0e801ff5535d65d78e789382ad2fa12c7..9b8ca946808d0f05e56d7e917dec4ff71f933350 100644 --- a/VECTO/Input Files/SubPath.vb +++ b/VECTO/Input Files/SubPath.vb @@ -1,74 +1,74 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Namespace Input_Files - Public Class SubPath - Private _fullPath As String - Private _originalPath As String - Private _valid As Boolean - - Public Sub New() - _valid = False - End Sub - - Public Sub Init(parentDir As String, path As String) - If CheckFilenameGiven(path) = "" Then - _valid = False - Else - _valid = True - _originalPath = path - _fullPath = FileRepl(path, parentDir) - End If - End Sub - - Private Function CheckFilenameGiven(f As String) As String - If Trim(UCase(f)) = NoFile Then - Return "" - Else - Return f - End If - End Function - - - Public Sub Clear() - _valid = False - End Sub - - Public ReadOnly Property FullPath() As String - Get - If _valid Then - Return _fullPath - Else - Return "" - End If - End Get - End Property - - Public ReadOnly Property OriginalPath() As String - Get - If _valid Then - Return _originalPath - Else - Return "" - End If - End Get - End Property - - Public ReadOnly Property PathOrDummy() As String - Get - If _valid Then - Return _originalPath - Else - Return NoFile - End If - End Get - End Property - End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Namespace Input_Files + Public Class SubPath + Private _fullPath As String + Private _originalPath As String + Private _valid As Boolean + + Public Sub New() + _valid = False + End Sub + + Public Sub Init(parentDir As String, path As String) + If CheckFilenameGiven(path) = "" Then + _valid = False + Else + _valid = True + _originalPath = path + _fullPath = FileRepl(path, parentDir) + End If + End Sub + + Private Function CheckFilenameGiven(f As String) As String + If Trim(UCase(f)) = NoFile Then + Return "" + Else + Return f + End If + End Function + + + Public Sub Clear() + _valid = False + End Sub + + Public ReadOnly Property FullPath() As String + Get + If _valid Then + Return _fullPath + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property OriginalPath() As String + Get + If _valid Then + Return _originalPath + Else + Return "" + End If + End Get + End Property + + Public ReadOnly Property PathOrDummy() As String + Get + If _valid Then + Return _originalPath + Else + Return NoFile + End If + End Get + End Property + End Class End Namespace \ No newline at end of file diff --git a/VECTO/Input Files/VectoJob.vb b/VECTO/Input Files/VectoJob.vb index 78a1748537367ea2163bae85a2cf4c58a300adac..d4b167272a4e884ebfcfef60544aed470ee412bd 100644 --- a/VECTO/Input Files/VectoJob.vb +++ b/VECTO/Input Files/VectoJob.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/Input Files/Vehicle.vb b/VECTO/Input Files/Vehicle.vb index 6c09f6430949c08509f256049eea815e2a746e48..980d3f7f42c030a7458be5a164d9edfc46f1d97a 100644 --- a/VECTO/Input Files/Vehicle.vb +++ b/VECTO/Input Files/Vehicle.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/MainModule.vb b/VECTO/MainModule.vb index fa3baf3f878cd6901847a81ac220e7b7fbaa6b4d..86b263c74384248c44df63e7aa4e9d060c33b951 100644 --- a/VECTO/MainModule.vb +++ b/VECTO/MainModule.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/VECTO_Global.vb b/VECTO/VECTO_Global.vb index ed057a0acfa47ed474d3083d4291461fa5119a2c..7adb29fa6b4ee6b8ed193693651f4ce34f42be11 100644 --- a/VECTO/VECTO_Global.vb +++ b/VECTO/VECTO_Global.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTO/VECTO_Types.vb b/VECTO/VECTO_Types.vb index 76140e455fcea745bba9f75b580334715a3357cf..0845d612a2f3d15130eb52dd77727a0a5f63a8b0 100644 --- a/VECTO/VECTO_Types.vb +++ b/VECTO/VECTO_Types.vb @@ -1,4 +1,4 @@ -' Copyright 2014 European Union. +' Copyright 2017 European Union. ' Licensed under the EUPL (the 'Licence'); ' ' * You may not use this work except in compliance with the Licence. diff --git a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb index 95b2442c5cfd569da918fc9d6ace3f08c2ffe95f..47d9a7596d401e65d163ec184bdabc5fc9a765f1 100644 --- a/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb +++ b/VECTOAux/VectoAuxiliaries/AdvancedAuxiliaries.vb @@ -1,535 +1,535 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.Runtime.CompilerServices -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules -Imports System.Windows.Forms -Imports TUGraz.VectoCommon.Utils - -<Assembly: InternalsVisibleTo("VectoCore")> - -''' <summary> -''' Main entry point for the advanced auxiliary module. -''' This class represents slide number 17 titled Calculations of Cycle FC accounting for Smart Auxiliaries. -''' </summary> -''' <remarks></remarks> -Public Class AdvancedAuxiliaries - Implements IAdvancedAuxiliaries - - Protected Friend auxConfig As AuxiliaryConfig - - 'Supporting classes which may generate event messages - Private WithEvents compressorMap As ICompressorMap - - Private WithEvents ssmTool As SSMTOOL - Private WithEvents ssmToolModule14 As SSMTOOL - - Private WithEvents alternatorMap As IAlternatorMap - Protected Friend WithEvents actuationsMap As IPneumaticActuationsMAP - Private fuelMap As IFuelConsumptionMap - - 'Classes which compose the model. - Private WithEvents M0 As IM0_NonSmart_AlternatorsSetEfficiency - Private WithEvents M05 As IM0_5_SmartAlternatorSetEfficiency - Private WithEvents M1 As IM1_AverageHVACLoadDemand - Private WithEvents M2 As IM2_AverageElectricalLoadDemand - Private WithEvents M3 As IM3_AveragePneumaticLoadDemand - Private WithEvents M4 As IM4_AirCompressor - Private WithEvents M5 As IM5_SmartAlternatorSetGeneration - Private WithEvents M6 As IM6 - Private WithEvents M7 As IM7 - Private WithEvents M8 As IM8 - Private WithEvents M9 As IM9 - Private WithEvents M10 As IM10 - Private WithEvents M11 As IM11 - Private WithEvents M12 As IM12 - Private WithEvents M13 As IM13 - Private WithEvents M14 As IM14 - - Private vectoDirectory As String - - Private hvacConstants As HVACConstants - - 'Event Handler top level bubble. - Public Sub VectoEventHandler(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Handles compressorMap.AuxiliaryEvent, alternatorMap.AuxiliaryEvent, ssmTool.Message, ssmToolModule14.Message - - If Signals.AuxiliaryEventReportingLevel <= messageType Then - - RaiseEvent AuxiliaryEvent(sender, message, messageType) - - End If - End Sub - - 'Constructor - Public Sub New() - - VectoInputs = New VectoInputs() - Signals = New Signals() - End Sub - - 'Initialise Model - Public Sub Initialise(IAuxPath As String, vectoFilePath As String) - - Dim auxPath As String - vectoDirectory = fPATH(vectoFilePath) - - auxPath = FilePathUtils.ResolveFilePath(vectoDirectory, IAuxPath) - - hvacConstants = New HVACConstants(VectoInputs.FuelDensity) - - Signals.CurrentCycleTimeInSeconds = 0 - auxConfig = New AuxiliaryConfig(auxPath) - - 'Pass some signals from config to Signals. ( These are stored in the configuration but shared in the signal distribution around modules ) - Signals.SmartElectrics = auxConfig.ElectricalUserInputsConfig.SmartElectrical - Signals.StoredEnergyEfficiency = auxConfig.ElectricalUserInputsConfig.StoredEnergyEfficiency - Signals.SmartPneumatics = auxConfig.PneumaticUserInputsConfig.SmartAirCompression - Signals.PneumaticOverrunUtilisation = auxConfig.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction - - alternatorMap = New CombinedAlternator( - FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.ElectricalUserInputsConfig.AlternatorMap), Signals) - - actuationsMap = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.PneumaticUserInputsConfig.ActuationsMap)) - - compressorMap = New CompressorMap(FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.PneumaticUserInputsConfig.CompressorMap)) - compressorMap.Initialise() - - 'fuelMap = New cMAP() - 'fuelMap.FilePath = FilePathUtils.ResolveFilePath(vectoDirectory, VectoInputs.FuelMap) - 'If Not fuelMap.ReadFile() Then - ' MessageBox.Show("Unable to read fuel map, aborting.") - ' Return - 'End If - 'fuelMap.Triangulate() - fuelMap = VectoInputs.FuelMap - - auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.DoorDutyCycleFraction = GetDoorActuationTimeFraction() - - 'SSM HVAC - Dim ssmPath As String = FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.HvacUserInputsConfig.SSMFilePath) - Dim BusDatabase As String = FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.HvacUserInputsConfig.BusDatabasePath) - ssmTool = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) - - 'This duplicate SSM is being created for use in M14 as its properties will be dynamically changed at that point - 'to honour EngineWaste Heat Usage in Fueling calculations. - ssmToolModule14 = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) - - - If (ssmTool.Load(ssmPath) = False OrElse ssmToolModule14.Load(ssmPath) = False) Then - - Throw New Exception(String.Format("Unable to load the ssmTOOL with file {0}", ssmPath)) - - End If - - - M0 = New M0_NonSmart_AlternatorsSetEfficiency(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, - alternatorMap, - auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), - Signals, - ssmTool) - - - Dim M05tmp As M0_5_SmartAlternatorSetEfficiency = New M0_5_SmartAlternatorSetEfficiency(M0, - auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, - alternatorMap, - auxConfig.ElectricalUserInputsConfig.ResultCardIdle, - auxConfig.ElectricalUserInputsConfig.ResultCardTraction, - auxConfig.ElectricalUserInputsConfig.ResultCardOverrun, Signals) - M05 = M05tmp - - M1 = New M1_AverageHVACLoadDemand(M0, - auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, - auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, - auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), - Signals, - ssmTool) - - - M2 = New M2_AverageElectricalLoadDemand(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, - M0, - auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, - auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), Signals) - - - M3 = New M3_AveragePneumaticLoadDemand(auxConfig.PneumaticUserInputsConfig, - auxConfig.PneumaticAuxillariesConfig, - actuationsMap, - compressorMap, - VectoInputs.VehicleWeightKG, - VectoInputs.Cycle, - Signals) - - M4 = New M4_AirCompressor(compressorMap, auxConfig.PneumaticUserInputsConfig.CompressorGearRatio, - auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, Signals) - M5 = New M5__SmartAlternatorSetGeneration(M05tmp, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), - auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency) - M6 = New M6(M1, M2, M3, M4, M5, Signals) - M7 = New M7(M5, M6, Signals) - M8 = New M8(M1, M6, M7, Signals) - M9 = New M9(M1, M4, M6, M8, fuelMap, auxConfig.PneumaticAuxillariesConfig, Signals) - M10 = New M10(M3, M9, Signals) - M11 = New M11(M1, M3, M6, M8, fuelMap, Signals) - M12 = New M12(M10, M11, Signals) - M13 = New M13(M10, M11, M12, Signals) - M14 = New M14(M13, ssmToolModule14, hvacConstants, Signals) - End Sub - -#Region "Interface implementation" - - Public Property Signals As ISignals Implements IAdvancedAuxiliaries.Signals - Public Property VectoInputs As IVectoInputs Implements IAdvancedAuxiliaries.VectoInputs - - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAdvancedAuxiliaries.AuxiliaryEvent - - Public Function Configure(filePath As String, vectoFilePath As String) As Boolean _ - Implements VectoAuxiliaries.IAdvancedAuxiliaries.Configure - - Try - - Dim frmAuxiliaryConfig As New frmAuxiliaryConfig(filePath, vectoFilePath) - - frmAuxiliaryConfig.Show() - - If frmAuxiliaryConfig.DialogResult <> DialogResult.OK Then - - Return True - - Else - - Return False - - End If - - - Catch ex As Exception - - Return False - - Return False - - End Try - - - Return True - End Function - - Public Function CycleStep(seconds As Second, ByRef message As String) As Boolean _ - Implements VectoAuxiliaries.IAdvancedAuxiliaries.CycleStep - - Try - M9.CycleStep(seconds) - M10.CycleStep(seconds) - M11.CycleStep(seconds) - - Signals.CurrentCycleTimeInSeconds += seconds.Value() - Catch ex As Exception - MessageBox.Show("Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace) - Return False - End Try - - - Return True - End Function - - Public ReadOnly Property Running As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.Running - Get - Throw New NotImplementedException - End Get - End Property - - Public Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean _ - Implements VectoAuxiliaries.IAdvancedAuxiliaries.RunStart - - Try - - Initialise(auxFilePath, vectoFilePath) - - Catch ex As Exception - - Return False - - End Try - - Return True - End Function - - Public Function RunStop(ByRef message As String) As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.RunStop - Throw New NotImplementedException - End Function - - Public ReadOnly Property TotalFuelGRAMS As Kilogram Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelGRAMS - Get - If Not M13 Is Nothing Then - Return M14.TotalCycleFCGrams - Else - Return 0.SI(Of Kilogram)() - End If - End Get - End Property - - Public ReadOnly Property TotalFuelLITRES As Liter Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelLITRES - Get - If Not M14 Is Nothing Then - Return M14.TotalCycleFCLitres - Else - Return 0.SI(Of Liter)() - End If - End Get - End Property - - Public ReadOnly Property AuxiliaryName As String Implements VectoAuxiliaries.IAdvancedAuxiliaries.AuxiliaryName - Get - Return "BusAuxiliaries" - End Get - End Property - - Public ReadOnly Property AuxiliaryVersion As String Implements VectoAuxiliaries.IAdvancedAuxiliaries.AuxiliaryVersion - Get - Return "Version 1.0 Beta" - End Get - End Property - - -#End Region - - 'Helpers - Private Function GetDoorActuationTimeFraction() As Single - - Dim actuationsMap As PneumaticActuationsMAP = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, - auxConfig.PneumaticUserInputsConfig.ActuationsMap)) - Dim actuationsKey As ActuationsKey = New ActuationsKey("Park brake + 2 doors", VectoInputs.Cycle) - - Dim numActuations As Single = actuationsMap.GetNumActuations(actuationsKey) - Dim secondsPerActuation As Single = auxConfig.ElectricalUserInputsConfig.DoorActuationTimeSecond - - Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds - - Return doorDutyCycleFraction - End Function - - Public Function ValidateAAUXFile(filePath As String, ByRef message As String) As Boolean _ - Implements IAdvancedAuxiliaries.ValidateAAUXFile - - - Dim validResult As Boolean = FilePathUtils.ValidateFilePath(filePath, ".aaux", message) - - If Not validResult Then Return False - - - Return True - End Function - - 'Diagnostics outputs for testing purposes in Vecto. - 'Eventually this can be removed or rendered non effective to reduce calculation load on the model. - Public ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_NonSmartAlternatorsEfficiency - Get - Return M0.AlternatorsEfficiency - End Get - End Property - - Public ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere Implements IAdvancedAuxiliaries.AA_SmartIdleCurrent_Amps - Get - Return M05.SmartIdleCurrent - End Get - End Property - - Public ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_SmartIdleAlternatorsEfficiency - Get - Return M05.AlternatorsEfficiencyIdleResultCard - End Get - End Property - - Public ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere _ - Implements IAdvancedAuxiliaries.AA_SmartTractionCurrent_Amps - Get - Return M05.SmartTractionCurrent - End Get - End Property - - Public ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_SmartTractionAlternatorEfficiency - Get - Return M05.AlternatorsEfficiencyTractionOnResultCard - End Get - End Property - - Public ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere _ - Implements IAdvancedAuxiliaries.AA_SmartOverrunCurrent_Amps - Get - Return M05.SmartOverrunCurrent - End Get - End Property - - Public ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double _ - Implements IAdvancedAuxiliaries.AA_SmartOverrunAlternatorEfficiency - Get - Return M05.AlternatorsEfficiencyOverrunResultCard - End Get - End Property - - Public ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond _ - Implements IAdvancedAuxiliaries.AA_CompressorFlowRate_LitrePerSec - Get - Return M4.GetFlowRate - End Get - End Property - - Public ReadOnly Property AA_OverrunFlag As Boolean Implements IAdvancedAuxiliaries.AA_OverrunFlag - Get - Return M6.OverrunFlag - End Get - End Property - - Public ReadOnly Property AA_EngineIdleFlag As Integer? Implements IAdvancedAuxiliaries.AA_EngineIdleFlag - Get - - Return _ - If _ - (Signals.EngineSpeed <= _Signals.EngineIdleSpeed AndAlso (Not Signals.ClutchEngaged OrElse Signals.InNeutral), 1, 0) - End Get - End Property - - Public ReadOnly Property AA_CompressorFlag As Boolean Implements IAdvancedAuxiliaries.AA_CompressorFlag - Get - Return M8.CompressorFlag - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFC_Grams As Kilogram Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Grams - Get - Return M14.TotalCycleFCGrams - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFC_Litres As Liter Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Litres - Get - Return M14.TotalCycleFCLitres - End Get - End Property - - Public ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt _ - Implements IAdvancedAuxiliaries.AuxiliaryPowerAtCrankWatts - Get - Return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACMechanicals - Get - Return M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts() - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACElectricals - Get - Return M1.AveragePowerDemandAtCrankFromHVACElectricsWatts() - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankElectrics - Get - Return M2.GetAveragePowerAtCrankFromElectrics() - End Get - End Property - - Public ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt _ - Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankPneumatics - Get - Return M3.GetAveragePowerDemandAtCrankFromPneumatics() - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram _ - Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOff - Get - Return M9.TotalCycleFuelConsumptionCompressorOffContinuously - End Get - End Property - - Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram _ - Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOn - Get - Return M9.TotalCycleFuelConsumptionCompressorOnContinuously - End Get - End Property - - - 'TODO:REMOVE WHEN TESTING IS COMPLETE - 'PURE DIAGNOSTICS SHOULD ONLY BE USED IN MOD FOR ENGINEERING TESTS - - Public ReadOnly Property AA_D_M12_INTERP1 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP1 - Get - Return M12.INTRP1() - End Get - End Property - - Public ReadOnly Property AA_D_M12_INTERP2 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP2 - Get - Return M12.INTRP2() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P1X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P1X - Get - Return M12.P1X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P1Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P1Y - Get - Return M12.P1Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P2X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P2X - Get - Return M12.P2X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P2Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P2Y - Get - Return M12.P2Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P3X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P3X - Get - Return M12.P3X() - End Get - End Property - - Public ReadOnly Property AA_D_M12_P3Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P3Y - Get - Return M12.P3Y() - End Get - End Property - - Public ReadOnly Property AA_D_M12_XTAIN As Joule Implements IAdvancedAuxiliaries.AA_D_M12_XTAIN - Get - Return M12.XTAIN() - End Get - End Property -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.Runtime.CompilerServices +Imports VectoAuxiliaries +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac +Imports VectoAuxiliaries.DownstreamModules +Imports System.Windows.Forms +Imports TUGraz.VectoCommon.Utils + +<Assembly: InternalsVisibleTo("VectoCore")> + +''' <summary> +''' Main entry point for the advanced auxiliary module. +''' This class represents slide number 17 titled Calculations of Cycle FC accounting for Smart Auxiliaries. +''' </summary> +''' <remarks></remarks> +Public Class AdvancedAuxiliaries + Implements IAdvancedAuxiliaries + + Protected Friend auxConfig As AuxiliaryConfig + + 'Supporting classes which may generate event messages + Private WithEvents compressorMap As ICompressorMap + + Private WithEvents ssmTool As SSMTOOL + Private WithEvents ssmToolModule14 As SSMTOOL + + Private WithEvents alternatorMap As IAlternatorMap + Protected Friend WithEvents actuationsMap As IPneumaticActuationsMAP + Private fuelMap As IFuelConsumptionMap + + 'Classes which compose the model. + Private WithEvents M0 As IM0_NonSmart_AlternatorsSetEfficiency + Private WithEvents M05 As IM0_5_SmartAlternatorSetEfficiency + Private WithEvents M1 As IM1_AverageHVACLoadDemand + Private WithEvents M2 As IM2_AverageElectricalLoadDemand + Private WithEvents M3 As IM3_AveragePneumaticLoadDemand + Private WithEvents M4 As IM4_AirCompressor + Private WithEvents M5 As IM5_SmartAlternatorSetGeneration + Private WithEvents M6 As IM6 + Private WithEvents M7 As IM7 + Private WithEvents M8 As IM8 + Private WithEvents M9 As IM9 + Private WithEvents M10 As IM10 + Private WithEvents M11 As IM11 + Private WithEvents M12 As IM12 + Private WithEvents M13 As IM13 + Private WithEvents M14 As IM14 + + Private vectoDirectory As String + + Private hvacConstants As HVACConstants + + 'Event Handler top level bubble. + Public Sub VectoEventHandler(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + Handles compressorMap.AuxiliaryEvent, alternatorMap.AuxiliaryEvent, ssmTool.Message, ssmToolModule14.Message + + If Signals.AuxiliaryEventReportingLevel <= messageType Then + + RaiseEvent AuxiliaryEvent(sender, message, messageType) + + End If + End Sub + + 'Constructor + Public Sub New() + + VectoInputs = New VectoInputs() + Signals = New Signals() + End Sub + + 'Initialise Model + Public Sub Initialise(IAuxPath As String, vectoFilePath As String) + + Dim auxPath As String + vectoDirectory = fPATH(vectoFilePath) + + auxPath = FilePathUtils.ResolveFilePath(vectoDirectory, IAuxPath) + + hvacConstants = New HVACConstants(VectoInputs.FuelDensity) + + Signals.CurrentCycleTimeInSeconds = 0 + auxConfig = New AuxiliaryConfig(auxPath) + + 'Pass some signals from config to Signals. ( These are stored in the configuration but shared in the signal distribution around modules ) + Signals.SmartElectrics = auxConfig.ElectricalUserInputsConfig.SmartElectrical + Signals.StoredEnergyEfficiency = auxConfig.ElectricalUserInputsConfig.StoredEnergyEfficiency + Signals.SmartPneumatics = auxConfig.PneumaticUserInputsConfig.SmartAirCompression + Signals.PneumaticOverrunUtilisation = auxConfig.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction + + alternatorMap = New CombinedAlternator( + FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.ElectricalUserInputsConfig.AlternatorMap), Signals) + + actuationsMap = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.PneumaticUserInputsConfig.ActuationsMap)) + + compressorMap = New CompressorMap(FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.PneumaticUserInputsConfig.CompressorMap)) + compressorMap.Initialise() + + 'fuelMap = New cMAP() + 'fuelMap.FilePath = FilePathUtils.ResolveFilePath(vectoDirectory, VectoInputs.FuelMap) + 'If Not fuelMap.ReadFile() Then + ' MessageBox.Show("Unable to read fuel map, aborting.") + ' Return + 'End If + 'fuelMap.Triangulate() + fuelMap = VectoInputs.FuelMap + + auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.DoorDutyCycleFraction = GetDoorActuationTimeFraction() + + 'SSM HVAC + Dim ssmPath As String = FilePathUtils.ResolveFilePath(vectoDirectory, auxConfig.HvacUserInputsConfig.SSMFilePath) + Dim BusDatabase As String = FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.HvacUserInputsConfig.BusDatabasePath) + ssmTool = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) + + 'This duplicate SSM is being created for use in M14 as its properties will be dynamically changed at that point + 'to honour EngineWaste Heat Usage in Fueling calculations. + ssmToolModule14 = New SSMTOOL(ssmPath, hvacConstants, auxConfig.HvacUserInputsConfig.SSMDisabled) + + + If (ssmTool.Load(ssmPath) = False OrElse ssmToolModule14.Load(ssmPath) = False) Then + + Throw New Exception(String.Format("Unable to load the ssmTOOL with file {0}", ssmPath)) + + End If + + + M0 = New M0_NonSmart_AlternatorsSetEfficiency(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, + alternatorMap, + auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), + Signals, + ssmTool) + + + Dim M05tmp As M0_5_SmartAlternatorSetEfficiency = New M0_5_SmartAlternatorSetEfficiency(M0, + auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, + alternatorMap, + auxConfig.ElectricalUserInputsConfig.ResultCardIdle, + auxConfig.ElectricalUserInputsConfig.ResultCardTraction, + auxConfig.ElectricalUserInputsConfig.ResultCardOverrun, Signals) + M05 = M05tmp + + M1 = New M1_AverageHVACLoadDemand(M0, + auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, + auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, + auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), + Signals, + ssmTool) + + + M2 = New M2_AverageElectricalLoadDemand(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers, + M0, + auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency, + auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), Signals) + + + M3 = New M3_AveragePneumaticLoadDemand(auxConfig.PneumaticUserInputsConfig, + auxConfig.PneumaticAuxillariesConfig, + actuationsMap, + compressorMap, + VectoInputs.VehicleWeightKG, + VectoInputs.Cycle, + Signals) + + M4 = New M4_AirCompressor(compressorMap, auxConfig.PneumaticUserInputsConfig.CompressorGearRatio, + auxConfig.PneumaticUserInputsConfig.CompressorGearEfficiency, Signals) + M5 = New M5__SmartAlternatorSetGeneration(M05tmp, auxConfig.ElectricalUserInputsConfig.PowerNetVoltage.SI(Of Volt), + auxConfig.ElectricalUserInputsConfig.AlternatorGearEfficiency) + M6 = New M6(M1, M2, M3, M4, M5, Signals) + M7 = New M7(M5, M6, Signals) + M8 = New M8(M1, M6, M7, Signals) + M9 = New M9(M1, M4, M6, M8, fuelMap, auxConfig.PneumaticAuxillariesConfig, Signals) + M10 = New M10(M3, M9, Signals) + M11 = New M11(M1, M3, M6, M8, fuelMap, Signals) + M12 = New M12(M10, M11, Signals) + M13 = New M13(M10, M11, M12, Signals) + M14 = New M14(M13, ssmToolModule14, hvacConstants, Signals) + End Sub + +#Region "Interface implementation" + + Public Property Signals As ISignals Implements IAdvancedAuxiliaries.Signals + Public Property VectoInputs As IVectoInputs Implements IAdvancedAuxiliaries.VectoInputs + + Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + Implements IAdvancedAuxiliaries.AuxiliaryEvent + + Public Function Configure(filePath As String, vectoFilePath As String) As Boolean _ + Implements VectoAuxiliaries.IAdvancedAuxiliaries.Configure + + Try + + Dim frmAuxiliaryConfig As New frmAuxiliaryConfig(filePath, vectoFilePath) + + frmAuxiliaryConfig.Show() + + If frmAuxiliaryConfig.DialogResult <> DialogResult.OK Then + + Return True + + Else + + Return False + + End If + + + Catch ex As Exception + + Return False + + Return False + + End Try + + + Return True + End Function + + Public Function CycleStep(seconds As Second, ByRef message As String) As Boolean _ + Implements VectoAuxiliaries.IAdvancedAuxiliaries.CycleStep + + Try + M9.CycleStep(seconds) + M10.CycleStep(seconds) + M11.CycleStep(seconds) + + Signals.CurrentCycleTimeInSeconds += seconds.Value() + Catch ex As Exception + MessageBox.Show("Exception: " + ex.Message + " Stack Trace: " + ex.StackTrace) + Return False + End Try + + + Return True + End Function + + Public ReadOnly Property Running As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.Running + Get + Throw New NotImplementedException + End Get + End Property + + Public Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean _ + Implements VectoAuxiliaries.IAdvancedAuxiliaries.RunStart + + Try + + Initialise(auxFilePath, vectoFilePath) + + Catch ex As Exception + + Return False + + End Try + + Return True + End Function + + Public Function RunStop(ByRef message As String) As Boolean Implements VectoAuxiliaries.IAdvancedAuxiliaries.RunStop + Throw New NotImplementedException + End Function + + Public ReadOnly Property TotalFuelGRAMS As Kilogram Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelGRAMS + Get + If Not M13 Is Nothing Then + Return M14.TotalCycleFCGrams + Else + Return 0.SI(Of Kilogram)() + End If + End Get + End Property + + Public ReadOnly Property TotalFuelLITRES As Liter Implements VectoAuxiliaries.IAdvancedAuxiliaries.TotalFuelLITRES + Get + If Not M14 Is Nothing Then + Return M14.TotalCycleFCLitres + Else + Return 0.SI(Of Liter)() + End If + End Get + End Property + + Public ReadOnly Property AuxiliaryName As String Implements VectoAuxiliaries.IAdvancedAuxiliaries.AuxiliaryName + Get + Return "BusAuxiliaries" + End Get + End Property + + Public ReadOnly Property AuxiliaryVersion As String Implements VectoAuxiliaries.IAdvancedAuxiliaries.AuxiliaryVersion + Get + Return "Version 1.0 Beta" + End Get + End Property + + +#End Region + + 'Helpers + Private Function GetDoorActuationTimeFraction() As Single + + Dim actuationsMap As PneumaticActuationsMAP = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(vectoDirectory, + auxConfig.PneumaticUserInputsConfig.ActuationsMap)) + Dim actuationsKey As ActuationsKey = New ActuationsKey("Park brake + 2 doors", VectoInputs.Cycle) + + Dim numActuations As Single = actuationsMap.GetNumActuations(actuationsKey) + Dim secondsPerActuation As Single = auxConfig.ElectricalUserInputsConfig.DoorActuationTimeSecond + + Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds + + Return doorDutyCycleFraction + End Function + + Public Function ValidateAAUXFile(filePath As String, ByRef message As String) As Boolean _ + Implements IAdvancedAuxiliaries.ValidateAAUXFile + + + Dim validResult As Boolean = FilePathUtils.ValidateFilePath(filePath, ".aaux", message) + + If Not validResult Then Return False + + + Return True + End Function + + 'Diagnostics outputs for testing purposes in Vecto. + 'Eventually this can be removed or rendered non effective to reduce calculation load on the model. + Public ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_NonSmartAlternatorsEfficiency + Get + Return M0.AlternatorsEfficiency + End Get + End Property + + Public ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere Implements IAdvancedAuxiliaries.AA_SmartIdleCurrent_Amps + Get + Return M05.SmartIdleCurrent + End Get + End Property + + Public ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_SmartIdleAlternatorsEfficiency + Get + Return M05.AlternatorsEfficiencyIdleResultCard + End Get + End Property + + Public ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere _ + Implements IAdvancedAuxiliaries.AA_SmartTractionCurrent_Amps + Get + Return M05.SmartTractionCurrent + End Get + End Property + + Public ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_SmartTractionAlternatorEfficiency + Get + Return M05.AlternatorsEfficiencyTractionOnResultCard + End Get + End Property + + Public ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere _ + Implements IAdvancedAuxiliaries.AA_SmartOverrunCurrent_Amps + Get + Return M05.SmartOverrunCurrent + End Get + End Property + + Public ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double _ + Implements IAdvancedAuxiliaries.AA_SmartOverrunAlternatorEfficiency + Get + Return M05.AlternatorsEfficiencyOverrunResultCard + End Get + End Property + + Public ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond _ + Implements IAdvancedAuxiliaries.AA_CompressorFlowRate_LitrePerSec + Get + Return M4.GetFlowRate + End Get + End Property + + Public ReadOnly Property AA_OverrunFlag As Boolean Implements IAdvancedAuxiliaries.AA_OverrunFlag + Get + Return M6.OverrunFlag + End Get + End Property + + Public ReadOnly Property AA_EngineIdleFlag As Integer? Implements IAdvancedAuxiliaries.AA_EngineIdleFlag + Get + + Return _ + If _ + (Signals.EngineSpeed <= _Signals.EngineIdleSpeed AndAlso (Not Signals.ClutchEngaged OrElse Signals.InNeutral), 1, 0) + End Get + End Property + + Public ReadOnly Property AA_CompressorFlag As Boolean Implements IAdvancedAuxiliaries.AA_CompressorFlag + Get + Return M8.CompressorFlag + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFC_Grams As Kilogram Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Grams + Get + Return M14.TotalCycleFCGrams + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFC_Litres As Liter Implements IAdvancedAuxiliaries.AA_TotalCycleFC_Litres + Get + Return M14.TotalCycleFCLitres + End Get + End Property + + Public ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt _ + Implements IAdvancedAuxiliaries.AuxiliaryPowerAtCrankWatts + Get + Return M8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACMechanicals + Get + Return M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts() + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankHVACElectricals + Get + Return M1.AveragePowerDemandAtCrankFromHVACElectricsWatts() + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankElectrics + Get + Return M2.GetAveragePowerAtCrankFromElectrics() + End Get + End Property + + Public ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt _ + Implements IAdvancedAuxiliaries.AA_AveragePowerDemandCrankPneumatics + Get + Return M3.GetAveragePowerDemandAtCrankFromPneumatics() + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram _ + Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOff + Get + Return M9.TotalCycleFuelConsumptionCompressorOffContinuously + End Get + End Property + + Public ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram _ + Implements IAdvancedAuxiliaries.AA_TotalCycleFuelConsumptionCompressorOn + Get + Return M9.TotalCycleFuelConsumptionCompressorOnContinuously + End Get + End Property + + + 'TODO:REMOVE WHEN TESTING IS COMPLETE + 'PURE DIAGNOSTICS SHOULD ONLY BE USED IN MOD FOR ENGINEERING TESTS + + Public ReadOnly Property AA_D_M12_INTERP1 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP1 + Get + Return M12.INTRP1() + End Get + End Property + + Public ReadOnly Property AA_D_M12_INTERP2 As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_INTERP2 + Get + Return M12.INTRP2() + End Get + End Property + + Public ReadOnly Property AA_D_M12_P1X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P1X + Get + Return M12.P1X() + End Get + End Property + + Public ReadOnly Property AA_D_M12_P1Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P1Y + Get + Return M12.P1Y() + End Get + End Property + + Public ReadOnly Property AA_D_M12_P2X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P2X + Get + Return M12.P2X() + End Get + End Property + + Public ReadOnly Property AA_D_M12_P2Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P2Y + Get + Return M12.P2Y() + End Get + End Property + + Public ReadOnly Property AA_D_M12_P3X As Joule Implements IAdvancedAuxiliaries.AA_D_M12_P3X + Get + Return M12.P3X() + End Get + End Property + + Public ReadOnly Property AA_D_M12_P3Y As Kilogram Implements IAdvancedAuxiliaries.AA_D_M12_P3Y + Get + Return M12.P3Y() + End Get + End Property + + Public ReadOnly Property AA_D_M12_XTAIN As Joule Implements IAdvancedAuxiliaries.AA_D_M12_XTAIN + Get + Return M12.XTAIN() + End Get + End Property +End Class diff --git a/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb index 3f95ec9bf666ca24d28037ec069e532b0c76b704..0478e8fff63a4f9a3e46691d73ef821d4084501b 100644 --- a/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/AuxiliaryConfig.vb @@ -1,451 +1,451 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports System.IO -Imports VectoAuxiliaries.DownstreamModules -Imports System.Windows.Forms -Imports Newtonsoft.Json -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries - -<Serializable()> -Public Class AuxiliaryConfig - Implements IAuxiliaryConfig - - 'Vecto - Public Property VectoInputs As IVectoInputs Implements IAuxiliaryConfig.VectoInputs - - 'Electrical - Public Property ElectricalUserInputsConfig As IElectricsUserInputsConfig _ - Implements IAuxiliaryConfig.ElectricalUserInputsConfig - - 'Pneumatics - Public Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig _ - Implements IAuxiliaryConfig.PneumaticUserInputsConfig - - Public Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig _ - Implements IAuxiliaryConfig.PneumaticAuxillariesConfig - - 'Hvac - Public Property HvacUserInputsConfig As IHVACUserInputsConfig Implements IAuxiliaryConfig.HvacUserInputsConfig - - 'Vecto Signals - <JsonIgnore> - Public Property Signals As ISignals - - 'Constructors - Sub New() - - Call Me.New("EMPTY") - End Sub - - Public Sub New(auxConfigFile As String) - - 'Special Condition - If auxConfigFile = "EMPTY" Then - ElectricalUserInputsConfig = New ElectricsUserInputsConfig() With {.PowerNetVoltage = 28.3} - ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.3, 0.096, - False) - ElectricalUserInputsConfig.ResultCardIdle = New ResultCard(New List(Of SmartResult)) - ElectricalUserInputsConfig.ResultCardOverrun = New ResultCard(New List(Of SmartResult)) - ElectricalUserInputsConfig.ResultCardTraction = New ResultCard(New List(Of SmartResult)) - PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(False) - PneumaticUserInputsConfig = New PneumaticUserInputsConfig(False) - HvacUserInputsConfig = New HVACUserInputsConfig(String.Empty, String.Empty, False) - Exit Sub - - End If - - If auxConfigFile Is Nothing OrElse auxConfigFile.Trim().Length = 0 OrElse Not File.Exists(auxConfigFile) Then - - setDefaults() - - Else - - setDefaults() - - If Not Load(auxConfigFile) Then - MessageBox.Show(String.Format("Unable to load file {0}", auxConfigFile)) - End If - - End If - End Sub - - 'Set Default Values - Private Sub setDefaults() - - Dim tmp As VectoInputs = New VectoInputs _ - With {.Cycle = "Urban", .VehicleWeightKG = 16500.SI(Of Kilogram)(), .PowerNetVoltage = 28.3.SI(Of Volt)()} - VectoInputs = tmp - Signals = New Signals With {.EngineSpeed = 2000.RPMtoRad(), .TotalCycleTimeSeconds = 3114, .ClutchEngaged = False} - - 'Pneumatics set deault values - PneumaticUserInputsConfig = New PneumaticUserInputsConfig(True) - PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(True) - - 'Electrical set deault values - ElectricalUserInputsConfig = New ElectricsUserInputsConfig(True, tmp) - ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.3, 0.096, True) - - 'HVAC set deault values - HvacUserInputsConfig = New HVACUserInputsConfig(String.Empty, String.Empty, False) - End Sub - - Private Function GetDoorActuationTimeFraction() As Single - - Dim actuationsMap As PneumaticActuationsMAP = New PneumaticActuationsMAP(PneumaticUserInputsConfig.ActuationsMap) - Dim actuationsKey As ActuationsKey = New ActuationsKey("Park brake + 2 doors", VectoInputs.Cycle) - - Dim numActuations As Single = actuationsMap.GetNumActuations(actuationsKey) - Dim secondsPerActuation As Single = ElectricalUserInputsConfig.DoorActuationTimeSecond - - Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds - - Return doorDutyCycleFraction - End Function - -#Region "Comparison" - - Private Function CompareElectricalConfiguration(other As AuxiliaryConfig) As Boolean - - 'AlternatorGearEfficiency - If Me.ElectricalUserInputsConfig.AlternatorGearEfficiency <> other.ElectricalUserInputsConfig.AlternatorGearEfficiency _ - Then Return False - - 'AlternatorMap - If Me.ElectricalUserInputsConfig.AlternatorMap <> other.ElectricalUserInputsConfig.AlternatorMap Then Return False - - 'DoorActuationTimeSecond - If Me.ElectricalUserInputsConfig.DoorActuationTimeSecond <> other.ElectricalUserInputsConfig.DoorActuationTimeSecond _ - Then Return False - - - 'Consumer list - If _ - Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count <> - other.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count Then Return False - Dim i As Integer - For i = 0 To Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count - 1 - Dim thisConsumer, otherConsumer As IElectricalConsumer - thisConsumer = Me.ElectricalUserInputsConfig.ElectricalConsumers.Items(i) - otherConsumer = other.ElectricalUserInputsConfig.ElectricalConsumers.Items(i) - - If thisConsumer.AvgConsumptionAmps <> otherConsumer.AvgConsumptionAmps OrElse - thisConsumer.BaseVehicle <> otherConsumer.BaseVehicle OrElse - thisConsumer.Category <> otherConsumer.Category OrElse - thisConsumer.ConsumerName <> otherConsumer.ConsumerName OrElse - thisConsumer.NominalConsumptionAmps <> otherConsumer.NominalConsumptionAmps OrElse - thisConsumer.NumberInActualVehicle <> otherConsumer.NumberInActualVehicle OrElse - thisConsumer.PhaseIdle_TractionOn <> otherConsumer.PhaseIdle_TractionOn OrElse - thisConsumer.TotalAvgConsumptionInWatts <> otherConsumer.TotalAvgConsumptionInWatts OrElse - thisConsumer.TotalAvgConumptionAmps <> otherConsumer.TotalAvgConumptionAmps Then Return False - - Next - - 'PowerNetVoltage - If Me.ElectricalUserInputsConfig.PowerNetVoltage <> other.ElectricalUserInputsConfig.PowerNetVoltage Then Return False - - 'ResultCardIdle - If _ - Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Count <> - other.ElectricalUserInputsConfig.ResultCardIdle.Results.Count Then Return False - For i = 0 To Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Count - 1 - If _ - Me.ElectricalUserInputsConfig.ResultCardIdle.Results(i).Amps <> - other.ElectricalUserInputsConfig.ResultCardIdle.Results(i).Amps OrElse - Me.ElectricalUserInputsConfig.ResultCardIdle.Results(i).SmartAmps <> - other.ElectricalUserInputsConfig.ResultCardIdle.Results(i).SmartAmps Then Return False - Next - - 'ResultCardOverrun - If _ - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count <> - other.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count Then Return False - For i = 0 To Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count - 1 - If _ - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).Amps <> - other.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).Amps OrElse - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).SmartAmps <> - other.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).SmartAmps Then Return False - Next - - - 'ResultCardTraction - If _ - Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Count <> - other.ElectricalUserInputsConfig.ResultCardTraction.Results.Count Then Return False - For i = 0 To Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Count - 1 - If _ - Me.ElectricalUserInputsConfig.ResultCardTraction.Results(i).Amps <> - other.ElectricalUserInputsConfig.ResultCardTraction.Results(i).Amps OrElse - Me.ElectricalUserInputsConfig.ResultCardTraction.Results(i).SmartAmps <> - other.ElectricalUserInputsConfig.ResultCardTraction.Results(i).SmartAmps Then Return False - Next - - 'SmartElectrical - If Me.ElectricalUserInputsConfig.SmartElectrical <> other.ElectricalUserInputsConfig.SmartElectrical Then Return False - - - Return True - End Function - - Private Function ComparePneumaticAuxiliariesConfig(other As AuxiliaryConfig) As Boolean - - If Me.PneumaticAuxillariesConfig.AdBlueNIperMinute <> other.PneumaticAuxillariesConfig.AdBlueNIperMinute Then _ - Return False - If _ - Me.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute <> - other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute Then Return False - If Me.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG <> other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG _ - Then Return False - If _ - Me.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG <> - other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG Then Return False - If _ - Me.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM <> - other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM Then Return False - If _ - Me.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour <> - other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour Then Return False - If Me.PneumaticAuxillariesConfig.DeadVolumeLitres <> other.PneumaticAuxillariesConfig.DeadVolumeLitres Then _ - Return False - If _ - Me.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand <> - other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand Then Return False - If Me.PneumaticAuxillariesConfig.PerDoorOpeningNI <> other.PneumaticAuxillariesConfig.PerDoorOpeningNI Then _ - Return False - If _ - Me.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG <> - other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG Then Return False - If _ - Me.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand <> - other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand Then Return False - If _ - Me.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction <> - other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction Then Return False - - Return True - End Function - - Private Function ComparePneumaticUserConfig(other As AuxiliaryConfig) As Boolean - - If Me.PneumaticUserInputsConfig.ActuationsMap <> other.PneumaticUserInputsConfig.ActuationsMap Then Return False - If Me.PneumaticUserInputsConfig.AdBlueDosing <> other.PneumaticUserInputsConfig.AdBlueDosing Then Return False - If Me.PneumaticUserInputsConfig.AirSuspensionControl <> other.PneumaticUserInputsConfig.AirSuspensionControl Then _ - Return False - If Me.PneumaticUserInputsConfig.CompressorGearEfficiency <> other.PneumaticUserInputsConfig.CompressorGearEfficiency _ - Then Return False - If Me.PneumaticUserInputsConfig.CompressorGearRatio <> other.PneumaticUserInputsConfig.CompressorGearRatio Then _ - Return False - If Me.PneumaticUserInputsConfig.CompressorMap <> other.PneumaticUserInputsConfig.CompressorMap Then Return False - If Me.PneumaticUserInputsConfig.Doors <> other.PneumaticUserInputsConfig.Doors Then Return False - If Me.PneumaticUserInputsConfig.KneelingHeightMillimeters <> other.PneumaticUserInputsConfig.KneelingHeightMillimeters _ - Then Return False - If Me.PneumaticUserInputsConfig.RetarderBrake <> other.PneumaticUserInputsConfig.RetarderBrake Then Return False - If Me.PneumaticUserInputsConfig.SmartAirCompression <> other.PneumaticUserInputsConfig.SmartAirCompression Then _ - Return False - If Me.PneumaticUserInputsConfig.SmartRegeneration <> other.PneumaticUserInputsConfig.SmartRegeneration Then _ - Return False - - Return True - End Function - - Private Function CompareHVACConfig(other As AuxiliaryConfig) As Boolean _ - Implements IAuxiliaryConfig.ConfigValuesAreTheSameAs - - If Me.HvacUserInputsConfig.SSMFilePath <> other.HvacUserInputsConfig.SSMFilePath Then Return False - If Me.HvacUserInputsConfig.BusDatabasePath <> other.HvacUserInputsConfig.BusDatabasePath Then Return False - If Me.HvacUserInputsConfig.SSMDisabled <> other.HvacUserInputsConfig.SSMDisabled Then Return False - - Return True - End Function - - Public Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) As Boolean - - If Not CompareElectricalConfiguration(other) Then Return False - If Not ComparePneumaticAuxiliariesConfig(other) Then Return False - If Not ComparePneumaticUserConfig(other) Then Return False - If Not CompareHVACConfig(other) Then Return False - - Return True - End Function - - -#End Region - -#Region "Persistance" - - 'Persistance Functions - Public Function Save(auxFile As String) As Boolean Implements IAuxiliaryConfig.Save - - Dim returnValue As Boolean = True - Dim settings As JsonSerializerSettings = New JsonSerializerSettings() - settings.TypeNameHandling = TypeNameHandling.Objects - - 'JSON METHOD - Try - - Dim output As String = JsonConvert.SerializeObject(Me, Formatting.Indented, settings) - - File.WriteAllText(auxFile, output) - - Catch ex As Exception - - returnValue = False - - End Try - - Return returnValue - End Function - - Public Function Load(auxFile As String) As Boolean Implements IAuxiliaryConfig.Load - - Dim returnValue As Boolean = True - Dim settings As JsonSerializerSettings = New JsonSerializerSettings() - Dim tmpAux As AuxiliaryConfig - - settings.TypeNameHandling = TypeNameHandling.Objects - - 'JSON METHOD - Try - - Dim output As String = File.ReadAllText(auxFile) - - - tmpAux = JsonConvert.DeserializeObject(Of AuxiliaryConfig)(output, settings) - - 'This is where we Assume values of loaded( Deserialized ) object. - AssumeValuesOfOther(tmpAux) - If Not tmpAux.VectoInputs.FuelMapFile Is Nothing Then - Dim tmp As cMAP = New cMAP - tmp.FilePath = Path.Combine(Path.GetDirectoryName(auxFile), tmpAux.VectoInputs.FuelMapFile) - If Not tmp.ReadFile() Then - MessageBox.Show("Unable to read fuel map, aborting.") - Return False - End If - tmp.Triangulate() - VectoInputs.FuelMap = tmp - End If - Catch ex As Exception - - returnValue = False - End Try - - Return returnValue - End Function - - 'Persistance Helpers - Public Sub AssumeValuesOfOther(other As AuxiliaryConfig) - - CloneElectricaConfiguration(other) - ClonePneumaticsAuxiliariesConfig(other) - ClonePneumaticsUserInputsConfig(other) - CloneHVAC(other) - End Sub - - Private Sub CloneElectricaConfiguration(other As AuxiliaryConfig) - - 'AlternatorGearEfficiency - Me.ElectricalUserInputsConfig.AlternatorGearEfficiency = other.ElectricalUserInputsConfig.AlternatorGearEfficiency - 'AlternatorMap - Me.ElectricalUserInputsConfig.AlternatorMap = other.ElectricalUserInputsConfig.AlternatorMap - 'DoorActuationTimeSecond - Me.ElectricalUserInputsConfig.DoorActuationTimeSecond = other.ElectricalUserInputsConfig.DoorActuationTimeSecond - - 'Electrical Consumer list - Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Clear() - For Each otherConsumer As IElectricalConsumer In other.ElectricalUserInputsConfig.ElectricalConsumers.Items - - Dim newConsumer As ElectricalConsumer = New ElectricalConsumer(otherConsumer.BaseVehicle, - otherConsumer.Category, - otherConsumer.ConsumerName, - otherConsumer.NominalConsumptionAmps, - otherConsumer.PhaseIdle_TractionOn, - otherConsumer.PowerNetVoltage, - otherConsumer.NumberInActualVehicle, - otherConsumer.Info) - - Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Add(newConsumer) - - Next - - 'PowerNetVoltage - Me.ElectricalUserInputsConfig.PowerNetVoltage = other.ElectricalUserInputsConfig.PowerNetVoltage - 'ResultCardIdle - Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Clear() - For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardIdle.Results - Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) - Next - 'ResultCardOverrun - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Clear() - For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardOverrun.Results - Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) - Next - 'ResultCardTraction - Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Clear() - For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardTraction.Results - Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) - Next - 'SmartElectrical - Me.ElectricalUserInputsConfig.SmartElectrical = other.ElectricalUserInputsConfig.SmartElectrical - End Sub - - Private Sub ClonePneumaticsAuxiliariesConfig(other As AuxiliaryConfig) - - Me.PneumaticAuxillariesConfig.AdBlueNIperMinute = other.PneumaticAuxillariesConfig.AdBlueNIperMinute - Me.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute = - other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute - Me.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG = other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG - Me.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG = other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG - Me.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM = - other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM - Me.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour = - other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour - Me.PneumaticAuxillariesConfig.DeadVolumeLitres = other.PneumaticAuxillariesConfig.DeadVolumeLitres - Me.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand = - other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand - Me.PneumaticAuxillariesConfig.PerDoorOpeningNI = other.PneumaticAuxillariesConfig.PerDoorOpeningNI - Me.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG = - other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG - Me.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand = - other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand - Me.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction = - other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction - End Sub - - Private Sub ClonePneumaticsUserInputsConfig(other As AuxiliaryConfig) - - Me.PneumaticUserInputsConfig.ActuationsMap = other.PneumaticUserInputsConfig.ActuationsMap - Me.PneumaticUserInputsConfig.AdBlueDosing = other.PneumaticUserInputsConfig.AdBlueDosing - Me.PneumaticUserInputsConfig.AirSuspensionControl = other.PneumaticUserInputsConfig.AirSuspensionControl - Me.PneumaticUserInputsConfig.CompressorGearEfficiency = other.PneumaticUserInputsConfig.CompressorGearEfficiency - Me.PneumaticUserInputsConfig.CompressorGearRatio = other.PneumaticUserInputsConfig.CompressorGearRatio - Me.PneumaticUserInputsConfig.CompressorMap = other.PneumaticUserInputsConfig.CompressorMap - Me.PneumaticUserInputsConfig.Doors = other.PneumaticUserInputsConfig.Doors - Me.PneumaticUserInputsConfig.KneelingHeightMillimeters = other.PneumaticUserInputsConfig.KneelingHeightMillimeters - Me.PneumaticUserInputsConfig.RetarderBrake = other.PneumaticUserInputsConfig.RetarderBrake - Me.PneumaticUserInputsConfig.SmartAirCompression = other.PneumaticUserInputsConfig.SmartAirCompression - Me.PneumaticUserInputsConfig.SmartRegeneration = other.PneumaticUserInputsConfig.SmartRegeneration - End Sub - - Private Sub CloneHVAC(other As AuxiliaryConfig) - - Me.HvacUserInputsConfig.SSMFilePath = other.HvacUserInputsConfig.SSMFilePath - Me.HvacUserInputsConfig.BusDatabasePath = other.HvacUserInputsConfig.BusDatabasePath - Me.HvacUserInputsConfig.SSMDisabled = other.HvacUserInputsConfig.SSMDisabled - End Sub - -#End Region -End Class - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac +Imports System.IO +Imports VectoAuxiliaries.DownstreamModules +Imports System.Windows.Forms +Imports Newtonsoft.Json +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries + +<Serializable()> +Public Class AuxiliaryConfig + Implements IAuxiliaryConfig + + 'Vecto + Public Property VectoInputs As IVectoInputs Implements IAuxiliaryConfig.VectoInputs + + 'Electrical + Public Property ElectricalUserInputsConfig As IElectricsUserInputsConfig _ + Implements IAuxiliaryConfig.ElectricalUserInputsConfig + + 'Pneumatics + Public Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig _ + Implements IAuxiliaryConfig.PneumaticUserInputsConfig + + Public Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig _ + Implements IAuxiliaryConfig.PneumaticAuxillariesConfig + + 'Hvac + Public Property HvacUserInputsConfig As IHVACUserInputsConfig Implements IAuxiliaryConfig.HvacUserInputsConfig + + 'Vecto Signals + <JsonIgnore> + Public Property Signals As ISignals + + 'Constructors + Sub New() + + Call Me.New("EMPTY") + End Sub + + Public Sub New(auxConfigFile As String) + + 'Special Condition + If auxConfigFile = "EMPTY" Then + ElectricalUserInputsConfig = New ElectricsUserInputsConfig() With {.PowerNetVoltage = 28.3} + ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.3, 0.096, + False) + ElectricalUserInputsConfig.ResultCardIdle = New ResultCard(New List(Of SmartResult)) + ElectricalUserInputsConfig.ResultCardOverrun = New ResultCard(New List(Of SmartResult)) + ElectricalUserInputsConfig.ResultCardTraction = New ResultCard(New List(Of SmartResult)) + PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(False) + PneumaticUserInputsConfig = New PneumaticUserInputsConfig(False) + HvacUserInputsConfig = New HVACUserInputsConfig(String.Empty, String.Empty, False) + Exit Sub + + End If + + If auxConfigFile Is Nothing OrElse auxConfigFile.Trim().Length = 0 OrElse Not File.Exists(auxConfigFile) Then + + setDefaults() + + Else + + setDefaults() + + If Not Load(auxConfigFile) Then + MessageBox.Show(String.Format("Unable to load file {0}", auxConfigFile)) + End If + + End If + End Sub + + 'Set Default Values + Private Sub setDefaults() + + Dim tmp As VectoInputs = New VectoInputs _ + With {.Cycle = "Urban", .VehicleWeightKG = 16500.SI(Of Kilogram)(), .PowerNetVoltage = 28.3.SI(Of Volt)()} + VectoInputs = tmp + Signals = New Signals With {.EngineSpeed = 2000.RPMtoRad(), .TotalCycleTimeSeconds = 3114, .ClutchEngaged = False} + + 'Pneumatics set deault values + PneumaticUserInputsConfig = New PneumaticUserInputsConfig(True) + PneumaticAuxillariesConfig = New PneumaticsAuxilliariesConfig(True) + + 'Electrical set deault values + ElectricalUserInputsConfig = New ElectricsUserInputsConfig(True, tmp) + ElectricalUserInputsConfig.ElectricalConsumers = New ElectricalConsumerList(28.3, 0.096, True) + + 'HVAC set deault values + HvacUserInputsConfig = New HVACUserInputsConfig(String.Empty, String.Empty, False) + End Sub + + Private Function GetDoorActuationTimeFraction() As Single + + Dim actuationsMap As PneumaticActuationsMAP = New PneumaticActuationsMAP(PneumaticUserInputsConfig.ActuationsMap) + Dim actuationsKey As ActuationsKey = New ActuationsKey("Park brake + 2 doors", VectoInputs.Cycle) + + Dim numActuations As Single = actuationsMap.GetNumActuations(actuationsKey) + Dim secondsPerActuation As Single = ElectricalUserInputsConfig.DoorActuationTimeSecond + + Dim doorDutyCycleFraction As Single = (numActuations * secondsPerActuation) / Signals.TotalCycleTimeSeconds + + Return doorDutyCycleFraction + End Function + +#Region "Comparison" + + Private Function CompareElectricalConfiguration(other As AuxiliaryConfig) As Boolean + + 'AlternatorGearEfficiency + If Me.ElectricalUserInputsConfig.AlternatorGearEfficiency <> other.ElectricalUserInputsConfig.AlternatorGearEfficiency _ + Then Return False + + 'AlternatorMap + If Me.ElectricalUserInputsConfig.AlternatorMap <> other.ElectricalUserInputsConfig.AlternatorMap Then Return False + + 'DoorActuationTimeSecond + If Me.ElectricalUserInputsConfig.DoorActuationTimeSecond <> other.ElectricalUserInputsConfig.DoorActuationTimeSecond _ + Then Return False + + + 'Consumer list + If _ + Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count <> + other.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count Then Return False + Dim i As Integer + For i = 0 To Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Count - 1 + Dim thisConsumer, otherConsumer As IElectricalConsumer + thisConsumer = Me.ElectricalUserInputsConfig.ElectricalConsumers.Items(i) + otherConsumer = other.ElectricalUserInputsConfig.ElectricalConsumers.Items(i) + + If thisConsumer.AvgConsumptionAmps <> otherConsumer.AvgConsumptionAmps OrElse + thisConsumer.BaseVehicle <> otherConsumer.BaseVehicle OrElse + thisConsumer.Category <> otherConsumer.Category OrElse + thisConsumer.ConsumerName <> otherConsumer.ConsumerName OrElse + thisConsumer.NominalConsumptionAmps <> otherConsumer.NominalConsumptionAmps OrElse + thisConsumer.NumberInActualVehicle <> otherConsumer.NumberInActualVehicle OrElse + thisConsumer.PhaseIdle_TractionOn <> otherConsumer.PhaseIdle_TractionOn OrElse + thisConsumer.TotalAvgConsumptionInWatts <> otherConsumer.TotalAvgConsumptionInWatts OrElse + thisConsumer.TotalAvgConumptionAmps <> otherConsumer.TotalAvgConumptionAmps Then Return False + + Next + + 'PowerNetVoltage + If Me.ElectricalUserInputsConfig.PowerNetVoltage <> other.ElectricalUserInputsConfig.PowerNetVoltage Then Return False + + 'ResultCardIdle + If _ + Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Count <> + other.ElectricalUserInputsConfig.ResultCardIdle.Results.Count Then Return False + For i = 0 To Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Count - 1 + If _ + Me.ElectricalUserInputsConfig.ResultCardIdle.Results(i).Amps <> + other.ElectricalUserInputsConfig.ResultCardIdle.Results(i).Amps OrElse + Me.ElectricalUserInputsConfig.ResultCardIdle.Results(i).SmartAmps <> + other.ElectricalUserInputsConfig.ResultCardIdle.Results(i).SmartAmps Then Return False + Next + + 'ResultCardOverrun + If _ + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count <> + other.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count Then Return False + For i = 0 To Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Count - 1 + If _ + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).Amps <> + other.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).Amps OrElse + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).SmartAmps <> + other.ElectricalUserInputsConfig.ResultCardOverrun.Results(i).SmartAmps Then Return False + Next + + + 'ResultCardTraction + If _ + Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Count <> + other.ElectricalUserInputsConfig.ResultCardTraction.Results.Count Then Return False + For i = 0 To Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Count - 1 + If _ + Me.ElectricalUserInputsConfig.ResultCardTraction.Results(i).Amps <> + other.ElectricalUserInputsConfig.ResultCardTraction.Results(i).Amps OrElse + Me.ElectricalUserInputsConfig.ResultCardTraction.Results(i).SmartAmps <> + other.ElectricalUserInputsConfig.ResultCardTraction.Results(i).SmartAmps Then Return False + Next + + 'SmartElectrical + If Me.ElectricalUserInputsConfig.SmartElectrical <> other.ElectricalUserInputsConfig.SmartElectrical Then Return False + + + Return True + End Function + + Private Function ComparePneumaticAuxiliariesConfig(other As AuxiliaryConfig) As Boolean + + If Me.PneumaticAuxillariesConfig.AdBlueNIperMinute <> other.PneumaticAuxillariesConfig.AdBlueNIperMinute Then _ + Return False + If _ + Me.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute <> + other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute Then Return False + If Me.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG <> other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG _ + Then Return False + If _ + Me.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG <> + other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG Then Return False + If _ + Me.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM <> + other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM Then Return False + If _ + Me.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour <> + other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour Then Return False + If Me.PneumaticAuxillariesConfig.DeadVolumeLitres <> other.PneumaticAuxillariesConfig.DeadVolumeLitres Then _ + Return False + If _ + Me.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand <> + other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand Then Return False + If Me.PneumaticAuxillariesConfig.PerDoorOpeningNI <> other.PneumaticAuxillariesConfig.PerDoorOpeningNI Then _ + Return False + If _ + Me.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG <> + other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG Then Return False + If _ + Me.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand <> + other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand Then Return False + If _ + Me.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction <> + other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction Then Return False + + Return True + End Function + + Private Function ComparePneumaticUserConfig(other As AuxiliaryConfig) As Boolean + + If Me.PneumaticUserInputsConfig.ActuationsMap <> other.PneumaticUserInputsConfig.ActuationsMap Then Return False + If Me.PneumaticUserInputsConfig.AdBlueDosing <> other.PneumaticUserInputsConfig.AdBlueDosing Then Return False + If Me.PneumaticUserInputsConfig.AirSuspensionControl <> other.PneumaticUserInputsConfig.AirSuspensionControl Then _ + Return False + If Me.PneumaticUserInputsConfig.CompressorGearEfficiency <> other.PneumaticUserInputsConfig.CompressorGearEfficiency _ + Then Return False + If Me.PneumaticUserInputsConfig.CompressorGearRatio <> other.PneumaticUserInputsConfig.CompressorGearRatio Then _ + Return False + If Me.PneumaticUserInputsConfig.CompressorMap <> other.PneumaticUserInputsConfig.CompressorMap Then Return False + If Me.PneumaticUserInputsConfig.Doors <> other.PneumaticUserInputsConfig.Doors Then Return False + If Me.PneumaticUserInputsConfig.KneelingHeightMillimeters <> other.PneumaticUserInputsConfig.KneelingHeightMillimeters _ + Then Return False + If Me.PneumaticUserInputsConfig.RetarderBrake <> other.PneumaticUserInputsConfig.RetarderBrake Then Return False + If Me.PneumaticUserInputsConfig.SmartAirCompression <> other.PneumaticUserInputsConfig.SmartAirCompression Then _ + Return False + If Me.PneumaticUserInputsConfig.SmartRegeneration <> other.PneumaticUserInputsConfig.SmartRegeneration Then _ + Return False + + Return True + End Function + + Private Function CompareHVACConfig(other As AuxiliaryConfig) As Boolean _ + Implements IAuxiliaryConfig.ConfigValuesAreTheSameAs + + If Me.HvacUserInputsConfig.SSMFilePath <> other.HvacUserInputsConfig.SSMFilePath Then Return False + If Me.HvacUserInputsConfig.BusDatabasePath <> other.HvacUserInputsConfig.BusDatabasePath Then Return False + If Me.HvacUserInputsConfig.SSMDisabled <> other.HvacUserInputsConfig.SSMDisabled Then Return False + + Return True + End Function + + Public Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) As Boolean + + If Not CompareElectricalConfiguration(other) Then Return False + If Not ComparePneumaticAuxiliariesConfig(other) Then Return False + If Not ComparePneumaticUserConfig(other) Then Return False + If Not CompareHVACConfig(other) Then Return False + + Return True + End Function + + +#End Region + +#Region "Persistance" + + 'Persistance Functions + Public Function Save(auxFile As String) As Boolean Implements IAuxiliaryConfig.Save + + Dim returnValue As Boolean = True + Dim settings As JsonSerializerSettings = New JsonSerializerSettings() + settings.TypeNameHandling = TypeNameHandling.Objects + + 'JSON METHOD + Try + + Dim output As String = JsonConvert.SerializeObject(Me, Formatting.Indented, settings) + + File.WriteAllText(auxFile, output) + + Catch ex As Exception + + returnValue = False + + End Try + + Return returnValue + End Function + + Public Function Load(auxFile As String) As Boolean Implements IAuxiliaryConfig.Load + + Dim returnValue As Boolean = True + Dim settings As JsonSerializerSettings = New JsonSerializerSettings() + Dim tmpAux As AuxiliaryConfig + + settings.TypeNameHandling = TypeNameHandling.Objects + + 'JSON METHOD + Try + + Dim output As String = File.ReadAllText(auxFile) + + + tmpAux = JsonConvert.DeserializeObject(Of AuxiliaryConfig)(output, settings) + + 'This is where we Assume values of loaded( Deserialized ) object. + AssumeValuesOfOther(tmpAux) + If Not tmpAux.VectoInputs.FuelMapFile Is Nothing Then + Dim tmp As cMAP = New cMAP + tmp.FilePath = Path.Combine(Path.GetDirectoryName(auxFile), tmpAux.VectoInputs.FuelMapFile) + If Not tmp.ReadFile() Then + MessageBox.Show("Unable to read fuel map, aborting.") + Return False + End If + tmp.Triangulate() + VectoInputs.FuelMap = tmp + End If + Catch ex As Exception + + returnValue = False + End Try + + Return returnValue + End Function + + 'Persistance Helpers + Public Sub AssumeValuesOfOther(other As AuxiliaryConfig) + + CloneElectricaConfiguration(other) + ClonePneumaticsAuxiliariesConfig(other) + ClonePneumaticsUserInputsConfig(other) + CloneHVAC(other) + End Sub + + Private Sub CloneElectricaConfiguration(other As AuxiliaryConfig) + + 'AlternatorGearEfficiency + Me.ElectricalUserInputsConfig.AlternatorGearEfficiency = other.ElectricalUserInputsConfig.AlternatorGearEfficiency + 'AlternatorMap + Me.ElectricalUserInputsConfig.AlternatorMap = other.ElectricalUserInputsConfig.AlternatorMap + 'DoorActuationTimeSecond + Me.ElectricalUserInputsConfig.DoorActuationTimeSecond = other.ElectricalUserInputsConfig.DoorActuationTimeSecond + + 'Electrical Consumer list + Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Clear() + For Each otherConsumer As IElectricalConsumer In other.ElectricalUserInputsConfig.ElectricalConsumers.Items + + Dim newConsumer As ElectricalConsumer = New ElectricalConsumer(otherConsumer.BaseVehicle, + otherConsumer.Category, + otherConsumer.ConsumerName, + otherConsumer.NominalConsumptionAmps, + otherConsumer.PhaseIdle_TractionOn, + otherConsumer.PowerNetVoltage, + otherConsumer.NumberInActualVehicle, + otherConsumer.Info) + + Me.ElectricalUserInputsConfig.ElectricalConsumers.Items.Add(newConsumer) + + Next + + 'PowerNetVoltage + Me.ElectricalUserInputsConfig.PowerNetVoltage = other.ElectricalUserInputsConfig.PowerNetVoltage + 'ResultCardIdle + Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Clear() + For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardIdle.Results + Me.ElectricalUserInputsConfig.ResultCardIdle.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) + Next + 'ResultCardOverrun + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Clear() + For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardOverrun.Results + Me.ElectricalUserInputsConfig.ResultCardOverrun.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) + Next + 'ResultCardTraction + Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Clear() + For Each result As SmartResult In other.ElectricalUserInputsConfig.ResultCardTraction.Results + Me.ElectricalUserInputsConfig.ResultCardTraction.Results.Add(New SmartResult(result.Amps, result.SmartAmps)) + Next + 'SmartElectrical + Me.ElectricalUserInputsConfig.SmartElectrical = other.ElectricalUserInputsConfig.SmartElectrical + End Sub + + Private Sub ClonePneumaticsAuxiliariesConfig(other As AuxiliaryConfig) + + Me.PneumaticAuxillariesConfig.AdBlueNIperMinute = other.PneumaticAuxillariesConfig.AdBlueNIperMinute + Me.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute = + other.PneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute + Me.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG = other.PneumaticAuxillariesConfig.BrakingNoRetarderNIperKG + Me.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG = other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG + Me.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM = + other.PneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM + Me.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour = + other.PneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour + Me.PneumaticAuxillariesConfig.DeadVolumeLitres = other.PneumaticAuxillariesConfig.DeadVolumeLitres + Me.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand = + other.PneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand + Me.PneumaticAuxillariesConfig.PerDoorOpeningNI = other.PneumaticAuxillariesConfig.PerDoorOpeningNI + Me.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG = + other.PneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG + Me.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand = + other.PneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand + Me.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction = + other.PneumaticAuxillariesConfig.OverrunUtilisationForCompressionFraction + End Sub + + Private Sub ClonePneumaticsUserInputsConfig(other As AuxiliaryConfig) + + Me.PneumaticUserInputsConfig.ActuationsMap = other.PneumaticUserInputsConfig.ActuationsMap + Me.PneumaticUserInputsConfig.AdBlueDosing = other.PneumaticUserInputsConfig.AdBlueDosing + Me.PneumaticUserInputsConfig.AirSuspensionControl = other.PneumaticUserInputsConfig.AirSuspensionControl + Me.PneumaticUserInputsConfig.CompressorGearEfficiency = other.PneumaticUserInputsConfig.CompressorGearEfficiency + Me.PneumaticUserInputsConfig.CompressorGearRatio = other.PneumaticUserInputsConfig.CompressorGearRatio + Me.PneumaticUserInputsConfig.CompressorMap = other.PneumaticUserInputsConfig.CompressorMap + Me.PneumaticUserInputsConfig.Doors = other.PneumaticUserInputsConfig.Doors + Me.PneumaticUserInputsConfig.KneelingHeightMillimeters = other.PneumaticUserInputsConfig.KneelingHeightMillimeters + Me.PneumaticUserInputsConfig.RetarderBrake = other.PneumaticUserInputsConfig.RetarderBrake + Me.PneumaticUserInputsConfig.SmartAirCompression = other.PneumaticUserInputsConfig.SmartAirCompression + Me.PneumaticUserInputsConfig.SmartRegeneration = other.PneumaticUserInputsConfig.SmartRegeneration + End Sub + + Private Sub CloneHVAC(other As AuxiliaryConfig) + + Me.HvacUserInputsConfig.SSMFilePath = other.HvacUserInputsConfig.SSMFilePath + Me.HvacUserInputsConfig.BusDatabasePath = other.HvacUserInputsConfig.BusDatabasePath + Me.HvacUserInputsConfig.SSMDisabled = other.HvacUserInputsConfig.SSMDisabled + End Sub + +#End Region +End Class + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb index 33375e64882a43e66712723ce171d6fc484a56ec..0576a556b7bb9353146b2a9f73db731880c07795 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM10.vb @@ -1,40 +1,40 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules - -Namespace DownstreamModules - Public Interface IM10 - 'AverageLoadsFuelConsumptionInterpolatedForPneumatics - ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Kilogram - - 'Interpolated FC between points 2-3-1 Representing smart Pneumatics = Fuel consumption with smart Pneumatics and average electrical power demand - ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Kilogram - - Sub CycleStep(stepTimeInSeconds As Second) - - 'Added for diagnostic inspection purposes only, does not materially affect the class function. - ReadOnly Property P1X As NormLiter - ReadOnly Property P1Y As Kilogram - ReadOnly Property P2X As NormLiter - ReadOnly Property P2Y As Kilogram - ReadOnly Property P3X As NormLiter - ReadOnly Property P3Y As Kilogram - ReadOnly Property XTAIN As NormLiter - ReadOnly Property INTRP1 As Kilogram - ReadOnly Property INTRP2 As Kilogram - End Interface -End Namespace - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac +Imports VectoAuxiliaries.DownstreamModules + +Namespace DownstreamModules + Public Interface IM10 + 'AverageLoadsFuelConsumptionInterpolatedForPneumatics + ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Kilogram + + 'Interpolated FC between points 2-3-1 Representing smart Pneumatics = Fuel consumption with smart Pneumatics and average electrical power demand + ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Kilogram + + Sub CycleStep(stepTimeInSeconds As Second) + + 'Added for diagnostic inspection purposes only, does not materially affect the class function. + ReadOnly Property P1X As NormLiter + ReadOnly Property P1Y As Kilogram + ReadOnly Property P2X As NormLiter + ReadOnly Property P2Y As Kilogram + ReadOnly Property P3X As NormLiter + ReadOnly Property P3Y As Kilogram + ReadOnly Property XTAIN As NormLiter + ReadOnly Property INTRP1 As Kilogram + ReadOnly Property INTRP2 As Kilogram + End Interface +End Namespace + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb index af031dbca530f1b6ea72a382ee346fa636a45783..a974b9b273be57f4ef531b98f13fad9975f14f51 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM11.vb @@ -1,90 +1,90 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM11 - ''' <summary> - ''' Smart Electrical Total Cycle Electrical Energy Generated During Overrun Only(J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly As Joule - - ''' <summary> - ''' Smart Electrical Total Cycle Eletrical EnergyGenerated (J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalTotalCycleEletricalEnergyGenerated As Joule - - ''' <summary> - ''' Total Cycle Electrical Demand (J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleElectricalDemand As Joule - - ''' <summary> - ''' Total Cycle Fuel Consumption: Smart Electrical Load (g) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionSmartElectricalLoad As Kilogram - - ''' <summary> - ''' Total Cycle Fuel Consumption: Zero Electrical Load (g) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionZeroElectricalLoad As Kilogram - - ''' <summary> - ''' Stop Start Sensitive: Total Cycle Electrical Demand (J) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property StopStartSensitiveTotalCycleElectricalDemand As Joule - - ''' <summary> - ''' Total Cycle Fuel Consuption : Average Loads (g) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsuptionAverageLoads As Kilogram - - ''' <summary> - ''' Clears aggregated values ( Sets them to zero ). - ''' </summary> - ''' <remarks></remarks> - Sub ClearAggregates() - - ''' <summary> - ''' Increments all aggregated outputs - ''' </summary> - ''' <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> - ''' <remarks></remarks> - Sub CycleStep(stepTimeInSeconds As Second) - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Interface IM11 + ''' <summary> + ''' Smart Electrical Total Cycle Electrical Energy Generated During Overrun Only(J) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly As Joule + + ''' <summary> + ''' Smart Electrical Total Cycle Eletrical EnergyGenerated (J) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElectricalTotalCycleEletricalEnergyGenerated As Joule + + ''' <summary> + ''' Total Cycle Electrical Demand (J) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalCycleElectricalDemand As Joule + + ''' <summary> + ''' Total Cycle Fuel Consumption: Smart Electrical Load (g) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalCycleFuelConsumptionSmartElectricalLoad As Kilogram + + ''' <summary> + ''' Total Cycle Fuel Consumption: Zero Electrical Load (g) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalCycleFuelConsumptionZeroElectricalLoad As Kilogram + + ''' <summary> + ''' Stop Start Sensitive: Total Cycle Electrical Demand (J) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property StopStartSensitiveTotalCycleElectricalDemand As Joule + + ''' <summary> + ''' Total Cycle Fuel Consuption : Average Loads (g) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalCycleFuelConsuptionAverageLoads As Kilogram + + ''' <summary> + ''' Clears aggregated values ( Sets them to zero ). + ''' </summary> + ''' <remarks></remarks> + Sub ClearAggregates() + + ''' <summary> + ''' Increments all aggregated outputs + ''' </summary> + ''' <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> + ''' <remarks></remarks> + Sub CycleStep(stepTimeInSeconds As Second) + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb index 4f8a681b71efdce16e20d2a763dda7a29fdb91ea..e1c5ad6bca92b94e931377c709f315376b03e9eb 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM12.vb @@ -1,53 +1,53 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace DownstreamModules - Public Interface IM12 - ''' <summary> - ''' Fuel consumption with smart Electrics and Average Pneumatic Power Demand - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand As Kilogram - - ''' <summary> - ''' Base Fuel Consumption With Average Auxiliary Loads - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property BaseFuelConsumptionWithTrueAuxiliaryLoads As Kilogram - - ''' <summary> - ''' Stop Start Correction - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property StopStartCorrection As Double - - - 'Diagnostic Signals Only For Testing - No Material interference with operation of class. - ReadOnly Property P1X As Joule - ReadOnly Property P1Y As Kilogram - ReadOnly Property P2X As Joule - ReadOnly Property P2Y As Kilogram - ReadOnly Property P3X As Joule - ReadOnly Property P3Y As Kilogram - ReadOnly Property XTAIN As Joule - ReadOnly Property INTRP1 As Kilogram - ReadOnly Property INTRP2 As Kilogram - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace DownstreamModules + Public Interface IM12 + ''' <summary> + ''' Fuel consumption with smart Electrics and Average Pneumatic Power Demand + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand As Kilogram + + ''' <summary> + ''' Base Fuel Consumption With Average Auxiliary Loads + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property BaseFuelConsumptionWithTrueAuxiliaryLoads As Kilogram + + ''' <summary> + ''' Stop Start Correction + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property StopStartCorrection As Double + + + 'Diagnostic Signals Only For Testing - No Material interference with operation of class. + ReadOnly Property P1X As Joule + ReadOnly Property P1Y As Kilogram + ReadOnly Property P2X As Joule + ReadOnly Property P2Y As Kilogram + ReadOnly Property P3X As Joule + ReadOnly Property P3Y As Kilogram + ReadOnly Property XTAIN As Joule + ReadOnly Property INTRP1 As Kilogram + ReadOnly Property INTRP2 As Kilogram + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb index 04531c6a0bc7945747c45c4bf145a57a659bc6c0..57d3253dfcb80dbae67a665878fdbda2e28d5eed 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM13.vb @@ -1,30 +1,30 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM13 - ''' <summary> - ''' Total Cycle Fuel Consumption Grams - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>WHTC and Start Stop Adjusted</remarks> - ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Kilogram - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Interface IM13 + ''' <summary> + ''' Total Cycle Fuel Consumption Grams + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>WHTC and Start Stop Adjusted</remarks> + ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Kilogram + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb index 0d688248cd3baf413f725ef49bd1f700d20bef1a..64c1aaa87915d2ce198fc5a3090629d3f6a5017f 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM6.vb @@ -1,89 +1,89 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace DownstreamModules - Public Interface IM6 - ''' <summary> - ''' OverrunFlag - ''' </summary> - ''' <value></value> - ''' <returns>0 = Not in overrun, 1 = In Overrun</returns> - ''' <remarks></remarks> - ReadOnly Property OverrunFlag As Boolean - - ''' <summary> - ''' Smart Elec And Pneumatics Compressor Flag - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecAndPneumaticsCompressorFlag As Boolean - - ''' <summary> - ''' Smart Elec And Pneumatic: Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecAndPneumaticAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Elec And Pneumatic: Air Compressor Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecAndPneumaticAirCompPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Electrics Only : Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElecOnlyAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Average Power Demand At Crank From Pneumatics (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AveragePowerDemandAtCrankFromPneumatics As Watt - - ''' <summary> - ''' Smart Pneumatic Only Air Comp Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartPneumaticOnlyAirCompPowerGenAtCrank As Watt - - ''' <summary> - ''' Avgerage Power Demand At Crank From Electrics Including HVAC electrics (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AvgPowerDemandAtCrankFromElectricsIncHVAC As Watt - - ''' <summary> - ''' Smart Pneumatics Only CompressorFlag - ''' </summary> - ''' <value></value> - ''' <returns>Less than Zero = No, Greater then Zero = Yes </returns> - ''' <remarks></remarks> - ReadOnly Property SmartPneumaticsOnlyCompressorFlag As Boolean - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace DownstreamModules + Public Interface IM6 + ''' <summary> + ''' OverrunFlag + ''' </summary> + ''' <value></value> + ''' <returns>0 = Not in overrun, 1 = In Overrun</returns> + ''' <remarks></remarks> + ReadOnly Property OverrunFlag As Boolean + + ''' <summary> + ''' Smart Elec And Pneumatics Compressor Flag + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElecAndPneumaticsCompressorFlag As Boolean + + ''' <summary> + ''' Smart Elec And Pneumatic: Alternator Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElecAndPneumaticAltPowerGenAtCrank As Watt + + ''' <summary> + ''' Smart Elec And Pneumatic: Air Compressor Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElecAndPneumaticAirCompPowerGenAtCrank As Watt + + ''' <summary> + ''' Smart Electrics Only : Alternator Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElecOnlyAltPowerGenAtCrank As Watt + + ''' <summary> + ''' Average Power Demand At Crank From Pneumatics (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AveragePowerDemandAtCrankFromPneumatics As Watt + + ''' <summary> + ''' Smart Pneumatic Only Air Comp Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartPneumaticOnlyAirCompPowerGenAtCrank As Watt + + ''' <summary> + ''' Avgerage Power Demand At Crank From Electrics Including HVAC electrics (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AvgPowerDemandAtCrankFromElectricsIncHVAC As Watt + + ''' <summary> + ''' Smart Pneumatics Only CompressorFlag + ''' </summary> + ''' <value></value> + ''' <returns>Less than Zero = No, Greater then Zero = Yes </returns> + ''' <remarks></remarks> + ReadOnly Property SmartPneumaticsOnlyCompressorFlag As Boolean + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb index cbc4a99f9f4d95065580b1ef4991b69b4f4c61fa..688c1c4bec9ee6efbf1f53456a4ec56ebf5ba82a 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM7.vb @@ -1,53 +1,53 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM7 - ''' <summary> - ''' Smart Electrical And Pneumatic Aux: Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalAndPneumaticAuxAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Electrical And Pneumatic Aux : Air Compressor Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Electrical Only Aux : Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalOnlyAuxAltPowerGenAtCrank As Watt - - ''' <summary> - ''' Smart Pneumatic Only Aux : Air Comppressor Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartPneumaticOnlyAuxAirCompPowerGenAtCrank As Watt - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Interface IM7 + ''' <summary> + ''' Smart Electrical And Pneumatic Aux: Alternator Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElectricalAndPneumaticAuxAltPowerGenAtCrank As Watt + + ''' <summary> + ''' Smart Electrical And Pneumatic Aux : Air Compressor Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank As Watt + + ''' <summary> + ''' Smart Electrical Only Aux : Alternator Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElectricalOnlyAuxAltPowerGenAtCrank As Watt + + ''' <summary> + ''' Smart Pneumatic Only Aux : Air Comppressor Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartPneumaticOnlyAuxAirCompPowerGenAtCrank As Watt + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb index 971f8c6b069bfa2ec72fcdb9e58611e173047cc1..30da43ede9672d02bacf5a56d09f9fd24cd6ab74 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM8.vb @@ -1,47 +1,47 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM8 -'OUT1 - ''' <summary> - ''' Aux Power At Crank From Electrical HVAC And Pneumatics Ancilaries (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries As Watt -'OUT2 - ''' <summary> - ''' Smart Electrical Alternator Power Gen At Crank (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartElectricalAlternatorPowerGenAtCrank As Watt -'OUT3 - ''' <summary> - ''' Compressor Flag - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property CompressorFlag As Boolean - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Interface IM8 +'OUT1 + ''' <summary> + ''' Aux Power At Crank From Electrical HVAC And Pneumatics Ancilaries (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries As Watt +'OUT2 + ''' <summary> + ''' Smart Electrical Alternator Power Gen At Crank (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartElectricalAlternatorPowerGenAtCrank As Watt +'OUT3 + ''' <summary> + ''' Compressor Flag + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property CompressorFlag As Boolean + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb index a3477464b0458b9576aec1ff46d7c3f912755e2d..9743dc4c1fd471991245905c4b52fd60f33e6ae4 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/IM9.vb @@ -1,68 +1,68 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Interface IM9 - Inherits IAuxiliaryEvent - - ''' <summary> - ''' Clears aggregated values ( Sets them to zero ) - ''' </summary> - ''' <remarks></remarks> - Sub ClearAggregates() - - ''' <summary> - ''' Increments all aggregated outputs - ''' </summary> - ''' <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> - ''' <remarks></remarks> - Sub CycleStep(stepTimeInSeconds As Second) - - ''' <summary> - ''' Litres Of Air: Compressor On Continually (L) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Start/Stop Sensitive</remarks> - ReadOnly Property LitresOfAirCompressorOnContinually As NormLiter - - ''' <summary> - ''' Litres Of Air Compressor On Only In Overrun (L) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As NormLiter - - ''' <summary> - ''' Total Cycle Fuel Consumption Compressor *On* Continuously (G) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Kilogram - - ''' <summary> - ''' Total Cycle Fuel Consumption Compressor *OFF* Continuously (G) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Kilogram - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Interface IM9 + Inherits IAuxiliaryEvent + + ''' <summary> + ''' Clears aggregated values ( Sets them to zero ) + ''' </summary> + ''' <remarks></remarks> + Sub ClearAggregates() + + ''' <summary> + ''' Increments all aggregated outputs + ''' </summary> + ''' <param name="stepTimeInSeconds">Single : Mutiplies the values to be aggregated by number of seconds</param> + ''' <remarks></remarks> + Sub CycleStep(stepTimeInSeconds As Second) + + ''' <summary> + ''' Litres Of Air: Compressor On Continually (L) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Start/Stop Sensitive</remarks> + ReadOnly Property LitresOfAirCompressorOnContinually As NormLiter + + ''' <summary> + ''' Litres Of Air Compressor On Only In Overrun (L) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As NormLiter + + ''' <summary> + ''' Total Cycle Fuel Consumption Compressor *On* Continuously (G) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Kilogram + + ''' <summary> + ''' Total Cycle Fuel Consumption Compressor *OFF* Continuously (G) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Kilogram + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb index 9dbfca19b46d104e13f8dc37a3d3aa047ca57e76..ab015bf56a68c660f17ab9a24d0bb94f8f1014a1 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M10.vb @@ -1,189 +1,189 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics - -Namespace DownstreamModules - Public Class M10 - Implements IM10 - - 'Aggregators - Private _AverageAirConsumedLitre As NormLiter - - 'Diagnostics - Private x1 As NormLiter - Private y1 As Kilogram - Private x2 As NormLiter - Private y2 As Kilogram - Private x3 As NormLiter - Private y3 As Kilogram - Private xTA As NormLiter - Private interp1 As Kilogram - Private interp2 As Kilogram - - Public ReadOnly Property P1X As NormLiter Implements IM10.P1X - Get - Return x1 - End Get - End Property - - Public ReadOnly Property P1Y As Kilogram Implements IM10.P1Y - Get - Return y1 - End Get - End Property - - Public ReadOnly Property P2X As NormLiter Implements IM10.P2X - Get - Return x2 - End Get - End Property - - Public ReadOnly Property P2Y As Kilogram Implements IM10.P2Y - Get - Return y2 - End Get - End Property - - Public ReadOnly Property P3X As NormLiter Implements IM10.P3X - Get - Return x3 - End Get - End Property - - Public ReadOnly Property P3Y As Kilogram Implements IM10.P3Y - Get - Return y3 - End Get - End Property - - Public ReadOnly Property XTAIN As NormLiter Implements IM10.XTAIN - Get - Return xTA - End Get - End Property - - Public ReadOnly Property INTRP1 As Kilogram Implements IM10.INTRP1 - Get - Return interp1 - End Get - End Property - - Public ReadOnly Property INTRP2 As Kilogram Implements IM10.INTRP2 - Get - Return interp2 - End Get - End Property - - - 'Private - -#Region "Private Fields = > Constructor Requirements" - - Private m3 As IM3_AveragePneumaticLoadDemand - Private m9 As IM9 - 'Not Currently used but there for ease of refactoring in future. - Private signals As ISignals - -#End Region - - Private Enum InterpolationType - NonSmartPneumtaics - SmartPneumtaics - End Enum - - Private Function Interpolate(interpType As InterpolationType) As Kilogram - - Dim returnValue As Kilogram = 0.SI(Of Kilogram)() - ' Dim x1,y1,x2,y2,x3,y3, xTA As Single - - x1 = m9.LitresOfAirCompressorOnContinually - y1 = m9.TotalCycleFuelConsumptionCompressorOnContinuously - x2 = 0.SI(Of NormLiter)() - y2 = m9.TotalCycleFuelConsumptionCompressorOffContinuously - x3 = m9.LitresOfAirCompressorOnOnlyInOverrun - y3 = m9.TotalCycleFuelConsumptionCompressorOffContinuously - - - xTA = _AverageAirConsumedLitre 'm3.AverageAirConsumedPerSecondLitre - - - Select Case interpType - - 'Non-Smart Pneumatics ( OUT 1 ) - Case InterpolationType.NonSmartPneumtaics - 'returnValue = (y2 + (((y1 - y2) * xTA) / x1)) - returnValue = VectoMath.Interpolate(x1, x2, y1, y2, xTA) - interp1 = returnValue - - 'Smart Pneumatics ( OUT 2 ) - Case InterpolationType.SmartPneumtaics - 'returnValue = (y3 + (((y1 - y3) / (x1 - x3)) * (xTA - x3))) - returnValue = VectoMath.Interpolate(x1, x3, y1, y3, xTA) - interp2 = returnValue - End Select - - - Return returnValue - End Function - - 'Public - -#Region "Public Properties" - - Public ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Kilogram _ - Implements IM10.AverageLoadsFuelConsumptionInterpolatedForPneumatics - Get - - 'SCHM 3_02 - Dim intrp1 As Kilogram = Interpolate(InterpolationType.NonSmartPneumtaics) - 'intrp1 = If(Not Single.IsNaN(intrp1), intrp1, 0) - Return intrp1 - End Get - End Property - - Public ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Kilogram _ - Implements IM10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand - Get - - 'SCHM 3_02 - Dim intrp2 As Kilogram = Interpolate(InterpolationType.SmartPneumtaics) - 'intrp2 = If(Not Single.IsNaN(intrp2), intrp2, 0) - Return intrp2 - End Get - End Property - -#End Region - -#Region "Contructors" - - Public Sub New(m3 As IM3_AveragePneumaticLoadDemand, m9 As IM9, signals As ISignals) - - Me.m3 = m3 - Me.m9 = m9 - Me.signals = signals - _AverageAirConsumedLitre = 0.SI(Of NormLiter)() - End Sub - -#End Region - - Public Sub CycleStep(stepTimeInSeconds As Second) Implements IM10.CycleStep - - _AverageAirConsumedLitre += - If _ - (Double.IsNaN(m3.AverageAirConsumedPerSecondLitre.Value()), 0.SI(Of NormLiter), - m3.AverageAirConsumedPerSecondLitre * stepTimeInSeconds) - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Pneumatics + +Namespace DownstreamModules + Public Class M10 + Implements IM10 + + 'Aggregators + Private _AverageAirConsumedLitre As NormLiter + + 'Diagnostics + Private x1 As NormLiter + Private y1 As Kilogram + Private x2 As NormLiter + Private y2 As Kilogram + Private x3 As NormLiter + Private y3 As Kilogram + Private xTA As NormLiter + Private interp1 As Kilogram + Private interp2 As Kilogram + + Public ReadOnly Property P1X As NormLiter Implements IM10.P1X + Get + Return x1 + End Get + End Property + + Public ReadOnly Property P1Y As Kilogram Implements IM10.P1Y + Get + Return y1 + End Get + End Property + + Public ReadOnly Property P2X As NormLiter Implements IM10.P2X + Get + Return x2 + End Get + End Property + + Public ReadOnly Property P2Y As Kilogram Implements IM10.P2Y + Get + Return y2 + End Get + End Property + + Public ReadOnly Property P3X As NormLiter Implements IM10.P3X + Get + Return x3 + End Get + End Property + + Public ReadOnly Property P3Y As Kilogram Implements IM10.P3Y + Get + Return y3 + End Get + End Property + + Public ReadOnly Property XTAIN As NormLiter Implements IM10.XTAIN + Get + Return xTA + End Get + End Property + + Public ReadOnly Property INTRP1 As Kilogram Implements IM10.INTRP1 + Get + Return interp1 + End Get + End Property + + Public ReadOnly Property INTRP2 As Kilogram Implements IM10.INTRP2 + Get + Return interp2 + End Get + End Property + + + 'Private + +#Region "Private Fields = > Constructor Requirements" + + Private m3 As IM3_AveragePneumaticLoadDemand + Private m9 As IM9 + 'Not Currently used but there for ease of refactoring in future. + Private signals As ISignals + +#End Region + + Private Enum InterpolationType + NonSmartPneumtaics + SmartPneumtaics + End Enum + + Private Function Interpolate(interpType As InterpolationType) As Kilogram + + Dim returnValue As Kilogram = 0.SI(Of Kilogram)() + ' Dim x1,y1,x2,y2,x3,y3, xTA As Single + + x1 = m9.LitresOfAirCompressorOnContinually + y1 = m9.TotalCycleFuelConsumptionCompressorOnContinuously + x2 = 0.SI(Of NormLiter)() + y2 = m9.TotalCycleFuelConsumptionCompressorOffContinuously + x3 = m9.LitresOfAirCompressorOnOnlyInOverrun + y3 = m9.TotalCycleFuelConsumptionCompressorOffContinuously + + + xTA = _AverageAirConsumedLitre 'm3.AverageAirConsumedPerSecondLitre + + + Select Case interpType + + 'Non-Smart Pneumatics ( OUT 1 ) + Case InterpolationType.NonSmartPneumtaics + 'returnValue = (y2 + (((y1 - y2) * xTA) / x1)) + returnValue = VectoMath.Interpolate(x1, x2, y1, y2, xTA) + interp1 = returnValue + + 'Smart Pneumatics ( OUT 2 ) + Case InterpolationType.SmartPneumtaics + 'returnValue = (y3 + (((y1 - y3) / (x1 - x3)) * (xTA - x3))) + returnValue = VectoMath.Interpolate(x1, x3, y1, y3, xTA) + interp2 = returnValue + End Select + + + Return returnValue + End Function + + 'Public + +#Region "Public Properties" + + Public ReadOnly Property AverageLoadsFuelConsumptionInterpolatedForPneumatics As Kilogram _ + Implements IM10.AverageLoadsFuelConsumptionInterpolatedForPneumatics + Get + + 'SCHM 3_02 + Dim intrp1 As Kilogram = Interpolate(InterpolationType.NonSmartPneumtaics) + 'intrp1 = If(Not Single.IsNaN(intrp1), intrp1, 0) + Return intrp1 + End Get + End Property + + Public ReadOnly Property FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand As Kilogram _ + Implements IM10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand + Get + + 'SCHM 3_02 + Dim intrp2 As Kilogram = Interpolate(InterpolationType.SmartPneumtaics) + 'intrp2 = If(Not Single.IsNaN(intrp2), intrp2, 0) + Return intrp2 + End Get + End Property + +#End Region + +#Region "Contructors" + + Public Sub New(m3 As IM3_AveragePneumaticLoadDemand, m9 As IM9, signals As ISignals) + + Me.m3 = m3 + Me.m9 = m9 + Me.signals = signals + _AverageAirConsumedLitre = 0.SI(Of NormLiter)() + End Sub + +#End Region + + Public Sub CycleStep(stepTimeInSeconds As Second) Implements IM10.CycleStep + + _AverageAirConsumedLitre += + If _ + (Double.IsNaN(m3.AverageAirConsumedPerSecondLitre.Value()), 0.SI(Of NormLiter), + m3.AverageAirConsumedPerSecondLitre * stepTimeInSeconds) + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb index c14e8c4462fb30c9d6de2e3268a588f5b535e585..8bd593943fc8297b1a1512bfe885e764d4b61661 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M11.vb @@ -1,250 +1,250 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M11 - Implements IM11 - - Private Const RPM_to_RadiansPerSecond As Single = 9.55 - -#Region "Private Aggregates" - 'Private Aggregations - Private AG1 As Joule - Private AG2 As Joule - Private AG3 As Joule - Private AG4 As Kilogram - Private AG5 As Kilogram - Private AG6 As Joule - Private AG7 As Kilogram - -#End Region - -#Region "Private Fields Assigned by Constructor." - - Private M1 As IM1_AverageHVACLoadDemand - Private M3 As IM3_AveragePneumaticLoadDemand - Private M6 As IM6 - Private M8 As IM8 - Private fmap As IFuelConsumptionMap - Private signals As ISignals - -#End Region - - - 'Staging Calculations - Private Function Sum0(ByVal rpm As PerSecond) As PerSecond - - If rpm < 1 Then rpm = 1.RPMtoRad() - - Return rpm ' / RPM_to_RadiansPerSecond - End Function - - Private ReadOnly Property Sum1 As Watt - Get - Return If(M6.OverrunFlag, M8.SmartElectricalAlternatorPowerGenAtCrank, SIBase(Of Watt).Create(0.0)) - 'Return M6.OverrunFlag*M8.SmartElectricalAlternatorPowerGenAtCrank - End Get - End Property - - Private ReadOnly Property Sum2 As Watt - Get - Return M3.GetAveragePowerDemandAtCrankFromPneumatics + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts - End Get - End Property - - Private ReadOnly Property Sum3 As NewtonMeter - Get - Return M8.SmartElectricalAlternatorPowerGenAtCrank / Sum0(signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property Sum4 As NewtonMeter - Get - Return Sum2 / Sum0(signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property Sum5 As NewtonMeter - Get - Return Sum4 + Sum9 - End Get - End Property - - Private ReadOnly Property Sum6 As NewtonMeter - Get - Return Sum3 + Sum5 - End Get - End Property - - Private ReadOnly Property Sum7 As KilogramPerSecond - Get - - 'SCM 3_02 - Dim intrp1 As KilogramPerSecond = fmap.GetFuelConsumption(Sum6, signals.EngineSpeed) - intrp1 = If(Not Double.IsNaN(intrp1.Value()) AndAlso intrp1 > 0, intrp1, 0.SI(Of KilogramPerSecond)) - Return intrp1 - End Get - End Property - - Private ReadOnly Property Sum8 As KilogramPerSecond - Get - - 'SCHM 3_2 - Dim intrp2 As KilogramPerSecond = fmap.GetFuelConsumption(Sum5, signals.EngineSpeed) - intrp2 = If(Not Double.IsNaN(intrp2.Value()) AndAlso intrp2 > 0, intrp2, 0.SI(Of KilogramPerSecond)) - Return intrp2 - End Get - End Property - - Private ReadOnly Property Sum9 As NewtonMeter - Get - - Return _ - signals.EngineDrivelineTorque + - (signals.PreExistingAuxPower / Sum0(signals.EngineSpeed)) - End Get - End Property - - Private ReadOnly Property Sum10 As NewtonMeter - Get - - Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC / Sum0(signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property Sum11 As NewtonMeter - Get - - Return Sum5 + Sum10 - End Get - End Property - - Private ReadOnly Property Sum12 As KilogramPerSecond - Get - - 'SCHM 3_2 - Dim intrp3 As KilogramPerSecond = fmap.GetFuelConsumption(Sum11, signals.EngineSpeed) - intrp3 = If(Not Double.IsNaN(intrp3.Value()) AndAlso intrp3 > 0, intrp3, 0.SI(Of KilogramPerSecond)) - Return intrp3 - End Get - End Property - - 'OUT1 - Public ReadOnly Property SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly As Joule _ - Implements IM11.SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly - Get - Return AG1 - End Get - End Property - 'OUT2 - Public ReadOnly Property SmartElectricalTotalCycleEletricalEnergyGenerated As Joule _ - Implements IM11.SmartElectricalTotalCycleEletricalEnergyGenerated - Get - Return AG2 - End Get - End Property - 'OUT3 - Public ReadOnly Property TotalCycleElectricalDemand As Joule Implements IM11.TotalCycleElectricalDemand - Get - Return AG3 - End Get - End Property - 'OUT4 - Public ReadOnly Property TotalCycleFuelConsumptionSmartElectricalLoad As Kilogram _ - Implements IM11.TotalCycleFuelConsumptionSmartElectricalLoad - Get - Return AG4 - End Get - End Property - 'OUT5 - Public ReadOnly Property TotalCycleFuelConsumptionZeroElectricalLoad As Kilogram _ - Implements IM11.TotalCycleFuelConsumptionZeroElectricalLoad - Get - Return AG5 - End Get - End Property - 'OUT6 - Public ReadOnly Property StopStartSensitiveTotalCycleElectricalDemand As Joule _ - Implements IM11.StopStartSensitiveTotalCycleElectricalDemand - Get - Return AG6 - End Get - End Property - 'OUT7 - Public ReadOnly Property TotalCycleFuelConsuptionAverageLoads As Kilogram _ - Implements IM11.TotalCycleFuelConsuptionAverageLoads - Get - Return AG7 - End Get - End Property - - Private ReadOnly Property SW1 As Boolean - Get - Return Not signals.EngineStopped - End Get - End Property - - 'Clear at the beginning of cycle - Sub ClearAggregates() Implements IM11.ClearAggregates - - AG1 = 0.SI(Of Joule)() - AG2 = 0.SI(Of Joule)() - AG3 = 0.SI(Of Joule)() - AG4 = 0.SI(Of Kilogram)() - AG5 = 0.SI(Of Kilogram)() - AG6 = 0.SI(Of Joule)() - AG7 = 0.SI(Of Kilogram)() - End Sub - - 'Add to Aggregates dependent on cycle step time. - Sub CycleStep(stepTimeInSeconds As Second) Implements IM11.CycleStep - - 'S/S Insensitive - AG3 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds) - - - If signals.EngineStopped Then Return - - 'S/S Sensitive - If (SW1) Then - AG1 += (Sum1 * stepTimeInSeconds) - AG2 += (M8.SmartElectricalAlternatorPowerGenAtCrank * stepTimeInSeconds) - - AG6 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds) - - 'MQ: No longer needed - already per Second 'These need to be divided by 3600 as the Fuel Map output is in Grams/Second. - AG4 += (Sum7 * stepTimeInSeconds) '/ 3600 - AG5 += (Sum8 * stepTimeInSeconds) ' / 3600 - AG7 += (Sum12 * stepTimeInSeconds) '/ 3600 - End If - End Sub - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, m3 As IM3_AveragePneumaticLoadDemand, m6 As IM6, m8 As IM8, - fmap As IFuelConsumptionMap, signals As ISignals) - - Me.M1 = m1 - Me.M3 = m3 - Me.M6 = m6 - Me.M8 = m8 - Me.fmap = fmap - Me.signals = signals - ClearAggregates() - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M11 + Implements IM11 + + Private Const RPM_to_RadiansPerSecond As Single = 9.55 + +#Region "Private Aggregates" + 'Private Aggregations + Private AG1 As Joule + Private AG2 As Joule + Private AG3 As Joule + Private AG4 As Kilogram + Private AG5 As Kilogram + Private AG6 As Joule + Private AG7 As Kilogram + +#End Region + +#Region "Private Fields Assigned by Constructor." + + Private M1 As IM1_AverageHVACLoadDemand + Private M3 As IM3_AveragePneumaticLoadDemand + Private M6 As IM6 + Private M8 As IM8 + Private fmap As IFuelConsumptionMap + Private signals As ISignals + +#End Region + + + 'Staging Calculations + Private Function Sum0(ByVal rpm As PerSecond) As PerSecond + + If rpm < 1 Then rpm = 1.RPMtoRad() + + Return rpm ' / RPM_to_RadiansPerSecond + End Function + + Private ReadOnly Property Sum1 As Watt + Get + Return If(M6.OverrunFlag, M8.SmartElectricalAlternatorPowerGenAtCrank, SIBase(Of Watt).Create(0.0)) + 'Return M6.OverrunFlag*M8.SmartElectricalAlternatorPowerGenAtCrank + End Get + End Property + + Private ReadOnly Property Sum2 As Watt + Get + Return M3.GetAveragePowerDemandAtCrankFromPneumatics + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + End Get + End Property + + Private ReadOnly Property Sum3 As NewtonMeter + Get + Return M8.SmartElectricalAlternatorPowerGenAtCrank / Sum0(signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property Sum4 As NewtonMeter + Get + Return Sum2 / Sum0(signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property Sum5 As NewtonMeter + Get + Return Sum4 + Sum9 + End Get + End Property + + Private ReadOnly Property Sum6 As NewtonMeter + Get + Return Sum3 + Sum5 + End Get + End Property + + Private ReadOnly Property Sum7 As KilogramPerSecond + Get + + 'SCM 3_02 + Dim intrp1 As KilogramPerSecond = fmap.GetFuelConsumption(Sum6, signals.EngineSpeed) + intrp1 = If(Not Double.IsNaN(intrp1.Value()) AndAlso intrp1 > 0, intrp1, 0.SI(Of KilogramPerSecond)) + Return intrp1 + End Get + End Property + + Private ReadOnly Property Sum8 As KilogramPerSecond + Get + + 'SCHM 3_2 + Dim intrp2 As KilogramPerSecond = fmap.GetFuelConsumption(Sum5, signals.EngineSpeed) + intrp2 = If(Not Double.IsNaN(intrp2.Value()) AndAlso intrp2 > 0, intrp2, 0.SI(Of KilogramPerSecond)) + Return intrp2 + End Get + End Property + + Private ReadOnly Property Sum9 As NewtonMeter + Get + + Return _ + signals.EngineDrivelineTorque + + (signals.PreExistingAuxPower / Sum0(signals.EngineSpeed)) + End Get + End Property + + Private ReadOnly Property Sum10 As NewtonMeter + Get + + Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC / Sum0(signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property Sum11 As NewtonMeter + Get + + Return Sum5 + Sum10 + End Get + End Property + + Private ReadOnly Property Sum12 As KilogramPerSecond + Get + + 'SCHM 3_2 + Dim intrp3 As KilogramPerSecond = fmap.GetFuelConsumption(Sum11, signals.EngineSpeed) + intrp3 = If(Not Double.IsNaN(intrp3.Value()) AndAlso intrp3 > 0, intrp3, 0.SI(Of KilogramPerSecond)) + Return intrp3 + End Get + End Property + + 'OUT1 + Public ReadOnly Property SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly As Joule _ + Implements IM11.SmartElectricalTotalCycleElectricalEnergyGeneratedDuringOverrunOnly + Get + Return AG1 + End Get + End Property + 'OUT2 + Public ReadOnly Property SmartElectricalTotalCycleEletricalEnergyGenerated As Joule _ + Implements IM11.SmartElectricalTotalCycleEletricalEnergyGenerated + Get + Return AG2 + End Get + End Property + 'OUT3 + Public ReadOnly Property TotalCycleElectricalDemand As Joule Implements IM11.TotalCycleElectricalDemand + Get + Return AG3 + End Get + End Property + 'OUT4 + Public ReadOnly Property TotalCycleFuelConsumptionSmartElectricalLoad As Kilogram _ + Implements IM11.TotalCycleFuelConsumptionSmartElectricalLoad + Get + Return AG4 + End Get + End Property + 'OUT5 + Public ReadOnly Property TotalCycleFuelConsumptionZeroElectricalLoad As Kilogram _ + Implements IM11.TotalCycleFuelConsumptionZeroElectricalLoad + Get + Return AG5 + End Get + End Property + 'OUT6 + Public ReadOnly Property StopStartSensitiveTotalCycleElectricalDemand As Joule _ + Implements IM11.StopStartSensitiveTotalCycleElectricalDemand + Get + Return AG6 + End Get + End Property + 'OUT7 + Public ReadOnly Property TotalCycleFuelConsuptionAverageLoads As Kilogram _ + Implements IM11.TotalCycleFuelConsuptionAverageLoads + Get + Return AG7 + End Get + End Property + + Private ReadOnly Property SW1 As Boolean + Get + Return Not signals.EngineStopped + End Get + End Property + + 'Clear at the beginning of cycle + Sub ClearAggregates() Implements IM11.ClearAggregates + + AG1 = 0.SI(Of Joule)() + AG2 = 0.SI(Of Joule)() + AG3 = 0.SI(Of Joule)() + AG4 = 0.SI(Of Kilogram)() + AG5 = 0.SI(Of Kilogram)() + AG6 = 0.SI(Of Joule)() + AG7 = 0.SI(Of Kilogram)() + End Sub + + 'Add to Aggregates dependent on cycle step time. + Sub CycleStep(stepTimeInSeconds As Second) Implements IM11.CycleStep + + 'S/S Insensitive + AG3 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds) + + + If signals.EngineStopped Then Return + + 'S/S Sensitive + If (SW1) Then + AG1 += (Sum1 * stepTimeInSeconds) + AG2 += (M8.SmartElectricalAlternatorPowerGenAtCrank * stepTimeInSeconds) + + AG6 += (M6.AvgPowerDemandAtCrankFromElectricsIncHVAC * stepTimeInSeconds) + + 'MQ: No longer needed - already per Second 'These need to be divided by 3600 as the Fuel Map output is in Grams/Second. + AG4 += (Sum7 * stepTimeInSeconds) '/ 3600 + AG5 += (Sum8 * stepTimeInSeconds) ' / 3600 + AG7 += (Sum12 * stepTimeInSeconds) '/ 3600 + End If + End Sub + + 'Constructor + Public Sub New(m1 As IM1_AverageHVACLoadDemand, m3 As IM3_AveragePneumaticLoadDemand, m6 As IM6, m8 As IM8, + fmap As IFuelConsumptionMap, signals As ISignals) + + Me.M1 = m1 + Me.M3 = m3 + Me.M6 = m6 + Me.M8 = m8 + Me.fmap = fmap + Me.signals = signals + ClearAggregates() + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb index 1ff23254f1ceb0e90e1d561aa1bee926274344ce..6afd2277edbb6cd4b456e4dd3384c68aeaba0c60 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M12.vb @@ -1,199 +1,199 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M12 - Implements IM12 - - Private Class Point - Public X As Joule - Public Y As Kilogram - End Class - - Private M11 As IM11 - Private M10 As IM10 - Private Signals As ISignals - Private _P1X As Joule - Private _P1Y As Kilogram - Private _P2X As Joule - Private _P2Y As Kilogram - Private _P3X As Joule - Private _P3Y As Kilogram - Private _XT As Joule - Private _INTERP1 As Kilogram - Private _INTERP2 As Kilogram - - Private Sub setPoints() - - _P1X = 0.SI(Of Joule)() - _P1Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad - _P2X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated - _P2Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad - _P3X = M11.StopStartSensitiveTotalCycleElectricalDemand - _P3Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics - _XT = M11.TotalCycleElectricalDemand - End Sub - - 'Interpolation - Private Function Sum1() As Kilogram - - Dim P1 As Point = New Point With {.X = 0.SI(Of Joule)(), .Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad} - Dim P2 As Point = New Point _ - With {.X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated * Signals.StoredEnergyEfficiency, - .Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad} - - Dim IP5x As Joule = M11.TotalCycleElectricalDemand - Dim IP5y As Kilogram - - Dim TanTeta As SI = (P2.Y - P1.Y) / (P2.X - P1.X) - - IP5y = P1.Y + (TanTeta * IP5x) - - _INTERP1 = IP5y - - setPoints() - - Return If(Double.IsNaN(IP5y.Value()), 0.SI(Of Kilogram), IP5y) - End Function - - Private Function Sum2() As Kilogram - - Dim P1 As Point = New Point With {.X = 0.SI(Of Joule)(), .Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad} - Dim P3 As Point = New Point _ - With {.X = M11.StopStartSensitiveTotalCycleElectricalDemand, - .Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics} - - Dim IP5x As Joule = M11.TotalCycleElectricalDemand - Dim IP5y As Kilogram - - Dim TanTeta As Double = (P3.Y - P1.Y).Value() / (P3.X - P1.X).Value() - - IP5y = P1.Y + (TanTeta * IP5x.Value()).SI(Of Kilogram)() - - _INTERP2 = IP5y - - Return If(Double.IsNaN(IP5y.Value()), 0.SI(Of Kilogram), IP5y) - End Function - - 'Constructor - Public Sub New(m10 As IM10, m11 As IM11, signals As ISignals) - - Me.M10 = m10 - Me.M11 = m11 - Me.Signals = signals - End Sub - - 'Main Class Outputs - Public ReadOnly Property FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand As Kilogram _ - Implements IM12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand - Get - - 'SCHM 3_2 - Dim interp1 As Kilogram = Sum1() - - interp1 = - If _ - (Not Double.IsNaN(interp1.Value()) AndAlso M11.StopStartSensitiveTotalCycleElectricalDemand > 0, interp1, - M11.TotalCycleFuelConsumptionZeroElectricalLoad) - Return interp1 - End Get - End Property - - Public ReadOnly Property BaseFuelConsumptionWithTrueAuxiliaryLoads As Kilogram _ - Implements IM12.BaseFuelConsumptionWithTrueAuxiliaryLoads - Get - - 'SCM 3_02 - Dim interp2 As Kilogram = Sum2() - - interp2 = - If _ - (Not Double.IsNaN(interp2.Value()) AndAlso M11.StopStartSensitiveTotalCycleElectricalDemand > 0, interp2, - M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics) - Return interp2 - End Get - End Property - - Public ReadOnly Property StopStartCorrection As Double Implements IM12.StopStartCorrection - Get - - Dim _stopStartCorrection As Scalar = BaseFuelConsumptionWithTrueAuxiliaryLoads() / - If _ - (M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics > 0, - M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics, 1.SI(Of Kilogram)) - - Return If(_stopStartCorrection > 0, _stopStartCorrection.Value(), 1) - End Get - End Property - - 'Diagnostics Signal Exposure only. Does not materially affect class operation. - Public ReadOnly Property INTRP1 As Kilogram Implements IM12.INTRP1 - Get - Return _INTERP1 - End Get - End Property - - Public ReadOnly Property INTRP2 As Kilogram Implements IM12.INTRP2 - Get - Return _INTERP2 - End Get - End Property - - Public ReadOnly Property P1X As Joule Implements IM12.P1X - Get - Return _P1X - End Get - End Property - - Public ReadOnly Property P1Y As Kilogram Implements IM12.P1Y - Get - Return _P1Y - End Get - End Property - - Public ReadOnly Property P2X As Joule Implements IM12.P2X - Get - Return _P2X - End Get - End Property - - Public ReadOnly Property P2Y As Kilogram Implements IM12.P2Y - Get - Return _P2Y - End Get - End Property - - Public ReadOnly Property P3X As Joule Implements IM12.P3X - Get - Return _P3X - End Get - End Property - - Public ReadOnly Property P3Y As Kilogram Implements IM12.P3Y - Get - Return _P3Y - End Get - End Property - - Public ReadOnly Property XTAIN As Joule Implements IM12.XTAIN - Get - Return _XT - End Get - End Property - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M12 + Implements IM12 + + Private Class Point + Public X As Joule + Public Y As Kilogram + End Class + + Private M11 As IM11 + Private M10 As IM10 + Private Signals As ISignals + Private _P1X As Joule + Private _P1Y As Kilogram + Private _P2X As Joule + Private _P2Y As Kilogram + Private _P3X As Joule + Private _P3Y As Kilogram + Private _XT As Joule + Private _INTERP1 As Kilogram + Private _INTERP2 As Kilogram + + Private Sub setPoints() + + _P1X = 0.SI(Of Joule)() + _P1Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad + _P2X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated + _P2Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad + _P3X = M11.StopStartSensitiveTotalCycleElectricalDemand + _P3Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics + _XT = M11.TotalCycleElectricalDemand + End Sub + + 'Interpolation + Private Function Sum1() As Kilogram + + Dim P1 As Point = New Point With {.X = 0.SI(Of Joule)(), .Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad} + Dim P2 As Point = New Point _ + With {.X = M11.SmartElectricalTotalCycleEletricalEnergyGenerated * Signals.StoredEnergyEfficiency, + .Y = M11.TotalCycleFuelConsumptionSmartElectricalLoad} + + Dim IP5x As Joule = M11.TotalCycleElectricalDemand + Dim IP5y As Kilogram + + Dim TanTeta As SI = (P2.Y - P1.Y) / (P2.X - P1.X) + + IP5y = P1.Y + (TanTeta * IP5x) + + _INTERP1 = IP5y + + setPoints() + + Return If(Double.IsNaN(IP5y.Value()), 0.SI(Of Kilogram), IP5y) + End Function + + Private Function Sum2() As Kilogram + + Dim P1 As Point = New Point With {.X = 0.SI(Of Joule)(), .Y = M11.TotalCycleFuelConsumptionZeroElectricalLoad} + Dim P3 As Point = New Point _ + With {.X = M11.StopStartSensitiveTotalCycleElectricalDemand, + .Y = M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics} + + Dim IP5x As Joule = M11.TotalCycleElectricalDemand + Dim IP5y As Kilogram + + Dim TanTeta As Double = (P3.Y - P1.Y).Value() / (P3.X - P1.X).Value() + + IP5y = P1.Y + (TanTeta * IP5x.Value()).SI(Of Kilogram)() + + _INTERP2 = IP5y + + Return If(Double.IsNaN(IP5y.Value()), 0.SI(Of Kilogram), IP5y) + End Function + + 'Constructor + Public Sub New(m10 As IM10, m11 As IM11, signals As ISignals) + + Me.M10 = m10 + Me.M11 = m11 + Me.Signals = signals + End Sub + + 'Main Class Outputs + Public ReadOnly Property FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand As Kilogram _ + Implements IM12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand + Get + + 'SCHM 3_2 + Dim interp1 As Kilogram = Sum1() + + interp1 = + If _ + (Not Double.IsNaN(interp1.Value()) AndAlso M11.StopStartSensitiveTotalCycleElectricalDemand > 0, interp1, + M11.TotalCycleFuelConsumptionZeroElectricalLoad) + Return interp1 + End Get + End Property + + Public ReadOnly Property BaseFuelConsumptionWithTrueAuxiliaryLoads As Kilogram _ + Implements IM12.BaseFuelConsumptionWithTrueAuxiliaryLoads + Get + + 'SCM 3_02 + Dim interp2 As Kilogram = Sum2() + + interp2 = + If _ + (Not Double.IsNaN(interp2.Value()) AndAlso M11.StopStartSensitiveTotalCycleElectricalDemand > 0, interp2, + M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics) + Return interp2 + End Get + End Property + + Public ReadOnly Property StopStartCorrection As Double Implements IM12.StopStartCorrection + Get + + Dim _stopStartCorrection As Scalar = BaseFuelConsumptionWithTrueAuxiliaryLoads() / + If _ + (M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics > 0, + M10.AverageLoadsFuelConsumptionInterpolatedForPneumatics, 1.SI(Of Kilogram)) + + Return If(_stopStartCorrection > 0, _stopStartCorrection.Value(), 1) + End Get + End Property + + 'Diagnostics Signal Exposure only. Does not materially affect class operation. + Public ReadOnly Property INTRP1 As Kilogram Implements IM12.INTRP1 + Get + Return _INTERP1 + End Get + End Property + + Public ReadOnly Property INTRP2 As Kilogram Implements IM12.INTRP2 + Get + Return _INTERP2 + End Get + End Property + + Public ReadOnly Property P1X As Joule Implements IM12.P1X + Get + Return _P1X + End Get + End Property + + Public ReadOnly Property P1Y As Kilogram Implements IM12.P1Y + Get + Return _P1Y + End Get + End Property + + Public ReadOnly Property P2X As Joule Implements IM12.P2X + Get + Return _P2X + End Get + End Property + + Public ReadOnly Property P2Y As Kilogram Implements IM12.P2Y + Get + Return _P2Y + End Get + End Property + + Public ReadOnly Property P3X As Joule Implements IM12.P3X + Get + Return _P3X + End Get + End Property + + Public ReadOnly Property P3Y As Kilogram Implements IM12.P3Y + Get + Return _P3Y + End Get + End Property + + Public ReadOnly Property XTAIN As Joule Implements IM12.XTAIN + Get + Return _XT + End Get + End Property + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb index 357c5c0b395a648543643c72c37c318c11f6d7f1..109eb23d446fed74f6f75f2449f81920bfde902d 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M13.vb @@ -1,126 +1,126 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M13 - Implements IM13 - - Private m10 As IM10 - Private m11 As IM11 - Private m12 As IM12 - Private signals As ISignals - - 'Internal Staging Calculations - - Private ReadOnly Property Sum1 As Kilogram - Get - Return m11.TotalCycleFuelConsuptionAverageLoads * m12.StopStartCorrection - End Get - End Property - - Private ReadOnly Property Sum2 As Kilogram - Get - Return m10.AverageLoadsFuelConsumptionInterpolatedForPneumatics * m12.StopStartCorrection - End Get - End Property - - Private ReadOnly Property Sum3 As Kilogram - Get - Return m10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand * m12.StopStartCorrection - End Get - End Property - - Private ReadOnly Property Sum4 As Kilogram - Get - Return -m12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand() + Sum1 - End Get - End Property - - Private ReadOnly Property Sum5 As Kilogram - Get - Return Sum2 - Sum3 - End Get - End Property - - Private ReadOnly Property Sum6 As Kilogram - Get - Return m12.BaseFuelConsumptionWithTrueAuxiliaryLoads() - Sum4 - End Get - End Property - - Private ReadOnly Property Sum7 As Kilogram - Get - Return m12.BaseFuelConsumptionWithTrueAuxiliaryLoads() - Sum5 - End Get - End Property - - Private ReadOnly Property Sum8 As Kilogram - Get - Return -Sum4 + Sum7 - End Get - End Property - - Private ReadOnly Property Sum9 As Kilogram - Get - Return SW4 * SW3 - End Get - End Property - - 'Internal Staging Switches - Private ReadOnly Property SW1 As Kilogram - Get - Return If(signals.SmartPneumatics, Sum8, Sum6) - End Get - End Property - - Private ReadOnly Property SW2 As Kilogram - Get - Return If(signals.SmartPneumatics, Sum3, m12.BaseFuelConsumptionWithTrueAuxiliaryLoads()) - End Get - End Property - - Private ReadOnly Property SW3 As Kilogram - Get - Return If(signals.SmartElectrics, SW1, SW2) - End Get - End Property - - Private ReadOnly Property SW4 As Double - Get - Return If(signals.DeclarationMode, signals.WHTC, 1) - End Get - End Property - - 'Constructor - Public Sub New(m10 As IM10, m11 As IM11, m12 As IM12, signals As ISignals) - - Me.m10 = m10 - Me.m11 = m11 - Me.m12 = m12 - Me.signals = signals - End Sub - - 'Public class outputs - Public ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Kilogram _ - Implements IM13.WHTCTotalCycleFuelConsumptionGrams - Get - Return Sum9 - End Get - End Property - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M13 + Implements IM13 + + Private m10 As IM10 + Private m11 As IM11 + Private m12 As IM12 + Private signals As ISignals + + 'Internal Staging Calculations + + Private ReadOnly Property Sum1 As Kilogram + Get + Return m11.TotalCycleFuelConsuptionAverageLoads * m12.StopStartCorrection + End Get + End Property + + Private ReadOnly Property Sum2 As Kilogram + Get + Return m10.AverageLoadsFuelConsumptionInterpolatedForPneumatics * m12.StopStartCorrection + End Get + End Property + + Private ReadOnly Property Sum3 As Kilogram + Get + Return m10.FuelConsumptionSmartPneumaticsAndAverageElectricalPowerDemand * m12.StopStartCorrection + End Get + End Property + + Private ReadOnly Property Sum4 As Kilogram + Get + Return -m12.FuelconsumptionwithsmartElectricsandAveragePneumaticPowerDemand() + Sum1 + End Get + End Property + + Private ReadOnly Property Sum5 As Kilogram + Get + Return Sum2 - Sum3 + End Get + End Property + + Private ReadOnly Property Sum6 As Kilogram + Get + Return m12.BaseFuelConsumptionWithTrueAuxiliaryLoads() - Sum4 + End Get + End Property + + Private ReadOnly Property Sum7 As Kilogram + Get + Return m12.BaseFuelConsumptionWithTrueAuxiliaryLoads() - Sum5 + End Get + End Property + + Private ReadOnly Property Sum8 As Kilogram + Get + Return -Sum4 + Sum7 + End Get + End Property + + Private ReadOnly Property Sum9 As Kilogram + Get + Return SW4 * SW3 + End Get + End Property + + 'Internal Staging Switches + Private ReadOnly Property SW1 As Kilogram + Get + Return If(signals.SmartPneumatics, Sum8, Sum6) + End Get + End Property + + Private ReadOnly Property SW2 As Kilogram + Get + Return If(signals.SmartPneumatics, Sum3, m12.BaseFuelConsumptionWithTrueAuxiliaryLoads()) + End Get + End Property + + Private ReadOnly Property SW3 As Kilogram + Get + Return If(signals.SmartElectrics, SW1, SW2) + End Get + End Property + + Private ReadOnly Property SW4 As Double + Get + Return If(signals.DeclarationMode, signals.WHTC, 1) + End Get + End Property + + 'Constructor + Public Sub New(m10 As IM10, m11 As IM11, m12 As IM12, signals As ISignals) + + Me.m10 = m10 + Me.m11 = m11 + Me.m12 = m12 + Me.signals = signals + End Sub + + 'Public class outputs + Public ReadOnly Property WHTCTotalCycleFuelConsumptionGrams As Kilogram _ + Implements IM13.WHTCTotalCycleFuelConsumptionGrams + Get + Return Sum9 + End Get + End Property + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb index 0748fc3fa57d993b4a163bdfc99860083fc98c41..4f4f332602a4c5b1a6fe531e9cf13762608d5007 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M6.vb @@ -1,291 +1,291 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M6 - Implements IM6 - -#Region "Private Field - Constructor requirements" - - Private _m1 As IM1_AverageHVACLoadDemand - Private _m2 As IM2_AverageElectricalLoadDemand - Private _m3 As IM3_AveragePneumaticLoadDemand - Private _m4 As IM4_AirCompressor - Private _m5 As IM5_SmartAlternatorSetGeneration - Private _signals As ISignals - -#End Region - - 'OUT1 - Public ReadOnly Property OverrunFlag As Boolean Implements IM6.OverrunFlag - - Get - Return VC0 - End Get - End Property - 'OUT2 - Public ReadOnly Property SmartElecAndPneumaticsCompressorFlag As Boolean _ - Implements IM6.SmartElecAndPneumaticsCompressorFlag - Get - Return VC2 - End Get - End Property - 'OUT3 - Public ReadOnly Property SmartElecAndPneumaticAltPowerGenAtCrank As Watt _ - Implements IM6.SmartElecAndPneumaticAltPowerGenAtCrank - Get - 'Multiply * 1 @ Engineering Request - Return Max1 * -1 - End Get - End Property - 'OUT4 - Public ReadOnly Property SmartElecAndPneumaticAirCompPowerGenAtCrank As Watt _ - Implements IM6.SmartElecAndPneumaticAirCompPowerGenAtCrank - Get - Return Sum16 - End Get - End Property - 'OUT5 - Public ReadOnly Property SmartElecOnlyAltPowerGenAtCrank As Watt Implements IM6.SmartElecOnlyAltPowerGenAtCrank - Get - 'Multiply * -1 @ Engineering request. - Return Max2 * -1 - End Get - End Property - 'OUT6 - Public ReadOnly Property AveragePowerDemandAtCrankFromPneumatics As Watt _ - Implements IM6.AveragePowerDemandAtCrankFromPneumatics - Get - Return _m3.GetAveragePowerDemandAtCrankFromPneumatics - End Get - End Property - 'OUT7 - Public ReadOnly Property SmartPneumaticOnlyAirCompPowerGenAtCrank As Watt _ - Implements IM6.SmartPneumaticOnlyAirCompPowerGenAtCrank - Get - Return Sum19 - End Get - End Property - 'OUT8 - Public ReadOnly Property AvgPowerDemandAtCrankFromElectricsIncHVAC As Watt _ - Implements IM6.AvgPowerDemandAtCrankFromElectricsIncHVAC - Get - - Return Sum1 - End Get - End Property - 'OUT9 - Public ReadOnly Property SmartPneumaticsOnlyCompressorFlag As Boolean Implements IM6.SmartPneumaticsOnlyCompressorFlag - Get - Return VC4 - End Get - End Property - - 'Internal Staging Calculations - 'switches - Private ReadOnly Property SW1 As Watt - Get - - Return If(_signals.SmartElectrics, _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts, Sum1) - End Get - End Property - - 'Max of Sum5 vs Sum10 - Public ReadOnly Property Max1 As Watt - Get - Return If(Sum5 > Sum10, Sum5, Sum10) - End Get - End Property - 'Max of Sum10 vs Sum7 - Public ReadOnly Property Max2 As Watt - Get - Return If(Sum7 > Sum10, Sum7, Sum10) - End Get - End Property - - 'Value Choices - Public ReadOnly Property VC0 As Boolean - Get - Return Sum3 <= 0 - End Get - End Property - - Public ReadOnly Property VC1 As Boolean - Get - Return Sum12 > 0 - End Get - End Property - - Public ReadOnly Property VC2 As Boolean - Get - Return Sum12 < 0 OrElse Sum12.IsEqual(0) - End Get - End Property - - Public ReadOnly Property VC3 As Boolean - Get - Return Sum13 > 0 - End Get - End Property - - Public ReadOnly Property VC4 As Boolean - Get - Return Sum13 < 0 OrElse Sum13.IsEqual(0) - End Get - End Property - - 'Sums - Public ReadOnly Property Sum1 As Watt - Get - Return _m1.AveragePowerDemandAtCrankFromHVACElectricsWatts() + _m2.GetAveragePowerAtCrankFromElectrics() - End Get - End Property - - Public ReadOnly Property Sum2 As Watt - Get - - Dim returnValue As Watt = _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + SW1 + - _m3.GetAveragePowerDemandAtCrankFromPneumatics - - Return returnValue - End Get - End Property - - Public ReadOnly Property Sum3 As Watt - Get - Return (_signals.EngineMotoringPower) + - (_signals.InternalEnginePower) + - Sum2 - End Get - End Property - - Public ReadOnly Property Sum4 As Watt - Get - - Return Sum3 - SW1 - _m3.GetAveragePowerDemandAtCrankFromPneumatics + _m4.GetPowerCompressorOff - End Get - End Property - - Public ReadOnly Property Sum5 As Watt - Get - Return If(OverrunFlag, Sum4, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum6 As Watt - Get - Return Sum4 - _m4.GetPowerCompressorOff + _m3.GetAveragePowerDemandAtCrankFromPneumatics - End Get - End Property - - Public ReadOnly Property Sum7 As Watt - Get - Return If(VC0, Sum6, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum8 As Watt - Get - Return Sum4 + SW1 - End Get - End Property - - Public ReadOnly Property Sum9 As Watt - Get - Return If(VC0, Sum8, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum10 As Watt - Get - Return _m5.AlternatorsGenerationPowerAtCrankOverrunWatts * -1.0 - End Get - End Property - - Public ReadOnly Property Sum11 As Watt - Get - Return Sum5 - Max1 - End Get - End Property - - Public ReadOnly Property Sum12 As Watt - Get - Return _m4.GetPowerDifference + Sum11 - End Get - End Property - - Public ReadOnly Property Sum13 As Watt - Get - Return Sum9 + _m4.GetPowerDifference - End Get - End Property - - Public ReadOnly Property Sum14 As Watt - Get - Return If(VC1, _m4.GetPowerCompressorOff, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum15 As Watt - Get - Return If(VC2, (_m4.GetPowerCompressorOn * _signals.PneumaticOverrunUtilisation), 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum16 As Watt - Get - Return Sum14 + Sum15 - End Get - End Property - - Public ReadOnly Property Sum17 As Watt - Get - Return If(VC3, _m4.GetPowerCompressorOff, 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum18 As Watt - Get - Return If(VC4, (_m4.GetPowerCompressorOn * _signals.PneumaticOverrunUtilisation), 0.SI(Of Watt)) - End Get - End Property - - Public ReadOnly Property Sum19 As Watt - Get - Return Sum17 + Sum18 - End Get - End Property - - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, - m2 As IM2_AverageElectricalLoadDemand, - m3 As IM3_AveragePneumaticLoadDemand, - m4 As IM4_AirCompressor, - m5 As IM5_SmartAlternatorSetGeneration, - signals As ISignals) - - _m1 = m1 - _m2 = m2 - _m3 = m3 - _m4 = m4 - _m5 = m5 - _signals = signals - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M6 + Implements IM6 + +#Region "Private Field - Constructor requirements" + + Private _m1 As IM1_AverageHVACLoadDemand + Private _m2 As IM2_AverageElectricalLoadDemand + Private _m3 As IM3_AveragePneumaticLoadDemand + Private _m4 As IM4_AirCompressor + Private _m5 As IM5_SmartAlternatorSetGeneration + Private _signals As ISignals + +#End Region + + 'OUT1 + Public ReadOnly Property OverrunFlag As Boolean Implements IM6.OverrunFlag + + Get + Return VC0 + End Get + End Property + 'OUT2 + Public ReadOnly Property SmartElecAndPneumaticsCompressorFlag As Boolean _ + Implements IM6.SmartElecAndPneumaticsCompressorFlag + Get + Return VC2 + End Get + End Property + 'OUT3 + Public ReadOnly Property SmartElecAndPneumaticAltPowerGenAtCrank As Watt _ + Implements IM6.SmartElecAndPneumaticAltPowerGenAtCrank + Get + 'Multiply * 1 @ Engineering Request + Return Max1 * -1 + End Get + End Property + 'OUT4 + Public ReadOnly Property SmartElecAndPneumaticAirCompPowerGenAtCrank As Watt _ + Implements IM6.SmartElecAndPneumaticAirCompPowerGenAtCrank + Get + Return Sum16 + End Get + End Property + 'OUT5 + Public ReadOnly Property SmartElecOnlyAltPowerGenAtCrank As Watt Implements IM6.SmartElecOnlyAltPowerGenAtCrank + Get + 'Multiply * -1 @ Engineering request. + Return Max2 * -1 + End Get + End Property + 'OUT6 + Public ReadOnly Property AveragePowerDemandAtCrankFromPneumatics As Watt _ + Implements IM6.AveragePowerDemandAtCrankFromPneumatics + Get + Return _m3.GetAveragePowerDemandAtCrankFromPneumatics + End Get + End Property + 'OUT7 + Public ReadOnly Property SmartPneumaticOnlyAirCompPowerGenAtCrank As Watt _ + Implements IM6.SmartPneumaticOnlyAirCompPowerGenAtCrank + Get + Return Sum19 + End Get + End Property + 'OUT8 + Public ReadOnly Property AvgPowerDemandAtCrankFromElectricsIncHVAC As Watt _ + Implements IM6.AvgPowerDemandAtCrankFromElectricsIncHVAC + Get + + Return Sum1 + End Get + End Property + 'OUT9 + Public ReadOnly Property SmartPneumaticsOnlyCompressorFlag As Boolean Implements IM6.SmartPneumaticsOnlyCompressorFlag + Get + Return VC4 + End Get + End Property + + 'Internal Staging Calculations + 'switches + Private ReadOnly Property SW1 As Watt + Get + + Return If(_signals.SmartElectrics, _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts, Sum1) + End Get + End Property + + 'Max of Sum5 vs Sum10 + Public ReadOnly Property Max1 As Watt + Get + Return If(Sum5 > Sum10, Sum5, Sum10) + End Get + End Property + 'Max of Sum10 vs Sum7 + Public ReadOnly Property Max2 As Watt + Get + Return If(Sum7 > Sum10, Sum7, Sum10) + End Get + End Property + + 'Value Choices + Public ReadOnly Property VC0 As Boolean + Get + Return Sum3 <= 0 + End Get + End Property + + Public ReadOnly Property VC1 As Boolean + Get + Return Sum12 > 0 + End Get + End Property + + Public ReadOnly Property VC2 As Boolean + Get + Return Sum12 < 0 OrElse Sum12.IsEqual(0) + End Get + End Property + + Public ReadOnly Property VC3 As Boolean + Get + Return Sum13 > 0 + End Get + End Property + + Public ReadOnly Property VC4 As Boolean + Get + Return Sum13 < 0 OrElse Sum13.IsEqual(0) + End Get + End Property + + 'Sums + Public ReadOnly Property Sum1 As Watt + Get + Return _m1.AveragePowerDemandAtCrankFromHVACElectricsWatts() + _m2.GetAveragePowerAtCrankFromElectrics() + End Get + End Property + + Public ReadOnly Property Sum2 As Watt + Get + + Dim returnValue As Watt = _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + SW1 + + _m3.GetAveragePowerDemandAtCrankFromPneumatics + + Return returnValue + End Get + End Property + + Public ReadOnly Property Sum3 As Watt + Get + Return (_signals.EngineMotoringPower) + + (_signals.InternalEnginePower) + + Sum2 + End Get + End Property + + Public ReadOnly Property Sum4 As Watt + Get + + Return Sum3 - SW1 - _m3.GetAveragePowerDemandAtCrankFromPneumatics + _m4.GetPowerCompressorOff + End Get + End Property + + Public ReadOnly Property Sum5 As Watt + Get + Return If(OverrunFlag, Sum4, 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum6 As Watt + Get + Return Sum4 - _m4.GetPowerCompressorOff + _m3.GetAveragePowerDemandAtCrankFromPneumatics + End Get + End Property + + Public ReadOnly Property Sum7 As Watt + Get + Return If(VC0, Sum6, 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum8 As Watt + Get + Return Sum4 + SW1 + End Get + End Property + + Public ReadOnly Property Sum9 As Watt + Get + Return If(VC0, Sum8, 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum10 As Watt + Get + Return _m5.AlternatorsGenerationPowerAtCrankOverrunWatts * -1.0 + End Get + End Property + + Public ReadOnly Property Sum11 As Watt + Get + Return Sum5 - Max1 + End Get + End Property + + Public ReadOnly Property Sum12 As Watt + Get + Return _m4.GetPowerDifference + Sum11 + End Get + End Property + + Public ReadOnly Property Sum13 As Watt + Get + Return Sum9 + _m4.GetPowerDifference + End Get + End Property + + Public ReadOnly Property Sum14 As Watt + Get + Return If(VC1, _m4.GetPowerCompressorOff, 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum15 As Watt + Get + Return If(VC2, (_m4.GetPowerCompressorOn * _signals.PneumaticOverrunUtilisation), 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum16 As Watt + Get + Return Sum14 + Sum15 + End Get + End Property + + Public ReadOnly Property Sum17 As Watt + Get + Return If(VC3, _m4.GetPowerCompressorOff, 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum18 As Watt + Get + Return If(VC4, (_m4.GetPowerCompressorOn * _signals.PneumaticOverrunUtilisation), 0.SI(Of Watt)) + End Get + End Property + + Public ReadOnly Property Sum19 As Watt + Get + Return Sum17 + Sum18 + End Get + End Property + + + 'Constructor + Public Sub New(m1 As IM1_AverageHVACLoadDemand, + m2 As IM2_AverageElectricalLoadDemand, + m3 As IM3_AveragePneumaticLoadDemand, + m4 As IM4_AirCompressor, + m5 As IM5_SmartAlternatorSetGeneration, + signals As ISignals) + + _m1 = m1 + _m2 = m2 + _m3 = m3 + _m4 = m4 + _m5 = m5 + _signals = signals + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb index f3bc2ceb5cefff4aabee6fb4831b036e5574a2e6..714bcce9c895a4e2f0812057e67e7f3d93937d4f 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M7.vb @@ -1,109 +1,109 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M7 - Implements IM7 - - Private _m5 As IM5_SmartAlternatorSetGeneration - Private _m6 As IM6 - Private _signals As ISignals - - 'Boolean Conditions - Private ReadOnly Property C1 As Boolean - Get - Return _m6.OverrunFlag AndAlso _signals.ClutchEngaged AndAlso _signals.InNeutral = False - End Get - End Property - - 'Internal Switched Outputs - Private ReadOnly Property SW1 As Watt - Get - - Dim idle As Boolean = _signals.EngineSpeed <= _signals.EngineIdleSpeed AndAlso - (Not _signals.ClutchEngaged OrElse _signals.InNeutral) - - Return _ - If(idle, _m5.AlternatorsGenerationPowerAtCrankIdleWatts, _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts) - End Get - End Property - - Private ReadOnly Property SW2 As Watt - Get - Return If(C1, _m6.SmartElecAndPneumaticAltPowerGenAtCrank, SW1) - End Get - End Property - - Private ReadOnly Property SW3 As Watt - Get - Return If(C1, _m6.SmartElecAndPneumaticAirCompPowerGenAtCrank, _m6.AveragePowerDemandAtCrankFromPneumatics) - End Get - End Property - - Private ReadOnly Property SW4 As Watt - Get - Return If(C1, _m6.SmartElecOnlyAltPowerGenAtCrank, SW1) - End Get - End Property - - Private ReadOnly Property SW5 As Watt - Get - Return If(C1, _m6.SmartPneumaticOnlyAirCompPowerGenAtCrank, _m6.AveragePowerDemandAtCrankFromPneumatics) - End Get - End Property - - 'Public readonly properties ( Outputs ) - Public ReadOnly Property SmartElectricalAndPneumaticAuxAltPowerGenAtCrank As Watt _ - Implements IM7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank - Get - Return SW2 - End Get - End Property - - Public ReadOnly Property SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank As Watt _ - Implements IM7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank - Get - Return SW3 - End Get - End Property - - Public ReadOnly Property SmartElectricalOnlyAuxAltPowerGenAtCrank As Watt _ - Implements IM7.SmartElectricalOnlyAuxAltPowerGenAtCrank - Get - Return SW4 - End Get - End Property - - Public ReadOnly Property SmartPneumaticOnlyAuxAirCompPowerGenAtCrank As Watt _ - Implements IM7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank - Get - Return SW5 - End Get - End Property - - 'Constructor - Public Sub New(m5 As IM5_SmartAlternatorSetGeneration, - m6 As IM6, - signals As ISignals) - - _m5 = m5 - _m6 = m6 - _signals = signals - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M7 + Implements IM7 + + Private _m5 As IM5_SmartAlternatorSetGeneration + Private _m6 As IM6 + Private _signals As ISignals + + 'Boolean Conditions + Private ReadOnly Property C1 As Boolean + Get + Return _m6.OverrunFlag AndAlso _signals.ClutchEngaged AndAlso _signals.InNeutral = False + End Get + End Property + + 'Internal Switched Outputs + Private ReadOnly Property SW1 As Watt + Get + + Dim idle As Boolean = _signals.EngineSpeed <= _signals.EngineIdleSpeed AndAlso + (Not _signals.ClutchEngaged OrElse _signals.InNeutral) + + Return _ + If(idle, _m5.AlternatorsGenerationPowerAtCrankIdleWatts, _m5.AlternatorsGenerationPowerAtCrankTractionOnWatts) + End Get + End Property + + Private ReadOnly Property SW2 As Watt + Get + Return If(C1, _m6.SmartElecAndPneumaticAltPowerGenAtCrank, SW1) + End Get + End Property + + Private ReadOnly Property SW3 As Watt + Get + Return If(C1, _m6.SmartElecAndPneumaticAirCompPowerGenAtCrank, _m6.AveragePowerDemandAtCrankFromPneumatics) + End Get + End Property + + Private ReadOnly Property SW4 As Watt + Get + Return If(C1, _m6.SmartElecOnlyAltPowerGenAtCrank, SW1) + End Get + End Property + + Private ReadOnly Property SW5 As Watt + Get + Return If(C1, _m6.SmartPneumaticOnlyAirCompPowerGenAtCrank, _m6.AveragePowerDemandAtCrankFromPneumatics) + End Get + End Property + + 'Public readonly properties ( Outputs ) + Public ReadOnly Property SmartElectricalAndPneumaticAuxAltPowerGenAtCrank As Watt _ + Implements IM7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank + Get + Return SW2 + End Get + End Property + + Public ReadOnly Property SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank As Watt _ + Implements IM7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank + Get + Return SW3 + End Get + End Property + + Public ReadOnly Property SmartElectricalOnlyAuxAltPowerGenAtCrank As Watt _ + Implements IM7.SmartElectricalOnlyAuxAltPowerGenAtCrank + Get + Return SW4 + End Get + End Property + + Public ReadOnly Property SmartPneumaticOnlyAuxAirCompPowerGenAtCrank As Watt _ + Implements IM7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank + Get + Return SW5 + End Get + End Property + + 'Constructor + Public Sub New(m5 As IM5_SmartAlternatorSetGeneration, + m6 As IM6, + signals As ISignals) + + _m5 = m5 + _m6 = m6 + _signals = signals + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb index fc2af644d96b61acaf92b198f0001f180bb1e655..3ac82eb359692df3bdf47524b034c2afd98ea7e2 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M8.vb @@ -1,144 +1,144 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M8 - Implements IM8 - -#Region "Private Fields" - - Private _m1 As IM1_AverageHVACLoadDemand - Private _m6 As IM6 - Private _m7 As IM7 - Private _signals As ISignals - -#End Region - -#Region "Internal Sums and Switches" - - 'Internal Staged Sums and Switches - Private ReadOnly Property Sum1 As Watt - Get - Return _ - _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank() + _m7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank() - End Get - End Property - - Private ReadOnly Property Sum2 As Watt - Get - Return _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank() + _m6.AveragePowerDemandAtCrankFromPneumatics - End Get - End Property - - Private ReadOnly Property Sum3 As Watt - Get - Return _m7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank + _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC - End Get - End Property - - Private ReadOnly Property Sum4 As Watt - Get - Return _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC + _m6.AveragePowerDemandAtCrankFromPneumatics - End Get - End Property - - Private ReadOnly Property Sum5 As Watt - Get - Return _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + SW5 - End Get - End Property - - Private ReadOnly Property Sum6 As Watt - Get - Return If(SW6, Sum5, SIBase(Of Watt).Create(0)) - End Get - End Property - - Private ReadOnly Property SW1 As Watt - Get - Return If(_signals.SmartPneumatics, Sum1, Sum2) - End Get - End Property - - Private ReadOnly Property SW2 As Watt - Get - Return If(_signals.SmartPneumatics, Sum3, Sum4) - End Get - End Property - - Private ReadOnly Property SW3 As Watt - Get - Return _ - If _ - (_signals.SmartPneumatics, _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank(), - _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank()) - End Get - End Property - - Private ReadOnly Property SW4 As Boolean - Get - Return If(_signals.SmartElectrics, _m6.SmartElecAndPneumaticsCompressorFlag, _m6.SmartPneumaticsOnlyCompressorFlag) - End Get - End Property - - Private ReadOnly Property SW5 As Watt - Get - Return If(_signals.SmartElectrics, SW1, SW2) - End Get - End Property - - Private ReadOnly Property SW6 As Boolean - Get - Return Not _signals.EngineStopped - End Get - End Property - -#End Region - - 'OUT1 - Public ReadOnly Property AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries As Watt _ - Implements IM8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries - Get - Return Sum6 - End Get - End Property - 'OUT2 - Public ReadOnly Property SmartElectricalAlternatorPowerGenAtCrank As Watt _ - Implements IM8.SmartElectricalAlternatorPowerGenAtCrank - Get - Return SW3 - End Get - End Property - 'OUT3 - Public ReadOnly Property CompressorFlag As Boolean Implements IM8.CompressorFlag - Get - Return SW4 - End Get - End Property - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, m6 As IM6, m7 As IM7, signals As ISignals) - - _m1 = m1 - _m6 = m6 - _m7 = m7 - _signals = signals - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M8 + Implements IM8 + +#Region "Private Fields" + + Private _m1 As IM1_AverageHVACLoadDemand + Private _m6 As IM6 + Private _m7 As IM7 + Private _signals As ISignals + +#End Region + +#Region "Internal Sums and Switches" + + 'Internal Staged Sums and Switches + Private ReadOnly Property Sum1 As Watt + Get + Return _ + _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank() + _m7.SmartElectricalAndPneumaticAuxAirCompPowerGenAtCrank() + End Get + End Property + + Private ReadOnly Property Sum2 As Watt + Get + Return _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank() + _m6.AveragePowerDemandAtCrankFromPneumatics + End Get + End Property + + Private ReadOnly Property Sum3 As Watt + Get + Return _m7.SmartPneumaticOnlyAuxAirCompPowerGenAtCrank + _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC + End Get + End Property + + Private ReadOnly Property Sum4 As Watt + Get + Return _m6.AvgPowerDemandAtCrankFromElectricsIncHVAC + _m6.AveragePowerDemandAtCrankFromPneumatics + End Get + End Property + + Private ReadOnly Property Sum5 As Watt + Get + Return _m1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + SW5 + End Get + End Property + + Private ReadOnly Property Sum6 As Watt + Get + Return If(SW6, Sum5, SIBase(Of Watt).Create(0)) + End Get + End Property + + Private ReadOnly Property SW1 As Watt + Get + Return If(_signals.SmartPneumatics, Sum1, Sum2) + End Get + End Property + + Private ReadOnly Property SW2 As Watt + Get + Return If(_signals.SmartPneumatics, Sum3, Sum4) + End Get + End Property + + Private ReadOnly Property SW3 As Watt + Get + Return _ + If _ + (_signals.SmartPneumatics, _m7.SmartElectricalAndPneumaticAuxAltPowerGenAtCrank(), + _m7.SmartElectricalOnlyAuxAltPowerGenAtCrank()) + End Get + End Property + + Private ReadOnly Property SW4 As Boolean + Get + Return If(_signals.SmartElectrics, _m6.SmartElecAndPneumaticsCompressorFlag, _m6.SmartPneumaticsOnlyCompressorFlag) + End Get + End Property + + Private ReadOnly Property SW5 As Watt + Get + Return If(_signals.SmartElectrics, SW1, SW2) + End Get + End Property + + Private ReadOnly Property SW6 As Boolean + Get + Return Not _signals.EngineStopped + End Get + End Property + +#End Region + + 'OUT1 + Public ReadOnly Property AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries As Watt _ + Implements IM8.AuxPowerAtCrankFromElectricalHVACAndPneumaticsAncillaries + Get + Return Sum6 + End Get + End Property + 'OUT2 + Public ReadOnly Property SmartElectricalAlternatorPowerGenAtCrank As Watt _ + Implements IM8.SmartElectricalAlternatorPowerGenAtCrank + Get + Return SW3 + End Get + End Property + 'OUT3 + Public ReadOnly Property CompressorFlag As Boolean Implements IM8.CompressorFlag + Get + Return SW4 + End Get + End Property + + 'Constructor + Public Sub New(m1 As IM1_AverageHVACLoadDemand, m6 As IM6, m7 As IM7, signals As ISignals) + + _m1 = m1 + _m6 = m6 + _m7 = m7 + _signals = signals + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb index bb5c089ad316ae83ed041b4bcad9c4578c56ae73..39908f12dd77c1d7af4b2aa3e48c87361a75cb08 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/M9.vb @@ -1,236 +1,236 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac - -Namespace DownstreamModules - Public Class M9 - Implements IM9 - Private Const RPM_TO_RADS_PER_SECOND As Single = 60 / (2 * Math.PI) '9.55F - -#Region "Aggregates" - - 'AG1 - Private _LitresOfAirCompressorOnContinuallyAggregate As NormLiter - 'AG2 - Private _LitresOfAirCompressorOnOnlyInOverrunAggregate As NormLiter - 'AG3 - Private _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate As Kilogram - 'AG4 - Private _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate As Kilogram - -#End Region - -#Region "Constructor Requirements" - - Private M1 As IM1_AverageHVACLoadDemand - Private M4 As IM4_AirCompressor - Private M6 As IM6 - Private M8 As IM8 - Private FMAP As IFuelConsumptionMap - Private PSAC As IPneumaticsAuxilliariesConfig - Private Signals As ISignals - -#End Region - - -#Region "Class Outputs" - 'OUT 1 - Public ReadOnly Property LitresOfAirCompressorOnContinually As NormLiter _ - Implements IM9.LitresOfAirCompressorOnContinually - Get - Return _LitresOfAirCompressorOnContinuallyAggregate - End Get - End Property - 'OUT 2 - Public ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As NormLiter _ - Implements IM9.LitresOfAirCompressorOnOnlyInOverrun - Get - Return _LitresOfAirCompressorOnOnlyInOverrunAggregate - End Get - End Property - 'OUT 3 - Public ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Kilogram _ - Implements IM9.TotalCycleFuelConsumptionCompressorOffContinuously - Get - Return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate - End Get - End Property - 'OUT 4 - Public ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Kilogram _ - Implements IM9.TotalCycleFuelConsumptionCompressorOnContinuously - Get - Return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate - End Get - End Property - -#End Region - - 'Staging Calculations - Private Function S0(ByVal rpm As PerSecond) As PerSecond - - If rpm < 1 Then rpm = 1.RPMtoRad() - - Return rpm ' / RPM_TO_RADS_PER_SECOND - End Function - - Private ReadOnly Property S1 As Watt - Get - Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts - End Get - End Property - - Private ReadOnly Property S2 As NewtonMeter - Get - If S0(Signals.EngineSpeed).IsEqual(0) Then _ - Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") - Return M4.GetPowerCompressorOn / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property S3 As NewtonMeter - Get - If S0(Signals.EngineSpeed).IsEqual(0) Then _ - Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") - Return M4.GetPowerCompressorOff / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property S4 As NewtonMeter - Get - If S0(Signals.EngineSpeed).IsEqual(0) Then _ - Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") - Return S1 / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property S5 As NewtonMeter - Get - Return S2 + S14 - End Get - End Property - - Private ReadOnly Property S6 As NewtonMeter - Get - Return S14 + S3 - End Get - End Property - - Private ReadOnly Property S7 As NewtonMeter - Get - Return S4 + S5 - End Get - End Property - - Private ReadOnly Property S8 As NewtonMeter - Get - Return S4 + S6 - End Get - End Property - - Private ReadOnly Property S9 As NormLiterPerSecond - Get - Return If(M6.OverrunFlag AndAlso M8.CompressorFlag, M4.GetFlowRate, SIBase(Of NormLiterPerSecond).Create(0)) - End Get - End Property - - Private ReadOnly Property S10 As NormLiterPerSecond - Get - Return S13 * PSAC.OverrunUtilisationForCompressionFraction - End Get - End Property - - Private ReadOnly Property S11 As KilogramPerSecond - Get - 'SCHM 3_02 - Dim int1 As KilogramPerSecond = FMAP.GetFuelConsumption(S7, Signals.EngineSpeed) - int1 = If(int1 > 0 AndAlso Not Double.IsNaN(int1.Value()), int1, 0.SI(Of KilogramPerSecond)) - - Return int1 - End Get - End Property - - Private ReadOnly Property S12 As KilogramPerSecond - Get - - 'SCHM 3_02 - Dim int2 As KilogramPerSecond = FMAP.GetFuelConsumption(S8, Signals.EngineSpeed) - int2 = If(int2 > 0 AndAlso Not Double.IsNaN(int2.Value()), int2, 0.SI(Of KilogramPerSecond)) - - Return int2 - End Get - End Property - - Private ReadOnly Property S13 As NormLiterPerSecond - Get - Return If(Signals.ClutchEngaged AndAlso Not (Signals.InNeutral), S9, SIBase(Of NormLiterPerSecond).Create(0)) - End Get - End Property - - Private ReadOnly Property S14 As NewtonMeter - Get - Return _ - Signals.EngineDrivelineTorque + - Signals.PreExistingAuxPower / S0(Signals.EngineSpeed) - End Get - End Property - - Private ReadOnly Property SW1 As Boolean - Get - Return Not Signals.EngineStopped - End Get - End Property - - 'Utility Methods - Public Sub ClearAggregates() Implements IM9.ClearAggregates - - _LitresOfAirCompressorOnContinuallyAggregate = SIBase(Of NormLiter).Create(0) - _LitresOfAirCompressorOnOnlyInOverrunAggregate = SIBase(Of NormLiter).Create(0) - _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate = SIBase(Of Kilogram).Create(0) - _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate = SIBase(Of Kilogram).Create(0) - End Sub - - Public Sub CycleStep(stepTimeInSeconds As Second) Implements IM9.CycleStep - - If Signals.EngineStopped Then Return - - If (SW1) Then - _LitresOfAirCompressorOnContinuallyAggregate += M4.GetFlowRate * stepTimeInSeconds - _LitresOfAirCompressorOnOnlyInOverrunAggregate += S10 * stepTimeInSeconds - _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate += S11 * stepTimeInSeconds - _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate += S12 * stepTimeInSeconds - End If - End Sub - - 'Constructor - Public Sub New(m1 As IM1_AverageHVACLoadDemand, m4 As IM4_AirCompressor, m6 As IM6, m8 As IM8, - fmap As IFuelConsumptionMap, psac As IPneumaticsAuxilliariesConfig, signals As ISignals) - Me.M1 = m1 - Me.M4 = m4 - Me.M6 = m6 - Me.M8 = m8 - Me.FMAP = fmap - Me.PSAC = psac - Me.Signals = signals - - ClearAggregates() - End Sub - - 'Auxiliary Event - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac + +Namespace DownstreamModules + Public Class M9 + Implements IM9 + Private Const RPM_TO_RADS_PER_SECOND As Single = 60 / (2 * Math.PI) '9.55F + +#Region "Aggregates" + + 'AG1 + Private _LitresOfAirCompressorOnContinuallyAggregate As NormLiter + 'AG2 + Private _LitresOfAirCompressorOnOnlyInOverrunAggregate As NormLiter + 'AG3 + Private _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate As Kilogram + 'AG4 + Private _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate As Kilogram + +#End Region + +#Region "Constructor Requirements" + + Private M1 As IM1_AverageHVACLoadDemand + Private M4 As IM4_AirCompressor + Private M6 As IM6 + Private M8 As IM8 + Private FMAP As IFuelConsumptionMap + Private PSAC As IPneumaticsAuxilliariesConfig + Private Signals As ISignals + +#End Region + + +#Region "Class Outputs" + 'OUT 1 + Public ReadOnly Property LitresOfAirCompressorOnContinually As NormLiter _ + Implements IM9.LitresOfAirCompressorOnContinually + Get + Return _LitresOfAirCompressorOnContinuallyAggregate + End Get + End Property + 'OUT 2 + Public ReadOnly Property LitresOfAirCompressorOnOnlyInOverrun As NormLiter _ + Implements IM9.LitresOfAirCompressorOnOnlyInOverrun + Get + Return _LitresOfAirCompressorOnOnlyInOverrunAggregate + End Get + End Property + 'OUT 3 + Public ReadOnly Property TotalCycleFuelConsumptionCompressorOffContinuously As Kilogram _ + Implements IM9.TotalCycleFuelConsumptionCompressorOffContinuously + Get + Return _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate + End Get + End Property + 'OUT 4 + Public ReadOnly Property TotalCycleFuelConsumptionCompressorOnContinuously As Kilogram _ + Implements IM9.TotalCycleFuelConsumptionCompressorOnContinuously + Get + Return _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate + End Get + End Property + +#End Region + + 'Staging Calculations + Private Function S0(ByVal rpm As PerSecond) As PerSecond + + If rpm < 1 Then rpm = 1.RPMtoRad() + + Return rpm ' / RPM_TO_RADS_PER_SECOND + End Function + + Private ReadOnly Property S1 As Watt + Get + Return M6.AvgPowerDemandAtCrankFromElectricsIncHVAC + M1.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + End Get + End Property + + Private ReadOnly Property S2 As NewtonMeter + Get + If S0(Signals.EngineSpeed).IsEqual(0) Then _ + Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") + Return M4.GetPowerCompressorOn / S0(Signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property S3 As NewtonMeter + Get + If S0(Signals.EngineSpeed).IsEqual(0) Then _ + Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") + Return M4.GetPowerCompressorOff / S0(Signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property S4 As NewtonMeter + Get + If S0(Signals.EngineSpeed).IsEqual(0) Then _ + Throw New DivideByZeroException("Engine speed is zero and cannot be used as a divisor.") + Return S1 / S0(Signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property S5 As NewtonMeter + Get + Return S2 + S14 + End Get + End Property + + Private ReadOnly Property S6 As NewtonMeter + Get + Return S14 + S3 + End Get + End Property + + Private ReadOnly Property S7 As NewtonMeter + Get + Return S4 + S5 + End Get + End Property + + Private ReadOnly Property S8 As NewtonMeter + Get + Return S4 + S6 + End Get + End Property + + Private ReadOnly Property S9 As NormLiterPerSecond + Get + Return If(M6.OverrunFlag AndAlso M8.CompressorFlag, M4.GetFlowRate, SIBase(Of NormLiterPerSecond).Create(0)) + End Get + End Property + + Private ReadOnly Property S10 As NormLiterPerSecond + Get + Return S13 * PSAC.OverrunUtilisationForCompressionFraction + End Get + End Property + + Private ReadOnly Property S11 As KilogramPerSecond + Get + 'SCHM 3_02 + Dim int1 As KilogramPerSecond = FMAP.GetFuelConsumption(S7, Signals.EngineSpeed) + int1 = If(int1 > 0 AndAlso Not Double.IsNaN(int1.Value()), int1, 0.SI(Of KilogramPerSecond)) + + Return int1 + End Get + End Property + + Private ReadOnly Property S12 As KilogramPerSecond + Get + + 'SCHM 3_02 + Dim int2 As KilogramPerSecond = FMAP.GetFuelConsumption(S8, Signals.EngineSpeed) + int2 = If(int2 > 0 AndAlso Not Double.IsNaN(int2.Value()), int2, 0.SI(Of KilogramPerSecond)) + + Return int2 + End Get + End Property + + Private ReadOnly Property S13 As NormLiterPerSecond + Get + Return If(Signals.ClutchEngaged AndAlso Not (Signals.InNeutral), S9, SIBase(Of NormLiterPerSecond).Create(0)) + End Get + End Property + + Private ReadOnly Property S14 As NewtonMeter + Get + Return _ + Signals.EngineDrivelineTorque + + Signals.PreExistingAuxPower / S0(Signals.EngineSpeed) + End Get + End Property + + Private ReadOnly Property SW1 As Boolean + Get + Return Not Signals.EngineStopped + End Get + End Property + + 'Utility Methods + Public Sub ClearAggregates() Implements IM9.ClearAggregates + + _LitresOfAirCompressorOnContinuallyAggregate = SIBase(Of NormLiter).Create(0) + _LitresOfAirCompressorOnOnlyInOverrunAggregate = SIBase(Of NormLiter).Create(0) + _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate = SIBase(Of Kilogram).Create(0) + _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate = SIBase(Of Kilogram).Create(0) + End Sub + + Public Sub CycleStep(stepTimeInSeconds As Second) Implements IM9.CycleStep + + If Signals.EngineStopped Then Return + + If (SW1) Then + _LitresOfAirCompressorOnContinuallyAggregate += M4.GetFlowRate * stepTimeInSeconds + _LitresOfAirCompressorOnOnlyInOverrunAggregate += S10 * stepTimeInSeconds + _TotalCycleFuelConsumptionCompressorOnContinuouslyAggregate += S11 * stepTimeInSeconds + _TotalCycleFuelConsumptionCompressorOffContinuouslyAggregate += S12 * stepTimeInSeconds + End If + End Sub + + 'Constructor + Public Sub New(m1 As IM1_AverageHVACLoadDemand, m4 As IM4_AirCompressor, m6 As IM6, m8 As IM8, + fmap As IFuelConsumptionMap, psac As IPneumaticsAuxilliariesConfig, signals As ISignals) + Me.M1 = m1 + Me.M4 = m4 + Me.M6 = m6 + Me.M8 = m8 + Me.FMAP = fmap + Me.PSAC = psac + Me.Signals = signals + + ClearAggregates() + End Sub + + 'Auxiliary Event + Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + Implements IAuxiliaryEvent.AuxiliaryEvent + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb index e5ac0614fbd243cae5346b64e45dd62efd5f75db..0dee1481c911afe5286ab6178db1a6830cf08059 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/cDelaunayMap.vb @@ -1,475 +1,475 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.Collections.Generic - -Public Class cDelaunayMap - Public ptDim As Integer - - Public ptList As List(Of dPoint) - Private lDT As List(Of dTriangle) - Private planes As List(Of Double()) - - Public DualMode As Boolean - Private ptListXZ As List(Of dPoint) - Private planesXZ As List(Of Double()) - Private lDTXZ As List(Of dTriangle) - - Public ExtrapolError As Boolean - - - Public Sub New() - ptList = New List(Of dPoint) - ptListXZ = New List(Of dPoint) - DualMode = False - End Sub - - Public Sub AddPoints(ByVal X As Double, ByVal Y As Double, ByVal Z As Double) - ptList.Add(New dPoint(X, Y, Z)) - If DualMode Then ptListXZ.Add(New dPoint(X, Z, Y)) - End Sub - - Public Function Triangulate() As Boolean - Dim tr As dTriangle - Dim DT As dTriangulation - - ptDim = ptList.Count - 1 - - 'XY-triangulation - Try - DT = New dTriangulation - lDT = DT.Triangulate(ptList) - Catch ex As Exception - Return False - End Try - - planes = New List(Of Double()) - - For Each tr In lDT - planes.Add(GetPlane(tr)) - Next - - - '#If DEBUG Then - ' Dim i As Int16 - ' Debug.Print("#,x1,y1,z1,x2,y2,z2") - ' i = -1 - ' For Each tr In lDT - ' i += 1 - ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) - ' Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) - ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z) - ' Next - '#End If - - - 'XZ-triangulation - If DualMode Then - - If ptDim <> ptListXZ.Count - 1 Then Return False - - Try - DT = New dTriangulation - lDTXZ = DT.Triangulate(ptListXZ) - Catch ex As Exception - Return False - End Try - - planesXZ = New List(Of Double()) - - For Each tr In lDTXZ - planesXZ.Add(GetPlane(tr)) - Next - - End If - - Return True - End Function - - 'XY => Z Interpolation - Public Function Intpol(ByVal x As Double, ByVal y As Double) As Double - Dim j As Integer - Dim l0 As Double() - Dim tr As dTriangle - - ExtrapolError = False - - 'Try exact solution for IsInside() - j = - 1 - For Each tr In lDT - j += 1 - If IsInside(tr, x, y, True) Then - l0 = planes(j) - Return (l0(3) - x*l0(0) - y*l0(1))/l0(2) - End If - Next - - 'Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) - j = - 1 - For Each tr In lDT - j += 1 - If IsInside(tr, x, y, False) Then - l0 = planes(j) - Return (l0(3) - x*l0(0) - y*l0(1))/l0(2) - End If - Next - - - 'ERROR: Extrapolation - ExtrapolError = True - - Return Nothing - End Function - - 'XZ => Y Interpolation - Public Function IntpolXZ(ByVal x As Double, ByVal z As Double) As Double - Dim j As Integer - Dim l0 As Double() - Dim tr As dTriangle - - ExtrapolError = False - - If DualMode Then - - j = - 1 - - 'Try exact solution for IsInside() - For Each tr In lDTXZ - j += 1 - If IsInside(tr, x, z, True) Then - l0 = planesXZ(j) - Return (l0(3) - x*l0(0) - z*l0(1))/l0(2) - End If - Next - - 'Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) - j = - 1 - For Each tr In lDTXZ - j += 1 - If IsInside(tr, x, z, False) Then - l0 = planesXZ(j) - Return (l0(3) - x*l0(0) - z*l0(1))/l0(2) - End If - Next - - 'ERROR: Extrapolation - ExtrapolError = True - Return Nothing - - Else - - 'ERROR: Extrapolation - ExtrapolError = True - Return Nothing - - End If - End Function - - Private Function GetPlane(ByRef tr As dTriangle) As Double() - Dim AB As dPoint - Dim AC As dPoint - Dim cross As dPoint - Dim l(3) As Double - Dim pt1 As dPoint - Dim pt2 As dPoint - Dim pt3 As dPoint - - pt1 = tr.P1 - pt2 = tr.P2 - pt3 = tr.P3 - - AB = New dPoint(pt2.X - pt1.X, pt2.Y - pt1.Y, pt2.Z - pt1.Z) - AC = New dPoint(pt3.X - pt1.X, pt3.Y - pt1.Y, pt3.Z - pt1.Z) - - cross = New dPoint(AB.Y*AC.Z - AB.Z*AC.Y, AB.Z*AC.X - AB.X*AC.Z, AB.X*AC.Y - AB.Y*AC.X) - - l(0) = cross.X - l(1) = cross.Y - l(2) = cross.Z - - l(3) = pt1.X*cross.X + pt1.Y*cross.Y + pt1.Z*cross.Z - - Return l - End Function - - Private Function IsInside(ByRef tr As dTriangle, ByVal xges As Double, ByVal yges As Double, ByVal Exact As Boolean) _ - As Boolean - Dim v0(1) As Double - Dim v1(1) As Double - Dim v2(1) As Double - Dim dot00 As Double - Dim dot01 As Double - Dim dot02 As Double - Dim dot11 As Double - Dim dot12 As Double - Dim invDenom As Double - Dim u As Double - Dim v As Double - Dim pt1 As dPoint - Dim pt2 As dPoint - Dim pt3 As dPoint - - pt1 = tr.P1 - pt2 = tr.P2 - pt3 = tr.P3 - - 'Quelle: http://www.blackpawn.com/texts/pointinpoly/default.html (Barycentric Technique) - - ' Compute vectors - v0(0) = pt3.X - pt1.X - v0(1) = pt3.Y - pt1.Y - - v1(0) = pt2.X - pt1.X - v1(1) = pt2.Y - pt1.Y - - v2(0) = xges - pt1.X - v2(1) = yges - pt1.Y - - ' Compute dot products - dot00 = v0(0)*v0(0) + v0(1)*v0(1) - dot01 = v0(0)*v1(0) + v0(1)*v1(1) - dot02 = v0(0)*v2(0) + v0(1)*v2(1) - dot11 = v1(0)*v1(0) + v1(1)*v1(1) - dot12 = v1(0)*v2(0) + v1(1)*v2(1) - - ' Compute barycentric coordinates - invDenom = 1/(dot00*dot11 - dot01*dot01) - u = (dot11*dot02 - dot01*dot12)*invDenom - v = (dot00*dot12 - dot01*dot02)*invDenom - - 'Debug.Print(u & ", " & v & ", " & u + v) - - ' Check if point is in triangle - If Exact Then - Return (u >= 0) And (v >= 0) And (u + v <= 1) - Else - Return (u >= - 0.001) And (v >= - 0.001) And (u + v <= 1.001) - End If - End Function - - Public Class dPoint - Public X As Double - Public Y As Double - Public Z As Double - - Public Sub New(ByVal xd As Double, ByVal yd As Double, ByVal zd As Double) - X = xd - Y = yd - Z = zd - End Sub - - Public Shared Operator =(left As dPoint, right As dPoint) As Boolean - - 'If DirectCast(left, Object) = DirectCast(right, Object) Then - ' Return True - 'End If - - 'If (DirectCast(left, Object) Is Nothing) OrElse (DirectCast(right, Object) Is Nothing) Then - ' Return False - 'End If - - ' Just compare x and y here... - If left.X <> right.X Then - Return False - End If - - If left.Y <> right.Y Then - Return False - End If - - Return True - End Operator - - Public Shared Operator <>(left As dPoint, right As dPoint) As Boolean - Return Not (left = right) - End Operator - End Class - - Public Class dTriangle - Public P1 As dPoint - Public P2 As dPoint - Public P3 As dPoint - - Public Sub New(ByRef pp1 As dPoint, ByRef pp2 As dPoint, ByRef pp3 As dPoint) - P1 = pp1 - P2 = pp2 - P3 = pp3 - End Sub - - Public Function ContainsInCircumcircle(pt As dPoint) As Double - Dim ax As Double = Me.P1.X - pt.X - Dim ay As Double = Me.P1.Y - pt.Y - Dim bx As Double = Me.P2.X - pt.X - Dim by As Double = Me.P2.Y - pt.Y - Dim cx As Double = Me.P3.X - pt.X - Dim cy As Double = Me.P3.Y - pt.Y - Dim det_ab As Double = ax*by - bx*ay - Dim det_bc As Double = bx*cy - cx*by - Dim det_ca As Double = cx*ay - ax*cy - Dim a_squared As Double = ax*ax + ay*ay - Dim b_squared As Double = bx*bx + by*by - Dim c_squared As Double = cx*cx + cy*cy - - Return a_squared*det_bc + b_squared*det_ca + c_squared*det_ab - End Function - - Public Function SharesVertexWith(triangle As dTriangle) As Boolean - If Me.P1.X = triangle.P1.X AndAlso Me.P1.Y = triangle.P1.Y Then - Return True - End If - If Me.P1.X = triangle.P2.X AndAlso Me.P1.Y = triangle.P2.Y Then - Return True - End If - If Me.P1.X = triangle.P3.X AndAlso Me.P1.Y = triangle.P3.Y Then - Return True - End If - - If Me.P2.X = triangle.P1.X AndAlso Me.P2.Y = triangle.P1.Y Then - Return True - End If - If Me.P2.X = triangle.P2.X AndAlso Me.P2.Y = triangle.P2.Y Then - Return True - End If - If Me.P2.X = triangle.P3.X AndAlso Me.P2.Y = triangle.P3.Y Then - Return True - End If - - If Me.P3.X = triangle.P1.X AndAlso Me.P3.Y = triangle.P1.Y Then - Return True - End If - If Me.P3.X = triangle.P2.X AndAlso Me.P3.Y = triangle.P2.Y Then - Return True - End If - If Me.P3.X = triangle.P3.X AndAlso Me.P3.Y = triangle.P3.Y Then - Return True - End If - - Return False - End Function - End Class - - Public Class dEdge - Public StartPoint As dPoint - Public EndPoint As dPoint - - Public Sub New(ByRef p1 As dPoint, ByRef p2 As dPoint) - StartPoint = p1 - EndPoint = p2 - End Sub - - Public Shared Operator =(left As dEdge, right As dEdge) As Boolean - 'If DirectCast(left, Object) = DirectCast(right, Object) Then - ' Return True - 'End If - - 'If (DirectCast(left, Object) Is Nothing) Or (DirectCast(right, Object) Is Nothing) Then - ' Return False - 'End If - - Return _ - ((left.StartPoint = right.StartPoint AndAlso left.EndPoint = right.EndPoint) OrElse - (left.StartPoint = right.EndPoint AndAlso left.EndPoint = right.StartPoint)) - End Operator - - Public Shared Operator <>(left As dEdge, right As dEdge) As Boolean - Return Not (left = right) - End Operator - End Class - - Public Class dTriangulation - Public Function Triangulate(triangulationPoints As List(Of dPoint)) As List(Of dTriangle) - If triangulationPoints.Count < 3 Then - Throw New ArgumentException("Can not triangulate less than three vertices!") - End If - - ' The triangle list - Dim triangles As New List(Of dTriangle)() - - - ' The "supertriangle" which encompasses all triangulation points. - ' This triangle initializes the algorithm and will be removed later. - Dim superTriangle As dTriangle = Me.SuperTriangle(triangulationPoints) - triangles.Add(superTriangle) - - ' Include each point one at a time into the existing triangulation - For i As Integer = 0 To triangulationPoints.Count - 1 - ' Initialize the edge buffer. - Dim EdgeBuffer As New List(Of dEdge)() - - ' If the actual vertex lies inside the circumcircle, then the three edges of the - ' triangle are added to the edge buffer and the triangle is removed from list. - For j As Integer = triangles.Count - 1 To 0 Step - 1 - Dim t As dTriangle = triangles(j) - If t.ContainsInCircumcircle(triangulationPoints(i)) > 0 Then - EdgeBuffer.Add(New dEdge(t.P1, t.P2)) - EdgeBuffer.Add(New dEdge(t.P2, t.P3)) - EdgeBuffer.Add(New dEdge(t.P3, t.P1)) - triangles.RemoveAt(j) - End If - Next - - ' Remove duplicate edges. This leaves the convex hull of the edges. - ' The edges in this convex hull are oriented counterclockwise! - For j As Integer = EdgeBuffer.Count - 2 To 0 Step - 1 - For k As Integer = EdgeBuffer.Count - 1 To j + 1 Step - 1 - If EdgeBuffer(j) = EdgeBuffer(k) Then - EdgeBuffer.RemoveAt(k) - EdgeBuffer.RemoveAt(j) - k -= 1 - Continue For - End If - Next - Next - - ' Generate new counterclockwise oriented triangles filling the "hole" in - ' the existing triangulation. These triangles all share the actual vertex. - For j As Integer = 0 To EdgeBuffer.Count - 1 - triangles.Add(New dTriangle(EdgeBuffer(j).StartPoint, EdgeBuffer(j).EndPoint, triangulationPoints(i))) - Next - Next - - ' We don't want the supertriangle in the triangulation, so - ' remove all triangles sharing a vertex with the supertriangle. - For i As Integer = triangles.Count - 1 To 0 Step - 1 - If triangles(i).SharesVertexWith(superTriangle) Then - triangles.RemoveAt(i) - End If - Next - - ' Return the triangles - Return triangles - End Function - - - Private Function SuperTriangle(triangulationPoints As List(Of dPoint)) As dTriangle - Dim M As Double = triangulationPoints(0).X - - ' get the extremal x and y coordinates - For i As Integer = 1 To triangulationPoints.Count - 1 - Dim xAbs As Double = Math.Abs(triangulationPoints(i).X) - Dim yAbs As Double = Math.Abs(triangulationPoints(i).Y) - If xAbs > M Then - M = xAbs - End If - If yAbs > M Then - M = yAbs - End If - Next - - ' make a triangle - Dim sp1 As New dPoint(10*M, 0, 0) - Dim sp2 As New dPoint(0, 10*M, 0) - Dim sp3 As New dPoint(- 10*M, - 10*M, 0) - - Return New dTriangle(sp1, sp2, sp3) - End Function - End Class -End Class - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.Collections.Generic + +Public Class cDelaunayMap + Public ptDim As Integer + + Public ptList As List(Of dPoint) + Private lDT As List(Of dTriangle) + Private planes As List(Of Double()) + + Public DualMode As Boolean + Private ptListXZ As List(Of dPoint) + Private planesXZ As List(Of Double()) + Private lDTXZ As List(Of dTriangle) + + Public ExtrapolError As Boolean + + + Public Sub New() + ptList = New List(Of dPoint) + ptListXZ = New List(Of dPoint) + DualMode = False + End Sub + + Public Sub AddPoints(ByVal X As Double, ByVal Y As Double, ByVal Z As Double) + ptList.Add(New dPoint(X, Y, Z)) + If DualMode Then ptListXZ.Add(New dPoint(X, Z, Y)) + End Sub + + Public Function Triangulate() As Boolean + Dim tr As dTriangle + Dim DT As dTriangulation + + ptDim = ptList.Count - 1 + + 'XY-triangulation + Try + DT = New dTriangulation + lDT = DT.Triangulate(ptList) + Catch ex As Exception + Return False + End Try + + planes = New List(Of Double()) + + For Each tr In lDT + planes.Add(GetPlane(tr)) + Next + + + '#If DEBUG Then + ' Dim i As Int16 + ' Debug.Print("#,x1,y1,z1,x2,y2,z2") + ' i = -1 + ' For Each tr In lDT + ' i += 1 + ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) + ' Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z) + ' Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z) + ' Next + '#End If + + + 'XZ-triangulation + If DualMode Then + + If ptDim <> ptListXZ.Count - 1 Then Return False + + Try + DT = New dTriangulation + lDTXZ = DT.Triangulate(ptListXZ) + Catch ex As Exception + Return False + End Try + + planesXZ = New List(Of Double()) + + For Each tr In lDTXZ + planesXZ.Add(GetPlane(tr)) + Next + + End If + + Return True + End Function + + 'XY => Z Interpolation + Public Function Intpol(ByVal x As Double, ByVal y As Double) As Double + Dim j As Integer + Dim l0 As Double() + Dim tr As dTriangle + + ExtrapolError = False + + 'Try exact solution for IsInside() + j = - 1 + For Each tr In lDT + j += 1 + If IsInside(tr, x, y, True) Then + l0 = planes(j) + Return (l0(3) - x*l0(0) - y*l0(1))/l0(2) + End If + Next + + 'Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) + j = - 1 + For Each tr In lDT + j += 1 + If IsInside(tr, x, y, False) Then + l0 = planes(j) + Return (l0(3) - x*l0(0) - y*l0(1))/l0(2) + End If + Next + + + 'ERROR: Extrapolation + ExtrapolError = True + + Return Nothing + End Function + + 'XZ => Y Interpolation + Public Function IntpolXZ(ByVal x As Double, ByVal z As Double) As Double + Dim j As Integer + Dim l0 As Double() + Dim tr As dTriangle + + ExtrapolError = False + + If DualMode Then + + j = - 1 + + 'Try exact solution for IsInside() + For Each tr In lDTXZ + j += 1 + If IsInside(tr, x, z, True) Then + l0 = planesXZ(j) + Return (l0(3) - x*l0(0) - z*l0(1))/l0(2) + End If + Next + + 'Try approx. solution (fixes rounding errors when points lies exactly on an edge of a triangle) + j = - 1 + For Each tr In lDTXZ + j += 1 + If IsInside(tr, x, z, False) Then + l0 = planesXZ(j) + Return (l0(3) - x*l0(0) - z*l0(1))/l0(2) + End If + Next + + 'ERROR: Extrapolation + ExtrapolError = True + Return Nothing + + Else + + 'ERROR: Extrapolation + ExtrapolError = True + Return Nothing + + End If + End Function + + Private Function GetPlane(ByRef tr As dTriangle) As Double() + Dim AB As dPoint + Dim AC As dPoint + Dim cross As dPoint + Dim l(3) As Double + Dim pt1 As dPoint + Dim pt2 As dPoint + Dim pt3 As dPoint + + pt1 = tr.P1 + pt2 = tr.P2 + pt3 = tr.P3 + + AB = New dPoint(pt2.X - pt1.X, pt2.Y - pt1.Y, pt2.Z - pt1.Z) + AC = New dPoint(pt3.X - pt1.X, pt3.Y - pt1.Y, pt3.Z - pt1.Z) + + cross = New dPoint(AB.Y*AC.Z - AB.Z*AC.Y, AB.Z*AC.X - AB.X*AC.Z, AB.X*AC.Y - AB.Y*AC.X) + + l(0) = cross.X + l(1) = cross.Y + l(2) = cross.Z + + l(3) = pt1.X*cross.X + pt1.Y*cross.Y + pt1.Z*cross.Z + + Return l + End Function + + Private Function IsInside(ByRef tr As dTriangle, ByVal xges As Double, ByVal yges As Double, ByVal Exact As Boolean) _ + As Boolean + Dim v0(1) As Double + Dim v1(1) As Double + Dim v2(1) As Double + Dim dot00 As Double + Dim dot01 As Double + Dim dot02 As Double + Dim dot11 As Double + Dim dot12 As Double + Dim invDenom As Double + Dim u As Double + Dim v As Double + Dim pt1 As dPoint + Dim pt2 As dPoint + Dim pt3 As dPoint + + pt1 = tr.P1 + pt2 = tr.P2 + pt3 = tr.P3 + + 'Quelle: http://www.blackpawn.com/texts/pointinpoly/default.html (Barycentric Technique) + + ' Compute vectors + v0(0) = pt3.X - pt1.X + v0(1) = pt3.Y - pt1.Y + + v1(0) = pt2.X - pt1.X + v1(1) = pt2.Y - pt1.Y + + v2(0) = xges - pt1.X + v2(1) = yges - pt1.Y + + ' Compute dot products + dot00 = v0(0)*v0(0) + v0(1)*v0(1) + dot01 = v0(0)*v1(0) + v0(1)*v1(1) + dot02 = v0(0)*v2(0) + v0(1)*v2(1) + dot11 = v1(0)*v1(0) + v1(1)*v1(1) + dot12 = v1(0)*v2(0) + v1(1)*v2(1) + + ' Compute barycentric coordinates + invDenom = 1/(dot00*dot11 - dot01*dot01) + u = (dot11*dot02 - dot01*dot12)*invDenom + v = (dot00*dot12 - dot01*dot02)*invDenom + + 'Debug.Print(u & ", " & v & ", " & u + v) + + ' Check if point is in triangle + If Exact Then + Return (u >= 0) And (v >= 0) And (u + v <= 1) + Else + Return (u >= - 0.001) And (v >= - 0.001) And (u + v <= 1.001) + End If + End Function + + Public Class dPoint + Public X As Double + Public Y As Double + Public Z As Double + + Public Sub New(ByVal xd As Double, ByVal yd As Double, ByVal zd As Double) + X = xd + Y = yd + Z = zd + End Sub + + Public Shared Operator =(left As dPoint, right As dPoint) As Boolean + + 'If DirectCast(left, Object) = DirectCast(right, Object) Then + ' Return True + 'End If + + 'If (DirectCast(left, Object) Is Nothing) OrElse (DirectCast(right, Object) Is Nothing) Then + ' Return False + 'End If + + ' Just compare x and y here... + If left.X <> right.X Then + Return False + End If + + If left.Y <> right.Y Then + Return False + End If + + Return True + End Operator + + Public Shared Operator <>(left As dPoint, right As dPoint) As Boolean + Return Not (left = right) + End Operator + End Class + + Public Class dTriangle + Public P1 As dPoint + Public P2 As dPoint + Public P3 As dPoint + + Public Sub New(ByRef pp1 As dPoint, ByRef pp2 As dPoint, ByRef pp3 As dPoint) + P1 = pp1 + P2 = pp2 + P3 = pp3 + End Sub + + Public Function ContainsInCircumcircle(pt As dPoint) As Double + Dim ax As Double = Me.P1.X - pt.X + Dim ay As Double = Me.P1.Y - pt.Y + Dim bx As Double = Me.P2.X - pt.X + Dim by As Double = Me.P2.Y - pt.Y + Dim cx As Double = Me.P3.X - pt.X + Dim cy As Double = Me.P3.Y - pt.Y + Dim det_ab As Double = ax*by - bx*ay + Dim det_bc As Double = bx*cy - cx*by + Dim det_ca As Double = cx*ay - ax*cy + Dim a_squared As Double = ax*ax + ay*ay + Dim b_squared As Double = bx*bx + by*by + Dim c_squared As Double = cx*cx + cy*cy + + Return a_squared*det_bc + b_squared*det_ca + c_squared*det_ab + End Function + + Public Function SharesVertexWith(triangle As dTriangle) As Boolean + If Me.P1.X = triangle.P1.X AndAlso Me.P1.Y = triangle.P1.Y Then + Return True + End If + If Me.P1.X = triangle.P2.X AndAlso Me.P1.Y = triangle.P2.Y Then + Return True + End If + If Me.P1.X = triangle.P3.X AndAlso Me.P1.Y = triangle.P3.Y Then + Return True + End If + + If Me.P2.X = triangle.P1.X AndAlso Me.P2.Y = triangle.P1.Y Then + Return True + End If + If Me.P2.X = triangle.P2.X AndAlso Me.P2.Y = triangle.P2.Y Then + Return True + End If + If Me.P2.X = triangle.P3.X AndAlso Me.P2.Y = triangle.P3.Y Then + Return True + End If + + If Me.P3.X = triangle.P1.X AndAlso Me.P3.Y = triangle.P1.Y Then + Return True + End If + If Me.P3.X = triangle.P2.X AndAlso Me.P3.Y = triangle.P2.Y Then + Return True + End If + If Me.P3.X = triangle.P3.X AndAlso Me.P3.Y = triangle.P3.Y Then + Return True + End If + + Return False + End Function + End Class + + Public Class dEdge + Public StartPoint As dPoint + Public EndPoint As dPoint + + Public Sub New(ByRef p1 As dPoint, ByRef p2 As dPoint) + StartPoint = p1 + EndPoint = p2 + End Sub + + Public Shared Operator =(left As dEdge, right As dEdge) As Boolean + 'If DirectCast(left, Object) = DirectCast(right, Object) Then + ' Return True + 'End If + + 'If (DirectCast(left, Object) Is Nothing) Or (DirectCast(right, Object) Is Nothing) Then + ' Return False + 'End If + + Return _ + ((left.StartPoint = right.StartPoint AndAlso left.EndPoint = right.EndPoint) OrElse + (left.StartPoint = right.EndPoint AndAlso left.EndPoint = right.StartPoint)) + End Operator + + Public Shared Operator <>(left As dEdge, right As dEdge) As Boolean + Return Not (left = right) + End Operator + End Class + + Public Class dTriangulation + Public Function Triangulate(triangulationPoints As List(Of dPoint)) As List(Of dTriangle) + If triangulationPoints.Count < 3 Then + Throw New ArgumentException("Can not triangulate less than three vertices!") + End If + + ' The triangle list + Dim triangles As New List(Of dTriangle)() + + + ' The "supertriangle" which encompasses all triangulation points. + ' This triangle initializes the algorithm and will be removed later. + Dim superTriangle As dTriangle = Me.SuperTriangle(triangulationPoints) + triangles.Add(superTriangle) + + ' Include each point one at a time into the existing triangulation + For i As Integer = 0 To triangulationPoints.Count - 1 + ' Initialize the edge buffer. + Dim EdgeBuffer As New List(Of dEdge)() + + ' If the actual vertex lies inside the circumcircle, then the three edges of the + ' triangle are added to the edge buffer and the triangle is removed from list. + For j As Integer = triangles.Count - 1 To 0 Step - 1 + Dim t As dTriangle = triangles(j) + If t.ContainsInCircumcircle(triangulationPoints(i)) > 0 Then + EdgeBuffer.Add(New dEdge(t.P1, t.P2)) + EdgeBuffer.Add(New dEdge(t.P2, t.P3)) + EdgeBuffer.Add(New dEdge(t.P3, t.P1)) + triangles.RemoveAt(j) + End If + Next + + ' Remove duplicate edges. This leaves the convex hull of the edges. + ' The edges in this convex hull are oriented counterclockwise! + For j As Integer = EdgeBuffer.Count - 2 To 0 Step - 1 + For k As Integer = EdgeBuffer.Count - 1 To j + 1 Step - 1 + If EdgeBuffer(j) = EdgeBuffer(k) Then + EdgeBuffer.RemoveAt(k) + EdgeBuffer.RemoveAt(j) + k -= 1 + Continue For + End If + Next + Next + + ' Generate new counterclockwise oriented triangles filling the "hole" in + ' the existing triangulation. These triangles all share the actual vertex. + For j As Integer = 0 To EdgeBuffer.Count - 1 + triangles.Add(New dTriangle(EdgeBuffer(j).StartPoint, EdgeBuffer(j).EndPoint, triangulationPoints(i))) + Next + Next + + ' We don't want the supertriangle in the triangulation, so + ' remove all triangles sharing a vertex with the supertriangle. + For i As Integer = triangles.Count - 1 To 0 Step - 1 + If triangles(i).SharesVertexWith(superTriangle) Then + triangles.RemoveAt(i) + End If + Next + + ' Return the triangles + Return triangles + End Function + + + Private Function SuperTriangle(triangulationPoints As List(Of dPoint)) As dTriangle + Dim M As Double = triangulationPoints(0).X + + ' get the extremal x and y coordinates + For i As Integer = 1 To triangulationPoints.Count - 1 + Dim xAbs As Double = Math.Abs(triangulationPoints(i).X) + Dim yAbs As Double = Math.Abs(triangulationPoints(i).Y) + If xAbs > M Then + M = xAbs + End If + If yAbs > M Then + M = yAbs + End If + Next + + ' make a triangle + Dim sp1 As New dPoint(10*M, 0, 0) + Dim sp2 As New dPoint(0, 10*M, 0) + Dim sp3 As New dPoint(- 10*M, - 10*M, 0) + + Return New dTriangle(sp1, sp2, sp3) + End Function + End Class +End Class + diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb index f1bdd41f6fb4c0165211cfe1d9353d9f81f25359..9c75cac2ce191764ed4369c14864a4e594a687f5 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/cFile V3.vb @@ -1,150 +1,150 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Public Class cFile_V3 - Private TxtFldParser As Microsoft.VisualBasic.FileIO.TextFieldParser - Private StrWrter As System.IO.StreamWriter - Private Mode As FileMode - Private Path As String - Private Sepp As String - Private SkipCom As Boolean - Private StopE As Boolean - Private FileOpen As Boolean - Private PreLine As String() - Private FileEnd As Boolean - - 'File format - private FileFormat As System.Text.Encoding = System.Text.Encoding.UTF8 - - Public Sub New() - Me.Reset() - End Sub - - Private Sub Reset() - FileOpen = False - Mode = FileMode.Undefined - PreLine = Nothing - FileEnd = False - End Sub - - Public Function OpenRead(ByVal FileName As String, Optional ByVal Separator As String = ",", - Optional ByVal SkipComment As Boolean = True, Optional ByVal StopAtE As Boolean = False) As Boolean - Me.Reset() - StopE = StopAtE - Path = FileName - Sepp = Separator - SkipCom = SkipComment - If Not (Mode = FileMode.Undefined) Then Return False - If Not IO.File.Exists(Path) Then Return False - Mode = FileMode.Read - Try - TxtFldParser = New Microsoft.VisualBasic.FileIO.TextFieldParser(Path, System.Text.Encoding.Default) - FileOpen = True - Catch ex As Exception - Return False - End Try - TxtFldParser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited - TxtFldParser.Delimiters = New String() {Sepp} - - 'If TxtFldParser.EndOfData Then Return False - - Me.ReadLine() - Return True - End Function - - Public Function ReadLine() As String() - Dim line As String() - Dim line0 As String - - line = PreLine - - lb10: - If TxtFldParser.EndOfData Then - - FileEnd = True - - Else - - PreLine = TxtFldParser.ReadFields - line0 = UCase(Trim(PreLine(0))) - - If SkipCom Then - If Left(line0, 1) = "#" Then GoTo lb10 - End If - - If StopE Then FileEnd = (line0 = "E") - - End If - - Return line - End Function - - Public Sub Close() - Select Case Mode - Case FileMode.Read - If FileOpen Then TxtFldParser.Close() - TxtFldParser = Nothing - Case FileMode.Write - If FileOpen Then StrWrter.Close() - StrWrter = Nothing - End Select - Me.Reset() - End Sub - - Public ReadOnly Property EndOfFile() As Boolean - Get - Return FileEnd - End Get - End Property - - Public Function OpenWrite(ByVal FileName As String, Optional ByVal Separator As String = ",", - Optional ByVal AutoFlush As Boolean = False, Optional ByVal Append As Boolean = False) As Boolean - Me.Reset() - Path = FileName - Sepp = Separator - If Not (Mode = FileMode.Undefined) Then Return False - Mode = FileMode.Write - Try - StrWrter = My.Computer.FileSystem.OpenTextFileWriter(Path, Append, FileFormat) - FileOpen = True - Catch ex As Exception - Return False - End Try - StrWrter.AutoFlush = AutoFlush - Return True - End Function - - Public Sub WriteLine(ByVal ParamArray x() As Object) - Dim St As String - Dim StB As New System.Text.StringBuilder - Dim Skip As Boolean - Skip = True - For Each St In x - If Skip Then - StB.Append(St) - Skip = False - Else - StB.Append(Sepp & St) - End If - Next - StrWrter.WriteLine(StB.ToString) - StB = Nothing - End Sub - - Public Sub WriteLine(ByVal x As String) - StrWrter.WriteLine(x) - End Sub - - Private Enum FileMode - Undefined - Read - Write - End Enum -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Public Class cFile_V3 + Private TxtFldParser As Microsoft.VisualBasic.FileIO.TextFieldParser + Private StrWrter As System.IO.StreamWriter + Private Mode As FileMode + Private Path As String + Private Sepp As String + Private SkipCom As Boolean + Private StopE As Boolean + Private FileOpen As Boolean + Private PreLine As String() + Private FileEnd As Boolean + + 'File format + private FileFormat As System.Text.Encoding = System.Text.Encoding.UTF8 + + Public Sub New() + Me.Reset() + End Sub + + Private Sub Reset() + FileOpen = False + Mode = FileMode.Undefined + PreLine = Nothing + FileEnd = False + End Sub + + Public Function OpenRead(ByVal FileName As String, Optional ByVal Separator As String = ",", + Optional ByVal SkipComment As Boolean = True, Optional ByVal StopAtE As Boolean = False) As Boolean + Me.Reset() + StopE = StopAtE + Path = FileName + Sepp = Separator + SkipCom = SkipComment + If Not (Mode = FileMode.Undefined) Then Return False + If Not IO.File.Exists(Path) Then Return False + Mode = FileMode.Read + Try + TxtFldParser = New Microsoft.VisualBasic.FileIO.TextFieldParser(Path, System.Text.Encoding.Default) + FileOpen = True + Catch ex As Exception + Return False + End Try + TxtFldParser.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited + TxtFldParser.Delimiters = New String() {Sepp} + + 'If TxtFldParser.EndOfData Then Return False + + Me.ReadLine() + Return True + End Function + + Public Function ReadLine() As String() + Dim line As String() + Dim line0 As String + + line = PreLine + + lb10: + If TxtFldParser.EndOfData Then + + FileEnd = True + + Else + + PreLine = TxtFldParser.ReadFields + line0 = UCase(Trim(PreLine(0))) + + If SkipCom Then + If Left(line0, 1) = "#" Then GoTo lb10 + End If + + If StopE Then FileEnd = (line0 = "E") + + End If + + Return line + End Function + + Public Sub Close() + Select Case Mode + Case FileMode.Read + If FileOpen Then TxtFldParser.Close() + TxtFldParser = Nothing + Case FileMode.Write + If FileOpen Then StrWrter.Close() + StrWrter = Nothing + End Select + Me.Reset() + End Sub + + Public ReadOnly Property EndOfFile() As Boolean + Get + Return FileEnd + End Get + End Property + + Public Function OpenWrite(ByVal FileName As String, Optional ByVal Separator As String = ",", + Optional ByVal AutoFlush As Boolean = False, Optional ByVal Append As Boolean = False) As Boolean + Me.Reset() + Path = FileName + Sepp = Separator + If Not (Mode = FileMode.Undefined) Then Return False + Mode = FileMode.Write + Try + StrWrter = My.Computer.FileSystem.OpenTextFileWriter(Path, Append, FileFormat) + FileOpen = True + Catch ex As Exception + Return False + End Try + StrWrter.AutoFlush = AutoFlush + Return True + End Function + + Public Sub WriteLine(ByVal ParamArray x() As Object) + Dim St As String + Dim StB As New System.Text.StringBuilder + Dim Skip As Boolean + Skip = True + For Each St In x + If Skip Then + StB.Append(St) + Skip = False + Else + StB.Append(Sepp & St) + End If + Next + StrWrter.WriteLine(StB.ToString) + StB = Nothing + End Sub + + Public Sub WriteLine(ByVal x As String) + StrWrter.WriteLine(x) + End Sub + + Private Enum FileMode + Undefined + Read + Write + End Enum +End Class diff --git a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb b/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb index c1ebf4fe23d4d5f186545206f12575a7e1d22e45..b32e65b86b56326e8187d65922a56f3c90787e2d 100644 --- a/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb +++ b/VECTOAux/VectoAuxiliaries/DownstreamModules/cMAP.vb @@ -1,194 +1,194 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.Collections.Generic -Imports System.Globalization -Imports TUGraz.VectoCommon.Utils - -Public Class cMAP - Implements IFuelConsumptionMap - - Private LnU As List(Of Single) - Private LTq As List(Of Single) - Private lFC As List(Of Single) - - Private sFilePath As String - Private iMapDim As Integer - - Private FuelMap As cDelaunayMap - - Private Sub ResetMe() - lFC = Nothing - LTq = Nothing - LnU = Nothing - iMapDim = -1 - FuelMap = New cDelaunayMap - End Sub - - Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean - Dim file As cFile_V3 - Dim line As String() - Dim nU As Single - Dim MsgSrc As String - - - MsgSrc = "Main/ReadInp/MAP" - - 'Reset - ResetMe() - - 'Stop if there's no file - If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then - 'If ShowMsg Then WorkerMsg(tMsgID.Err, "Map file not found! (" & sFilePath & ")", MsgSrc) - Return False - End If - - 'Open file - file = New cFile_V3 - If Not file.OpenRead(sFilePath) Then - file = Nothing - 'TODO:WORKERMESSAGE If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) - Return False - End If - - 'Skip Header - file.ReadLine() - - 'Initi Lists (before version check so ReadOldFormat works) - lFC = New System.Collections.Generic.List(Of Single) - LTq = New System.Collections.Generic.List(Of Single) - LnU = New System.Collections.Generic.List(Of Single) - - Try - Do While Not file.EndOfFile - - 'Line read - line = file.ReadLine - - 'Line counter up (was reset in ResetMe) - iMapDim += 1 - - 'Revolutions - nU = Single.Parse(line(0), CultureInfo.InvariantCulture) - - LnU.Add(nU) - - 'Power - LTq.Add(Single.Parse(line(1), CultureInfo.InvariantCulture)) - - 'FC - 'Check sign - If CSng(line(2)) < 0 Then - file.Close() - 'TODO:WORKERMESSAGEIf ShowMsg Then WorkerMsg(tMsgID.Err, "FC < 0 in map at " & nU & " [1/min], " & line(1) & " [Nm]", MsgSrc) - Return False - End If - - lFC.Add(CSng(line(2))) - - - Loop - Catch ex As Exception - - 'TODO:WORKERMESSAGE If ShowMsg Then WorkerMsg(tMsgID.Err, "Error during file read! Line number " & iMapDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) - GoTo lbEr - - End Try - - 'Close file - file.Close() - - file = Nothing - - Return True - - - 'ERROR-label for clean Abort -lbEr: - file.Close() - file = Nothing - - Return False - End Function - - Public Function Triangulate() As Boolean - Dim i As Integer - - Dim MsgSrc As String - - MsgSrc = "MAP/Norm" - - 'FC Delauney - For i = 0 To iMapDim - FuelMap.AddPoints(LnU(i), LTq(i), lFC(i)) - Next - - Return FuelMap.Triangulate() - End Function - - - Public Function fFCdelaunay_Intp(ByVal nU As Single, ByVal Tq As Single) As Single - Dim val As Single - - val = CType(FuelMap.Intpol(nU, Tq), Single) - - If FuelMap.ExtrapolError Then - 'TODO:WORKERMESSAGE WorkerMsg(tMsgID.Err, "Cannot extrapolate FC map! n= " & nU.ToString("0.0") & " [1/min], Me= " & Tq.ToString("0.0") & " [Nm]", "MAP/FC_Intp") - Return -10000 - Else - Return val - End If - End Function - -#Region "Properties" - - Public Property FilePath() As String - Get - Return sFilePath - End Get - Set(ByVal value As String) - sFilePath = value - End Set - End Property - - Public ReadOnly Property MapDim As Integer - Get - Return iMapDim - End Get - End Property - - Public ReadOnly Property Tq As List(Of Single) - Get - Return LTq - End Get - End Property - - Public ReadOnly Property FC As List(Of Single) - Get - Return lFC - End Get - End Property - - Public ReadOnly Property nU As List(Of Single) - Get - Return LnU - End Get - End Property - -#End Region - - Public Function GetFuelConsumption(torque As NewtonMeter, angularVelocity As PerSecond) As KilogramPerSecond _ - Implements IFuelConsumptionMap.GetFuelConsumption - Return _ - (fFCdelaunay_Intp(CType(angularVelocity.AsRPM, Single), CType(torque.Value(), Single)) / 3600.0 / 1000.0).SI(Of KilogramPerSecond)() - End Function -End Class - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.Collections.Generic +Imports System.Globalization +Imports TUGraz.VectoCommon.Utils + +Public Class cMAP + Implements IFuelConsumptionMap + + Private LnU As List(Of Single) + Private LTq As List(Of Single) + Private lFC As List(Of Single) + + Private sFilePath As String + Private iMapDim As Integer + + Private FuelMap As cDelaunayMap + + Private Sub ResetMe() + lFC = Nothing + LTq = Nothing + LnU = Nothing + iMapDim = -1 + FuelMap = New cDelaunayMap + End Sub + + Public Function ReadFile(Optional ByVal ShowMsg As Boolean = True) As Boolean + Dim file As cFile_V3 + Dim line As String() + Dim nU As Single + Dim MsgSrc As String + + + MsgSrc = "Main/ReadInp/MAP" + + 'Reset + ResetMe() + + 'Stop if there's no file + If sFilePath = "" OrElse Not IO.File.Exists(sFilePath) Then + 'If ShowMsg Then WorkerMsg(tMsgID.Err, "Map file not found! (" & sFilePath & ")", MsgSrc) + Return False + End If + + 'Open file + file = New cFile_V3 + If Not file.OpenRead(sFilePath) Then + file = Nothing + 'TODO:WORKERMESSAGE If ShowMsg Then WorkerMsg(tMsgID.Err, "Failed to open file (" & sFilePath & ") !", MsgSrc) + Return False + End If + + 'Skip Header + file.ReadLine() + + 'Initi Lists (before version check so ReadOldFormat works) + lFC = New System.Collections.Generic.List(Of Single) + LTq = New System.Collections.Generic.List(Of Single) + LnU = New System.Collections.Generic.List(Of Single) + + Try + Do While Not file.EndOfFile + + 'Line read + line = file.ReadLine + + 'Line counter up (was reset in ResetMe) + iMapDim += 1 + + 'Revolutions + nU = Single.Parse(line(0), CultureInfo.InvariantCulture) + + LnU.Add(nU) + + 'Power + LTq.Add(Single.Parse(line(1), CultureInfo.InvariantCulture)) + + 'FC + 'Check sign + If CSng(line(2)) < 0 Then + file.Close() + 'TODO:WORKERMESSAGEIf ShowMsg Then WorkerMsg(tMsgID.Err, "FC < 0 in map at " & nU & " [1/min], " & line(1) & " [Nm]", MsgSrc) + Return False + End If + + lFC.Add(CSng(line(2))) + + + Loop + Catch ex As Exception + + 'TODO:WORKERMESSAGE If ShowMsg Then WorkerMsg(tMsgID.Err, "Error during file read! Line number " & iMapDim + 1 & " (" & sFilePath & ")", MsgSrc, sFilePath) + GoTo lbEr + + End Try + + 'Close file + file.Close() + + file = Nothing + + Return True + + + 'ERROR-label for clean Abort +lbEr: + file.Close() + file = Nothing + + Return False + End Function + + Public Function Triangulate() As Boolean + Dim i As Integer + + Dim MsgSrc As String + + MsgSrc = "MAP/Norm" + + 'FC Delauney + For i = 0 To iMapDim + FuelMap.AddPoints(LnU(i), LTq(i), lFC(i)) + Next + + Return FuelMap.Triangulate() + End Function + + + Public Function fFCdelaunay_Intp(ByVal nU As Single, ByVal Tq As Single) As Single + Dim val As Single + + val = CType(FuelMap.Intpol(nU, Tq), Single) + + If FuelMap.ExtrapolError Then + 'TODO:WORKERMESSAGE WorkerMsg(tMsgID.Err, "Cannot extrapolate FC map! n= " & nU.ToString("0.0") & " [1/min], Me= " & Tq.ToString("0.0") & " [Nm]", "MAP/FC_Intp") + Return -10000 + Else + Return val + End If + End Function + +#Region "Properties" + + Public Property FilePath() As String + Get + Return sFilePath + End Get + Set(ByVal value As String) + sFilePath = value + End Set + End Property + + Public ReadOnly Property MapDim As Integer + Get + Return iMapDim + End Get + End Property + + Public ReadOnly Property Tq As List(Of Single) + Get + Return LTq + End Get + End Property + + Public ReadOnly Property FC As List(Of Single) + Get + Return lFC + End Get + End Property + + Public ReadOnly Property nU As List(Of Single) + Get + Return LnU + End Get + End Property + +#End Region + + Public Function GetFuelConsumption(torque As NewtonMeter, angularVelocity As PerSecond) As KilogramPerSecond _ + Implements IFuelConsumptionMap.GetFuelConsumption + Return _ + (fFCdelaunay_Intp(CType(angularVelocity.AsRPM, Single), CType(torque.Value(), Single)) / 3600.0 / 1000.0).SI(Of KilogramPerSecond)() + End Function +End Class + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb index 9b13d9c499a1b0349cbfd5792b93369feebf51bc..1456fb32911e0a529b10bd58af7571d790f362b3 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMap.vb @@ -1,339 +1,339 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.Globalization -Imports System.IO -Imports System.Text -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class AlternatorMap - Implements IAlternatorMap - - Private ReadOnly filePath As String - - Private _map As New List(Of MapPoint) - Private _yRange As List(Of Double) - Private _xRange As List(Of Double) - Private _minX, _minY, _maxX, _maxY As Double - - 'Required Action Test or Interpolation Type - Public Function OnBoundaryYInterpolatedX(x As Double, y As Double) As Boolean - Return _yRange.Contains(y) AndAlso Not _xRange.Contains(x) - End Function - - Public Function OnBoundaryXInterpolatedY(x As Double, y As Double) As Boolean - Return Not _yRange.Contains(y) AndAlso _xRange.Contains(x) - End Function - - Public Function ONBoundaryXY(x As Double, y As Double) As Boolean - Return (From sector In _map Where sector.Y = y AndAlso sector.x = x).Count = 1 - End Function - - 'Determine Value Methods - Private Function GetOnBoundaryXY(x As Double, y As Double) As Double - Return (From sector In _map Where sector.Y = y AndAlso sector.x = x).First().v - End Function - - Private Function GetOnBoundaryYInterpolatedX(x As Double, y As Double) As Double - - Dim x0, x1, v0, v1, slope, dx As Double - - x0 = (From p In _xRange Order By p Where p < x).Last() - x1 = (From p In _xRange Order By p Where p > x).First() - dx = x1 - x0 - - v0 = GetOnBoundaryXY(x0, y) - v1 = GetOnBoundaryXY(x1, y) - - slope = (v1 - v0) / (x1 - x0) - - Return v0 + ((x - x0) * slope) - End Function - - Private Function GetOnBoundaryXInterpolatedY(x As Double, y As Double) As Double - - Dim y0, y1, v0, v1, dy, v, slope As Double - - y0 = (From p In _yRange Order By p Where p < y).Last() - y1 = (From p In _yRange Order By p Where p > y).First() - dy = y1 - y0 - - v0 = GetOnBoundaryXY(x, y0) - v1 = GetOnBoundaryXY(x, y1) - - slope = (v1 - v0) / (y1 - y0) - - v = v0 + ((y - y0) * slope) - - Return v - End Function - - Private Function GetBiLinearInterpolatedValue(x As Double, y As Double) As Double - - Dim q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p As Double - - y1 = (From mapSector As MapPoint In _map Where mapSector.Y < y).Last().Y - y2 = (From mapSector As MapPoint In _map Where mapSector.Y > y).First().Y - - x1 = (From mapSector As MapPoint In _map Where mapSector.x < x).Last().x - x2 = (From mapSector As MapPoint In _map Where mapSector.x > x).First().x - - q11 = GetOnBoundaryXY(x1, y1) - q12 = GetOnBoundaryXY(x1, y2) - - q21 = GetOnBoundaryXY(x2, y1) - q22 = GetOnBoundaryXY(x2, y2) - - r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)) * q21 - - r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)) * q22 - - - p = ((y2 - y) / (y2 - y1)) * r1 + ((y - y1) / (y2 - y1)) * r2 - - - Return p - End Function - - 'Utilities - Private Sub fillMapWithDefaults() - - - _map.Add(New MapPoint(10, 1500, 0.615)) - _map.Add(New MapPoint(27, 1500, 0.7)) - _map.Add(New MapPoint(53, 1500, 0.1947)) - _map.Add(New MapPoint(63, 1500, 0.0)) - _map.Add(New MapPoint(68, 1500, 0.0)) - _map.Add(New MapPoint(125, 1500, 0.0)) - _map.Add(New MapPoint(136, 1500, 0.0)) - _map.Add(New MapPoint(10, 2000, 0.62)) - _map.Add(New MapPoint(27, 2000, 0.7)) - _map.Add(New MapPoint(53, 2000, 0.3)) - _map.Add(New MapPoint(63, 2000, 0.1462)) - _map.Add(New MapPoint(68, 2000, 0.692)) - _map.Add(New MapPoint(125, 2000, 0.0)) - _map.Add(New MapPoint(136, 2000, 0.0)) - _map.Add(New MapPoint(10, 4000, 0.64)) - _map.Add(New MapPoint(27, 4000, 0.6721)) - _map.Add(New MapPoint(53, 4000, 0.7211)) - _map.Add(New MapPoint(63, 4000, 0.74)) - _map.Add(New MapPoint(68, 4000, 0.7352)) - _map.Add(New MapPoint(125, 4000, 0.68)) - _map.Add(New MapPoint(136, 4000, 0.6694)) - _map.Add(New MapPoint(10, 6000, 0.53)) - _map.Add(New MapPoint(27, 6000, 0.5798)) - _map.Add(New MapPoint(53, 6000, 0.656)) - _map.Add(New MapPoint(63, 6000, 0.6853)) - _map.Add(New MapPoint(68, 6000, 0.7)) - _map.Add(New MapPoint(125, 6000, 0.6329)) - _map.Add(New MapPoint(136, 6000, 0.62)) - _map.Add(New MapPoint(10, 7000, 0.475)) - _map.Add(New MapPoint(27, 7000, 0.5337)) - _map.Add(New MapPoint(53, 7000, 0.6235)) - _map.Add(New MapPoint(63, 7000, 0.658)) - _map.Add(New MapPoint(68, 7000, 0.6824)) - _map.Add(New MapPoint(125, 7000, 0.6094)) - _map.Add(New MapPoint(136, 7000, 0.5953)) - End Sub - - Private Sub getMapRanges() - - _yRange = (From coords As MapPoint In _map Order By coords.Y Select coords.Y Distinct).ToList() - _xRange = (From coords As MapPoint In _map Order By coords.x Select coords.x Distinct).ToList() - - _minX = _xRange.First - _maxX = _xRange.Last - _minY = _yRange.First - _maxY = _yRange.Last - End Sub - - 'Single entry point to determine Value on map - Public Function GetValue(x As Double, y As Double) As Double - - - If x < _minX OrElse x > _maxX OrElse y < _minY OrElse y > _maxY Then - - 'OnAuxiliaryEvent(String.Format("Alternator Map Limiting : RPM{0}, AMPS{1}",x,y),AdvancedAuxiliaryMessageType.Warning) - - - 'Limiting - If x < _minX Then x = _minX - If x > _maxX Then x = _maxX - If y < _minY Then y = _minY - If y > _maxY Then y = _maxY - - End If - - - 'Satisfies both data points - non interpolated value - If ONBoundaryXY(x, y) Then Return GetOnBoundaryXY(x, y) - - 'Satisfies only x or y - single interpolation value - If OnBoundaryXInterpolatedY(x, y) Then Return GetOnBoundaryXInterpolatedY(x, y) - If OnBoundaryYInterpolatedX(x, y) Then Return GetOnBoundaryYInterpolatedX(x, y) - - 'satisfies no data points - Bi-Linear interpolation - Return GetBiLinearInterpolatedValue(x, y) - End Function - - Public Function ReturnDefaultMapValueTests() As String - - Dim sb As StringBuilder = New StringBuilder() - Dim x, y As Single - - 'All Sector Values - sb.AppendLine("All Values From Map") - sb.AppendLine("-------------------") - For Each x In _xRange - - For Each y In _yRange - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - Next - - Next - - sb.AppendLine("") - sb.AppendLine("Four Corners with interpolated other") - sb.AppendLine("-------------------") - x = 1500 - y = 18.5 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - x = 7000 - y = 96.5 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - x = 1750 - y = 10 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - x = 6500 - y = 10 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - - sb.AppendLine("") - sb.AppendLine("Interpolated both") - sb.AppendLine("-------------------") - - Dim mx, my As Double - Dim x2, y2 As Integer - For x2 = 0 To _xRange.Count - 2 - - For y2 = 0 To _yRange.Count - 2 - - mx = _xRange(x2) + (_xRange(x2 + 1) - _xRange(x2)) / 2 - my = _yRange(y2) + (_yRange(y2 + 1) - _yRange(y2)) / 2 - - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", mx, my, GetValue(mx, my))) - - - Next - - Next - - sb.AppendLine("") - sb.AppendLine("MIKE -> 40 & 1000") - sb.AppendLine("-------------------") - x = 1000 - y = 40 - sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) - - - Return sb.ToString() - End Function - - 'Constructors - Public Sub New(filepath As String) - - Me.filePath = filepath - - Initialise() - - getMapRanges() - End Sub - - Private Class MapPoint - Public Y As Double - Public x As Double - Public v As Double - - Public Sub New(y As Double, x As Double, v As Double) - - Me.Y = y - Me.x = x - Me.v = v - End Sub - End Class - - 'Get Alternator Efficiency - Public Function GetEfficiency(rpm As Double, amps As Ampere) As AlternatorMapValues _ - Implements IAlternatorMap.GetEfficiency - - Return New AlternatorMapValues(GetValue(rpm, amps.Value())) - End Function - - 'Initialises the map. - Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise - If File.Exists(filePath) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array og lines fron csv - Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), - StringSplitOptions.RemoveEmptyEntries) - - 'Must have at least 2 entries in map to make it usable [dont forget the header row] - If (lines.Count() < 3) Then - Throw New ArgumentException("Insufficient rows in csv to build a usable map") - End If - - _map = New List(Of MapPoint) - Dim firstline As Boolean = True - - For Each line As String In lines - If Not firstline Then - - 'Advanced Alternator Source Check. - If line.Contains("[MODELSOURCE") Then Exit For - - 'split the line - Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 3) Then - Throw New ArgumentException("Incorrect number of values in csv file") - End If - 'add values to map - - 'Create AlternatorKey - Dim newPoint As MapPoint = New MapPoint(Single.Parse(elements(0), CultureInfo.InvariantCulture), - Single.Parse(elements(1), CultureInfo.InvariantCulture), - Single.Parse(elements(2), CultureInfo.InvariantCulture)) - _map.Add(newPoint) - - Else - firstline = False - End If - Next line - End Using - Return True - Else - Throw New ArgumentException("Supplied input file does not exist") - End If - End Function - - - 'Public Events - Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - - Protected Sub OnAuxiliaryEvent(message As String, messageType As AdvancedAuxiliaryMessageType) - - RaiseEvent AuxiliaryEvent(Me, message, messageType) - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.Globalization +Imports System.IO +Imports System.Text +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Class AlternatorMap + Implements IAlternatorMap + + Private ReadOnly filePath As String + + Private _map As New List(Of MapPoint) + Private _yRange As List(Of Double) + Private _xRange As List(Of Double) + Private _minX, _minY, _maxX, _maxY As Double + + 'Required Action Test or Interpolation Type + Public Function OnBoundaryYInterpolatedX(x As Double, y As Double) As Boolean + Return _yRange.Contains(y) AndAlso Not _xRange.Contains(x) + End Function + + Public Function OnBoundaryXInterpolatedY(x As Double, y As Double) As Boolean + Return Not _yRange.Contains(y) AndAlso _xRange.Contains(x) + End Function + + Public Function ONBoundaryXY(x As Double, y As Double) As Boolean + Return (From sector In _map Where sector.Y = y AndAlso sector.x = x).Count = 1 + End Function + + 'Determine Value Methods + Private Function GetOnBoundaryXY(x As Double, y As Double) As Double + Return (From sector In _map Where sector.Y = y AndAlso sector.x = x).First().v + End Function + + Private Function GetOnBoundaryYInterpolatedX(x As Double, y As Double) As Double + + Dim x0, x1, v0, v1, slope, dx As Double + + x0 = (From p In _xRange Order By p Where p < x).Last() + x1 = (From p In _xRange Order By p Where p > x).First() + dx = x1 - x0 + + v0 = GetOnBoundaryXY(x0, y) + v1 = GetOnBoundaryXY(x1, y) + + slope = (v1 - v0) / (x1 - x0) + + Return v0 + ((x - x0) * slope) + End Function + + Private Function GetOnBoundaryXInterpolatedY(x As Double, y As Double) As Double + + Dim y0, y1, v0, v1, dy, v, slope As Double + + y0 = (From p In _yRange Order By p Where p < y).Last() + y1 = (From p In _yRange Order By p Where p > y).First() + dy = y1 - y0 + + v0 = GetOnBoundaryXY(x, y0) + v1 = GetOnBoundaryXY(x, y1) + + slope = (v1 - v0) / (y1 - y0) + + v = v0 + ((y - y0) * slope) + + Return v + End Function + + Private Function GetBiLinearInterpolatedValue(x As Double, y As Double) As Double + + Dim q11, q12, q21, q22, x1, x2, y1, y2, r1, r2, p As Double + + y1 = (From mapSector As MapPoint In _map Where mapSector.Y < y).Last().Y + y2 = (From mapSector As MapPoint In _map Where mapSector.Y > y).First().Y + + x1 = (From mapSector As MapPoint In _map Where mapSector.x < x).Last().x + x2 = (From mapSector As MapPoint In _map Where mapSector.x > x).First().x + + q11 = GetOnBoundaryXY(x1, y1) + q12 = GetOnBoundaryXY(x1, y2) + + q21 = GetOnBoundaryXY(x2, y1) + q22 = GetOnBoundaryXY(x2, y2) + + r1 = ((x2 - x) / (x2 - x1)) * q11 + ((x - x1) / (x2 - x1)) * q21 + + r2 = ((x2 - x) / (x2 - x1)) * q12 + ((x - x1) / (x2 - x1)) * q22 + + + p = ((y2 - y) / (y2 - y1)) * r1 + ((y - y1) / (y2 - y1)) * r2 + + + Return p + End Function + + 'Utilities + Private Sub fillMapWithDefaults() + + + _map.Add(New MapPoint(10, 1500, 0.615)) + _map.Add(New MapPoint(27, 1500, 0.7)) + _map.Add(New MapPoint(53, 1500, 0.1947)) + _map.Add(New MapPoint(63, 1500, 0.0)) + _map.Add(New MapPoint(68, 1500, 0.0)) + _map.Add(New MapPoint(125, 1500, 0.0)) + _map.Add(New MapPoint(136, 1500, 0.0)) + _map.Add(New MapPoint(10, 2000, 0.62)) + _map.Add(New MapPoint(27, 2000, 0.7)) + _map.Add(New MapPoint(53, 2000, 0.3)) + _map.Add(New MapPoint(63, 2000, 0.1462)) + _map.Add(New MapPoint(68, 2000, 0.692)) + _map.Add(New MapPoint(125, 2000, 0.0)) + _map.Add(New MapPoint(136, 2000, 0.0)) + _map.Add(New MapPoint(10, 4000, 0.64)) + _map.Add(New MapPoint(27, 4000, 0.6721)) + _map.Add(New MapPoint(53, 4000, 0.7211)) + _map.Add(New MapPoint(63, 4000, 0.74)) + _map.Add(New MapPoint(68, 4000, 0.7352)) + _map.Add(New MapPoint(125, 4000, 0.68)) + _map.Add(New MapPoint(136, 4000, 0.6694)) + _map.Add(New MapPoint(10, 6000, 0.53)) + _map.Add(New MapPoint(27, 6000, 0.5798)) + _map.Add(New MapPoint(53, 6000, 0.656)) + _map.Add(New MapPoint(63, 6000, 0.6853)) + _map.Add(New MapPoint(68, 6000, 0.7)) + _map.Add(New MapPoint(125, 6000, 0.6329)) + _map.Add(New MapPoint(136, 6000, 0.62)) + _map.Add(New MapPoint(10, 7000, 0.475)) + _map.Add(New MapPoint(27, 7000, 0.5337)) + _map.Add(New MapPoint(53, 7000, 0.6235)) + _map.Add(New MapPoint(63, 7000, 0.658)) + _map.Add(New MapPoint(68, 7000, 0.6824)) + _map.Add(New MapPoint(125, 7000, 0.6094)) + _map.Add(New MapPoint(136, 7000, 0.5953)) + End Sub + + Private Sub getMapRanges() + + _yRange = (From coords As MapPoint In _map Order By coords.Y Select coords.Y Distinct).ToList() + _xRange = (From coords As MapPoint In _map Order By coords.x Select coords.x Distinct).ToList() + + _minX = _xRange.First + _maxX = _xRange.Last + _minY = _yRange.First + _maxY = _yRange.Last + End Sub + + 'Single entry point to determine Value on map + Public Function GetValue(x As Double, y As Double) As Double + + + If x < _minX OrElse x > _maxX OrElse y < _minY OrElse y > _maxY Then + + 'OnAuxiliaryEvent(String.Format("Alternator Map Limiting : RPM{0}, AMPS{1}",x,y),AdvancedAuxiliaryMessageType.Warning) + + + 'Limiting + If x < _minX Then x = _minX + If x > _maxX Then x = _maxX + If y < _minY Then y = _minY + If y > _maxY Then y = _maxY + + End If + + + 'Satisfies both data points - non interpolated value + If ONBoundaryXY(x, y) Then Return GetOnBoundaryXY(x, y) + + 'Satisfies only x or y - single interpolation value + If OnBoundaryXInterpolatedY(x, y) Then Return GetOnBoundaryXInterpolatedY(x, y) + If OnBoundaryYInterpolatedX(x, y) Then Return GetOnBoundaryYInterpolatedX(x, y) + + 'satisfies no data points - Bi-Linear interpolation + Return GetBiLinearInterpolatedValue(x, y) + End Function + + Public Function ReturnDefaultMapValueTests() As String + + Dim sb As StringBuilder = New StringBuilder() + Dim x, y As Single + + 'All Sector Values + sb.AppendLine("All Values From Map") + sb.AppendLine("-------------------") + For Each x In _xRange + + For Each y In _yRange + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + Next + + Next + + sb.AppendLine("") + sb.AppendLine("Four Corners with interpolated other") + sb.AppendLine("-------------------") + x = 1500 + y = 18.5 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + x = 7000 + y = 96.5 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + x = 1750 + y = 10 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + x = 6500 + y = 10 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + + sb.AppendLine("") + sb.AppendLine("Interpolated both") + sb.AppendLine("-------------------") + + Dim mx, my As Double + Dim x2, y2 As Integer + For x2 = 0 To _xRange.Count - 2 + + For y2 = 0 To _yRange.Count - 2 + + mx = _xRange(x2) + (_xRange(x2 + 1) - _xRange(x2)) / 2 + my = _yRange(y2) + (_yRange(y2 + 1) - _yRange(y2)) / 2 + + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", mx, my, GetValue(mx, my))) + + + Next + + Next + + sb.AppendLine("") + sb.AppendLine("MIKE -> 40 & 1000") + sb.AppendLine("-------------------") + x = 1000 + y = 40 + sb.AppendLine(String.Format("X:{0}, Y:{1}, V:{2}", x, y, GetValue(x, y))) + + + Return sb.ToString() + End Function + + 'Constructors + Public Sub New(filepath As String) + + Me.filePath = filepath + + Initialise() + + getMapRanges() + End Sub + + Private Class MapPoint + Public Y As Double + Public x As Double + Public v As Double + + Public Sub New(y As Double, x As Double, v As Double) + + Me.Y = y + Me.x = x + Me.v = v + End Sub + End Class + + 'Get Alternator Efficiency + Public Function GetEfficiency(rpm As Double, amps As Ampere) As AlternatorMapValues _ + Implements IAlternatorMap.GetEfficiency + + Return New AlternatorMapValues(GetValue(rpm, amps.Value())) + End Function + + 'Initialises the map. + Public Function Initialise() As Boolean Implements IAlternatorMap.Initialise + If File.Exists(filePath) Then + Using sr As StreamReader = New StreamReader(filePath) + 'get array og lines fron csv + Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), + StringSplitOptions.RemoveEmptyEntries) + + 'Must have at least 2 entries in map to make it usable [dont forget the header row] + If (lines.Count() < 3) Then + Throw New ArgumentException("Insufficient rows in csv to build a usable map") + End If + + _map = New List(Of MapPoint) + Dim firstline As Boolean = True + + For Each line As String In lines + If Not firstline Then + + 'Advanced Alternator Source Check. + If line.Contains("[MODELSOURCE") Then Exit For + + 'split the line + Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) + '3 entries per line required + If (elements.Length <> 3) Then + Throw New ArgumentException("Incorrect number of values in csv file") + End If + 'add values to map + + 'Create AlternatorKey + Dim newPoint As MapPoint = New MapPoint(Single.Parse(elements(0), CultureInfo.InvariantCulture), + Single.Parse(elements(1), CultureInfo.InvariantCulture), + Single.Parse(elements(2), CultureInfo.InvariantCulture)) + _map.Add(newPoint) + + Else + firstline = False + End If + Next line + End Using + Return True + Else + Throw New ArgumentException("Supplied input file does not exist") + End If + End Function + + + 'Public Events + Public Event AuxiliaryEvent(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + Implements IAuxiliaryEvent.AuxiliaryEvent + + Protected Sub OnAuxiliaryEvent(message As String, messageType As AdvancedAuxiliaryMessageType) + + RaiseEvent AuxiliaryEvent(Me, message, messageType) + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb index fecaa48ca0e90a0fed30b95447af5146bb0bb925..54c3f19b07bbe2cb1b3cbb41c3268c47abb69098 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/AlternatorMapValues.vb @@ -1,23 +1,23 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Namespace Electrics - 'Originally was going to hold more than one value type. - Public Structure AlternatorMapValues - Public ReadOnly Efficiency As Double - - Public Sub New(ByVal efficiency As Double) - Me.Efficiency = efficiency - End Sub - End Structure -End Namespace - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Namespace Electrics + 'Originally was going to hold more than one value type. + Public Structure AlternatorMapValues + Public ReadOnly Efficiency As Double + + Public Sub New(ByVal efficiency As Double) + Me.Efficiency = efficiency + End Sub + End Structure +End Namespace + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb index 8ab4c624b9580a5ad210baa05e46f2819ecb09af..a04737a39216d3215492120ee2698857c7c0fec8 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/ElectricConstants.vb @@ -1,33 +1,33 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Electrics - Public Class ElectricConstants - 'Anticipated Min and Max Allowable values for Powernet, normally 26.3 volts but could be 48 in the future. - Public Const PowenetVoltageMin As Double = 6 - Public Const PowenetVoltageMax As Double = 50 - - 'Duty Cycle IE Percentage of use - Public Const PhaseIdleTractionOnMin As Double = 0 - Public Const PhaseIdleTractionMax As Double = 1 - - 'Max Min Expected Consumption for a Single Consumer, negative values allowed as bonuses. - Public Const NonminalConsumerConsumptionAmpsMin As Integer = - 10 - Public Const NominalConsumptionAmpsMax As Integer = 100 - - - 'Alternator - public const AlternatorPulleyEfficiencyMin as single = 0.1 - public const AlternatorPulleyEfficiencyMax as single = 1 - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Electrics + Public Class ElectricConstants + 'Anticipated Min and Max Allowable values for Powernet, normally 26.3 volts but could be 48 in the future. + Public Const PowenetVoltageMin As Double = 6 + Public Const PowenetVoltageMax As Double = 50 + + 'Duty Cycle IE Percentage of use + Public Const PhaseIdleTractionOnMin As Double = 0 + Public Const PhaseIdleTractionMax As Double = 1 + + 'Max Min Expected Consumption for a Single Consumer, negative values allowed as bonuses. + Public Const NonminalConsumerConsumptionAmpsMin As Integer = - 10 + Public Const NominalConsumptionAmpsMax As Integer = 100 + + + 'Alternator + public const AlternatorPulleyEfficiencyMin as single = 0.1 + public const AlternatorPulleyEfficiencyMax as single = 1 + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb index dbac602ff539dbc03c972f7def606fbdef6df071..8fff90df7738db016cb6a10cab5c26689923a479 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumer.vb @@ -1,190 +1,190 @@ -Imports System.ComponentModel -Imports TUGraz.VectoCommon.Utils - -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Electrics - ''' <summary> - ''' Described a consumer of Alternator electrical power - ''' </summary> - ''' <remarks></remarks> - Public Class ElectricalConsumer - Implements IElectricalConsumer - - 'Fields - Private _BaseVehicle As Boolean - Private _Category As String - Private _ConsumerName As String - Private _NominalConsumptionAmps As Double - Private _NumberInActualVehicle As Integer - Private _PhaseIdle_TractionOn As Double - Private _PowerNetVoltage As Double - Private _Info As String - - 'Calculated - Private Property AvgConsumptionAmps As Double Implements IElectricalConsumer.AvgConsumptionAmps - - 'Properties - Public Property BaseVehicle As Boolean Implements IElectricalConsumer.BaseVehicle - Get - Return _BaseVehicle - End Get - Set(value As Boolean) - _BaseVehicle = value - NotifyPropertyChanged("BaseVehicle") - End Set - End Property - - Public Property Category As String Implements IElectricalConsumer.Category - Get - Return _Category - End Get - Set(value As String) - _Category = value - NotifyPropertyChanged("Category") - End Set - End Property - - Public Property ConsumerName As String Implements IElectricalConsumer.ConsumerName - Get - Return _ConsumerName - End Get - Set(value As String) - _ConsumerName = value - NotifyPropertyChanged("ConsumerName") - End Set - End Property - - Public Property NominalConsumptionAmps As Double Implements IElectricalConsumer.NominalConsumptionAmps - Get - Return _NominalConsumptionAmps - End Get - Set(value As Double) - _NominalConsumptionAmps = value - NotifyPropertyChanged("NominalConsumptionAmps") - End Set - End Property - - Public Property NumberInActualVehicle As Integer Implements IElectricalConsumer.NumberInActualVehicle - Get - Return _NumberInActualVehicle - End Get - Set(value As Integer) - _NumberInActualVehicle = value - NotifyPropertyChanged("NumberInActualVehicle") - End Set - End Property - - Public Property PhaseIdle_TractionOn As Double Implements IElectricalConsumer.PhaseIdle_TractionOn - Get - Return _PhaseIdle_TractionOn - End Get - Set(value As Double) - _PhaseIdle_TractionOn = value - NotifyPropertyChanged("PhaseIdle_TractionOn") - End Set - End Property - - Public Property PowerNetVoltage As Double Implements IElectricalConsumer.PowerNetVoltage - Get - Return _PowerNetVoltage - End Get - Set(value As Double) - _PowerNetVoltage = value - NotifyPropertyChanged("PowerNetVoltage") - End Set - End Property - - Public Property Info As String Implements IElectricalConsumer.Info - Get - Return _Info - End Get - Set(value As String) - _Info = value - NotifyPropertyChanged("Info") - End Set - End Property - - - 'Public class outputs - Public Function TotalAvgConumptionAmps(Optional PhaseIdle_TractionOnBasedOnCycle As Double = Nothing) As Ampere _ - Implements IElectricalConsumer.TotalAvgConumptionAmps - - If ConsumerName = "Doors per Door" Then - Return NominalConsumptionAmps.SI(Of Ampere)() * (NumberInActualVehicle * PhaseIdle_TractionOnBasedOnCycle) - Else - Return NominalConsumptionAmps.SI(Of Ampere)() * (NumberInActualVehicle * PhaseIdle_TractionOn) - End If - End Function - - Public Function TotalAvgConsumptionInWatts(Optional PhaseIdle_TractionOnBasedOnCycle As Double = 0.0) As Watt _ - Implements IElectricalConsumer.TotalAvgConsumptionInWatts - Return TotalAvgConumptionAmps(PhaseIdle_TractionOnBasedOnCycle) * PowerNetVoltage.SI(Of Volt)() - End Function - - 'Constructor - Public Sub New(BaseVehicle As Boolean, Category As String, ConsumerName As String, NominalConsumptionAmps As Double, - PhaseIdle_TractionOn As Double, PowerNetVoltage As Double, numberInVehicle As Integer, info As String) - - 'Illegal Value Check. - If Category.Trim.Length = 0 Then Throw New ArgumentException("Category Name cannot be empty") - If ConsumerName.Trim.Length = 0 Then Throw New ArgumentException("ConsumerName Name cannot be empty") - If _ - PhaseIdle_TractionOn < ElectricConstants.PhaseIdleTractionOnMin Or - PhaseIdle_TractionOn > ElectricConstants.PhaseIdleTractionMax Then _ - Throw New ArgumentException("PhaseIdle_TractionOn must have a value between 0 and 1") - If _ - NominalConsumptionAmps < ElectricConstants.NonminalConsumerConsumptionAmpsMin Or - NominalConsumptionAmps > ElectricConstants.NominalConsumptionAmpsMax Then _ - Throw New ArgumentException("NominalConsumptionAmps must have a value between 0 and 100") - If PowerNetVoltage < ElectricConstants.PowenetVoltageMin Or PowerNetVoltage > ElectricConstants.PowenetVoltageMax _ - Then Throw New ArgumentException("PowerNetVoltage must have a value between 6 and 48") - If numberInVehicle < 0 Then Throw New ArgumentException("Cannot have less than 0 consumers in the vehicle") - - 'Good, now assign. - Me.BaseVehicle = BaseVehicle - Me.Category = Category - Me.ConsumerName = ConsumerName - Me.NominalConsumptionAmps = NominalConsumptionAmps - Me.PhaseIdle_TractionOn = PhaseIdle_TractionOn - Me.PowerNetVoltage = PowerNetVoltage - Me.NumberInActualVehicle = numberInVehicle - Me.Info = info - End Sub - - 'Comparison Overrides - Public Overrides Function Equals(obj As Object) As Boolean - - If obj Is Nothing OrElse Not Me.GetType() Is obj.GetType() Then - Return False - End If - - Dim other As IElectricalConsumer = CType(obj, IElectricalConsumer) - - - Return Me.ConsumerName = other.ConsumerName - End Function - - <System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage> - Public Overrides Function GetHashCode() As Integer - Return 0 - End Function - - - Public Event PropertyChanged As PropertyChangedEventHandler _ - Implements INotifyPropertyChanged.PropertyChanged - - Private Sub NotifyPropertyChanged(p As String) - RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(p)) - End Sub - End Class +Imports System.ComponentModel +Imports TUGraz.VectoCommon.Utils + +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Electrics + ''' <summary> + ''' Described a consumer of Alternator electrical power + ''' </summary> + ''' <remarks></remarks> + Public Class ElectricalConsumer + Implements IElectricalConsumer + + 'Fields + Private _BaseVehicle As Boolean + Private _Category As String + Private _ConsumerName As String + Private _NominalConsumptionAmps As Double + Private _NumberInActualVehicle As Integer + Private _PhaseIdle_TractionOn As Double + Private _PowerNetVoltage As Double + Private _Info As String + + 'Calculated + Private Property AvgConsumptionAmps As Double Implements IElectricalConsumer.AvgConsumptionAmps + + 'Properties + Public Property BaseVehicle As Boolean Implements IElectricalConsumer.BaseVehicle + Get + Return _BaseVehicle + End Get + Set(value As Boolean) + _BaseVehicle = value + NotifyPropertyChanged("BaseVehicle") + End Set + End Property + + Public Property Category As String Implements IElectricalConsumer.Category + Get + Return _Category + End Get + Set(value As String) + _Category = value + NotifyPropertyChanged("Category") + End Set + End Property + + Public Property ConsumerName As String Implements IElectricalConsumer.ConsumerName + Get + Return _ConsumerName + End Get + Set(value As String) + _ConsumerName = value + NotifyPropertyChanged("ConsumerName") + End Set + End Property + + Public Property NominalConsumptionAmps As Double Implements IElectricalConsumer.NominalConsumptionAmps + Get + Return _NominalConsumptionAmps + End Get + Set(value As Double) + _NominalConsumptionAmps = value + NotifyPropertyChanged("NominalConsumptionAmps") + End Set + End Property + + Public Property NumberInActualVehicle As Integer Implements IElectricalConsumer.NumberInActualVehicle + Get + Return _NumberInActualVehicle + End Get + Set(value As Integer) + _NumberInActualVehicle = value + NotifyPropertyChanged("NumberInActualVehicle") + End Set + End Property + + Public Property PhaseIdle_TractionOn As Double Implements IElectricalConsumer.PhaseIdle_TractionOn + Get + Return _PhaseIdle_TractionOn + End Get + Set(value As Double) + _PhaseIdle_TractionOn = value + NotifyPropertyChanged("PhaseIdle_TractionOn") + End Set + End Property + + Public Property PowerNetVoltage As Double Implements IElectricalConsumer.PowerNetVoltage + Get + Return _PowerNetVoltage + End Get + Set(value As Double) + _PowerNetVoltage = value + NotifyPropertyChanged("PowerNetVoltage") + End Set + End Property + + Public Property Info As String Implements IElectricalConsumer.Info + Get + Return _Info + End Get + Set(value As String) + _Info = value + NotifyPropertyChanged("Info") + End Set + End Property + + + 'Public class outputs + Public Function TotalAvgConumptionAmps(Optional PhaseIdle_TractionOnBasedOnCycle As Double = Nothing) As Ampere _ + Implements IElectricalConsumer.TotalAvgConumptionAmps + + If ConsumerName = "Doors per Door" Then + Return NominalConsumptionAmps.SI(Of Ampere)() * (NumberInActualVehicle * PhaseIdle_TractionOnBasedOnCycle) + Else + Return NominalConsumptionAmps.SI(Of Ampere)() * (NumberInActualVehicle * PhaseIdle_TractionOn) + End If + End Function + + Public Function TotalAvgConsumptionInWatts(Optional PhaseIdle_TractionOnBasedOnCycle As Double = 0.0) As Watt _ + Implements IElectricalConsumer.TotalAvgConsumptionInWatts + Return TotalAvgConumptionAmps(PhaseIdle_TractionOnBasedOnCycle) * PowerNetVoltage.SI(Of Volt)() + End Function + + 'Constructor + Public Sub New(BaseVehicle As Boolean, Category As String, ConsumerName As String, NominalConsumptionAmps As Double, + PhaseIdle_TractionOn As Double, PowerNetVoltage As Double, numberInVehicle As Integer, info As String) + + 'Illegal Value Check. + If Category.Trim.Length = 0 Then Throw New ArgumentException("Category Name cannot be empty") + If ConsumerName.Trim.Length = 0 Then Throw New ArgumentException("ConsumerName Name cannot be empty") + If _ + PhaseIdle_TractionOn < ElectricConstants.PhaseIdleTractionOnMin Or + PhaseIdle_TractionOn > ElectricConstants.PhaseIdleTractionMax Then _ + Throw New ArgumentException("PhaseIdle_TractionOn must have a value between 0 and 1") + If _ + NominalConsumptionAmps < ElectricConstants.NonminalConsumerConsumptionAmpsMin Or + NominalConsumptionAmps > ElectricConstants.NominalConsumptionAmpsMax Then _ + Throw New ArgumentException("NominalConsumptionAmps must have a value between 0 and 100") + If PowerNetVoltage < ElectricConstants.PowenetVoltageMin Or PowerNetVoltage > ElectricConstants.PowenetVoltageMax _ + Then Throw New ArgumentException("PowerNetVoltage must have a value between 6 and 48") + If numberInVehicle < 0 Then Throw New ArgumentException("Cannot have less than 0 consumers in the vehicle") + + 'Good, now assign. + Me.BaseVehicle = BaseVehicle + Me.Category = Category + Me.ConsumerName = ConsumerName + Me.NominalConsumptionAmps = NominalConsumptionAmps + Me.PhaseIdle_TractionOn = PhaseIdle_TractionOn + Me.PowerNetVoltage = PowerNetVoltage + Me.NumberInActualVehicle = numberInVehicle + Me.Info = info + End Sub + + 'Comparison Overrides + Public Overrides Function Equals(obj As Object) As Boolean + + If obj Is Nothing OrElse Not Me.GetType() Is obj.GetType() Then + Return False + End If + + Dim other As IElectricalConsumer = CType(obj, IElectricalConsumer) + + + Return Me.ConsumerName = other.ConsumerName + End Function + + <System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage> + Public Overrides Function GetHashCode() As Integer + Return 0 + End Function + + + Public Event PropertyChanged As PropertyChangedEventHandler _ + Implements INotifyPropertyChanged.PropertyChanged + + Private Sub NotifyPropertyChanged(p As String) + RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(p)) + End Sub + End Class End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb index dc470c604d7d0e628a4e03ebfde13a0eded77209..132c93c0e920ab17deceace6d5abb584e14cbfec 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/ElectricalConsumerList.vb @@ -1,230 +1,230 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Imports System.Collections.Generic -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class ElectricalConsumerList - Implements IElectricalConsumerList - - Private _items As New List(Of IElectricalConsumer) - Private _powernetVoltage As Double - Private _doorDutyCycleZeroToOne As Double - - - 'Constructor - Public Sub New(powernetVoltage As Double, doorDutyCycle_ZeroToOne As Double, - Optional createDefaultList As Boolean = False) - - _powernetVoltage = powernetVoltage - - If createDefaultList Then - - _items = GetDefaultConsumerList() - - End If - - - _doorDutyCycleZeroToOne = doorDutyCycle_ZeroToOne - End Sub - - 'Transfers the Info comments from a default set of consumables to a live set. - 'This way makes the comments not dependent on saved data. - Public Sub MergeInfoData() Implements IElectricalConsumerList.MergeInfoData - - If _items.Count <> GetDefaultConsumerList().Count Then Return - - Dim dflt As List(Of IElectricalConsumer) = GetDefaultConsumerList() - - For idx As Integer = 0 To _items.Count - 1 - - _items(idx).Info = dflt(idx).Info - - Next - End Sub - - 'Initialise default set of consumers - Public Function GetDefaultConsumerList() As List(Of IElectricalConsumer) - - 'This populates the default settings as per engineering spreadsheet. - 'Vehicle Basic Equipment' category can be added or remove by customers. - 'At some time in the future, this may be removed and replace with file based consumer lists. - - Dim items As New List(Of IElectricalConsumer) - - Dim c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 As IElectricalConsumer - - c1 = CType(New ElectricalConsumer(False, "Doors", "Doors per Door", 3.0, 0.096339, - _powernetVoltage, 3, ""), - IElectricalConsumer) - c2 = CType(New ElectricalConsumer(True, "Veh Electronics &Engine", "Controllers,Valves etc", - 25.0, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c3 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio City", 2.0, 0.8, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c4 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio Intercity", 5.0, - 0.8, _powernetVoltage, - 0, ""), - IElectricalConsumer) - c5 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio/Audio Tourism", - 9.0, 0.8, - _powernetVoltage, 0, ""), - IElectricalConsumer) - c6 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Fridge", 4.0, 0.5, - _powernetVoltage, 0, ""), - IElectricalConsumer) - c7 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Kitchen Standard", - 67.0, 0.05, _powernetVoltage, - 0, ""), - IElectricalConsumer) - c8 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", - "Interior lights City/ Intercity + Doorlights [Should be 1/m]", 1.0, 0.7, - _powernetVoltage, 12, - "1 Per metre length of bus"), - IElectricalConsumer) - c9 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", - "LED Interior lights ceiling city/Intercity + door [Should be 1/m]", 0.6, 0.7, - _powernetVoltage, 0, - "1 Per metre length of bus"), - IElectricalConsumer) - c10 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Interior lights Tourism + reading [1/m]", - 1.1, - 0.7, _powernetVoltage, 0, "1 Per metre length of bus"), - IElectricalConsumer) - c11 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", - "LED Interior lights ceiling Tourism + LED reading [Should be 1/m]", 0.66, 0.7, - _powernetVoltage, 0, - "1 Per metre length of bus"), - IElectricalConsumer) - c12 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", "External Displays Font/Side/Rear", - 2.65017667844523, 1.0, _powernetVoltage, 4, ""), - IElectricalConsumer) - c13 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", - "Internal display per unit ( front side rear)", 1.06007067137809, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c14 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", - "CityBus Ref EBSF Table4 Devices ITS No Displays", 9.3, 1.0, _powernetVoltage, 1, - ""), - IElectricalConsumer) - c15 = CType(New ElectricalConsumer(False, "Lights", "Exterior Lights BULB", 7.4, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - c16 = CType(New ElectricalConsumer(False, "Lights", "Day running lights LED bonus", - -0.723, 1.0, _powernetVoltage, - 1, ""), - IElectricalConsumer) - c17 = CType(New ElectricalConsumer(False, "Lights", "Antifog rear lights LED bonus", - -0.17, 1.0, _powernetVoltage, - 1, ""), - IElectricalConsumer) - c18 = CType(New ElectricalConsumer(False, "Lights", "Position lights LED bonus", -1.2, - 1.0, _powernetVoltage, 1, - ""), - IElectricalConsumer) - c19 = CType(New ElectricalConsumer(False, "Lights", "Direction lights LED bonus", -0.3, - 1.0, _powernetVoltage, 1, - ""), - IElectricalConsumer) - c20 = CType(New ElectricalConsumer(False, "Lights", "Brake Lights LED bonus", -1.2, 1.0, - _powernetVoltage, 1, ""), - IElectricalConsumer) - - items.Add(c1) - items.Add(c2) - items.Add(c3) - items.Add(c4) - items.Add(c5) - items.Add(c6) - items.Add(c7) - items.Add(c8) - items.Add(c9) - items.Add(c10) - items.Add(c11) - items.Add(c12) - items.Add(c13) - items.Add(c14) - items.Add(c15) - items.Add(c16) - items.Add(c17) - items.Add(c18) - items.Add(c19) - items.Add(c20) - - Return items - End Function - - - 'Interface implementation - Public Property DoorDutyCycleFraction As Double Implements IElectricalConsumerList.DoorDutyCycleFraction - - Get - Return _doorDutyCycleZeroToOne - End Get - Set(value As Double) - _doorDutyCycleZeroToOne = value - End Set - End Property - - Public ReadOnly Property Items As List(Of IElectricalConsumer) Implements IElectricalConsumerList.Items - Get - Return _items - End Get - End Property - - Public Sub AddConsumer(consumer As IElectricalConsumer) Implements Electrics.IElectricalConsumerList.AddConsumer - - If Not _items.Contains(consumer) Then - _items.Add(consumer) - Else - - Throw New ArgumentException("Consumer Already Present in the list") - - End If - End Sub - - Public Sub RemoveConsumer(consumer As IElectricalConsumer) Implements Electrics.IElectricalConsumerList.RemoveConsumer - - If _items.Contains(consumer) Then - - _items.Remove(consumer) - - Else - - Throw New ArgumentException("Consumer Not In List") - - End If - End Sub - - - Public Function GetTotalAverageDemandAmps(excludeOnBase As Boolean) As Ampere _ - Implements Electrics.IElectricalConsumerList.GetTotalAverageDemandAmps - - Dim Amps As Ampere - - If excludeOnBase Then - Amps = - Aggregate item In Items Where item.BaseVehicle = False Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) - Else - Amps = Aggregate item In Items Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) - End If - - - Return Amps - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Imports System.Collections.Generic +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Class ElectricalConsumerList + Implements IElectricalConsumerList + + Private _items As New List(Of IElectricalConsumer) + Private _powernetVoltage As Double + Private _doorDutyCycleZeroToOne As Double + + + 'Constructor + Public Sub New(powernetVoltage As Double, doorDutyCycle_ZeroToOne As Double, + Optional createDefaultList As Boolean = False) + + _powernetVoltage = powernetVoltage + + If createDefaultList Then + + _items = GetDefaultConsumerList() + + End If + + + _doorDutyCycleZeroToOne = doorDutyCycle_ZeroToOne + End Sub + + 'Transfers the Info comments from a default set of consumables to a live set. + 'This way makes the comments not dependent on saved data. + Public Sub MergeInfoData() Implements IElectricalConsumerList.MergeInfoData + + If _items.Count <> GetDefaultConsumerList().Count Then Return + + Dim dflt As List(Of IElectricalConsumer) = GetDefaultConsumerList() + + For idx As Integer = 0 To _items.Count - 1 + + _items(idx).Info = dflt(idx).Info + + Next + End Sub + + 'Initialise default set of consumers + Public Function GetDefaultConsumerList() As List(Of IElectricalConsumer) + + 'This populates the default settings as per engineering spreadsheet. + 'Vehicle Basic Equipment' category can be added or remove by customers. + 'At some time in the future, this may be removed and replace with file based consumer lists. + + Dim items As New List(Of IElectricalConsumer) + + Dim c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 As IElectricalConsumer + + c1 = CType(New ElectricalConsumer(False, "Doors", "Doors per Door", 3.0, 0.096339, + _powernetVoltage, 3, ""), + IElectricalConsumer) + c2 = CType(New ElectricalConsumer(True, "Veh Electronics &Engine", "Controllers,Valves etc", + 25.0, 1.0, + _powernetVoltage, 1, ""), + IElectricalConsumer) + c3 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio City", 2.0, 0.8, + _powernetVoltage, 1, ""), + IElectricalConsumer) + c4 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio Intercity", 5.0, + 0.8, _powernetVoltage, + 0, ""), + IElectricalConsumer) + c5 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Radio/Audio Tourism", + 9.0, 0.8, + _powernetVoltage, 0, ""), + IElectricalConsumer) + c6 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Fridge", 4.0, 0.5, + _powernetVoltage, 0, ""), + IElectricalConsumer) + c7 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Kitchen Standard", + 67.0, 0.05, _powernetVoltage, + 0, ""), + IElectricalConsumer) + c8 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", + "Interior lights City/ Intercity + Doorlights [Should be 1/m]", 1.0, 0.7, + _powernetVoltage, 12, + "1 Per metre length of bus"), + IElectricalConsumer) + c9 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", + "LED Interior lights ceiling city/Intercity + door [Should be 1/m]", 0.6, 0.7, + _powernetVoltage, 0, + "1 Per metre length of bus"), + IElectricalConsumer) + c10 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", "Interior lights Tourism + reading [1/m]", + 1.1, + 0.7, _powernetVoltage, 0, "1 Per metre length of bus"), + IElectricalConsumer) + c11 = CType(New ElectricalConsumer(False, "Vehicle basic equipment", + "LED Interior lights ceiling Tourism + LED reading [Should be 1/m]", 0.66, 0.7, + _powernetVoltage, 0, + "1 Per metre length of bus"), + IElectricalConsumer) + c12 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", "External Displays Font/Side/Rear", + 2.65017667844523, 1.0, _powernetVoltage, 4, ""), + IElectricalConsumer) + c13 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", + "Internal display per unit ( front side rear)", 1.06007067137809, 1.0, + _powernetVoltage, 1, ""), + IElectricalConsumer) + c14 = CType(New ElectricalConsumer(False, "Customer Specific Equipment", + "CityBus Ref EBSF Table4 Devices ITS No Displays", 9.3, 1.0, _powernetVoltage, 1, + ""), + IElectricalConsumer) + c15 = CType(New ElectricalConsumer(False, "Lights", "Exterior Lights BULB", 7.4, 1.0, + _powernetVoltage, 1, ""), + IElectricalConsumer) + c16 = CType(New ElectricalConsumer(False, "Lights", "Day running lights LED bonus", + -0.723, 1.0, _powernetVoltage, + 1, ""), + IElectricalConsumer) + c17 = CType(New ElectricalConsumer(False, "Lights", "Antifog rear lights LED bonus", + -0.17, 1.0, _powernetVoltage, + 1, ""), + IElectricalConsumer) + c18 = CType(New ElectricalConsumer(False, "Lights", "Position lights LED bonus", -1.2, + 1.0, _powernetVoltage, 1, + ""), + IElectricalConsumer) + c19 = CType(New ElectricalConsumer(False, "Lights", "Direction lights LED bonus", -0.3, + 1.0, _powernetVoltage, 1, + ""), + IElectricalConsumer) + c20 = CType(New ElectricalConsumer(False, "Lights", "Brake Lights LED bonus", -1.2, 1.0, + _powernetVoltage, 1, ""), + IElectricalConsumer) + + items.Add(c1) + items.Add(c2) + items.Add(c3) + items.Add(c4) + items.Add(c5) + items.Add(c6) + items.Add(c7) + items.Add(c8) + items.Add(c9) + items.Add(c10) + items.Add(c11) + items.Add(c12) + items.Add(c13) + items.Add(c14) + items.Add(c15) + items.Add(c16) + items.Add(c17) + items.Add(c18) + items.Add(c19) + items.Add(c20) + + Return items + End Function + + + 'Interface implementation + Public Property DoorDutyCycleFraction As Double Implements IElectricalConsumerList.DoorDutyCycleFraction + + Get + Return _doorDutyCycleZeroToOne + End Get + Set(value As Double) + _doorDutyCycleZeroToOne = value + End Set + End Property + + Public ReadOnly Property Items As List(Of IElectricalConsumer) Implements IElectricalConsumerList.Items + Get + Return _items + End Get + End Property + + Public Sub AddConsumer(consumer As IElectricalConsumer) Implements Electrics.IElectricalConsumerList.AddConsumer + + If Not _items.Contains(consumer) Then + _items.Add(consumer) + Else + + Throw New ArgumentException("Consumer Already Present in the list") + + End If + End Sub + + Public Sub RemoveConsumer(consumer As IElectricalConsumer) Implements Electrics.IElectricalConsumerList.RemoveConsumer + + If _items.Contains(consumer) Then + + _items.Remove(consumer) + + Else + + Throw New ArgumentException("Consumer Not In List") + + End If + End Sub + + + Public Function GetTotalAverageDemandAmps(excludeOnBase As Boolean) As Ampere _ + Implements Electrics.IElectricalConsumerList.GetTotalAverageDemandAmps + + Dim Amps As Ampere + + If excludeOnBase Then + Amps = + Aggregate item In Items Where item.BaseVehicle = False Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) + Else + Amps = Aggregate item In Items Into Sum(item.TotalAvgConumptionAmps(DoorDutyCycleFraction)) + End If + + + Return Amps + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb index 6ccffb23e7ba00ab224c3726aa5ca4eabaa60a4d..db1bc9a072a64671f1323e65e5478c7c67826367 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/ElectricsUserInputsConfig.vb @@ -1,55 +1,55 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics - -Namespace Electrics - Public Class ElectricsUserInputsConfig - Implements IElectricsUserInputsConfig - - Public Property PowerNetVoltage As Double Implements IElectricsUserInputsConfig.PowerNetVoltage - Public Property AlternatorMap As String Implements IElectricsUserInputsConfig.AlternatorMap - Public Property AlternatorGearEfficiency As Double Implements IElectricsUserInputsConfig.AlternatorGearEfficiency - - Public Property ElectricalConsumers As IElectricalConsumerList _ - Implements IElectricsUserInputsConfig.ElectricalConsumers - - Public Property DoorActuationTimeSecond As Integer Implements IElectricsUserInputsConfig.DoorActuationTimeSecond - Public Property StoredEnergyEfficiency As Single Implements IElectricsUserInputsConfig.StoredEnergyEfficiency - - Public Property ResultCardIdle As IResultCard Implements IElectricsUserInputsConfig.ResultCardIdle - Public Property ResultCardTraction As IResultCard Implements IElectricsUserInputsConfig.ResultCardTraction - Public Property ResultCardOverrun As IResultCard Implements IElectricsUserInputsConfig.ResultCardOverrun - - Public Property SmartElectrical As Boolean Implements IElectricsUserInputsConfig.SmartElectrical - - Public Sub New(Optional setToDefaults As Boolean = False, Optional vectoInputs As VectoInputs = Nothing) - - If setToDefaults Then SetPropertiesToDefaults(vectoInputs) - End Sub - - Public Sub SetPropertiesToDefaults(vectoInputs As VectoInputs) - - DoorActuationTimeSecond = 4 - StoredEnergyEfficiency = 0.935 - AlternatorGearEfficiency = 0.92 - PowerNetVoltage = vectoInputs.PowerNetVoltage.Value() - ResultCardIdle = New ResultCard(New List(Of SmartResult)) - ResultCardOverrun = New ResultCard(New List(Of SmartResult)) - ResultCardTraction = New ResultCard(New List(Of SmartResult)) - SmartElectrical = False - AlternatorMap = String.Empty - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics + +Namespace Electrics + Public Class ElectricsUserInputsConfig + Implements IElectricsUserInputsConfig + + Public Property PowerNetVoltage As Double Implements IElectricsUserInputsConfig.PowerNetVoltage + Public Property AlternatorMap As String Implements IElectricsUserInputsConfig.AlternatorMap + Public Property AlternatorGearEfficiency As Double Implements IElectricsUserInputsConfig.AlternatorGearEfficiency + + Public Property ElectricalConsumers As IElectricalConsumerList _ + Implements IElectricsUserInputsConfig.ElectricalConsumers + + Public Property DoorActuationTimeSecond As Integer Implements IElectricsUserInputsConfig.DoorActuationTimeSecond + Public Property StoredEnergyEfficiency As Single Implements IElectricsUserInputsConfig.StoredEnergyEfficiency + + Public Property ResultCardIdle As IResultCard Implements IElectricsUserInputsConfig.ResultCardIdle + Public Property ResultCardTraction As IResultCard Implements IElectricsUserInputsConfig.ResultCardTraction + Public Property ResultCardOverrun As IResultCard Implements IElectricsUserInputsConfig.ResultCardOverrun + + Public Property SmartElectrical As Boolean Implements IElectricsUserInputsConfig.SmartElectrical + + Public Sub New(Optional setToDefaults As Boolean = False, Optional vectoInputs As VectoInputs = Nothing) + + If setToDefaults Then SetPropertiesToDefaults(vectoInputs) + End Sub + + Public Sub SetPropertiesToDefaults(vectoInputs As VectoInputs) + + DoorActuationTimeSecond = 4 + StoredEnergyEfficiency = 0.935 + AlternatorGearEfficiency = 0.92 + PowerNetVoltage = vectoInputs.PowerNetVoltage.Value() + ResultCardIdle = New ResultCard(New List(Of SmartResult)) + ResultCardOverrun = New ResultCard(New List(Of SmartResult)) + ResultCardTraction = New ResultCard(New List(Of SmartResult)) + SmartElectrical = False + AlternatorMap = String.Empty + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb b/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb index 01782b03f37f9b837a67b8e0c8a8e21af09da208..d5622c8f7e34cb60a6d7a9924d14e22284ec9c38 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IAlternatorMap.vb @@ -1,32 +1,32 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IAlternatorMap - Inherits IAuxiliaryEvent - - ''' <summary> - ''' Initialise the map from supplied csv data - ''' </summary> - ''' <returns>Boolean - true if map is created successfully</returns> - ''' <remarks></remarks> - Function Initialise() As Boolean - - ''' <summary> - ''' Returns the alternator efficiency at given rpm - ''' </summary> - ''' <param name="rpm">alternator rotation speed</param> - ''' <returns>Single</returns> - ''' <remarks></remarks> - Function GetEfficiency(ByVal rpm As Double, ByVal amps As Ampere) As AlternatorMapValues - End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IAlternatorMap + Inherits IAuxiliaryEvent + + ''' <summary> + ''' Initialise the map from supplied csv data + ''' </summary> + ''' <returns>Boolean - true if map is created successfully</returns> + ''' <remarks></remarks> + Function Initialise() As Boolean + + ''' <summary> + ''' Returns the alternator efficiency at given rpm + ''' </summary> + ''' <param name="rpm">alternator rotation speed</param> + ''' <returns>Single</returns> + ''' <remarks></remarks> + Function GetEfficiency(ByVal rpm As Double, ByVal amps As Ampere) As AlternatorMapValues + End Interface End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb b/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb index 4a7f0e32dfd88b2c1436e189a94c79963a5c4597..7158bc909ca62d9015e9c6aef8e0601b38247fb0 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumer.vb @@ -1,31 +1,31 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.ComponentModel -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IElectricalConsumer - Inherits INotifyPropertyChanged - - Property Category As String - Property ConsumerName As String - Property BaseVehicle As Boolean - Property NominalConsumptionAmps As Double - Property PhaseIdle_TractionOn As Double - Property NumberInActualVehicle As Integer - Property PowerNetVoltage As Double - Property AvgConsumptionAmps As Double - Property Info As String - Function TotalAvgConumptionAmps(Optional PhaseIdle_TractionOnBasedOnCycle As Double = Nothing) As Ampere - Function TotalAvgConsumptionInWatts(Optional PhaseIdle_TractionOnBasedOnCycle As Double = 0.0) As Watt - End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.ComponentModel +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IElectricalConsumer + Inherits INotifyPropertyChanged + + Property Category As String + Property ConsumerName As String + Property BaseVehicle As Boolean + Property NominalConsumptionAmps As Double + Property PhaseIdle_TractionOn As Double + Property NumberInActualVehicle As Integer + Property PowerNetVoltage As Double + Property AvgConsumptionAmps As Double + Property Info As String + Function TotalAvgConumptionAmps(Optional PhaseIdle_TractionOnBasedOnCycle As Double = Nothing) As Ampere + Function TotalAvgConsumptionInWatts(Optional PhaseIdle_TractionOnBasedOnCycle As Double = 0.0) As Watt + End Interface End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb b/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb index 0eff826f13ef85203f754bcffc86a22ac41cfa08..f29100d7c7fae3ac5923f40a9cf029a338806443 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IElectricalConsumerList.vb @@ -1,59 +1,59 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IElectricalConsumerList - ''' <summary> - ''' List of Electrical Consumers - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property Items As List(Of IElectricalConsumer) - - ''' <summary> - ''' Add New Electrical Consumer - ''' </summary> - ''' <param name="consumer"></param> - ''' <remarks></remarks> - Sub AddConsumer(consumer As IElectricalConsumer) - - ''' <summary> - ''' Remove Electrical Consumer - ''' </summary> - ''' <param name="consumer"></param> - ''' <remarks></remarks> - Sub RemoveConsumer(consumer As IElectricalConsumer) - - ''' <summary> - ''' Get Total Average Demand In Amps - ''' </summary> - ''' <param name="excludeOnBase">Exclude those on base vehicle</param> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetTotalAverageDemandAmps(excludeOnBase As Boolean) As Ampere - - ''' <summary> - ''' Door Actuation Time Fraction ( Total Time Spent Operational during cycle ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property DoorDutyCycleFraction As Double - - 'Merge Info data from ElectricalConsumer in a Default set into live set - 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. - Sub MergeInfoData() - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IElectricalConsumerList + ''' <summary> + ''' List of Electrical Consumers + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property Items As List(Of IElectricalConsumer) + + ''' <summary> + ''' Add New Electrical Consumer + ''' </summary> + ''' <param name="consumer"></param> + ''' <remarks></remarks> + Sub AddConsumer(consumer As IElectricalConsumer) + + ''' <summary> + ''' Remove Electrical Consumer + ''' </summary> + ''' <param name="consumer"></param> + ''' <remarks></remarks> + Sub RemoveConsumer(consumer As IElectricalConsumer) + + ''' <summary> + ''' Get Total Average Demand In Amps + ''' </summary> + ''' <param name="excludeOnBase">Exclude those on base vehicle</param> + ''' <returns></returns> + ''' <remarks></remarks> + Function GetTotalAverageDemandAmps(excludeOnBase As Boolean) As Ampere + + ''' <summary> + ''' Door Actuation Time Fraction ( Total Time Spent Operational during cycle ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property DoorDutyCycleFraction As Double + + 'Merge Info data from ElectricalConsumer in a Default set into live set + 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. + Sub MergeInfoData() + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb index 39aba740256742d84dd47bb7659640537b038e5d..86e44534b4c975d82bc06ceebcccb88fedd2e6de 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IElectricsUserInputsConfig.vb @@ -1,98 +1,98 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports VectoAuxiliaries.Electrics - -Namespace Electrics - Public Interface IElectricsUserInputsConfig - ''' <summary> - ''' Power Net Voltage - The supply voltage used on the vehilce. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PowerNetVoltage As Double - - ''' <summary> - ''' The Path for the Alternator map - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property AlternatorMap As String - - ''' <summary> - ''' Alternator Gear Efficiency - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property AlternatorGearEfficiency As Double - - ''' <summary> - ''' List of Electrical Consumers - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ElectricalConsumers As IElectricalConsumerList - - ''' <summary> - ''' Door Actuation Time In Seconds ( Time Taken to Open/Close the door ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property DoorActuationTimeSecond As Integer - - ''' <summary> - ''' Result Card Taken During Idle. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ResultCardIdle As IResultCard - - ''' <summary> - ''' Result Card Taken During Traction - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ResultCardTraction As IResultCard - - ''' <summary> - ''' Result Card Taken During Overrun - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property ResultCardOverrun As IResultCard - - ''' <summary> - ''' Smart Electrical System - ''' </summary> - ''' <value></value> - ''' <returns>True For Smart Electrical Systems/ False For non Smart.</returns> - ''' <remarks></remarks> - Property SmartElectrical As Boolean - - ''' <summary> - ''' Stored Energy Efficiency - ''' </summary> - ''' <value></value> - ''' <returns>Stored Energy Efficiency</returns> - ''' <remarks></remarks> - Property StoredEnergyEfficiency As Single - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports VectoAuxiliaries.Electrics + +Namespace Electrics + Public Interface IElectricsUserInputsConfig + ''' <summary> + ''' Power Net Voltage - The supply voltage used on the vehilce. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property PowerNetVoltage As Double + + ''' <summary> + ''' The Path for the Alternator map + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property AlternatorMap As String + + ''' <summary> + ''' Alternator Gear Efficiency + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property AlternatorGearEfficiency As Double + + ''' <summary> + ''' List of Electrical Consumers + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property ElectricalConsumers As IElectricalConsumerList + + ''' <summary> + ''' Door Actuation Time In Seconds ( Time Taken to Open/Close the door ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property DoorActuationTimeSecond As Integer + + ''' <summary> + ''' Result Card Taken During Idle. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property ResultCardIdle As IResultCard + + ''' <summary> + ''' Result Card Taken During Traction + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property ResultCardTraction As IResultCard + + ''' <summary> + ''' Result Card Taken During Overrun + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property ResultCardOverrun As IResultCard + + ''' <summary> + ''' Smart Electrical System + ''' </summary> + ''' <value></value> + ''' <returns>True For Smart Electrical Systems/ False For non Smart.</returns> + ''' <remarks></remarks> + Property SmartElectrical As Boolean + + ''' <summary> + ''' Stored Energy Efficiency + ''' </summary> + ''' <value></value> + ''' <returns>Stored Energy Efficiency</returns> + ''' <remarks></remarks> + Property StoredEnergyEfficiency As Single + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb index a05a4815ab561094a8e939a32d39b7e0ead2a9f5..e7caf4eb4a54c485adeb977adb8f2612a6927feb 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IM0_5_SmartAlternatorSetEfficiency.vb @@ -1,65 +1,65 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM0_5_SmartAlternatorSetEfficiency - ''' <summary> - ''' Smart Idle Current (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartIdleCurrent() As Ampere - - ''' <summary> - ''' Alternators Efficiency In Idle ( Fraction ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiencyIdleResultCard() As Double - - ''' <summary> - ''' Smart Traction Current (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartTractionCurrent As Ampere - - ''' <summary> - ''' Alternators Efficiency In Traction ( Fraction ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiencyTractionOnResultCard() As Double - - ''' <summary> - ''' Smart Overrrun Current (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property SmartOverrunCurrent As Ampere - - ''' <summary> - ''' Alternators Efficiency In Overrun ( Fraction ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiencyOverrunResultCard() As Double - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IM0_5_SmartAlternatorSetEfficiency + ''' <summary> + ''' Smart Idle Current (A) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartIdleCurrent() As Ampere + + ''' <summary> + ''' Alternators Efficiency In Idle ( Fraction ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AlternatorsEfficiencyIdleResultCard() As Double + + ''' <summary> + ''' Smart Traction Current (A) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartTractionCurrent As Ampere + + ''' <summary> + ''' Alternators Efficiency In Traction ( Fraction ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AlternatorsEfficiencyTractionOnResultCard() As Double + + ''' <summary> + ''' Smart Overrrun Current (A) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property SmartOverrunCurrent As Ampere + + ''' <summary> + ''' Alternators Efficiency In Overrun ( Fraction ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AlternatorsEfficiencyOverrunResultCard() As Double + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb index f3d70844d23b6f40e94aa66cbde0e35761cb49b6..49c492ca1751714fe137b5c5096a4115ae407f88 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IM0_NonSmart_AlternatorsSetEfficiency.vb @@ -1,33 +1,33 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM0_NonSmart_AlternatorsSetEfficiency - ''' <summary> - ''' Gets HVAC Electrical Power Demand (A) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property GetHVACElectricalPowerDemandAmps() As Ampere - - ''' <summary> - ''' Gets Alternator Efficiency (0-1) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AlternatorsEfficiency() As Double - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IM0_NonSmart_AlternatorsSetEfficiency + ''' <summary> + ''' Gets HVAC Electrical Power Demand (A) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property GetHVACElectricalPowerDemandAmps() As Ampere + + ''' <summary> + ''' Gets Alternator Efficiency (0-1) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AlternatorsEfficiency() As Double + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb index 790270baa25c0efe902625a735238f32ca38f7eb..5412a35c5954ebf5e3a81e49fc52213a7da09a5b 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IM2_AverageElectricalLoadDemand.vb @@ -1,20 +1,20 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM2_AverageElectricalLoadDemand - Function GetAveragePowerDemandAtAlternator() As Watt - Function GetAveragePowerAtCrankFromElectrics() As Watt - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IM2_AverageElectricalLoadDemand + Function GetAveragePowerDemandAtAlternator() As Watt + Function GetAveragePowerAtCrankFromElectrics() As Watt + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb b/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb index 8d2dceb2faffd155b0cce044a72a649be0872b16..42ee115e433764678f4b0fe0d425ac104de51936 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IM5_SmartAlternatorSetGeneration.vb @@ -1,38 +1,38 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IM5_SmartAlternatorSetGeneration - ''' <summary> - ''' Alternators Generation Power At Crank Idle (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt - - ''' <summary> - ''' Alternators Generation Power At Crank Traction On (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt - - ''' <summary> - ''' Alternators Generation Power At Crank Overrun (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IM5_SmartAlternatorSetGeneration + ''' <summary> + ''' Alternators Generation Power At Crank Idle (W) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt + + ''' <summary> + ''' Alternators Generation Power At Crank Traction On (W) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt + + ''' <summary> + ''' Alternators Generation Power At Crank Overrun (W) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb b/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb index 8c5f8969c9ddc680e9792997f33efff7bbc0d237..0b6481b72bacdfb3cdca31418ffcfc0c847ea39a 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/IResultCard.vb @@ -1,33 +1,33 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Interface IResultCard - ''' <summary> - ''' Returns a List of (SmartResult ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property Results As List(Of SmartResult) - - ''' <summary> - ''' Returns the Smart Current (A) - ''' </summary> - ''' <param name="Amps"></param> - ''' <returns></returns> - ''' <remarks>Defaults to 10 Amps if no readings present</remarks> - Function GetSmartCurrentResult(ByVal Amps As Ampere) As Ampere - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Interface IResultCard + ''' <summary> + ''' Returns a List of (SmartResult ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property Results As List(Of SmartResult) + + ''' <summary> + ''' Returns the Smart Current (A) + ''' </summary> + ''' <param name="Amps"></param> + ''' <returns></returns> + ''' <remarks>Defaults to 10 Amps if no readings present</remarks> + Function GetSmartCurrentResult(ByVal Amps As Ampere) As Ampere + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb index c516b3c7b9ec26f40587525fe1bfb80aa32b2ca7..c964dbc28dc5f23e07cc1768ad68a2b58764ab85 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/M0_5_SmartAlternatorSetEfficiency.vb @@ -1,121 +1,121 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.Diagnostics.CodeAnalysis -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class M0_5_SmartAlternatorSetEfficiency - Implements IM0_5_SmartAlternatorSetEfficiency - - 'Fields - Private _m0 As IM0_NonSmart_AlternatorsSetEfficiency - Private _electricalConsumables As IElectricalConsumerList - Private _alternatorMap As IAlternatorMap - Private _resultCardIdle As IResultCard - Private _resultCardTraction As IResultCard - Private _resultCardOverrun As IResultCard - Private _signals As ISignals - - 'Constructor - Public Sub New(m0 As IM0_NonSmart_AlternatorsSetEfficiency, - electricalConsumables As IElectricalConsumerList, - alternatorMap As IAlternatorMap, - resultCardIdle As IResultCard, - resultCardTraction As IResultCard, - resultCardOverrun As IResultCard, - signals As ISignals) - - 'Sanity Check on supplied arguments, throw an argument exception - If m0 Is Nothing Then Throw New ArgumentException("Module 0 must be supplied") - If electricalConsumables Is Nothing Then _ - Throw New ArgumentException("ElectricalConsumablesList must be supplied even if empty") - If alternatorMap Is Nothing Then Throw New ArgumentException("Must supply a valid alternator map") - If resultCardIdle Is Nothing Then _ - Throw New ArgumentException("Result Card 'IDLE' must be supplied even if it has no contents") - If resultCardTraction Is Nothing Then _ - Throw New ArgumentException("Result Card 'TRACTION' must be supplied even if it has no contents") - If resultCardOverrun Is Nothing Then _ - Throw New ArgumentException("Result Card 'OVERRUN' must be supplied even if it has no contents") - If signals Is Nothing Then Throw New ArgumentException("No Signals Reference object was provided ") - - 'Assignments to private variables. - _m0 = m0 - _electricalConsumables = electricalConsumables - _alternatorMap = alternatorMap - _resultCardIdle = resultCardIdle - _resultCardTraction = resultCardTraction - _resultCardOverrun = resultCardOverrun - _signals = signals - End Sub - - - 'Public Class Outputs (Properties) - Public ReadOnly Property SmartIdleCurrent() As Ampere Implements IM0_5_SmartAlternatorSetEfficiency.SmartIdleCurrent - Get - Dim hvac_Plus_None_Base As Ampere = HvacPlusNonBaseCurrents() - Dim smart_idle_current As Ampere = _resultCardIdle.GetSmartCurrentResult(hvac_Plus_None_Base) - - Return smart_idle_current - End Get - End Property - - Public ReadOnly Property AlternatorsEfficiencyIdleResultCard() As Double _ - Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyIdleResultCard - Get - Return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartIdleCurrent()).Efficiency - End Get - End Property - - Public ReadOnly Property SmartTractionCurrent As Ampere _ - Implements IM0_5_SmartAlternatorSetEfficiency.SmartTractionCurrent - Get - Return _resultCardTraction.GetSmartCurrentResult(HvacPlusNonBaseCurrents()) - End Get - End Property - - Public ReadOnly Property AlternatorsEfficiencyTractionOnResultCard() As Double _ - Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyTractionOnResultCard - Get - Return _alternatorMap.GetEfficiency(CType(_signals.EngineSpeed.AsRPM, Single), SmartTractionCurrent()).Efficiency - End Get - End Property - - Public ReadOnly Property SmartOverrunCurrent As Ampere _ - Implements IM0_5_SmartAlternatorSetEfficiency.SmartOverrunCurrent - Get - Return _resultCardOverrun.GetSmartCurrentResult(HvacPlusNonBaseCurrents()) - End Get - End Property - - Public ReadOnly Property AlternatorsEfficiencyOverrunResultCard() As Double _ - Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyOverrunResultCard - Get - Return _alternatorMap.GetEfficiency(CType(_signals.EngineSpeed.AsRPM, Single), SmartOverrunCurrent()).Efficiency - End Get - End Property - - 'Helpers - ''' <summary> - ''' Returns Non Base Currents (A) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - <ExcludeFromCodeCoverage> - Private Function HvacPlusNonBaseCurrents() As Ampere - 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb - Return _m0.GetHVACElectricalPowerDemandAmps() + _electricalConsumables.GetTotalAverageDemandAmps(True) _ - '/ElectricConstants.StoredEnergyEfficiency) - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.Diagnostics.CodeAnalysis +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Class M0_5_SmartAlternatorSetEfficiency + Implements IM0_5_SmartAlternatorSetEfficiency + + 'Fields + Private _m0 As IM0_NonSmart_AlternatorsSetEfficiency + Private _electricalConsumables As IElectricalConsumerList + Private _alternatorMap As IAlternatorMap + Private _resultCardIdle As IResultCard + Private _resultCardTraction As IResultCard + Private _resultCardOverrun As IResultCard + Private _signals As ISignals + + 'Constructor + Public Sub New(m0 As IM0_NonSmart_AlternatorsSetEfficiency, + electricalConsumables As IElectricalConsumerList, + alternatorMap As IAlternatorMap, + resultCardIdle As IResultCard, + resultCardTraction As IResultCard, + resultCardOverrun As IResultCard, + signals As ISignals) + + 'Sanity Check on supplied arguments, throw an argument exception + If m0 Is Nothing Then Throw New ArgumentException("Module 0 must be supplied") + If electricalConsumables Is Nothing Then _ + Throw New ArgumentException("ElectricalConsumablesList must be supplied even if empty") + If alternatorMap Is Nothing Then Throw New ArgumentException("Must supply a valid alternator map") + If resultCardIdle Is Nothing Then _ + Throw New ArgumentException("Result Card 'IDLE' must be supplied even if it has no contents") + If resultCardTraction Is Nothing Then _ + Throw New ArgumentException("Result Card 'TRACTION' must be supplied even if it has no contents") + If resultCardOverrun Is Nothing Then _ + Throw New ArgumentException("Result Card 'OVERRUN' must be supplied even if it has no contents") + If signals Is Nothing Then Throw New ArgumentException("No Signals Reference object was provided ") + + 'Assignments to private variables. + _m0 = m0 + _electricalConsumables = electricalConsumables + _alternatorMap = alternatorMap + _resultCardIdle = resultCardIdle + _resultCardTraction = resultCardTraction + _resultCardOverrun = resultCardOverrun + _signals = signals + End Sub + + + 'Public Class Outputs (Properties) + Public ReadOnly Property SmartIdleCurrent() As Ampere Implements IM0_5_SmartAlternatorSetEfficiency.SmartIdleCurrent + Get + Dim hvac_Plus_None_Base As Ampere = HvacPlusNonBaseCurrents() + Dim smart_idle_current As Ampere = _resultCardIdle.GetSmartCurrentResult(hvac_Plus_None_Base) + + Return smart_idle_current + End Get + End Property + + Public ReadOnly Property AlternatorsEfficiencyIdleResultCard() As Double _ + Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyIdleResultCard + Get + Return _alternatorMap.GetEfficiency(_signals.EngineSpeed.AsRPM, SmartIdleCurrent()).Efficiency + End Get + End Property + + Public ReadOnly Property SmartTractionCurrent As Ampere _ + Implements IM0_5_SmartAlternatorSetEfficiency.SmartTractionCurrent + Get + Return _resultCardTraction.GetSmartCurrentResult(HvacPlusNonBaseCurrents()) + End Get + End Property + + Public ReadOnly Property AlternatorsEfficiencyTractionOnResultCard() As Double _ + Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyTractionOnResultCard + Get + Return _alternatorMap.GetEfficiency(CType(_signals.EngineSpeed.AsRPM, Single), SmartTractionCurrent()).Efficiency + End Get + End Property + + Public ReadOnly Property SmartOverrunCurrent As Ampere _ + Implements IM0_5_SmartAlternatorSetEfficiency.SmartOverrunCurrent + Get + Return _resultCardOverrun.GetSmartCurrentResult(HvacPlusNonBaseCurrents()) + End Get + End Property + + Public ReadOnly Property AlternatorsEfficiencyOverrunResultCard() As Double _ + Implements IM0_5_SmartAlternatorSetEfficiency.AlternatorsEfficiencyOverrunResultCard + Get + Return _alternatorMap.GetEfficiency(CType(_signals.EngineSpeed.AsRPM, Single), SmartOverrunCurrent()).Efficiency + End Get + End Property + + 'Helpers + ''' <summary> + ''' Returns Non Base Currents (A) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + <ExcludeFromCodeCoverage> + Private Function HvacPlusNonBaseCurrents() As Ampere + 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb + Return _m0.GetHVACElectricalPowerDemandAmps() + _electricalConsumables.GetTotalAverageDemandAmps(True) _ + '/ElectricConstants.StoredEnergyEfficiency) + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb b/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb index 0d24142c6b4ddea2538a8635a823124663f719f8..a57e0abf23f7dab739e9d4cc96f587b15b47ecbf 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/M0_NonSmart_AlternatorsSetEfficiency.vb @@ -1,73 +1,73 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Hvac - -Namespace Electrics - Public Class M0_NonSmart_AlternatorsSetEfficiency - Implements IM0_NonSmart_AlternatorsSetEfficiency - - Private _electricalConsumersList As IElectricalConsumerList - Private _alternatorEfficiencyMap As IAlternatorMap - Private _powernetVoltage As Volt - Private _signals As ISignals - Private _steadyStateModelHVAC As ISSMTOOL - - - Private _ElectricalPowerW As Watt - Private _MechanicalPowerW As Watt - Private _FuelingLPerH As LiterPerSecond - - 'Constructor - Public Sub New(electricalConsumers As IElectricalConsumerList, alternatorEfficiencyMap As IAlternatorMap, - powernetVoltage As Volt, signals As ISignals, ssmHvac As ISSMTOOL) - - If electricalConsumers Is Nothing Then Throw New ArgumentException("No ElectricalConsumersList Supplied") - If alternatorEfficiencyMap Is Nothing Then Throw New ArgumentException("No Alternator Efficiency Map Supplied") - If (powernetVoltage < ElectricConstants.PowenetVoltageMin Or powernetVoltage > ElectricConstants.PowenetVoltageMax) _ - Then Throw New ArgumentException("Powernet Voltage out of range") - If signals Is Nothing Then Throw New ArgumentException("No Signals reference was supplied.") - - Me._electricalConsumersList = electricalConsumers - Me._alternatorEfficiencyMap = alternatorEfficiencyMap - Me._powernetVoltage = powernetVoltage - Me._signals = signals - Me._steadyStateModelHVAC = ssmHvac - - _ElectricalPowerW = ssmHvac.ElectricalWAdjusted.SI(Of Watt)() - _MechanicalPowerW = ssmHvac.MechanicalWBaseAdjusted.SI(Of Watt)() - _FuelingLPerH = ssmHvac.FuelPerHBaseAdjusted.SI(Of LiterPerSecond)() - End Sub - - 'Public class outputs (Properties) - Public ReadOnly Property AlternatorsEfficiency As Double _ - Implements IM0_NonSmart_AlternatorsSetEfficiency.AlternatorsEfficiency - - Get - 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb - Dim baseCurrentDemandAmps As Ampere = _electricalConsumersList.GetTotalAverageDemandAmps(False) _ - ' ElectricConstants.StoredEnergyEfficiency - Dim totalDemandAmps As Ampere = baseCurrentDemandAmps + GetHVACElectricalPowerDemandAmps - Return _alternatorEfficiencyMap.GetEfficiency(_signals.EngineSpeed.AsRPM, totalDemandAmps).Efficiency - End Get - End Property - - Public ReadOnly Property GetHVACElectricalPowerDemandAmps As Ampere _ - Implements IM0_NonSmart_AlternatorsSetEfficiency.GetHVACElectricalPowerDemandAmps - Get - Return _ElectricalPowerW / _powernetVoltage - End Get - End Property - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Hvac + +Namespace Electrics + Public Class M0_NonSmart_AlternatorsSetEfficiency + Implements IM0_NonSmart_AlternatorsSetEfficiency + + Private _electricalConsumersList As IElectricalConsumerList + Private _alternatorEfficiencyMap As IAlternatorMap + Private _powernetVoltage As Volt + Private _signals As ISignals + Private _steadyStateModelHVAC As ISSMTOOL + + + Private _ElectricalPowerW As Watt + Private _MechanicalPowerW As Watt + Private _FuelingLPerH As LiterPerSecond + + 'Constructor + Public Sub New(electricalConsumers As IElectricalConsumerList, alternatorEfficiencyMap As IAlternatorMap, + powernetVoltage As Volt, signals As ISignals, ssmHvac As ISSMTOOL) + + If electricalConsumers Is Nothing Then Throw New ArgumentException("No ElectricalConsumersList Supplied") + If alternatorEfficiencyMap Is Nothing Then Throw New ArgumentException("No Alternator Efficiency Map Supplied") + If (powernetVoltage < ElectricConstants.PowenetVoltageMin Or powernetVoltage > ElectricConstants.PowenetVoltageMax) _ + Then Throw New ArgumentException("Powernet Voltage out of range") + If signals Is Nothing Then Throw New ArgumentException("No Signals reference was supplied.") + + Me._electricalConsumersList = electricalConsumers + Me._alternatorEfficiencyMap = alternatorEfficiencyMap + Me._powernetVoltage = powernetVoltage + Me._signals = signals + Me._steadyStateModelHVAC = ssmHvac + + _ElectricalPowerW = ssmHvac.ElectricalWAdjusted.SI(Of Watt)() + _MechanicalPowerW = ssmHvac.MechanicalWBaseAdjusted.SI(Of Watt)() + _FuelingLPerH = ssmHvac.FuelPerHBaseAdjusted.SI(Of LiterPerSecond)() + End Sub + + 'Public class outputs (Properties) + Public ReadOnly Property AlternatorsEfficiency As Double _ + Implements IM0_NonSmart_AlternatorsSetEfficiency.AlternatorsEfficiency + + Get + 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb + Dim baseCurrentDemandAmps As Ampere = _electricalConsumersList.GetTotalAverageDemandAmps(False) _ + ' ElectricConstants.StoredEnergyEfficiency + Dim totalDemandAmps As Ampere = baseCurrentDemandAmps + GetHVACElectricalPowerDemandAmps + Return _alternatorEfficiencyMap.GetEfficiency(_signals.EngineSpeed.AsRPM, totalDemandAmps).Efficiency + End Get + End Property + + Public ReadOnly Property GetHVACElectricalPowerDemandAmps As Ampere _ + Implements IM0_NonSmart_AlternatorsSetEfficiency.GetHVACElectricalPowerDemandAmps + Get + Return _ElectricalPowerW / _powernetVoltage + End Get + End Property + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb index bba981a94fdaca70a17025a94f7416febc43bda7..956eda52d38efe9180f3ff3053e18f88d7ee4f43 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/M2_AverageElectricalLoadDemand.vb @@ -1,69 +1,69 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class M2_AverageElectricalLoadDemand - Implements IM2_AverageElectricalLoadDemand - - Public _powerNetVoltage As Volt = 26.3.SI(Of Volt)() - Private _electricalConsumers As IElectricalConsumerList - Private _module0 As IM0_NonSmart_AlternatorsSetEfficiency - Private _alternatorPulleyEffiency As Double - Private _signals As Signals - - - 'Constructor - Public Sub New(ByVal electricalConsumers As IElectricalConsumerList, m0 As IM0_NonSmart_AlternatorsSetEfficiency, - altPulleyEfficiency As Double, powerNetVoltage As Volt, signals As ISignals) - - If electricalConsumers Is Nothing Then Throw New ArgumentException("Electrical Consumer List must be supplied") - If m0 Is Nothing Then Throw New ArgumentException("Must supply module 0") - If altPulleyEfficiency = 0 OrElse altPulleyEfficiency > 1 Then _ - Throw New ArgumentException("Alternator Gear efficiency out of range.") - If powerNetVoltage < ElectricConstants.PowenetVoltageMin OrElse powerNetVoltage > ElectricConstants.PowenetVoltageMax _ - Then - Throw New ArgumentException("Powernet Voltage out of known range.") - End If - - - _powerNetVoltage = powerNetVoltage - _electricalConsumers = electricalConsumers - _module0 = m0 - _alternatorPulleyEffiency = altPulleyEfficiency - End Sub - - 'Public class outputs (Properties) - Public Function GetAveragePowerDemandAtAlternator() As Watt _ - Implements IM2_AverageElectricalLoadDemand.GetAveragePowerDemandAtAlternator - - 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb - 'Return ( _electricalConsumers.GetTotalAverageDemandAmps(False)/ElectricConstants.StoredEnergyEfficiency) * _powerNetVoltage - Return _powerNetVoltage * _electricalConsumers.GetTotalAverageDemandAmps(False) - End Function - - Public Function GetAveragePowerAtCrankFromElectrics() As Watt _ - Implements IM2_AverageElectricalLoadDemand.GetAveragePowerAtCrankFromElectrics - - Dim ElectricalPowerDemandsWatts As Watt = GetAveragePowerDemandAtAlternator() - Dim alternatorsEfficiency As Double = _module0.AlternatorsEfficiency - Dim ElectricalPowerDemandsWattsDividedByAlternatorEfficiency As Watt = ElectricalPowerDemandsWatts * (1 / - alternatorsEfficiency) - - Dim averagePowerDemandAtCrankFromElectricsWatts As Watt - - averagePowerDemandAtCrankFromElectricsWatts = ElectricalPowerDemandsWattsDividedByAlternatorEfficiency * (1 / - _alternatorPulleyEffiency) - - Return averagePowerDemandAtCrankFromElectricsWatts - End Function - End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Class M2_AverageElectricalLoadDemand + Implements IM2_AverageElectricalLoadDemand + + Public _powerNetVoltage As Volt = 26.3.SI(Of Volt)() + Private _electricalConsumers As IElectricalConsumerList + Private _module0 As IM0_NonSmart_AlternatorsSetEfficiency + Private _alternatorPulleyEffiency As Double + Private _signals As Signals + + + 'Constructor + Public Sub New(ByVal electricalConsumers As IElectricalConsumerList, m0 As IM0_NonSmart_AlternatorsSetEfficiency, + altPulleyEfficiency As Double, powerNetVoltage As Volt, signals As ISignals) + + If electricalConsumers Is Nothing Then Throw New ArgumentException("Electrical Consumer List must be supplied") + If m0 Is Nothing Then Throw New ArgumentException("Must supply module 0") + If altPulleyEfficiency = 0 OrElse altPulleyEfficiency > 1 Then _ + Throw New ArgumentException("Alternator Gear efficiency out of range.") + If powerNetVoltage < ElectricConstants.PowenetVoltageMin OrElse powerNetVoltage > ElectricConstants.PowenetVoltageMax _ + Then + Throw New ArgumentException("Powernet Voltage out of known range.") + End If + + + _powerNetVoltage = powerNetVoltage + _electricalConsumers = electricalConsumers + _module0 = m0 + _alternatorPulleyEffiency = altPulleyEfficiency + End Sub + + 'Public class outputs (Properties) + Public Function GetAveragePowerDemandAtAlternator() As Watt _ + Implements IM2_AverageElectricalLoadDemand.GetAveragePowerDemandAtAlternator + + 'Stored Energy Efficience removed from V8.0 21/4/15 by Mike Preston //tb + 'Return ( _electricalConsumers.GetTotalAverageDemandAmps(False)/ElectricConstants.StoredEnergyEfficiency) * _powerNetVoltage + Return _powerNetVoltage * _electricalConsumers.GetTotalAverageDemandAmps(False) + End Function + + Public Function GetAveragePowerAtCrankFromElectrics() As Watt _ + Implements IM2_AverageElectricalLoadDemand.GetAveragePowerAtCrankFromElectrics + + Dim ElectricalPowerDemandsWatts As Watt = GetAveragePowerDemandAtAlternator() + Dim alternatorsEfficiency As Double = _module0.AlternatorsEfficiency + Dim ElectricalPowerDemandsWattsDividedByAlternatorEfficiency As Watt = ElectricalPowerDemandsWatts * (1 / + alternatorsEfficiency) + + Dim averagePowerDemandAtCrankFromElectricsWatts As Watt + + averagePowerDemandAtCrankFromElectricsWatts = ElectricalPowerDemandsWattsDividedByAlternatorEfficiency * (1 / + _alternatorPulleyEffiency) + + Return averagePowerDemandAtCrankFromElectricsWatts + End Function + End Class End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb b/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb index 5d8643347cb248b3f524a7dc4da6d7c8f2b4b2d7..c2535205c05c7e7859be31113d3ae6d20fee150c 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/M5__SmartAlternatorSetGeneration.vb @@ -1,65 +1,65 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Electrics - Public Class M5__SmartAlternatorSetGeneration - Implements IM5_SmartAlternatorSetGeneration - - Private _powerNetVoltage As Volt - Private _m05 As M0_5_SmartAlternatorSetEfficiency - Private _alternatorGearEfficiency As Double - - 'Constructor - Public Sub New(m05 As M0_5_SmartAlternatorSetEfficiency, ByVal powernetVoltage As Volt, - alternatorGearEfficiency As Double) - - 'sanity check - If m05 Is Nothing Then Throw New ArgumentException("Please supply a valid module M05") - If powernetVoltage < ElectricConstants.PowenetVoltageMin OrElse powernetVoltage > ElectricConstants.PowenetVoltageMax _ - Then Throw New ArgumentException("Powernet Voltage out of range") - If alternatorGearEfficiency < 0 Or alternatorGearEfficiency > 1 Then _ - Throw New ArgumentException("AlternatorGearEfficiency Out of bounds, should be 0 to 1") - - 'assign private variables. - _m05 = m05 - _powerNetVoltage = powernetVoltage - _alternatorGearEfficiency = alternatorGearEfficiency - End Sub - - 'Public class outputs (Functions) - Public Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt _ - Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankIdleWatts - - Return _ - (_m05.SmartIdleCurrent() * _powerNetVoltage) * - (1 / (_m05.AlternatorsEfficiencyIdleResultCard() * _alternatorGearEfficiency)) - End Function - - Public Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt _ - Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankOverrunWatts - - Return _ - (_m05.SmartOverrunCurrent() * _powerNetVoltage) * (1 / - (_m05.AlternatorsEfficiencyOverrunResultCard() * _alternatorGearEfficiency)) - End Function - - Public Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt _ - Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankTractionOnWatts - - Return _ - (_m05.SmartTractionCurrent() * _powerNetVoltage) * (1 / - (_m05.AlternatorsEfficiencyTractionOnResultCard() * _alternatorGearEfficiency)) - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Electrics + Public Class M5__SmartAlternatorSetGeneration + Implements IM5_SmartAlternatorSetGeneration + + Private _powerNetVoltage As Volt + Private _m05 As M0_5_SmartAlternatorSetEfficiency + Private _alternatorGearEfficiency As Double + + 'Constructor + Public Sub New(m05 As M0_5_SmartAlternatorSetEfficiency, ByVal powernetVoltage As Volt, + alternatorGearEfficiency As Double) + + 'sanity check + If m05 Is Nothing Then Throw New ArgumentException("Please supply a valid module M05") + If powernetVoltage < ElectricConstants.PowenetVoltageMin OrElse powernetVoltage > ElectricConstants.PowenetVoltageMax _ + Then Throw New ArgumentException("Powernet Voltage out of range") + If alternatorGearEfficiency < 0 Or alternatorGearEfficiency > 1 Then _ + Throw New ArgumentException("AlternatorGearEfficiency Out of bounds, should be 0 to 1") + + 'assign private variables. + _m05 = m05 + _powerNetVoltage = powernetVoltage + _alternatorGearEfficiency = alternatorGearEfficiency + End Sub + + 'Public class outputs (Functions) + Public Function AlternatorsGenerationPowerAtCrankIdleWatts() As Watt _ + Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankIdleWatts + + Return _ + (_m05.SmartIdleCurrent() * _powerNetVoltage) * + (1 / (_m05.AlternatorsEfficiencyIdleResultCard() * _alternatorGearEfficiency)) + End Function + + Public Function AlternatorsGenerationPowerAtCrankOverrunWatts() As Watt _ + Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankOverrunWatts + + Return _ + (_m05.SmartOverrunCurrent() * _powerNetVoltage) * (1 / + (_m05.AlternatorsEfficiencyOverrunResultCard() * _alternatorGearEfficiency)) + End Function + + Public Function AlternatorsGenerationPowerAtCrankTractionOnWatts() As Watt _ + Implements IM5_SmartAlternatorSetGeneration.AlternatorsGenerationPowerAtCrankTractionOnWatts + + Return _ + (_m05.SmartTractionCurrent() * _powerNetVoltage) * (1 / + (_m05.AlternatorsEfficiencyTractionOnResultCard() * _alternatorGearEfficiency)) + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb b/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb index 22b56c545fa5484a5a78c1e8321a8f4a3b62af35..c6a0d60ed92d2cc9abf7ad7111360c38b5533b82 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/ResultCard.vb @@ -1,143 +1,143 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics - -Namespace Electrics - Public Class ResultCard - Implements IResultCard - - Private _results As List(Of SmartResult) - - 'Constructor - Public Sub New(results As List(Of SmartResult)) - - If results Is Nothing Then Throw New ArgumentException("A list of smart results must be supplied.") - - _results = results - End Sub - - - 'Public class outputs - Public ReadOnly Property Results As List(Of SmartResult) Implements IResultCard.Results - Get - Return _results - End Get - End Property - - Public Function GetSmartCurrentResult(ByVal Amps As Ampere) As Ampere Implements IResultCard.GetSmartCurrentResult - - - If _results.Count < 2 Then Return 10.SI(Of Ampere)() - - Return GetOrInterpolate(Amps.Value()).SI(Of Ampere)() - End Function - - - 'Helpers - ''' <summary> - ''' Gets or interpolates value (A) - ''' </summary> - ''' <param name="amps"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Private Function GetOrInterpolate(amps As Double) As Double - - Dim pre As Double - Dim post As Double - Dim dAmps As Double - Dim dSmartAmps As Double - Dim smartAmpsSlope As Double - Dim smartAmps As Double - Dim maxKey As Double - Dim minKey As Double - - maxKey = _results.Max.Amps - minKey = _results.Min.Amps - - Dim compareKey As SmartResult = New SmartResult(amps, 0) - - 'Is on boundary check - If _results.Contains(compareKey) Then _ - Return _results.OrderBy(Function(x) x.Amps).First(Function(x) x.Amps = compareKey.Amps).SmartAmps - - 'Is over map - Extrapolate - If amps > maxKey Then - - 'get the entries before and after the supplied key - pre = (From a In _results Order By a.Amps Where a.Amps < maxKey Select a).Last().Amps - post = maxKey - - 'get the delta values - dAmps = post - pre - dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps - - 'calculate the slopes - smartAmpsSlope = dSmartAmps / dAmps - - 'calculate the new values - smartAmps = ((amps - post) * smartAmpsSlope) + - (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - Return smartAmps - - End If - - 'Is under map - Extrapolate - If amps < minKey Then - - 'get the entries before and after the supplied key - 'Post is the first entry and pre is the penultimate to first entry - post = minKey - pre = (From k In _results Order By k.Amps Where k.Amps > minKey Select k).First().Amps - - 'get the delta values - dAmps = post - pre - dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps - - 'calculate the slopes - smartAmpsSlope = dSmartAmps / dAmps - - 'calculate the new values - smartAmps = ((amps - post) * smartAmpsSlope) + - (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - Return smartAmps - End If - - 'Is Inside map - Interpolate - - 'get the entries before and after the supplied rpm - pre = (From m In _results Order By m.Amps Where m.Amps < amps Select m).Last().Amps - post = (From m In _results Where m.Amps > amps Select m).First().Amps - - 'get the delta values for rpm and the map values - dAmps = post - pre - dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps - - 'calculate the slopes - smartAmpsSlope = dSmartAmps / dAmps - - 'calculate the new values - smartAmps = ((amps - post) * smartAmpsSlope) + - (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - - - Return smartAmps - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics + +Namespace Electrics + Public Class ResultCard + Implements IResultCard + + Private _results As List(Of SmartResult) + + 'Constructor + Public Sub New(results As List(Of SmartResult)) + + If results Is Nothing Then Throw New ArgumentException("A list of smart results must be supplied.") + + _results = results + End Sub + + + 'Public class outputs + Public ReadOnly Property Results As List(Of SmartResult) Implements IResultCard.Results + Get + Return _results + End Get + End Property + + Public Function GetSmartCurrentResult(ByVal Amps As Ampere) As Ampere Implements IResultCard.GetSmartCurrentResult + + + If _results.Count < 2 Then Return 10.SI(Of Ampere)() + + Return GetOrInterpolate(Amps.Value()).SI(Of Ampere)() + End Function + + + 'Helpers + ''' <summary> + ''' Gets or interpolates value (A) + ''' </summary> + ''' <param name="amps"></param> + ''' <returns></returns> + ''' <remarks></remarks> + Private Function GetOrInterpolate(amps As Double) As Double + + Dim pre As Double + Dim post As Double + Dim dAmps As Double + Dim dSmartAmps As Double + Dim smartAmpsSlope As Double + Dim smartAmps As Double + Dim maxKey As Double + Dim minKey As Double + + maxKey = _results.Max.Amps + minKey = _results.Min.Amps + + Dim compareKey As SmartResult = New SmartResult(amps, 0) + + 'Is on boundary check + If _results.Contains(compareKey) Then _ + Return _results.OrderBy(Function(x) x.Amps).First(Function(x) x.Amps = compareKey.Amps).SmartAmps + + 'Is over map - Extrapolate + If amps > maxKey Then + + 'get the entries before and after the supplied key + pre = (From a In _results Order By a.Amps Where a.Amps < maxKey Select a).Last().Amps + post = maxKey + + 'get the delta values + dAmps = post - pre + dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - + (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps + + 'calculate the slopes + smartAmpsSlope = dSmartAmps / dAmps + + 'calculate the new values + smartAmps = ((amps - post) * smartAmpsSlope) + + (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps + + Return smartAmps + + End If + + 'Is under map - Extrapolate + If amps < minKey Then + + 'get the entries before and after the supplied key + 'Post is the first entry and pre is the penultimate to first entry + post = minKey + pre = (From k In _results Order By k.Amps Where k.Amps > minKey Select k).First().Amps + + 'get the delta values + dAmps = post - pre + dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - + (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps + + 'calculate the slopes + smartAmpsSlope = dSmartAmps / dAmps + + 'calculate the new values + smartAmps = ((amps - post) * smartAmpsSlope) + + (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps + + Return smartAmps + End If + + 'Is Inside map - Interpolate + + 'get the entries before and after the supplied rpm + pre = (From m In _results Order By m.Amps Where m.Amps < amps Select m).Last().Amps + post = (From m In _results Where m.Amps > amps Select m).First().Amps + + 'get the delta values for rpm and the map values + dAmps = post - pre + dSmartAmps = (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps - + (From da In _results Order By da.Amps Where da.Amps = pre).First().SmartAmps + + 'calculate the slopes + smartAmpsSlope = dSmartAmps / dAmps + + 'calculate the new values + smartAmps = ((amps - post) * smartAmpsSlope) + + (From da In _results Order By da.Amps Where da.Amps = post).First().SmartAmps + + + Return smartAmps + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb b/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb index 8e3bd4e4565b14b22a690a1afa73f60cc3585257..ff17f3651cccb6a03a254f1f8a115c59b568cdd7 100644 --- a/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb +++ b/VECTOAux/VectoAuxiliaries/Electrics/SmartResult.vb @@ -1,53 +1,53 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Electrics - Public Class SmartResult - Implements IComparable(Of SmartResult) - - Public Property Amps As Double - Public Property SmartAmps As Double - - 'Constructors - Public Sub new() - 'An empty constructor is requried. Do not remove. - End Sub - - Public Sub New(amps As Double, smartAmps As Double) - - Me.Amps = amps - Me.SmartAmps = smartAmps - End Sub - - 'Comparison - Public Function CompareTo(other As SmartResult) As Integer Implements IComparable(Of SmartResult).CompareTo - - If other.Amps > Me.Amps then return - 1 - If other.Amps = Me.Amps then Return 0 - - Return 1 - End Function - - 'Comparison Overrides - Public Overrides Function Equals(obj As Object) As Boolean - - Dim other as SmartResult = Ctype(Obj, SmartResult) - - Return Me.Amps = other.Amps - End Function - - Public Overrides Function GetHashCode() As Integer - Return 0 - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Electrics + Public Class SmartResult + Implements IComparable(Of SmartResult) + + Public Property Amps As Double + Public Property SmartAmps As Double + + 'Constructors + Public Sub new() + 'An empty constructor is requried. Do not remove. + End Sub + + Public Sub New(amps As Double, smartAmps As Double) + + Me.Amps = amps + Me.SmartAmps = smartAmps + End Sub + + 'Comparison + Public Function CompareTo(other As SmartResult) As Integer Implements IComparable(Of SmartResult).CompareTo + + If other.Amps > Me.Amps then return - 1 + If other.Amps = Me.Amps then Return 0 + + Return 1 + End Function + + 'Comparison Overrides + Public Overrides Function Equals(obj As Object) As Boolean + + Dim other as SmartResult = Ctype(Obj, SmartResult) + + Return Me.Amps = other.Amps + End Function + + Public Overrides Function GetHashCode() As Integer + Return 0 + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/FilePathUtils.vb b/VECTOAux/VectoAuxiliaries/FilePathUtils.vb index 7fa77028360df16d5386e379722335f088cd70fe..8b5033244c6ea8ed5a7874bd708d6d8d771dcdb6 100644 --- a/VECTOAux/VectoAuxiliaries/FilePathUtils.vb +++ b/VECTOAux/VectoAuxiliaries/FilePathUtils.vb @@ -1,144 +1,144 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.IO - -Public Class FilePathUtils - Public Shared Function ValidateFilePath(ByVal filePath As String, ByVal expectedExtension As String, - ByRef message As String) As Boolean - - - Dim illegalFileNameCharacters As Char() = {"<"c, ">"c, ":"c, """"c, "/"c, "\"c, "|"c, "?"c, "*"c, "~"c} - Dim detectedExtention As String = fileExtentionOnly(filePath) - Dim pathOnly As String = filePathOnly(filePath) - Dim fileNameOnlyWithExtension As String = fileNameOnly(filePath, True) - Dim fileNameOnlyNoExtension As String = fileNameOnly(filePath, False) - - 'Is this filePath empty - If filePath.Trim.Length = 0 OrElse Right(filePath, 1) = "\" Then - message = "A filename cannot be empty" - Return False - End If - - - 'Extension Expected, but not match - If expectedExtension.Trim.Length > 0 Then - If String.Compare(expectedExtension, detectedExtention, True) <> 0 Then - message = String.Format("The file extension type does not match the expected type of {0}", expectedExtension) - Return False - End If - End If - - 'Extension Not Expected, but was supplied - If expectedExtension.Trim.Length > 0 Then - If detectedExtention.Length = 0 Then - message = String.Format("No Extension was supplied, but an extension of {0}, this is not required", - detectedExtention) - Return False - End If - End If - - - 'Illegal characters - If Not fileNameLegal(fileNameOnlyWithExtension) Then - message = String.Format("The filenames have one or more illegal characters") - Return False - End If - - - message = "OK" - Return True - End Function - - - Public Shared Function fileNameLegal(fileName As String) As Boolean - - Dim illegalFileNameCharacters As Char() = {"<"c, ">"c, ":"c, """"c, "/"c, "\"c, "|"c, "?"c, "*"c, "~"c} - - - 'Illegal characters - For Each ch As Char In illegalFileNameCharacters - - If fileName.Contains(ch) Then - - Return False - - End If - Next - Return True - End Function - - - Public Shared Function ResolveFilePath(vectoPath As String, filename As String) As String - - 'No Vecto Path supplied - If vectoPath = "" Then Return filename - - 'This is not relative - If filename.Contains(":\") Then - - 'Filepath is already absolute - Return filename - Else - Return Path.Combine(vectoPath, filename) 'vectoPath & filename - End If - End Function - - - ''' <summary> - ''' File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="WithExtention"></param> - ''' <returns>Return file portion of the path, with or without the extension</returns> - ''' <remarks></remarks> - Public Shared Function fileNameOnly(ByVal filePath As String, ByVal WithExtention As Boolean) As String - Dim x As Integer - x = filePath.LastIndexOf("\") + 1 - filePath = Microsoft.VisualBasic.Right(filePath, Microsoft.VisualBasic.Len(filePath) - x) - If Not WithExtention Then - x = filePath.LastIndexOf(".") - If x > 0 Then filePath = Microsoft.VisualBasic.Left(filePath, x) - End If - Return filePath - End Function - - - ''' <summary> - ''' Extension alone "C:\temp\TEST.txt" >> ".txt" - ''' </summary> - ''' <param name="filePath"></param> - ''' <returns>Extension alone Including the dot IE .EXT</returns> - ''' <remarks></remarks> - Public Shared Function fileExtentionOnly(ByVal filePath As String) As String - Dim x As Integer - x = filePath.LastIndexOf(".") - If x = -1 Then - Return "" - Else - Return Microsoft.VisualBasic.Right(filePath, Microsoft.VisualBasic.Len(filePath) - x) - End If - End Function - - ''' <summary> - ''' File Path alone "C:\temp\TEST.txt" >> "C:\temp\" - ''' "TEST.txt" >> "" - ''' </summary> - ''' <param name="filePath"></param> - ''' <returns>Filepath without the extension</returns> - ''' <remarks></remarks> - Public Shared Function filePathOnly(ByVal filePath As String) As String - Dim x As Integer - If filePath Is Nothing OrElse filePath.Length < 3 OrElse filePath.Substring(1, 2) <> ":\" Then Return "" - x = filePath.LastIndexOf("\") - Return Microsoft.VisualBasic.Left(filePath, x + 1) - End Function -End Class - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.IO + +Public Class FilePathUtils + Public Shared Function ValidateFilePath(ByVal filePath As String, ByVal expectedExtension As String, + ByRef message As String) As Boolean + + + Dim illegalFileNameCharacters As Char() = {"<"c, ">"c, ":"c, """"c, "/"c, "\"c, "|"c, "?"c, "*"c, "~"c} + Dim detectedExtention As String = fileExtentionOnly(filePath) + Dim pathOnly As String = filePathOnly(filePath) + Dim fileNameOnlyWithExtension As String = fileNameOnly(filePath, True) + Dim fileNameOnlyNoExtension As String = fileNameOnly(filePath, False) + + 'Is this filePath empty + If filePath.Trim.Length = 0 OrElse Right(filePath, 1) = "\" Then + message = "A filename cannot be empty" + Return False + End If + + + 'Extension Expected, but not match + If expectedExtension.Trim.Length > 0 Then + If String.Compare(expectedExtension, detectedExtention, True) <> 0 Then + message = String.Format("The file extension type does not match the expected type of {0}", expectedExtension) + Return False + End If + End If + + 'Extension Not Expected, but was supplied + If expectedExtension.Trim.Length > 0 Then + If detectedExtention.Length = 0 Then + message = String.Format("No Extension was supplied, but an extension of {0}, this is not required", + detectedExtention) + Return False + End If + End If + + + 'Illegal characters + If Not fileNameLegal(fileNameOnlyWithExtension) Then + message = String.Format("The filenames have one or more illegal characters") + Return False + End If + + + message = "OK" + Return True + End Function + + + Public Shared Function fileNameLegal(fileName As String) As Boolean + + Dim illegalFileNameCharacters As Char() = {"<"c, ">"c, ":"c, """"c, "/"c, "\"c, "|"c, "?"c, "*"c, "~"c} + + + 'Illegal characters + For Each ch As Char In illegalFileNameCharacters + + If fileName.Contains(ch) Then + + Return False + + End If + Next + Return True + End Function + + + Public Shared Function ResolveFilePath(vectoPath As String, filename As String) As String + + 'No Vecto Path supplied + If vectoPath = "" Then Return filename + + 'This is not relative + If filename.Contains(":\") Then + + 'Filepath is already absolute + Return filename + Else + Return Path.Combine(vectoPath, filename) 'vectoPath & filename + End If + End Function + + + ''' <summary> + ''' File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" + ''' </summary> + ''' <param name="filePath"></param> + ''' <param name="WithExtention"></param> + ''' <returns>Return file portion of the path, with or without the extension</returns> + ''' <remarks></remarks> + Public Shared Function fileNameOnly(ByVal filePath As String, ByVal WithExtention As Boolean) As String + Dim x As Integer + x = filePath.LastIndexOf("\") + 1 + filePath = Microsoft.VisualBasic.Right(filePath, Microsoft.VisualBasic.Len(filePath) - x) + If Not WithExtention Then + x = filePath.LastIndexOf(".") + If x > 0 Then filePath = Microsoft.VisualBasic.Left(filePath, x) + End If + Return filePath + End Function + + + ''' <summary> + ''' Extension alone "C:\temp\TEST.txt" >> ".txt" + ''' </summary> + ''' <param name="filePath"></param> + ''' <returns>Extension alone Including the dot IE .EXT</returns> + ''' <remarks></remarks> + Public Shared Function fileExtentionOnly(ByVal filePath As String) As String + Dim x As Integer + x = filePath.LastIndexOf(".") + If x = -1 Then + Return "" + Else + Return Microsoft.VisualBasic.Right(filePath, Microsoft.VisualBasic.Len(filePath) - x) + End If + End Function + + ''' <summary> + ''' File Path alone "C:\temp\TEST.txt" >> "C:\temp\" + ''' "TEST.txt" >> "" + ''' </summary> + ''' <param name="filePath"></param> + ''' <returns>Filepath without the extension</returns> + ''' <remarks></remarks> + Public Shared Function filePathOnly(ByVal filePath As String) As String + Dim x As Integer + If filePath Is Nothing OrElse filePath.Length < 3 OrElse filePath.Substring(1, 2) <> ":\" Then Return "" + x = filePath.LastIndexOf("\") + Return Microsoft.VisualBasic.Left(filePath, x + 1) + End Function +End Class + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb index 51fb2270763d201c5f004ef8b4a9c37098c1258e..80b77d30013afd2158d7dd874d9793a05b42e0bb 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACConstants.vb @@ -1,53 +1,53 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports Newtonsoft.Json -Imports TUGraz.VectoCommon.Utils - -Namespace Hvac - Public Class HVACConstants - Implements IHVACConstants - - <JsonProperty("FuelDensity")> ReadOnly _fuelDensity As Double - <JsonProperty("DieselGCVJperGram")> ReadOnly _dieselGcvJperGram As Double = 44800 - - Public Sub New() - _fuelDensity = 835 '.SI(Of KilogramPerCubicMeter)() - End Sub - - Public Sub New(fuelDensitySingle As KilogramPerCubicMeter) - _fuelDensity = fuelDensitySingle.Value() - End Sub - - - <JsonIgnore> - Public ReadOnly Property DieselGCVJperGram As JoulePerKilogramm Implements IHVACConstants.DieselGCVJperGram - Get - Return _dieselGcvJperGram.SI().Joule.Per.Gramm.Cast(Of JoulePerKilogramm)() - End Get - End Property - - <JsonIgnore()> - Public ReadOnly Property FuelDensity As KilogramPerCubicMeter Implements IHVACConstants.FuelDensity - Get - Return _fuelDensity.SI(Of KilogramPerCubicMeter)() - End Get - End Property - - <JsonIgnore()> - Public ReadOnly Property FuelDensityAsGramPerLiter As Double Implements IHVACConstants.FuelDensityAsGramPerLiter - Get - Return _fuelDensity * 1000 - End Get - End Property - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports Newtonsoft.Json +Imports TUGraz.VectoCommon.Utils + +Namespace Hvac + Public Class HVACConstants + Implements IHVACConstants + + <JsonProperty("FuelDensity")> ReadOnly _fuelDensity As Double + <JsonProperty("DieselGCVJperGram")> ReadOnly _dieselGcvJperGram As Double = 44800 + + Public Sub New() + _fuelDensity = 835 '.SI(Of KilogramPerCubicMeter)() + End Sub + + Public Sub New(fuelDensitySingle As KilogramPerCubicMeter) + _fuelDensity = fuelDensitySingle.Value() + End Sub + + + <JsonIgnore> + Public ReadOnly Property DieselGCVJperGram As JoulePerKilogramm Implements IHVACConstants.DieselGCVJperGram + Get + Return _dieselGcvJperGram.SI().Joule.Per.Gramm.Cast(Of JoulePerKilogramm)() + End Get + End Property + + <JsonIgnore()> + Public ReadOnly Property FuelDensity As KilogramPerCubicMeter Implements IHVACConstants.FuelDensity + Get + Return _fuelDensity.SI(Of KilogramPerCubicMeter)() + End Get + End Property + + <JsonIgnore()> + Public ReadOnly Property FuelDensityAsGramPerLiter As Double Implements IHVACConstants.FuelDensityAsGramPerLiter + Get + Return _fuelDensity * 1000 + End Get + End Property + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb index 241fe5a563c426e2603e5269d171be40f922f9ce..fe840ffd87027d89646c98b9178957cc78bd5eb0 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACSteadyStateModel.vb @@ -1,112 +1,112 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.IO - -Namespace Hvac - Public Class HVACSteadyStateModel - Implements IHVACSteadyStateModel - - Public Property HVACElectricalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACElectricalLoadPowerWatts - Public Property HVACFuellingLitresPerHour As Single Implements IHVACSteadyStateModel.HVACFuellingLitresPerHour - Public Property HVACMechanicalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACMechanicalLoadPowerWatts - - 'Constructors - Public Sub New() - End Sub - - Public Sub New(elecPowerW As Single, mechPowerW As Single, fuellingLPH As Single) - - HVACElectricalLoadPowerWatts = elecPowerW - HVACFuellingLitresPerHour = mechPowerW - HVACMechanicalLoadPowerWatts = fuellingLPH - End Sub - - 'Implementation - Public Function SetValuesFromMap(ByVal filePath As String, byref message As String) As Boolean _ - Implements IHVACSteadyStateModel.SetValuesFromMap - - - Dim myData As String - Dim linesArray As String() - - - 'Check map file can be found. - Try - myData = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8) - Catch ex As FileNotFoundException - - message = "HVAC Steady State Model : The map file was not found" - Return false - End Try - - - linesArray = (From s As String In myData.Split(CType(vbLf, Char)) Select s.Trim).ToArray - - 'Check count is at least 2 rows - If linesArray.Count < 2 then - message = "HVAC Steady State Model : Insufficient Lines in this File" - Return False - End If - - 'validate headers - Dim headers As String() = linesArray(0).Split(","c) - If headers.Count <> 3 OrElse - headers(0).Trim <> "[Electrical Power (w)]" OrElse - headers(1).Trim <> "[Mechanical Power (w)]" OrElse - headers(2).Trim <> "[Fuelling (L/H)]" Then - message = "HVAC Steady State Model : Column headers in *.AHSM file being read are incompatable." - Return False - - End If - - 'validate values - Dim values As String() = linesArray(1).Split(","c) - If headers.Count <> 3 OrElse - NOT IsNumeric(values(0)) OrElse - NOT IsNumeric(values(1)) OrElse - Not IsNumeric(values(2)) - message = "Steady State Model : Unable to confirm numeric values in the *.AHSM file being read." - Return False - End If - - 'OK we have the values so lets set the properties - Dim out1, out2, out3 As single - out1 = HVACElectricalLoadPowerWatts - out2 = HVACMechanicalLoadPowerWatts - out3 = HVACFuellingLitresPerHour - try - - HVACElectricalLoadPowerWatts = Single.Parse(values(0)) - HVACMechanicalLoadPowerWatts = Single.Parse(values(1)) - HVACFuellingLitresPerHour = Single.Parse(values(2)) - - Catch ex As Exception - - 'Restore in the event of failure to fully assign - HVACElectricalLoadPowerWatts = out1 - HVACMechanicalLoadPowerWatts = out2 - HVACFuellingLitresPerHour = out3 - - 'Return result - message = - "Steady State Model : Unable to parse the values in the *.AHSM file being read no values were harmed in reading of this file." - Return False - - End Try - - - Return True - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.IO + +Namespace Hvac + Public Class HVACSteadyStateModel + Implements IHVACSteadyStateModel + + Public Property HVACElectricalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACElectricalLoadPowerWatts + Public Property HVACFuellingLitresPerHour As Single Implements IHVACSteadyStateModel.HVACFuellingLitresPerHour + Public Property HVACMechanicalLoadPowerWatts As Single Implements IHVACSteadyStateModel.HVACMechanicalLoadPowerWatts + + 'Constructors + Public Sub New() + End Sub + + Public Sub New(elecPowerW As Single, mechPowerW As Single, fuellingLPH As Single) + + HVACElectricalLoadPowerWatts = elecPowerW + HVACFuellingLitresPerHour = mechPowerW + HVACMechanicalLoadPowerWatts = fuellingLPH + End Sub + + 'Implementation + Public Function SetValuesFromMap(ByVal filePath As String, byref message As String) As Boolean _ + Implements IHVACSteadyStateModel.SetValuesFromMap + + + Dim myData As String + Dim linesArray As String() + + + 'Check map file can be found. + Try + myData = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8) + Catch ex As FileNotFoundException + + message = "HVAC Steady State Model : The map file was not found" + Return false + End Try + + + linesArray = (From s As String In myData.Split(CType(vbLf, Char)) Select s.Trim).ToArray + + 'Check count is at least 2 rows + If linesArray.Count < 2 then + message = "HVAC Steady State Model : Insufficient Lines in this File" + Return False + End If + + 'validate headers + Dim headers As String() = linesArray(0).Split(","c) + If headers.Count <> 3 OrElse + headers(0).Trim <> "[Electrical Power (w)]" OrElse + headers(1).Trim <> "[Mechanical Power (w)]" OrElse + headers(2).Trim <> "[Fuelling (L/H)]" Then + message = "HVAC Steady State Model : Column headers in *.AHSM file being read are incompatable." + Return False + + End If + + 'validate values + Dim values As String() = linesArray(1).Split(","c) + If headers.Count <> 3 OrElse + NOT IsNumeric(values(0)) OrElse + NOT IsNumeric(values(1)) OrElse + Not IsNumeric(values(2)) + message = "Steady State Model : Unable to confirm numeric values in the *.AHSM file being read." + Return False + End If + + 'OK we have the values so lets set the properties + Dim out1, out2, out3 As single + out1 = HVACElectricalLoadPowerWatts + out2 = HVACMechanicalLoadPowerWatts + out3 = HVACFuellingLitresPerHour + try + + HVACElectricalLoadPowerWatts = Single.Parse(values(0)) + HVACMechanicalLoadPowerWatts = Single.Parse(values(1)) + HVACFuellingLitresPerHour = Single.Parse(values(2)) + + Catch ex As Exception + + 'Restore in the event of failure to fully assign + HVACElectricalLoadPowerWatts = out1 + HVACMechanicalLoadPowerWatts = out2 + HVACFuellingLitresPerHour = out3 + + 'Return result + message = + "Steady State Model : Unable to parse the values in the *.AHSM file being read no values were harmed in reading of this file." + Return False + + End Try + + + Return True + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb index cbc00b08341b333bcc064503f60d3fa3a859190c..3a806dcd8ab247c8cd1f0001b35a0d4b34d8123f 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/HVACUserInputsConfig.vb @@ -1,36 +1,36 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics - -Namespace Hvac - Public Class HVACUserInputsConfig - Implements IHVACUserInputsConfig - - 'Constructor - Public Sub New(ssmFilePath As String, busDatabasePath As String, isDisabled As Boolean) - - Me.SSMFilePath = ssmFilePath - Me.BusDatabasePath = busDatabasePath - Me.SSMDisabled = isDisabled - End Sub - - Public Property SSMFilePath As String Implements IHVACUserInputsConfig.SSMFilePath - - Public Property BusDatabasePath As String Implements IHVACUserInputsConfig.BusDatabasePath - - Public Property SSMDisabled As Boolean Implements IHVACUserInputsConfig.SSMDisabled - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports VectoAuxiliaries.Hvac +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics + +Namespace Hvac + Public Class HVACUserInputsConfig + Implements IHVACUserInputsConfig + + 'Constructor + Public Sub New(ssmFilePath As String, busDatabasePath As String, isDisabled As Boolean) + + Me.SSMFilePath = ssmFilePath + Me.BusDatabasePath = busDatabasePath + Me.SSMDisabled = isDisabled + End Sub + + Public Property SSMFilePath As String Implements IHVACUserInputsConfig.SSMFilePath + + Public Property BusDatabasePath As String Implements IHVACUserInputsConfig.BusDatabasePath + + Public Property SSMDisabled As Boolean Implements IHVACUserInputsConfig.SSMDisabled + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb index 42e31edc0cbdec899faafb5324b45ebea59d6bd0..15069622b36f34f49df22eaf537857545f5169fc 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/IHVACSteadyStateModel.vb @@ -1,49 +1,49 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Hvac - Public Interface IHVACSteadyStateModel - ''' <summary> - ''' Initialised Values From Map - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="message"></param> - ''' <returns>True if successfull, and False if not.</returns> - ''' <remarks></remarks> - Function SetValuesFromMap(byval filePath As String, ByRef message As string) As Boolean - - ''' <summary> - ''' HVAC Mechanical Load Power (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property HVACMechanicalLoadPowerWatts As Single - - ''' <summary> - ''' HVAC Electrical Load Power (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property HVACElectricalLoadPowerWatts As Single - - ''' <summary> - ''' HVAC Fuelling (L/H) - ''' </summary> - ''' <value></value> - ''' <returns>Liters per hour</returns> - ''' <remarks></remarks> - Property HVACFuellingLitresPerHour As single - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Hvac + Public Interface IHVACSteadyStateModel + ''' <summary> + ''' Initialised Values From Map + ''' </summary> + ''' <param name="filePath"></param> + ''' <param name="message"></param> + ''' <returns>True if successfull, and False if not.</returns> + ''' <remarks></remarks> + Function SetValuesFromMap(byval filePath As String, ByRef message As string) As Boolean + + ''' <summary> + ''' HVAC Mechanical Load Power (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property HVACMechanicalLoadPowerWatts As Single + + ''' <summary> + ''' HVAC Electrical Load Power (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property HVACElectricalLoadPowerWatts As Single + + ''' <summary> + ''' HVAC Fuelling (L/H) + ''' </summary> + ''' <value></value> + ''' <returns>Liters per hour</returns> + ''' <remarks></remarks> + Property HVACFuellingLitresPerHour As single + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb index e9216c80ff98cc096c71dd49625de9a2f0e2e63e..9c5063622e2996c98257591fe12977ff93d8eb23 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/IHVACUserInputsConfig.vb @@ -1,33 +1,33 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Hvac - -Namespace Hvac - Public Interface IHVACUserInputsConfig - ' Property SteadyStateModel As IHVACSteadyStateModel - ''' <summary> - ''' PathName of the Steady State Model File - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property SSMFilePath As String - - Property BusDatabasePath As String - - Property SSMDisabled As Boolean - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Hvac + +Namespace Hvac + Public Interface IHVACUserInputsConfig + ' Property SteadyStateModel As IHVACSteadyStateModel + ''' <summary> + ''' PathName of the Steady State Model File + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property SSMFilePath As String + + Property BusDatabasePath As String + + Property SSMDisabled As Boolean + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb index 36c741a55bfaa68183e97fc6d60d3f96ee6566e1..61255d11c46b2ba5eee30256ed118fa1df30b0fc 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/IM1_AverageHVACLoadDemand.vb @@ -1,45 +1,45 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Hvac - Public Interface IM1_AverageHVACLoadDemand - ''' <summary> - ''' Average Power Demand At Crank From HVAC Mechanicals (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AveragePowerDemandAtCrankFromHVACMechanicalsWatts() As Watt - - ''' <summary> - ''' Average Power Demand At Alternator From HVAC Electrics (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AveragePowerDemandAtAlternatorFromHVACElectricsWatts() As Watt - - ''' <summary> - ''' Average Power Demand At Crank From HVAC Electrics (W) - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function AveragePowerDemandAtCrankFromHVACElectricsWatts() As Watt - - ''' <summary> - ''' HVAC Fueling (L/H) - ''' </summary> - ''' <returns>Litres Per Hour</returns> - ''' <remarks></remarks> - Function HVACFuelingLitresPerHour() As LiterPerSecond - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Hvac + Public Interface IM1_AverageHVACLoadDemand + ''' <summary> + ''' Average Power Demand At Crank From HVAC Mechanicals (W) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function AveragePowerDemandAtCrankFromHVACMechanicalsWatts() As Watt + + ''' <summary> + ''' Average Power Demand At Alternator From HVAC Electrics (W) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function AveragePowerDemandAtAlternatorFromHVACElectricsWatts() As Watt + + ''' <summary> + ''' Average Power Demand At Crank From HVAC Electrics (W) + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function AveragePowerDemandAtCrankFromHVACElectricsWatts() As Watt + + ''' <summary> + ''' HVAC Fueling (L/H) + ''' </summary> + ''' <returns>Litres Per Hour</returns> + ''' <remarks></remarks> + Function HVACFuelingLitresPerHour() As LiterPerSecond + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb index 8e3afcc9a5b73fad3f5d6518c7cca779c52bc58e..b4e46d573aa23435f07d96e9da77b077f247d0b9 100644 --- a/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Hvac/M1_AverageHVACLoadDemand.vb @@ -1,98 +1,98 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics - -Namespace Hvac - Public Class M1_AverageHVACLoadDemand - Implements IM1_AverageHVACLoadDemand - - Private _m0 As IM0_NonSmart_AlternatorsSetEfficiency - Private _alternatorGearEfficiency As Double - Private _compressorGearEfficiency As Double - Private _signals As ISignals - Private _powernetVoltage As Volt - Private _steadyStateModel As ISSMTOOL - - Private _ElectricalPowerW As Watt - Private _MechanicalPowerW As Watt - Private _FuelingLPerH As LiterPerSecond - - - 'Constructor - Public Sub New(m0 As IM0_NonSmart_AlternatorsSetEfficiency, altGearEfficiency As Double, - compressorGearEfficiency As Double, powernetVoltage As Volt, signals As ISignals, ssm As ISSMTOOL) - - 'Sanity Check - Illegal operations without all params. - If m0 Is Nothing Then Throw New ArgumentException("Module0 as supplied is null") - - If _ - altGearEfficiency < ElectricConstants.AlternatorPulleyEfficiencyMin OrElse - altGearEfficiency > ElectricConstants.AlternatorPulleyEfficiencyMax Then _ - Throw _ - New ArgumentException(String.Format("Gear efficiency must be between {0} and {1}", - ElectricConstants.AlternatorPulleyEfficiencyMin, ElectricConstants.AlternatorPulleyEfficiencyMax)) - - If signals Is Nothing Then Throw New Exception("Signals object as supplied is null") - If powernetVoltage < ElectricConstants.PowenetVoltageMin OrElse powernetVoltage > ElectricConstants.PowenetVoltageMax _ - Then _ - Throw _ - New ArgumentException(String.Format("PowenetVoltage supplied must be in the range {0} to {1}", - ElectricConstants.PowenetVoltageMin, ElectricConstants.PowenetVoltageMax)) - If ssm Is Nothing Then Throw New ArgumentException("Steady State model was not supplied") - If compressorGearEfficiency < 0 OrElse altGearEfficiency > 1 Then _ - Throw New ArgumentException(String.Format("Compressor Gear efficiency must be between {0} and {1}", 0, 1)) - - - 'Assign - _m0 = m0 - _alternatorGearEfficiency = altGearEfficiency - _signals = signals - - _compressorGearEfficiency = compressorGearEfficiency - _powernetVoltage = powernetVoltage - - - _steadyStateModel = ssm - - _ElectricalPowerW = ssm.ElectricalWAdjusted.SI(Of Watt)() - _MechanicalPowerW = ssm.MechanicalWBaseAdjusted.SI(Of Watt)() - _FuelingLPerH = ssm.FuelPerHBaseAdjusted.SI().Liter.Per.Hour.Cast(Of LiterPerSecond)() ' SI(Of LiterPerHour)() - End Sub - - 'Public Methods - Implementation - Public Function AveragePowerDemandAtCrankFromHVACMechanicalsWatts() As Watt _ - Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtCrankFromHVACMechanicalsWatts - - Return _MechanicalPowerW * (1 / _compressorGearEfficiency) - End Function - - Public Function AveragePowerDemandAtAlternatorFromHVACElectricsWatts() As Watt _ - Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtAlternatorFromHVACElectricsWatts - - Return _ElectricalPowerW - End Function - - Public Function AveragePowerDemandAtCrankFromHVACElectricsWatts() As Watt _ - Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtCrankFromHVACElectricsWatts - - Return _ElectricalPowerW * (1 / _m0.AlternatorsEfficiency() / _alternatorGearEfficiency) - End Function - - Public Function HVACFuelingLitresPerHour() As LiterPerSecond _ - Implements IM1_AverageHVACLoadDemand.HVACFuelingLitresPerHour - - Return _FuelingLPerH - End Function - End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics + +Namespace Hvac + Public Class M1_AverageHVACLoadDemand + Implements IM1_AverageHVACLoadDemand + + Private _m0 As IM0_NonSmart_AlternatorsSetEfficiency + Private _alternatorGearEfficiency As Double + Private _compressorGearEfficiency As Double + Private _signals As ISignals + Private _powernetVoltage As Volt + Private _steadyStateModel As ISSMTOOL + + Private _ElectricalPowerW As Watt + Private _MechanicalPowerW As Watt + Private _FuelingLPerH As LiterPerSecond + + + 'Constructor + Public Sub New(m0 As IM0_NonSmart_AlternatorsSetEfficiency, altGearEfficiency As Double, + compressorGearEfficiency As Double, powernetVoltage As Volt, signals As ISignals, ssm As ISSMTOOL) + + 'Sanity Check - Illegal operations without all params. + If m0 Is Nothing Then Throw New ArgumentException("Module0 as supplied is null") + + If _ + altGearEfficiency < ElectricConstants.AlternatorPulleyEfficiencyMin OrElse + altGearEfficiency > ElectricConstants.AlternatorPulleyEfficiencyMax Then _ + Throw _ + New ArgumentException(String.Format("Gear efficiency must be between {0} and {1}", + ElectricConstants.AlternatorPulleyEfficiencyMin, ElectricConstants.AlternatorPulleyEfficiencyMax)) + + If signals Is Nothing Then Throw New Exception("Signals object as supplied is null") + If powernetVoltage < ElectricConstants.PowenetVoltageMin OrElse powernetVoltage > ElectricConstants.PowenetVoltageMax _ + Then _ + Throw _ + New ArgumentException(String.Format("PowenetVoltage supplied must be in the range {0} to {1}", + ElectricConstants.PowenetVoltageMin, ElectricConstants.PowenetVoltageMax)) + If ssm Is Nothing Then Throw New ArgumentException("Steady State model was not supplied") + If compressorGearEfficiency < 0 OrElse altGearEfficiency > 1 Then _ + Throw New ArgumentException(String.Format("Compressor Gear efficiency must be between {0} and {1}", 0, 1)) + + + 'Assign + _m0 = m0 + _alternatorGearEfficiency = altGearEfficiency + _signals = signals + + _compressorGearEfficiency = compressorGearEfficiency + _powernetVoltage = powernetVoltage + + + _steadyStateModel = ssm + + _ElectricalPowerW = ssm.ElectricalWAdjusted.SI(Of Watt)() + _MechanicalPowerW = ssm.MechanicalWBaseAdjusted.SI(Of Watt)() + _FuelingLPerH = ssm.FuelPerHBaseAdjusted.SI().Liter.Per.Hour.Cast(Of LiterPerSecond)() ' SI(Of LiterPerHour)() + End Sub + + 'Public Methods - Implementation + Public Function AveragePowerDemandAtCrankFromHVACMechanicalsWatts() As Watt _ + Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtCrankFromHVACMechanicalsWatts + + Return _MechanicalPowerW * (1 / _compressorGearEfficiency) + End Function + + Public Function AveragePowerDemandAtAlternatorFromHVACElectricsWatts() As Watt _ + Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtAlternatorFromHVACElectricsWatts + + Return _ElectricalPowerW + End Function + + Public Function AveragePowerDemandAtCrankFromHVACElectricsWatts() As Watt _ + Implements IM1_AverageHVACLoadDemand.AveragePowerDemandAtCrankFromHVACElectricsWatts + + Return _ElectricalPowerW * (1 / _m0.AlternatorsEfficiency() / _alternatorGearEfficiency) + End Function + + Public Function HVACFuelingLitresPerHour() As LiterPerSecond _ + Implements IM1_AverageHVACLoadDemand.HVACFuelingLitresPerHour + + Return _FuelingLPerH + End Function + End Class End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb index 08e0f4853a77664aae891ea10955752d4fc2792e..0ea2a7543e687bbfd29b74c81fbef129ced18a65 100644 --- a/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/IAuxiliaryConfig.vb @@ -1,43 +1,43 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports VectoAuxiliaries.Hvac -Imports VectoAuxiliaries.DownstreamModules -Imports System.IO - -Imports System.Windows.Forms -Imports Newtonsoft.Json - - -Public Interface IAuxiliaryConfig - 'Vecto - Property VectoInputs As IVectoInputs - - 'Electrical - property ElectricalUserInputsConfig As IElectricsUserInputsConfig - - - 'Pneumatics - Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig - Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig - - 'Hvac - Property HvacUserInputsConfig As IHVACUserInputsConfig - - Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) As Boolean - - - 'Persistance Functions - Function Save(filePath As String) As Boolean - Function Load(filePath As String) As Boolean -End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports VectoAuxiliaries.Hvac +Imports VectoAuxiliaries.DownstreamModules +Imports System.IO + +Imports System.Windows.Forms +Imports Newtonsoft.Json + + +Public Interface IAuxiliaryConfig + 'Vecto + Property VectoInputs As IVectoInputs + + 'Electrical + property ElectricalUserInputsConfig As IElectricsUserInputsConfig + + + 'Pneumatics + Property PneumaticUserInputsConfig As IPneumaticUserInputsConfig + Property PneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig + + 'Hvac + Property HvacUserInputsConfig As IHVACUserInputsConfig + + Function ConfigValuesAreTheSameAs(other As AuxiliaryConfig) As Boolean + + + 'Persistance Functions + Function Save(filePath As String) As Boolean + Function Load(filePath As String) As Boolean +End Interface diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb index d811960588599a498a5e5680a24409f1440bff5d..c943df8f2288055a489f081f49d82c3cd90f9b15 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/ActuationsKey.vb @@ -1,53 +1,53 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Pneumatics - Public Class ActuationsKey - Private _consumerName As String - Private _cycleName As String - -'Properties - Public ReadOnly Property ConsumerName As String - Get - Return _consumerName - End Get - End Property - - Public ReadOnly Property CycleName As String - Get - Return _cycleName - End Get - End Property - -'Constructor - Public Sub New(consumerName As String, cycleName As String) - - If consumerName.Trim.Length = 0 Or cycleName.Trim.Length = 0 Then _ - Throw New ArgumentException("ConsumerName and CycleName must be provided") - _consumerName = consumerName - _cycleName = cycleName - End Sub - - - 'Overrides to enable this class to be used as a dictionary key in the ActuationsMap. - Public Overrides Function Equals(obj As Object) As Boolean - - Dim other As ActuationsKey = CType(obj, ActuationsKey) - - Return other.ConsumerName = Me.ConsumerName AndAlso other.CycleName = Me.CycleName - End Function - - Public Overrides Function GetHashCode() As Integer - Return 0 - End Function - End Class -End Namespace - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Pneumatics + Public Class ActuationsKey + Private _consumerName As String + Private _cycleName As String + +'Properties + Public ReadOnly Property ConsumerName As String + Get + Return _consumerName + End Get + End Property + + Public ReadOnly Property CycleName As String + Get + Return _cycleName + End Get + End Property + +'Constructor + Public Sub New(consumerName As String, cycleName As String) + + If consumerName.Trim.Length = 0 Or cycleName.Trim.Length = 0 Then _ + Throw New ArgumentException("ConsumerName and CycleName must be provided") + _consumerName = consumerName + _cycleName = cycleName + End Sub + + + 'Overrides to enable this class to be used as a dictionary key in the ActuationsMap. + Public Overrides Function Equals(obj As Object) As Boolean + + Dim other As ActuationsKey = CType(obj, ActuationsKey) + + Return other.ConsumerName = Me.ConsumerName AndAlso other.CycleName = Me.CycleName + End Function + + Public Overrides Function GetHashCode() As Integer + Return 0 + End Function + End Class +End Namespace + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb index 2c8d9b064d2fce2ecc979027e8fa4d7bb3fe407d..66a9abdebbdd9fe02a177933cb4d0da534cf4290 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/CompressorMap.vb @@ -1,260 +1,260 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.Globalization -Imports System.IO -Imports TUGraz.VectoCommon.Utils - -Namespace Pneumatics - ''' <summary> - ''' Compressor Flow Rate and Power Map - ''' </summary> - ''' <remarks></remarks> - Public Class CompressorMap - Implements ICompressorMap, - IAuxiliaryEvent - - Private ReadOnly filePath As String - Private _averagePowerDemandPerCompressorUnitFlowRateLitresperSec As Double - Private _MapBoundariesExceeded As Boolean - - ''' <summary> - ''' Dictionary of values keyed by the rpm valaues in the csv file - ''' Values are held as a tuple as follows - ''' Item1 = flow rate - ''' Item2 - power [compressor on] - ''' Item3 - power [compressor off] - ''' </summary> - ''' <remarks></remarks> - Private map As Dictionary(Of Integer, CompressorMapValues) - - 'Returns the AveragePowerDemand per unit flow rate in seconds. - Public Function GetAveragePowerDemandPerCompressorUnitFlowRate() As Double _ - Implements ICompressorMap.GetAveragePowerDemandPerCompressorUnitFlowRate - - Return _averagePowerDemandPerCompressorUnitFlowRateLitresperSec - End Function - - - ''' <summary> - ''' Creates a new instance of the CompressorMap class - ''' </summary> - ''' <param name="path">full path to csv data file</param> - ''' <remarks></remarks> - Public Sub New(ByVal path As String) - filePath = path - End Sub - - ''' <summary> - ''' Initilaises the map from the supplied csv data - ''' </summary> - ''' <remarks></remarks> - Public Function Initialise() As Boolean Implements ICompressorMap.Initialise - - If File.Exists(filePath) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array of lines from csv - Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), - StringSplitOptions.RemoveEmptyEntries) - - 'Must have at least 2 entries in map to make it usable [dont forget the header row] - If lines.Length < 3 Then Throw New ArgumentException("Insufficient rows in csv to build a usable map") - - map = New Dictionary(Of Integer, CompressorMapValues)() - Dim firstline As Boolean = True - - For Each line As String In lines - If Not firstline Then - 'split the line - Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) - '4 entries per line required - If (elements.Length <> 4) Then Throw New ArgumentException("Incorrect number of values in csv file") - 'add values to map - Try - map.Add(Integer.Parse(elements(0)), - New CompressorMapValues(Double.Parse(elements(1), CultureInfo.InvariantCulture).SI(Of NormLiterPerSecond), - Double.Parse(elements(2), CultureInfo.InvariantCulture).SI(Of Watt), - Double.Parse(elements(3), CultureInfo.InvariantCulture).SI(Of Watt))) - Catch fe As FormatException - Throw New InvalidCastException(String.Format("Compresor Map: line '{0}", line), fe) - End Try - Else - firstline = False - End If - Next - End Using - - '********************************************************************* - 'Calculate the Average Power Demand Per Compressor Unit FlowRate / per second. - Dim powerDividedByFlowRateSum As Double = 0 - For Each speed As KeyValuePair(Of Integer, CompressorMapValues) In map - powerDividedByFlowRateSum += (speed.Value.PowerCompressorOn - speed.Value.PowerCompressorOff).Value() / - speed.Value.FlowRate.Value() - Next - - 'Map in Litres Per Minute, so * 60 to get per second, calculated only once at initialisation. - _averagePowerDemandPerCompressorUnitFlowRateLitresperSec = (powerDividedByFlowRateSum / map.Count) * 60 - '********************************************************************** - - Else - Throw New ArgumentException("supplied input file does not exist") - End If - - 'If we get here then all should be well and we can return a True value of success. - Return True - End Function - - ''' <summary> - ''' Returns compressor flow rate at the given rotation speed - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Public Function GetFlowRate(ByVal rpm As Double) As NormLiterPerSecond Implements ICompressorMap.GetFlowRate - Dim val As CompressorMapValues = InterpolatedTuple(rpm) - Return val.FlowRate - End Function - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is on - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Public Function GetPowerCompressorOn(ByVal rpm As Double) As Watt Implements ICompressorMap.GetPowerCompressorOn - Dim val As CompressorMapValues = InterpolatedTuple(rpm) - Return val.PowerCompressorOn - End Function - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is off - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Public Function GetPowerCompressorOff(ByVal rpm As Double) As Watt Implements ICompressorMap.GetPowerCompressorOff - Dim val As CompressorMapValues = InterpolatedTuple(rpm) - Return val.PowerCompressorOff - End Function - - ''' <summary> - ''' Returns an instance of CompressorMapValues containing the values at a key, or interpolated values - ''' </summary> - ''' <returns>CompressorMapValues</returns> - ''' <remarks>Throws exception if rpm are outside map</remarks> - Private Function InterpolatedTuple(ByVal rpm As Double) As CompressorMapValues - 'check the rpm is within the map - Dim min As Integer = map.Keys.Min() - Dim max As Integer = map.Keys.Max() - - If rpm < min OrElse rpm > max Then - If Not _MapBoundariesExceeded Then - OnMessage(Me, - String.Format("Compresser : limited RPM of '{2}' to extent of map - map range is {0} to {1}", min, max, rpm), - AdvancedAuxiliaryMessageType.Warning) - _MapBoundariesExceeded = True - End If - - 'Limiting as agreed. - If rpm > max Then rpm = max - If rpm < min Then rpm = min - - End If - - 'If supplied rpm is a key, we can just return the appropriate tuple - Dim intRpm As Integer = CType(rpm, Integer) - If rpm.IsEqual(intRpm) AndAlso map.ContainsKey(intRpm) Then - Return map(intRpm) - End If - - 'Not a key value, interpolate - 'get the entries before and after the supplied rpm - Dim pre As KeyValuePair(Of Integer, CompressorMapValues) = (From m In map Where m.Key < rpm Select m).Last() - Dim post As KeyValuePair(Of Integer, CompressorMapValues) = (From m In map Where m.Key > rpm Select m).First() - - 'get the delta values for rpm and the map values - Dim dRpm As Double = post.Key - pre.Key - Dim dFlowRate As NormLiterPerSecond = post.Value.FlowRate - pre.Value.FlowRate - Dim dPowerOn As Watt = post.Value.PowerCompressorOn - pre.Value.PowerCompressorOn - Dim dPowerOff As Watt = post.Value.PowerCompressorOff - pre.Value.PowerCompressorOff - - 'calculate the slopes - Dim flowSlope As Double = dFlowRate.Value() / dRpm - Dim powerOnSlope As Double = dPowerOn.Value() / dRpm - Dim powerOffSlope As Double = dPowerOff.Value() / dRpm - - 'calculate the new values - Dim flowRate As NormLiterPerSecond = (((rpm - pre.Key) * flowSlope).SI(Of NormLiterPerSecond)() + pre.Value.FlowRate) - Dim powerCompressorOn As Watt = (((rpm - pre.Key) * powerOnSlope).SI(Of Watt)() + pre.Value.PowerCompressorOn) - Dim powerCompressorOff As Watt = (((rpm - pre.Key) * powerOffSlope).SI(Of Watt)() + pre.Value.PowerCompressorOff) - - 'Build and return a new CompressorMapValues instance - Return New CompressorMapValues(flowRate, powerCompressorOn, powerCompressorOff) - End Function - - ''' <summary> - ''' Encapsulates compressor map values - ''' Flow Rate - ''' Power - Compressor On - ''' Power - Compressor Off - ''' </summary> - ''' <remarks></remarks> - ''' - - Private Structure CompressorMapValues - ''' <summary> - ''' Compressor flowrate - ''' </summary> - ''' <remarks></remarks> - Public ReadOnly FlowRate As NormLiterPerSecond - - ''' <summary> - ''' Power, compressor on - ''' </summary> - ''' <remarks></remarks> - Public ReadOnly PowerCompressorOn As Watt - - ''' <summary> - ''' Power compressor off - ''' </summary> - ''' <remarks></remarks> - Public ReadOnly PowerCompressorOff As Watt - - ''' <summary> - ''' Creates a new instance of CompressorMapValues - ''' </summary> - ''' <param name="flowRate">flow rate</param> - ''' <param name="powerCompressorOn">power - compressor on</param> - ''' <param name="powerCompressorOff">power - compressor off</param> - ''' <remarks></remarks> - Public Sub New(ByVal flowRate As NormLiterPerSecond, ByVal powerCompressorOn As Watt, - ByVal powerCompressorOff As Watt) - Me.FlowRate = flowRate - Me.PowerCompressorOn = powerCompressorOn - Me.PowerCompressorOff = powerCompressorOff - End Sub - End Structure - - - Public Event Message(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ - Implements IAuxiliaryEvent.AuxiliaryEvent - - Private Sub OnMessage(sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) - - - If Not message Is Nothing Then - - RaiseEvent Message(Me, message, messageType) - - End If - End Sub - End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.Globalization +Imports System.IO +Imports TUGraz.VectoCommon.Utils + +Namespace Pneumatics + ''' <summary> + ''' Compressor Flow Rate and Power Map + ''' </summary> + ''' <remarks></remarks> + Public Class CompressorMap + Implements ICompressorMap, + IAuxiliaryEvent + + Private ReadOnly filePath As String + Private _averagePowerDemandPerCompressorUnitFlowRateLitresperSec As Double + Private _MapBoundariesExceeded As Boolean + + ''' <summary> + ''' Dictionary of values keyed by the rpm valaues in the csv file + ''' Values are held as a tuple as follows + ''' Item1 = flow rate + ''' Item2 - power [compressor on] + ''' Item3 - power [compressor off] + ''' </summary> + ''' <remarks></remarks> + Private map As Dictionary(Of Integer, CompressorMapValues) + + 'Returns the AveragePowerDemand per unit flow rate in seconds. + Public Function GetAveragePowerDemandPerCompressorUnitFlowRate() As Double _ + Implements ICompressorMap.GetAveragePowerDemandPerCompressorUnitFlowRate + + Return _averagePowerDemandPerCompressorUnitFlowRateLitresperSec + End Function + + + ''' <summary> + ''' Creates a new instance of the CompressorMap class + ''' </summary> + ''' <param name="path">full path to csv data file</param> + ''' <remarks></remarks> + Public Sub New(ByVal path As String) + filePath = path + End Sub + + ''' <summary> + ''' Initilaises the map from the supplied csv data + ''' </summary> + ''' <remarks></remarks> + Public Function Initialise() As Boolean Implements ICompressorMap.Initialise + + If File.Exists(filePath) Then + Using sr As StreamReader = New StreamReader(filePath) + 'get array of lines from csv + Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), + StringSplitOptions.RemoveEmptyEntries) + + 'Must have at least 2 entries in map to make it usable [dont forget the header row] + If lines.Length < 3 Then Throw New ArgumentException("Insufficient rows in csv to build a usable map") + + map = New Dictionary(Of Integer, CompressorMapValues)() + Dim firstline As Boolean = True + + For Each line As String In lines + If Not firstline Then + 'split the line + Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) + '4 entries per line required + If (elements.Length <> 4) Then Throw New ArgumentException("Incorrect number of values in csv file") + 'add values to map + Try + map.Add(Integer.Parse(elements(0)), + New CompressorMapValues(Double.Parse(elements(1), CultureInfo.InvariantCulture).SI(Of NormLiterPerSecond), + Double.Parse(elements(2), CultureInfo.InvariantCulture).SI(Of Watt), + Double.Parse(elements(3), CultureInfo.InvariantCulture).SI(Of Watt))) + Catch fe As FormatException + Throw New InvalidCastException(String.Format("Compresor Map: line '{0}", line), fe) + End Try + Else + firstline = False + End If + Next + End Using + + '********************************************************************* + 'Calculate the Average Power Demand Per Compressor Unit FlowRate / per second. + Dim powerDividedByFlowRateSum As Double = 0 + For Each speed As KeyValuePair(Of Integer, CompressorMapValues) In map + powerDividedByFlowRateSum += (speed.Value.PowerCompressorOn - speed.Value.PowerCompressorOff).Value() / + speed.Value.FlowRate.Value() + Next + + 'Map in Litres Per Minute, so * 60 to get per second, calculated only once at initialisation. + _averagePowerDemandPerCompressorUnitFlowRateLitresperSec = (powerDividedByFlowRateSum / map.Count) * 60 + '********************************************************************** + + Else + Throw New ArgumentException("supplied input file does not exist") + End If + + 'If we get here then all should be well and we can return a True value of success. + Return True + End Function + + ''' <summary> + ''' Returns compressor flow rate at the given rotation speed + ''' </summary> + ''' <param name="rpm">compressor rotation speed</param> + ''' <returns></returns> + ''' <remarks>Single</remarks> + Public Function GetFlowRate(ByVal rpm As Double) As NormLiterPerSecond Implements ICompressorMap.GetFlowRate + Dim val As CompressorMapValues = InterpolatedTuple(rpm) + Return val.FlowRate + End Function + + ''' <summary> + ''' Returns mechanical power at rpm when compressor is on + ''' </summary> + ''' <param name="rpm">compressor rotation speed</param> + ''' <returns></returns> + ''' <remarks>Single</remarks> + Public Function GetPowerCompressorOn(ByVal rpm As Double) As Watt Implements ICompressorMap.GetPowerCompressorOn + Dim val As CompressorMapValues = InterpolatedTuple(rpm) + Return val.PowerCompressorOn + End Function + + ''' <summary> + ''' Returns mechanical power at rpm when compressor is off + ''' </summary> + ''' <param name="rpm">compressor rotation speed</param> + ''' <returns></returns> + ''' <remarks>Single</remarks> + Public Function GetPowerCompressorOff(ByVal rpm As Double) As Watt Implements ICompressorMap.GetPowerCompressorOff + Dim val As CompressorMapValues = InterpolatedTuple(rpm) + Return val.PowerCompressorOff + End Function + + ''' <summary> + ''' Returns an instance of CompressorMapValues containing the values at a key, or interpolated values + ''' </summary> + ''' <returns>CompressorMapValues</returns> + ''' <remarks>Throws exception if rpm are outside map</remarks> + Private Function InterpolatedTuple(ByVal rpm As Double) As CompressorMapValues + 'check the rpm is within the map + Dim min As Integer = map.Keys.Min() + Dim max As Integer = map.Keys.Max() + + If rpm < min OrElse rpm > max Then + If Not _MapBoundariesExceeded Then + OnMessage(Me, + String.Format("Compresser : limited RPM of '{2}' to extent of map - map range is {0} to {1}", min, max, rpm), + AdvancedAuxiliaryMessageType.Warning) + _MapBoundariesExceeded = True + End If + + 'Limiting as agreed. + If rpm > max Then rpm = max + If rpm < min Then rpm = min + + End If + + 'If supplied rpm is a key, we can just return the appropriate tuple + Dim intRpm As Integer = CType(rpm, Integer) + If rpm.IsEqual(intRpm) AndAlso map.ContainsKey(intRpm) Then + Return map(intRpm) + End If + + 'Not a key value, interpolate + 'get the entries before and after the supplied rpm + Dim pre As KeyValuePair(Of Integer, CompressorMapValues) = (From m In map Where m.Key < rpm Select m).Last() + Dim post As KeyValuePair(Of Integer, CompressorMapValues) = (From m In map Where m.Key > rpm Select m).First() + + 'get the delta values for rpm and the map values + Dim dRpm As Double = post.Key - pre.Key + Dim dFlowRate As NormLiterPerSecond = post.Value.FlowRate - pre.Value.FlowRate + Dim dPowerOn As Watt = post.Value.PowerCompressorOn - pre.Value.PowerCompressorOn + Dim dPowerOff As Watt = post.Value.PowerCompressorOff - pre.Value.PowerCompressorOff + + 'calculate the slopes + Dim flowSlope As Double = dFlowRate.Value() / dRpm + Dim powerOnSlope As Double = dPowerOn.Value() / dRpm + Dim powerOffSlope As Double = dPowerOff.Value() / dRpm + + 'calculate the new values + Dim flowRate As NormLiterPerSecond = (((rpm - pre.Key) * flowSlope).SI(Of NormLiterPerSecond)() + pre.Value.FlowRate) + Dim powerCompressorOn As Watt = (((rpm - pre.Key) * powerOnSlope).SI(Of Watt)() + pre.Value.PowerCompressorOn) + Dim powerCompressorOff As Watt = (((rpm - pre.Key) * powerOffSlope).SI(Of Watt)() + pre.Value.PowerCompressorOff) + + 'Build and return a new CompressorMapValues instance + Return New CompressorMapValues(flowRate, powerCompressorOn, powerCompressorOff) + End Function + + ''' <summary> + ''' Encapsulates compressor map values + ''' Flow Rate + ''' Power - Compressor On + ''' Power - Compressor Off + ''' </summary> + ''' <remarks></remarks> + ''' + + Private Structure CompressorMapValues + ''' <summary> + ''' Compressor flowrate + ''' </summary> + ''' <remarks></remarks> + Public ReadOnly FlowRate As NormLiterPerSecond + + ''' <summary> + ''' Power, compressor on + ''' </summary> + ''' <remarks></remarks> + Public ReadOnly PowerCompressorOn As Watt + + ''' <summary> + ''' Power compressor off + ''' </summary> + ''' <remarks></remarks> + Public ReadOnly PowerCompressorOff As Watt + + ''' <summary> + ''' Creates a new instance of CompressorMapValues + ''' </summary> + ''' <param name="flowRate">flow rate</param> + ''' <param name="powerCompressorOn">power - compressor on</param> + ''' <param name="powerCompressorOff">power - compressor off</param> + ''' <remarks></remarks> + Public Sub New(ByVal flowRate As NormLiterPerSecond, ByVal powerCompressorOn As Watt, + ByVal powerCompressorOff As Watt) + Me.FlowRate = flowRate + Me.PowerCompressorOn = powerCompressorOn + Me.PowerCompressorOff = powerCompressorOff + End Sub + End Structure + + + Public Event Message(ByRef sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) _ + Implements IAuxiliaryEvent.AuxiliaryEvent + + Private Sub OnMessage(sender As Object, message As String, messageType As AdvancedAuxiliaryMessageType) + + + If Not message Is Nothing Then + + RaiseEvent Message(Me, message, messageType) + + End If + End Sub + End Class End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb index 2c8956306d68d0243830d9225d2e0470f167b593..ebb7b4de8330b1c71535d11b5f18d9e2a51c06b1 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/ICompressorMap.vb @@ -1,50 +1,50 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Interface ICompressorMap - Inherits IAuxiliaryEvent - - ''' <summary> - ''' Initilaises the map from the supplied csv data - ''' </summary> - ''' <remarks></remarks> - Function Initialise() As Boolean - - ''' <summary> - ''' Returns compressor flow rate at the given rotation speed - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Function GetFlowRate(ByVal rpm As Double) As NormLiterPerSecond - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is on - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Function GetPowerCompressorOn(ByVal rpm As Double) As Watt - - ''' <summary> - ''' Returns mechanical power at rpm when compressor is off - ''' </summary> - ''' <param name="rpm">compressor rotation speed</param> - ''' <returns></returns> - ''' <remarks>Single</remarks> - Function GetPowerCompressorOff(ByVal rpm As Double) As Watt - - 'Returns Average Power Demand Per Compressor Unit FlowRate - Function GetAveragePowerDemandPerCompressorUnitFlowRate() As Double - End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Pneumatics + Public Interface ICompressorMap + Inherits IAuxiliaryEvent + + ''' <summary> + ''' Initilaises the map from the supplied csv data + ''' </summary> + ''' <remarks></remarks> + Function Initialise() As Boolean + + ''' <summary> + ''' Returns compressor flow rate at the given rotation speed + ''' </summary> + ''' <param name="rpm">compressor rotation speed</param> + ''' <returns></returns> + ''' <remarks>Single</remarks> + Function GetFlowRate(ByVal rpm As Double) As NormLiterPerSecond + + ''' <summary> + ''' Returns mechanical power at rpm when compressor is on + ''' </summary> + ''' <param name="rpm">compressor rotation speed</param> + ''' <returns></returns> + ''' <remarks>Single</remarks> + Function GetPowerCompressorOn(ByVal rpm As Double) As Watt + + ''' <summary> + ''' Returns mechanical power at rpm when compressor is off + ''' </summary> + ''' <param name="rpm">compressor rotation speed</param> + ''' <returns></returns> + ''' <remarks>Single</remarks> + Function GetPowerCompressorOff(ByVal rpm As Double) As Watt + + 'Returns Average Power Demand Per Compressor Unit FlowRate + Function GetAveragePowerDemandPerCompressorUnitFlowRate() As Double + End Interface End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb index 2915abf1239576594659b4a0ab8b72e7155c4c95..860b26b99e45b6ebae91c4c0d16bebf753aa6179 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/IM3_AveragePneumaticLoadDemand.vb @@ -1,21 +1,21 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Interface IM3_AveragePneumaticLoadDemand - Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt - - Function AverageAirConsumedPerSecondLitre() As NormLiterPerSecond - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Pneumatics + Public Interface IM3_AveragePneumaticLoadDemand + Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt + + Function AverageAirConsumedPerSecondLitre() As NormLiterPerSecond + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb index 1f7e76b40b7e5b9c576d9bb70b122df5e19d4235..757fc9ec00e6d5475b4a14c237eb534d3da52502 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/IM4_AirCompressor.vb @@ -1,73 +1,73 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Interface IM4_AirCompressor - ''' <summary> - ''' Ratio of Gear or Pulley used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PulleyGearRatio() As Double - - ''' <summary> - ''' Efficiency of the Pulley or Gear used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PulleyGearEfficiency() As Double - - ''' <summary> - ''' Initialises the AirCompressor Class - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function Initialise() As Boolean - - ''' <summary> - ''' Returns the flow rate [litres/second] of compressor for the given engine rpm - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetFlowRate() As NormLiterPerSecond - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is off - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetPowerCompressorOff() As Watt - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is on - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetPowerCompressorOn() As Watt - - ''' <summary> - ''' Returns the difference in power between compressonr on and compressor off operation at the given engine rpm - ''' </summary> - ''' <returns>Single / Watts</returns> - ''' <remarks></remarks> - Function GetPowerDifference() As Watt - - ''' <summary> - ''' Returns Average PoweDemand PeCompressor UnitFlowRate - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Function GetAveragePowerDemandPerCompressorUnitFlowRate() As SI - End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Pneumatics + Public Interface IM4_AirCompressor + ''' <summary> + ''' Ratio of Gear or Pulley used to drive the compressor + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property PulleyGearRatio() As Double + + ''' <summary> + ''' Efficiency of the Pulley or Gear used to drive the compressor + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property PulleyGearEfficiency() As Double + + ''' <summary> + ''' Initialises the AirCompressor Class + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function Initialise() As Boolean + + ''' <summary> + ''' Returns the flow rate [litres/second] of compressor for the given engine rpm + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function GetFlowRate() As NormLiterPerSecond + + ''' <summary> + ''' Returns the power consumed for the given engine rpm when compressor is off + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function GetPowerCompressorOff() As Watt + + ''' <summary> + ''' Returns the power consumed for the given engine rpm when compressor is on + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function GetPowerCompressorOn() As Watt + + ''' <summary> + ''' Returns the difference in power between compressonr on and compressor off operation at the given engine rpm + ''' </summary> + ''' <returns>Single / Watts</returns> + ''' <remarks></remarks> + Function GetPowerDifference() As Watt + + ''' <summary> + ''' Returns Average PoweDemand PeCompressor UnitFlowRate + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Function GetAveragePowerDemandPerCompressorUnitFlowRate() As SI + End Interface End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb index eafc484e6a3e5616b24cfd0c0c132be6ef7c214f..cf0dcfea4c862fefac3792d16a262486366d5773 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticActuationsMAP.vb @@ -1,21 +1,21 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Namespace Pneumatics - Public Interface IPneumaticActuationsMAP - Function GetNumActuations(key As ActuationsKey) As Integer - - Function Initialise() As Boolean - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Namespace Pneumatics + Public Interface IPneumaticActuationsMAP + Function GetNumActuations(key As ActuationsKey) As Integer + + Function Initialise() As Boolean + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb index a3e8643fdc5aaaae06c0d93eba835b0e1b7a7351..1cd6931fc90c9a15ecd56b834f18cdc8eeb8cf20 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticUserInputsConfig.vb @@ -1,29 +1,29 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - - -Namespace Pneumatics - Public Interface IPneumaticUserInputsConfig - Property CompressorMap As String - Property CompressorGearEfficiency As Double - Property CompressorGearRatio As Double - Property ActuationsMap As String - Property SmartAirCompression As Boolean - Property SmartRegeneration As Boolean - Property RetarderBrake As Boolean - Property KneelingHeightMillimeters As Double - Property AirSuspensionControl As String 'mechanical or electrical - Property AdBlueDosing As String 'pnmeumatic or electric - Property Doors As String 'pneumatic or electric - End Interface -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + + +Namespace Pneumatics + Public Interface IPneumaticUserInputsConfig + Property CompressorMap As String + Property CompressorGearEfficiency As Double + Property CompressorGearRatio As Double + Property ActuationsMap As String + Property SmartAirCompression As Boolean + Property SmartRegeneration As Boolean + Property RetarderBrake As Boolean + Property KneelingHeightMillimeters As Double + Property AirSuspensionControl As String 'mechanical or electrical + Property AdBlueDosing As String 'pnmeumatic or electric + Property Doors As String 'pneumatic or electric + End Interface +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb index a5dc01da88c95dd3dd0f177e192cfc7b73b50ded..421f7c2c81d0cf67059e5b1ea44c05f8e19665cd 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/IPneumaticsAuxilliariesConfig.vb @@ -1,25 +1,25 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Public Interface IPneumaticsAuxilliariesConfig - Property OverrunUtilisationForCompressionFraction As Double - Property BrakingWithRetarderNIperKG As Double - Property BrakingNoRetarderNIperKG As Double - Property BreakingPerKneelingNIperKGinMM As Double - Property PerDoorOpeningNI As Double - Property PerStopBrakeActuationNIperKG As Double - Property AirControlledSuspensionNIperMinute As Double - Property AdBlueNIperMinute As Double - Property NonSmartRegenFractionTotalAirDemand As Double - Property SmartRegenFractionTotalAirDemand As Double - Property DeadVolumeLitres As Double - Property DeadVolBlowOutsPerLitresperHour As Double -End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Public Interface IPneumaticsAuxilliariesConfig + Property OverrunUtilisationForCompressionFraction As Double + Property BrakingWithRetarderNIperKG As Double + Property BrakingNoRetarderNIperKG As Double + Property BreakingPerKneelingNIperKGinMM As Double + Property PerDoorOpeningNI As Double + Property PerStopBrakeActuationNIperKG As Double + Property AirControlledSuspensionNIperMinute As Double + Property AdBlueNIperMinute As Double + Property NonSmartRegenFractionTotalAirDemand As Double + Property SmartRegenFractionTotalAirDemand As Double + Property DeadVolumeLitres As Double + Property DeadVolBlowOutsPerLitresperHour As Double +End Interface diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb index dea3a4e6b81a494ef0552ef294bb76d63e2f6345..7e5a23a3db4880e08019b78618cda70338501aa1 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/M3_AveragePneumaticLoadDemand.vb @@ -1,220 +1,220 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports TUGraz.VectoCommon.Utils -Imports VectoAuxiliaries.Pneumatics - -Namespace Pneumatics - Public Class M3_AveragePneumaticLoadDemand - Implements IM3_AveragePneumaticLoadDemand - - Private _pneumaticUserInputsConfig As IPneumaticUserInputsConfig - Private _pneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig - Private _pneumaticsActuationsMap As IPneumaticActuationsMAP - Private _pneumaticsCompressorFlowRateMap As ICompressorMap - Private _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond As SI - Private _vehicleMassKG As Kilogram - Private _cycleName As String - Private _cycleDurationMinutes As Double - Private _totalAirDemand As NormLiter - Private _signals As ISignals - - - Private ReadOnly Property Sum1 As NormLiterPerSecond - Get - Return _totalAirDemand / _signals.TotalCycleTimeSeconds.SI(Of Second)() - End Get - End Property - - Private ReadOnly Property Sum2 As Watt - Get - Return (Sum7.Value() / Sum6.Value() * Sum1.Value()).SI(Of Watt)() ' Watt / Nl/s * Nl/s = Watt - End Get - End Property - - Private ReadOnly Property Sum3 As Watt - Get - Return _ - Sum2 + - _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) - End Get - End Property - - Private ReadOnly Property Sum4 As Watt - Get - Return Sum3 * (1 / _pneumaticUserInputsConfig.CompressorGearEfficiency) - End Get - End Property - - 'Private ReadOnly Property Sum5 As Single - ' Get - ' 'NOT USED. - ' End Get - 'End Property - - Private ReadOnly Property Sum6 As NormLiterPerSecond - Get - Return _ - _pneumaticsCompressorFlowRateMap.GetFlowRate( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) / - 60 - End Get - End Property - - Private ReadOnly Property Sum7 As Watt - Get - - Dim pon As Watt = - _pneumaticsCompressorFlowRateMap.GetPowerCompressorOn( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) - Dim poff As Watt = - _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( - _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) - Dim diff As Watt = pon - poff - Return diff - End Get - End Property - - - Public ReadOnly Property TotalAirDemand As NormLiter - Get - Return _totalAirDemand - End Get - End Property - - - 'Constructors - Public Sub New( - ByRef pneumaticsUserInputConfig As IPneumaticUserInputsConfig, - ByRef pneumaticsAuxillariesConfig As IPneumaticsAuxilliariesConfig, - ByRef pneumaticsActuationsMap As IPneumaticActuationsMAP, - ByRef pneumaticsCompressorFlowRateMap As ICompressorMap, - vehicleMassKG As Kilogram, - cycleName As String, - signals As ISignals - ) - - - _pneumaticUserInputsConfig = pneumaticsUserInputConfig - _pneumaticAuxillariesConfig = pneumaticsAuxillariesConfig - _pneumaticsActuationsMap = pneumaticsActuationsMap - _pneumaticsCompressorFlowRateMap = pneumaticsCompressorFlowRateMap - _vehicleMassKG = vehicleMassKG - _cycleName = cycleName - _signals = signals - - - 'Total up the blow demands from compressor map - _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond = - (_pneumaticsCompressorFlowRateMap.GetAveragePowerDemandPerCompressorUnitFlowRate() / 60).SI() - - 'Calculate the Total Required Air Delivery Rate L / S - _totalAirDemand = TotalAirDemandCalculation() - End Sub - - - Private Function TotalAirDemandCalculation() As NormLiter - - 'These calculation are done directly from formulae provided from a supplied spreadsheet. - - Dim numActuationsPerCycle As Double - Dim airConsumptionPerActuationNI As Double - Dim TotalAirDemand As NormLiter - - 'Consumers - Dim Breaks As NormLiter - Dim ParkBrakesplus2Doors As NormLiter - Dim Kneeling As NormLiter - Dim AdBlue As NormLiter - Dim Regeneration As NormLiter - Dim DeadVolBlowOuts As NormLiter - Dim AirSuspension As NormLiter - - - '** Breaks ** - numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Brakes", _cycleName)) - '=IF(K10 = "yes", IF(COUNTBLANK(F33),G33,F33), IF(COUNTBLANK(F34),G34,F34))*K16 - airConsumptionPerActuationNI = - If _ - (_pneumaticUserInputsConfig.RetarderBrake, _pneumaticAuxillariesConfig.BrakingWithRetarderNIperKG, - _pneumaticAuxillariesConfig.BrakingNoRetarderNIperKG) - Breaks = (numActuationsPerCycle * airConsumptionPerActuationNI * _vehicleMassKG.Value()).SI(Of NormLiter)() - - '** ParkBrakesBreakplus2Doors ** Park break + 2 doors - numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Park brake + 2 doors", - _cycleName)) - '=SUM(IF(K14="electric",0,IF(COUNTBLANK(F36),G36,F36)),PRODUCT(K16*IF(COUNTBLANK(F37),G37,F37))) - airConsumptionPerActuationNI = - If(_pneumaticUserInputsConfig.Doors = "Electric", 0, _pneumaticAuxillariesConfig.PerDoorOpeningNI) - airConsumptionPerActuationNI += (_pneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG * _vehicleMassKG.Value()) - ParkBrakesplus2Doors = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() - - '** Kneeling ** - numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Kneeling", _cycleName)) - '=IF(COUNTBLANK(F35),G35,F35)*K11*K16 - airConsumptionPerActuationNI = _pneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM * _vehicleMassKG.Value() * - _pneumaticUserInputsConfig.KneelingHeightMillimeters - Kneeling = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() - - '** AdBlue ** - '=IF(K13="electric",0,G39*F54)- Supplied Spreadsheet - AdBlue = - If _ - (_pneumaticUserInputsConfig.AdBlueDosing = "Electric", 0, - _pneumaticAuxillariesConfig.AdBlueNIperMinute * (_signals.TotalCycleTimeSeconds / 60)).SI(Of NormLiter)() - - '** Regeneration ** - '=SUM(R6:R9)*IF(K9="yes",IF(COUNTBLANK(F41),G41,F41),IF(COUNTBLANK(F40),G40,F40)) - Supplied SpreadSheet - Regeneration = (Breaks + ParkBrakesplus2Doors + Kneeling + AdBlue) - Dim regenFraction As Double = - If(_pneumaticUserInputsConfig.SmartRegeneration, _pneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand, - _pneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand) - Regeneration = Regeneration * regenFraction - - '** DeadVolBlowOuts ** - '=IF(COUNTBLANK(F43),G43,F43)/(F54/60) - Supplied SpreadSheet - numActuationsPerCycle = _pneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour / - (60 / (_signals.TotalCycleTimeSeconds / 60)) - airConsumptionPerActuationNI = _pneumaticAuxillariesConfig.DeadVolumeLitres - DeadVolBlowOuts = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() - - '** AirSuspension ** - '=IF(K12="electrically",0,G38*F54) - Suplied Spreadsheet - AirSuspension = - If _ - (_pneumaticUserInputsConfig.AirSuspensionControl = "Electrically", 0, - _pneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute * _cycleDurationMinutes).SI(Of NormLiter)() - - '** Total Air Demand ** - TotalAirDemand = Breaks + ParkBrakesplus2Doors + Kneeling + AdBlue + Regeneration + DeadVolBlowOuts + AirSuspension - - - Return TotalAirDemand - End Function - - - 'Get Average Power Demand @ Crank From Pneumatics - Public Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt _ - Implements IM3_AveragePneumaticLoadDemand.GetAveragePowerDemandAtCrankFromPneumatics - - Return Sum4 - End Function - - 'Get Total Required Air Delivery Rate - Public Function AverageAirConsumedPerSecondLitre() As NormLiterPerSecond _ - Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre - - Return Sum1 - End Function - End Class -End Namespace - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports TUGraz.VectoCommon.Utils +Imports VectoAuxiliaries.Pneumatics + +Namespace Pneumatics + Public Class M3_AveragePneumaticLoadDemand + Implements IM3_AveragePneumaticLoadDemand + + Private _pneumaticUserInputsConfig As IPneumaticUserInputsConfig + Private _pneumaticAuxillariesConfig As IPneumaticsAuxilliariesConfig + Private _pneumaticsActuationsMap As IPneumaticActuationsMAP + Private _pneumaticsCompressorFlowRateMap As ICompressorMap + Private _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond As SI + Private _vehicleMassKG As Kilogram + Private _cycleName As String + Private _cycleDurationMinutes As Double + Private _totalAirDemand As NormLiter + Private _signals As ISignals + + + Private ReadOnly Property Sum1 As NormLiterPerSecond + Get + Return _totalAirDemand / _signals.TotalCycleTimeSeconds.SI(Of Second)() + End Get + End Property + + Private ReadOnly Property Sum2 As Watt + Get + Return (Sum7.Value() / Sum6.Value() * Sum1.Value()).SI(Of Watt)() ' Watt / Nl/s * Nl/s = Watt + End Get + End Property + + Private ReadOnly Property Sum3 As Watt + Get + Return _ + Sum2 + + _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) + End Get + End Property + + Private ReadOnly Property Sum4 As Watt + Get + Return Sum3 * (1 / _pneumaticUserInputsConfig.CompressorGearEfficiency) + End Get + End Property + + 'Private ReadOnly Property Sum5 As Single + ' Get + ' 'NOT USED. + ' End Get + 'End Property + + Private ReadOnly Property Sum6 As NormLiterPerSecond + Get + Return _ + _pneumaticsCompressorFlowRateMap.GetFlowRate( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) / + 60 + End Get + End Property + + Private ReadOnly Property Sum7 As Watt + Get + + Dim pon As Watt = + _pneumaticsCompressorFlowRateMap.GetPowerCompressorOn( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) + Dim poff As Watt = + _pneumaticsCompressorFlowRateMap.GetPowerCompressorOff( + _signals.EngineSpeed.AsRPM * _pneumaticUserInputsConfig.CompressorGearRatio) + Dim diff As Watt = pon - poff + Return diff + End Get + End Property + + + Public ReadOnly Property TotalAirDemand As NormLiter + Get + Return _totalAirDemand + End Get + End Property + + + 'Constructors + Public Sub New( + ByRef pneumaticsUserInputConfig As IPneumaticUserInputsConfig, + ByRef pneumaticsAuxillariesConfig As IPneumaticsAuxilliariesConfig, + ByRef pneumaticsActuationsMap As IPneumaticActuationsMAP, + ByRef pneumaticsCompressorFlowRateMap As ICompressorMap, + vehicleMassKG As Kilogram, + cycleName As String, + signals As ISignals + ) + + + _pneumaticUserInputsConfig = pneumaticsUserInputConfig + _pneumaticAuxillariesConfig = pneumaticsAuxillariesConfig + _pneumaticsActuationsMap = pneumaticsActuationsMap + _pneumaticsCompressorFlowRateMap = pneumaticsCompressorFlowRateMap + _vehicleMassKG = vehicleMassKG + _cycleName = cycleName + _signals = signals + + + 'Total up the blow demands from compressor map + _averagePowerDemandPerCompressorUnitFlowRateInWPerLitresPerSecond = + (_pneumaticsCompressorFlowRateMap.GetAveragePowerDemandPerCompressorUnitFlowRate() / 60).SI() + + 'Calculate the Total Required Air Delivery Rate L / S + _totalAirDemand = TotalAirDemandCalculation() + End Sub + + + Private Function TotalAirDemandCalculation() As NormLiter + + 'These calculation are done directly from formulae provided from a supplied spreadsheet. + + Dim numActuationsPerCycle As Double + Dim airConsumptionPerActuationNI As Double + Dim TotalAirDemand As NormLiter + + 'Consumers + Dim Breaks As NormLiter + Dim ParkBrakesplus2Doors As NormLiter + Dim Kneeling As NormLiter + Dim AdBlue As NormLiter + Dim Regeneration As NormLiter + Dim DeadVolBlowOuts As NormLiter + Dim AirSuspension As NormLiter + + + '** Breaks ** + numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Brakes", _cycleName)) + '=IF(K10 = "yes", IF(COUNTBLANK(F33),G33,F33), IF(COUNTBLANK(F34),G34,F34))*K16 + airConsumptionPerActuationNI = + If _ + (_pneumaticUserInputsConfig.RetarderBrake, _pneumaticAuxillariesConfig.BrakingWithRetarderNIperKG, + _pneumaticAuxillariesConfig.BrakingNoRetarderNIperKG) + Breaks = (numActuationsPerCycle * airConsumptionPerActuationNI * _vehicleMassKG.Value()).SI(Of NormLiter)() + + '** ParkBrakesBreakplus2Doors ** Park break + 2 doors + numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Park brake + 2 doors", + _cycleName)) + '=SUM(IF(K14="electric",0,IF(COUNTBLANK(F36),G36,F36)),PRODUCT(K16*IF(COUNTBLANK(F37),G37,F37))) + airConsumptionPerActuationNI = + If(_pneumaticUserInputsConfig.Doors = "Electric", 0, _pneumaticAuxillariesConfig.PerDoorOpeningNI) + airConsumptionPerActuationNI += (_pneumaticAuxillariesConfig.PerStopBrakeActuationNIperKG * _vehicleMassKG.Value()) + ParkBrakesplus2Doors = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() + + '** Kneeling ** + numActuationsPerCycle = _pneumaticsActuationsMap.GetNumActuations(New ActuationsKey("Kneeling", _cycleName)) + '=IF(COUNTBLANK(F35),G35,F35)*K11*K16 + airConsumptionPerActuationNI = _pneumaticAuxillariesConfig.BreakingPerKneelingNIperKGinMM * _vehicleMassKG.Value() * + _pneumaticUserInputsConfig.KneelingHeightMillimeters + Kneeling = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() + + '** AdBlue ** + '=IF(K13="electric",0,G39*F54)- Supplied Spreadsheet + AdBlue = + If _ + (_pneumaticUserInputsConfig.AdBlueDosing = "Electric", 0, + _pneumaticAuxillariesConfig.AdBlueNIperMinute * (_signals.TotalCycleTimeSeconds / 60)).SI(Of NormLiter)() + + '** Regeneration ** + '=SUM(R6:R9)*IF(K9="yes",IF(COUNTBLANK(F41),G41,F41),IF(COUNTBLANK(F40),G40,F40)) - Supplied SpreadSheet + Regeneration = (Breaks + ParkBrakesplus2Doors + Kneeling + AdBlue) + Dim regenFraction As Double = + If(_pneumaticUserInputsConfig.SmartRegeneration, _pneumaticAuxillariesConfig.SmartRegenFractionTotalAirDemand, + _pneumaticAuxillariesConfig.NonSmartRegenFractionTotalAirDemand) + Regeneration = Regeneration * regenFraction + + '** DeadVolBlowOuts ** + '=IF(COUNTBLANK(F43),G43,F43)/(F54/60) - Supplied SpreadSheet + numActuationsPerCycle = _pneumaticAuxillariesConfig.DeadVolBlowOutsPerLitresperHour / + (60 / (_signals.TotalCycleTimeSeconds / 60)) + airConsumptionPerActuationNI = _pneumaticAuxillariesConfig.DeadVolumeLitres + DeadVolBlowOuts = (numActuationsPerCycle * airConsumptionPerActuationNI).SI(Of NormLiter)() + + '** AirSuspension ** + '=IF(K12="electrically",0,G38*F54) - Suplied Spreadsheet + AirSuspension = + If _ + (_pneumaticUserInputsConfig.AirSuspensionControl = "Electrically", 0, + _pneumaticAuxillariesConfig.AirControlledSuspensionNIperMinute * _cycleDurationMinutes).SI(Of NormLiter)() + + '** Total Air Demand ** + TotalAirDemand = Breaks + ParkBrakesplus2Doors + Kneeling + AdBlue + Regeneration + DeadVolBlowOuts + AirSuspension + + + Return TotalAirDemand + End Function + + + 'Get Average Power Demand @ Crank From Pneumatics + Public Function GetAveragePowerDemandAtCrankFromPneumatics() As Watt _ + Implements IM3_AveragePneumaticLoadDemand.GetAveragePowerDemandAtCrankFromPneumatics + + Return Sum4 + End Function + + 'Get Total Required Air Delivery Rate + Public Function AverageAirConsumedPerSecondLitre() As NormLiterPerSecond _ + Implements IM3_AveragePneumaticLoadDemand.AverageAirConsumedPerSecondLitre + + Return Sum1 + End Function + End Class +End Namespace + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb index 8184910f54757e14c91a55b801abdad58b74e0aa..547aaf8b9ba1cb5247870fd9ac90463d8c352dbf 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/M4_AirCompressor.vb @@ -1,175 +1,175 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Namespace Pneumatics - Public Class M4_AirCompressor - Implements IM4_AirCompressor - - Private Const MinRatio As Double = 1 - Private Const MaxRatio As Double = 10 - Private Const MinEff As Double = 0 - Private Const MaxEff As Double = 1 - - Private _pulleyGearRatio As Double - Private _pulleyGearEfficiency As Double - Private _map As ICompressorMap - Private _signals As ISignals - - - ''' <summary> - ''' Ratio of Gear or Pulley used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property PulleyGearRatio() As Double Implements IM4_AirCompressor.PulleyGearRatio - Get - Return _pulleyGearRatio - End Get - Set(value As Double) - If (value < MinRatio OrElse value > MaxRatio) Then - Throw _ - New ArgumentOutOfRangeException("pulleyGearRatio", value, - String.Format("Invalid value, should be in the range {0} to {1}", MinRatio, MaxRatio)) - Else - _pulleyGearRatio = value - End If - End Set - End Property - - ''' <summary> - ''' Efficiency of the Pulley or Gear used to drive the compressor - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property PulleyGearEfficiency() As Double Implements IM4_AirCompressor.PulleyGearEfficiency - Get - Return _pulleyGearEfficiency - End Get - Set(value As Double) - If (value < MinEff OrElse value > MaxEff) Then - Throw _ - New ArgumentOutOfRangeException("pulleyGearEfficiency", value, - String.Format("Invalid value, should be in the range {0} to {1}", MinEff, MaxEff) - ) - Else - _pulleyGearEfficiency = value - End If - End Set - End Property - - - '''<summary> - ''' Creates a new instance of the AirCompressor Class - ''' </summary> - ''' <param name="map">map of compressor values against compressor rpm</param> - ''' <param name="pulleyGearRatio">Ratio of Pulley/Gear</param> - ''' <param name="pulleyGearEfficiency">Efficiency of Pulley/Gear</param> - ''' <remarks></remarks> - Public Sub New(ByVal map As ICompressorMap, ByRef pulleyGearRatio As Double, ByRef pulleyGearEfficiency As Double, - signals As ISignals) - - _map = map - _pulleyGearRatio = pulleyGearRatio - _pulleyGearEfficiency = pulleyGearEfficiency - _signals = signals - End Sub - - ''' <summary> - ''' Initialises the AirCompressor Class - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function Initialise() As Boolean Implements IM4_AirCompressor.Initialise - Return _map.Initialise() - End Function - - 'Queryable Compressor Methods - ' - 'Compressor ( Speed ) Flow Rate - 'Power @ Crank From Pnumatics compressor off ( A ) - 'Power @ Crank From Pnumatics compressor On ( B ) - 'Power Delta ( A ) vs ( B ) - - - 'Return Average Power Demand Per Compressor Unit Flow Rate - - - ''' <summary> - ''' Returns the flow rate [litres/second] of compressor for the given engine rpm - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetFlowRate() As NormLiterPerSecond Implements IM4_AirCompressor.GetFlowRate - Dim compressorRpm As Double = _signals.EngineSpeed.AsRPM * PulleyGearRatio - - ''Flow Rate in the map is Litres/min so divide by 60 to get Units per second. - Return _map.GetFlowRate(compressorRpm) / 60 - End Function - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is off - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetPowerCompressorOff() As Watt Implements IM4_AirCompressor.GetPowerCompressorOff - Return GetCompressorPower(False) - End Function - - ''' <summary> - ''' Returns the power consumed for the given engine rpm when compressor is on - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetPowerCompressorOn() As Watt Implements IM4_AirCompressor.GetPowerCompressorOn - Return GetCompressorPower(True) - End Function - - ''' <summary> - ''' Returns the difference in power between compressonr on and compressor off operation at the given engine rpm - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetPowerDifference() As Watt Implements IM4_AirCompressor.GetPowerDifference - Dim powerOn As Watt = GetPowerCompressorOn() - Dim powerOff As Watt = GetPowerCompressorOff() - Return powerOn - powerOff - End Function - - ''' <summary> - ''' Looks up the compressor power from the map at given engine speed - ''' </summary> - ''' <param name="compressorOn">Is compressor on</param> - ''' <returns></returns> - ''' <remarks></remarks> - Private Function GetCompressorPower(ByVal compressorOn As Boolean) As Watt - Dim compressorRpm As Double = _signals.EngineSpeed.AsRPM * PulleyGearRatio - If compressorOn Then - Return _map.GetPowerCompressorOn(compressorRpm) - Else - Return _map.GetPowerCompressorOff(compressorRpm) - End If - End Function - - ''' <summary> - ''' Aver - ''' </summary> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function GetAveragePowerDemandPerCompressorUnitFlowRate() As SI _ - Implements IM4_AirCompressor.GetAveragePowerDemandPerCompressorUnitFlowRate - - Return _map.GetAveragePowerDemandPerCompressorUnitFlowRate().SI() - End Function - End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Namespace Pneumatics + Public Class M4_AirCompressor + Implements IM4_AirCompressor + + Private Const MinRatio As Double = 1 + Private Const MaxRatio As Double = 10 + Private Const MinEff As Double = 0 + Private Const MaxEff As Double = 1 + + Private _pulleyGearRatio As Double + Private _pulleyGearEfficiency As Double + Private _map As ICompressorMap + Private _signals As ISignals + + + ''' <summary> + ''' Ratio of Gear or Pulley used to drive the compressor + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property PulleyGearRatio() As Double Implements IM4_AirCompressor.PulleyGearRatio + Get + Return _pulleyGearRatio + End Get + Set(value As Double) + If (value < MinRatio OrElse value > MaxRatio) Then + Throw _ + New ArgumentOutOfRangeException("pulleyGearRatio", value, + String.Format("Invalid value, should be in the range {0} to {1}", MinRatio, MaxRatio)) + Else + _pulleyGearRatio = value + End If + End Set + End Property + + ''' <summary> + ''' Efficiency of the Pulley or Gear used to drive the compressor + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property PulleyGearEfficiency() As Double Implements IM4_AirCompressor.PulleyGearEfficiency + Get + Return _pulleyGearEfficiency + End Get + Set(value As Double) + If (value < MinEff OrElse value > MaxEff) Then + Throw _ + New ArgumentOutOfRangeException("pulleyGearEfficiency", value, + String.Format("Invalid value, should be in the range {0} to {1}", MinEff, MaxEff) + ) + Else + _pulleyGearEfficiency = value + End If + End Set + End Property + + + '''<summary> + ''' Creates a new instance of the AirCompressor Class + ''' </summary> + ''' <param name="map">map of compressor values against compressor rpm</param> + ''' <param name="pulleyGearRatio">Ratio of Pulley/Gear</param> + ''' <param name="pulleyGearEfficiency">Efficiency of Pulley/Gear</param> + ''' <remarks></remarks> + Public Sub New(ByVal map As ICompressorMap, ByRef pulleyGearRatio As Double, ByRef pulleyGearEfficiency As Double, + signals As ISignals) + + _map = map + _pulleyGearRatio = pulleyGearRatio + _pulleyGearEfficiency = pulleyGearEfficiency + _signals = signals + End Sub + + ''' <summary> + ''' Initialises the AirCompressor Class + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function Initialise() As Boolean Implements IM4_AirCompressor.Initialise + Return _map.Initialise() + End Function + + 'Queryable Compressor Methods + ' + 'Compressor ( Speed ) Flow Rate + 'Power @ Crank From Pnumatics compressor off ( A ) + 'Power @ Crank From Pnumatics compressor On ( B ) + 'Power Delta ( A ) vs ( B ) + + + 'Return Average Power Demand Per Compressor Unit Flow Rate + + + ''' <summary> + ''' Returns the flow rate [litres/second] of compressor for the given engine rpm + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function GetFlowRate() As NormLiterPerSecond Implements IM4_AirCompressor.GetFlowRate + Dim compressorRpm As Double = _signals.EngineSpeed.AsRPM * PulleyGearRatio + + ''Flow Rate in the map is Litres/min so divide by 60 to get Units per second. + Return _map.GetFlowRate(compressorRpm) / 60 + End Function + + ''' <summary> + ''' Returns the power consumed for the given engine rpm when compressor is off + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function GetPowerCompressorOff() As Watt Implements IM4_AirCompressor.GetPowerCompressorOff + Return GetCompressorPower(False) + End Function + + ''' <summary> + ''' Returns the power consumed for the given engine rpm when compressor is on + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function GetPowerCompressorOn() As Watt Implements IM4_AirCompressor.GetPowerCompressorOn + Return GetCompressorPower(True) + End Function + + ''' <summary> + ''' Returns the difference in power between compressonr on and compressor off operation at the given engine rpm + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function GetPowerDifference() As Watt Implements IM4_AirCompressor.GetPowerDifference + Dim powerOn As Watt = GetPowerCompressorOn() + Dim powerOff As Watt = GetPowerCompressorOff() + Return powerOn - powerOff + End Function + + ''' <summary> + ''' Looks up the compressor power from the map at given engine speed + ''' </summary> + ''' <param name="compressorOn">Is compressor on</param> + ''' <returns></returns> + ''' <remarks></remarks> + Private Function GetCompressorPower(ByVal compressorOn As Boolean) As Watt + Dim compressorRpm As Double = _signals.EngineSpeed.AsRPM * PulleyGearRatio + If compressorOn Then + Return _map.GetPowerCompressorOn(compressorRpm) + Else + Return _map.GetPowerCompressorOff(compressorRpm) + End If + End Function + + ''' <summary> + ''' Aver + ''' </summary> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function GetAveragePowerDemandPerCompressorUnitFlowRate() As SI _ + Implements IM4_AirCompressor.GetAveragePowerDemandPerCompressorUnitFlowRate + + Return _map.GetAveragePowerDemandPerCompressorUnitFlowRate().SI() + End Function + End Class End Namespace \ No newline at end of file diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb index 714e6efb105aaf2fa1f6cc9e9b81aadc835df530..1af67ca9c9fef1f80875d1f52446778381c2793c 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticActuationsMap.vb @@ -1,101 +1,101 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports System.Globalization -Imports System.IO - -Namespace Pneumatics - Public Class PneumaticActuationsMAP - Implements IPneumaticActuationsMAP - - Private map As Dictionary(Of ActuationsKey, Integer) - Private filePath As String - - - Public Function GetNumActuations(key As ActuationsKey) As Integer Implements IPneumaticActuationsMAP.GetNumActuations - - If map Is Nothing OrElse Not map.ContainsKey(key) Then - Throw _ - New ArgumentException(String.Format("Pneumatic Actuations map does not contain the key '{0}'.", - key.CycleName & ":" & key.ConsumerName)) - End If - - Return map(key) - End Function - - - Public Sub New(filePath As String) - - Me.filePath = filePath - - If filePath.Trim.Length = 0 Then _ - Throw New ArgumentException("A filename for the Pneumatic Actuations Map has not been supplied") - - Initialise() - End Sub - - Public Function Initialise() As Boolean Implements IPneumaticActuationsMAP.Initialise - - Dim newKey As ActuationsKey - Dim numActuations As Integer - - If File.Exists(filePath) Then - Using sr As StreamReader = New StreamReader(filePath) - 'get array of lines from csv - Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), - StringSplitOptions.RemoveEmptyEntries) - - 'Must have at least 2 entries in map to make it usable [dont forget the header row] - If lines.Length < 3 Then _ - Throw _ - New ArgumentException("Pneumatic Actuations Map does not have sufficient rows in file to build a usable map") - - map = New Dictionary(Of ActuationsKey, Integer)() - Dim firstline As Boolean = True - - For Each line As String In lines - If Not firstline Then - 'split the line - Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) - '3 entries per line required - If (elements.Length <> 3) Then _ - Throw New ArgumentException("Pneumatic Actuations Map has Incorrect number of values in file") - - 'add values to map - - - If Not Integer.TryParse(elements(2), numActuations) Then - Throw New ArgumentException("Pneumatic Actuations Map Contains Non Integer values in actuations column") - End If - - 'Should throw exception if ConsumerName or CycleName are empty. - newKey = New ActuationsKey(elements(0).ToString(), elements(1).ToString()) - - map.Add(newKey, Integer.Parse(elements(2), CultureInfo.InvariantCulture)) - - Else - firstline = False - End If - Next - End Using - - - Else - Throw New ArgumentException(String.Format(" Pneumatic Acutations map '{0}' supplied does not exist", filePath)) - End If - - 'If we get here then all should be well and we can return a True value of success. - Return True - End Function - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports System.Globalization +Imports System.IO + +Namespace Pneumatics + Public Class PneumaticActuationsMAP + Implements IPneumaticActuationsMAP + + Private map As Dictionary(Of ActuationsKey, Integer) + Private filePath As String + + + Public Function GetNumActuations(key As ActuationsKey) As Integer Implements IPneumaticActuationsMAP.GetNumActuations + + If map Is Nothing OrElse Not map.ContainsKey(key) Then + Throw _ + New ArgumentException(String.Format("Pneumatic Actuations map does not contain the key '{0}'.", + key.CycleName & ":" & key.ConsumerName)) + End If + + Return map(key) + End Function + + + Public Sub New(filePath As String) + + Me.filePath = filePath + + If filePath.Trim.Length = 0 Then _ + Throw New ArgumentException("A filename for the Pneumatic Actuations Map has not been supplied") + + Initialise() + End Sub + + Public Function Initialise() As Boolean Implements IPneumaticActuationsMAP.Initialise + + Dim newKey As ActuationsKey + Dim numActuations As Integer + + If File.Exists(filePath) Then + Using sr As StreamReader = New StreamReader(filePath) + 'get array of lines from csv + Dim lines() As String = sr.ReadToEnd().Split(CType(Environment.NewLine, Char()), + StringSplitOptions.RemoveEmptyEntries) + + 'Must have at least 2 entries in map to make it usable [dont forget the header row] + If lines.Length < 3 Then _ + Throw _ + New ArgumentException("Pneumatic Actuations Map does not have sufficient rows in file to build a usable map") + + map = New Dictionary(Of ActuationsKey, Integer)() + Dim firstline As Boolean = True + + For Each line As String In lines + If Not firstline Then + 'split the line + Dim elements() As String = line.Split(New Char() {","c}, StringSplitOptions.RemoveEmptyEntries) + '3 entries per line required + If (elements.Length <> 3) Then _ + Throw New ArgumentException("Pneumatic Actuations Map has Incorrect number of values in file") + + 'add values to map + + + If Not Integer.TryParse(elements(2), numActuations) Then + Throw New ArgumentException("Pneumatic Actuations Map Contains Non Integer values in actuations column") + End If + + 'Should throw exception if ConsumerName or CycleName are empty. + newKey = New ActuationsKey(elements(0).ToString(), elements(1).ToString()) + + map.Add(newKey, Integer.Parse(elements(2), CultureInfo.InvariantCulture)) + + Else + firstline = False + End If + Next + End Using + + + Else + Throw New ArgumentException(String.Format(" Pneumatic Acutations map '{0}' supplied does not exist", filePath)) + End If + + 'If we get here then all should be well and we can return a True value of success. + Return True + End Function + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb index ece5e02a5eda3dd421ba374e4fc405c91045d549..47dc0fcca30340d40a4d1b9e2da647aaf705307e 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticUserInputsConfig.vb @@ -1,59 +1,59 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Pneumatics - Public Class PneumaticUserInputsConfig - Implements IPneumaticUserInputsConfig - - Public Property CompressorMap As String Implements IPneumaticUserInputsConfig.CompressorMap - Public Property CompressorGearRatio As Double Implements IPneumaticUserInputsConfig.CompressorGearRatio - Public Property CompressorGearEfficiency As Double Implements IPneumaticUserInputsConfig.CompressorGearEfficiency - - 'pnmeumatic or electric - Public Property AdBlueDosing As String Implements IPneumaticUserInputsConfig.AdBlueDosing - - 'mechanical or electrical - Public Property AirSuspensionControl As String Implements IPneumaticUserInputsConfig.AirSuspensionControl - - 'pneumatic or electric - Public Property Doors As String Implements IPneumaticUserInputsConfig.Doors - Public Property KneelingHeightMillimeters As Double Implements IPneumaticUserInputsConfig.KneelingHeightMillimeters - - 'PneumaticActuationsMap - Public Property ActuationsMap As String Implements IPneumaticUserInputsConfig.ActuationsMap - - Public Property RetarderBrake As Boolean Implements IPneumaticUserInputsConfig.RetarderBrake - Public Property SmartAirCompression As Boolean Implements IPneumaticUserInputsConfig.SmartAirCompression - Public Property SmartRegeneration As Boolean Implements IPneumaticUserInputsConfig.SmartRegeneration - - Public Sub New(Optional setToDefaults As Boolean = False) - - If setToDefaults Then SetPropertiesToDefaults() - End Sub - - Public Sub SetPropertiesToDefaults() - - CompressorMap = String.Empty - CompressorGearRatio = 1.0 - CompressorGearEfficiency = 0.97 - AdBlueDosing = "Pneumatic" - AirSuspensionControl = "Mechanically" - Doors = "Pneumatic" - KneelingHeightMillimeters = 70 - ActuationsMap = Nothing - RetarderBrake = True - SmartAirCompression = False - SmartRegeneration = False - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Pneumatics + Public Class PneumaticUserInputsConfig + Implements IPneumaticUserInputsConfig + + Public Property CompressorMap As String Implements IPneumaticUserInputsConfig.CompressorMap + Public Property CompressorGearRatio As Double Implements IPneumaticUserInputsConfig.CompressorGearRatio + Public Property CompressorGearEfficiency As Double Implements IPneumaticUserInputsConfig.CompressorGearEfficiency + + 'pnmeumatic or electric + Public Property AdBlueDosing As String Implements IPneumaticUserInputsConfig.AdBlueDosing + + 'mechanical or electrical + Public Property AirSuspensionControl As String Implements IPneumaticUserInputsConfig.AirSuspensionControl + + 'pneumatic or electric + Public Property Doors As String Implements IPneumaticUserInputsConfig.Doors + Public Property KneelingHeightMillimeters As Double Implements IPneumaticUserInputsConfig.KneelingHeightMillimeters + + 'PneumaticActuationsMap + Public Property ActuationsMap As String Implements IPneumaticUserInputsConfig.ActuationsMap + + Public Property RetarderBrake As Boolean Implements IPneumaticUserInputsConfig.RetarderBrake + Public Property SmartAirCompression As Boolean Implements IPneumaticUserInputsConfig.SmartAirCompression + Public Property SmartRegeneration As Boolean Implements IPneumaticUserInputsConfig.SmartRegeneration + + Public Sub New(Optional setToDefaults As Boolean = False) + + If setToDefaults Then SetPropertiesToDefaults() + End Sub + + Public Sub SetPropertiesToDefaults() + + CompressorMap = String.Empty + CompressorGearRatio = 1.0 + CompressorGearEfficiency = 0.97 + AdBlueDosing = "Pneumatic" + AirSuspensionControl = "Mechanically" + Doors = "Pneumatic" + KneelingHeightMillimeters = 70 + ActuationsMap = Nothing + RetarderBrake = True + SmartAirCompression = False + SmartRegeneration = False + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb index 5e4fc8d7d8d05bfd720c144c7d449a2eb381448e..43353ff6fbd9de0cfe598f64d834bfd2bd8614ef 100644 --- a/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb +++ b/VECTOAux/VectoAuxiliaries/Pneumatics/PneumaticsAuxilliariesConfig.vb @@ -1,71 +1,71 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Namespace Pneumatics - Public Class PneumaticsAuxilliariesConfig - Implements IPneumaticsAuxilliariesConfig - - Public Property AdBlueNIperMinute As Double Implements IPneumaticsAuxilliariesConfig.AdBlueNIperMinute - - Public Property AirControlledSuspensionNIperMinute As Double _ - Implements IPneumaticsAuxilliariesConfig.AirControlledSuspensionNIperMinute - - Public Property BrakingNoRetarderNIperKG As Double Implements IPneumaticsAuxilliariesConfig.BrakingNoRetarderNIperKG - - Public Property BrakingWithRetarderNIperKG As Double _ - Implements IPneumaticsAuxilliariesConfig.BrakingWithRetarderNIperKG - - Public Property BreakingPerKneelingNIperKGinMM As Double _ - Implements IPneumaticsAuxilliariesConfig.BreakingPerKneelingNIperKGinMM - - Public Property DeadVolBlowOutsPerLitresperHour As Double _ - Implements IPneumaticsAuxilliariesConfig.DeadVolBlowOutsPerLitresperHour - - Public Property DeadVolumeLitres As Double Implements IPneumaticsAuxilliariesConfig.DeadVolumeLitres - - Public Property NonSmartRegenFractionTotalAirDemand As Double _ - Implements IPneumaticsAuxilliariesConfig.NonSmartRegenFractionTotalAirDemand - - Public Property OverrunUtilisationForCompressionFraction As Double _ - Implements IPneumaticsAuxilliariesConfig.OverrunUtilisationForCompressionFraction - - Public Property PerDoorOpeningNI As Double Implements IPneumaticsAuxilliariesConfig.PerDoorOpeningNI - - Public Property PerStopBrakeActuationNIperKG As Double _ - Implements IPneumaticsAuxilliariesConfig.PerStopBrakeActuationNIperKG - - Public Property SmartRegenFractionTotalAirDemand As Double _ - Implements IPneumaticsAuxilliariesConfig.SmartRegenFractionTotalAirDemand - - - Public Sub New(Optional setToDefaults As Boolean = False) - - If setToDefaults Then SetDefaults() - End Sub - - Public Sub SetDefaults() - AdBlueNIperMinute = 21.25 - AirControlledSuspensionNIperMinute = 15 - BrakingNoRetarderNIperKG = 0.00081 - BrakingWithRetarderNIperKG = 0.0006 - BreakingPerKneelingNIperKGinMM = 0.000066 - DeadVolBlowOutsPerLitresperHour = 24 - DeadVolumeLitres = 30 - NonSmartRegenFractionTotalAirDemand = 0.26 - OverrunUtilisationForCompressionFraction = 0.97 - PerDoorOpeningNI = 12.7 - PerStopBrakeActuationNIperKG = 0.00064 - SmartRegenFractionTotalAirDemand = 0.12 - End Sub - End Class -End Namespace - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Namespace Pneumatics + Public Class PneumaticsAuxilliariesConfig + Implements IPneumaticsAuxilliariesConfig + + Public Property AdBlueNIperMinute As Double Implements IPneumaticsAuxilliariesConfig.AdBlueNIperMinute + + Public Property AirControlledSuspensionNIperMinute As Double _ + Implements IPneumaticsAuxilliariesConfig.AirControlledSuspensionNIperMinute + + Public Property BrakingNoRetarderNIperKG As Double Implements IPneumaticsAuxilliariesConfig.BrakingNoRetarderNIperKG + + Public Property BrakingWithRetarderNIperKG As Double _ + Implements IPneumaticsAuxilliariesConfig.BrakingWithRetarderNIperKG + + Public Property BreakingPerKneelingNIperKGinMM As Double _ + Implements IPneumaticsAuxilliariesConfig.BreakingPerKneelingNIperKGinMM + + Public Property DeadVolBlowOutsPerLitresperHour As Double _ + Implements IPneumaticsAuxilliariesConfig.DeadVolBlowOutsPerLitresperHour + + Public Property DeadVolumeLitres As Double Implements IPneumaticsAuxilliariesConfig.DeadVolumeLitres + + Public Property NonSmartRegenFractionTotalAirDemand As Double _ + Implements IPneumaticsAuxilliariesConfig.NonSmartRegenFractionTotalAirDemand + + Public Property OverrunUtilisationForCompressionFraction As Double _ + Implements IPneumaticsAuxilliariesConfig.OverrunUtilisationForCompressionFraction + + Public Property PerDoorOpeningNI As Double Implements IPneumaticsAuxilliariesConfig.PerDoorOpeningNI + + Public Property PerStopBrakeActuationNIperKG As Double _ + Implements IPneumaticsAuxilliariesConfig.PerStopBrakeActuationNIperKG + + Public Property SmartRegenFractionTotalAirDemand As Double _ + Implements IPneumaticsAuxilliariesConfig.SmartRegenFractionTotalAirDemand + + + Public Sub New(Optional setToDefaults As Boolean = False) + + If setToDefaults Then SetDefaults() + End Sub + + Public Sub SetDefaults() + AdBlueNIperMinute = 21.25 + AirControlledSuspensionNIperMinute = 15 + BrakingNoRetarderNIperKG = 0.00081 + BrakingWithRetarderNIperKG = 0.0006 + BreakingPerKneelingNIperKGinMM = 0.000066 + DeadVolBlowOutsPerLitresperHour = 24 + DeadVolumeLitres = 30 + NonSmartRegenFractionTotalAirDemand = 0.26 + OverrunUtilisationForCompressionFraction = 0.97 + PerDoorOpeningNI = 12.7 + PerStopBrakeActuationNIperKG = 0.00064 + SmartRegenFractionTotalAirDemand = 0.12 + End Sub + End Class +End Namespace + + diff --git a/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.designer.vb b/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.designer.vb index 5b263f08845832b7b9f455b429536095d1944e20..8a6eff270baae87c942111e9cb3a0377ec4627d4 100644 --- a/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.designer.vb +++ b/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.designer.vb @@ -1,446 +1,446 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ -Partial Class FB_Dialog - Inherits System.Windows.Forms.Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - <System.Diagnostics.DebuggerNonUserCode()> _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As System.ComponentModel.IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - <System.Diagnostics.DebuggerStepThrough()> _ - Private Sub InitializeComponent() - Me.components = New System.ComponentModel.Container() - Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FB_Dialog)) - Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() - Me.Label1 = New System.Windows.Forms.Label() - Me.ButtonNewDir = New System.Windows.Forms.Button() - Me.ButtonDesktop = New System.Windows.Forms.Button() - Me.ButtonHisFolder = New System.Windows.Forms.Button() - Me.ButtonFolderBack = New System.Windows.Forms.Button() - Me.TextBoxSearchFolder = New System.Windows.Forms.TextBox() - Me.ListViewFolder = New System.Windows.Forms.ListView() - Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) - Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) - Me.ComboBoxDrive = New System.Windows.Forms.ComboBox() - Me.Label5 = New System.Windows.Forms.Label() - Me.Label2 = New System.Windows.Forms.Label() - Me.ButtonAll = New System.Windows.Forms.Button() - Me.ComboBoxExt = New System.Windows.Forms.ComboBox() - Me.ButtonHisFile = New System.Windows.Forms.Button() - Me.TextBoxSearchFile = New System.Windows.Forms.TextBox() - Me.ListViewFiles = New System.Windows.Forms.ListView() - Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) - Me.ContextMenuFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.RenameFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.DeleteFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.TextBoxPath = New System.Windows.Forms.TextBox() - Me.ContextMenuHisFolder = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.ContextMenuHisFile = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.ButtonOK = New System.Windows.Forms.Button() - Me.ButtonCancel = New System.Windows.Forms.Button() - Me.TextBoxCurrent = New System.Windows.Forms.TextBox() - Me.Label3 = New System.Windows.Forms.Label() - Me.Label4 = New System.Windows.Forms.Label() - Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) - CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SplitContainer1.Panel1.SuspendLayout() - Me.SplitContainer1.Panel2.SuspendLayout() - Me.SplitContainer1.SuspendLayout() - Me.ContextMenuFile.SuspendLayout() - Me.SuspendLayout() - ' - 'SplitContainer1 - ' - Me.SplitContainer1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.SplitContainer1.Location = New System.Drawing.Point(0, 46) - Me.SplitContainer1.Name = "SplitContainer1" - ' - 'SplitContainer1.Panel1 - ' - Me.SplitContainer1.Panel1.Controls.Add(Me.Label1) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) - Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ListViewFolder) - Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxDrive) - ' - 'SplitContainer1.Panel2 - ' - Me.SplitContainer1.Panel2.Controls.Add(Me.Label5) - Me.SplitContainer1.Panel2.Controls.Add(Me.Label2) - Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonAll) - Me.SplitContainer1.Panel2.Controls.Add(Me.ComboBoxExt) - Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonHisFile) - Me.SplitContainer1.Panel2.Controls.Add(Me.TextBoxSearchFile) - Me.SplitContainer1.Panel2.Controls.Add(Me.ListViewFiles) - Me.SplitContainer1.Size = New System.Drawing.Size(734, 292) - Me.SplitContainer1.SplitterDistance = 365 - Me.SplitContainer1.TabIndex = 5 - Me.SplitContainer1.TabStop = False - ' - 'Label1 - ' - Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(3, 272) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(32, 13) - Me.Label1.TabIndex = 28 - Me.Label1.Text = "Filter:" - ' - 'ButtonNewDir - ' - Me.ButtonNewDir.Image = Global.VectoAuxiliaries.My.Resources.Resources.new_dir - Me.ButtonNewDir.Location = New System.Drawing.Point(139, 2) - Me.ButtonNewDir.Name = "ButtonNewDir" - Me.ButtonNewDir.Size = New System.Drawing.Size(24, 24) - Me.ButtonNewDir.TabIndex = 21 - Me.ButtonNewDir.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonNewDir, "Create new Directory") - Me.ButtonNewDir.UseVisualStyleBackColor = True - ' - 'ButtonDesktop - ' - Me.ButtonDesktop.Image = Global.VectoAuxiliaries.My.Resources.Resources.desktop - Me.ButtonDesktop.Location = New System.Drawing.Point(86, 2) - Me.ButtonDesktop.Name = "ButtonDesktop" - Me.ButtonDesktop.Size = New System.Drawing.Size(24, 24) - Me.ButtonDesktop.TabIndex = 22 - Me.ButtonDesktop.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonDesktop, "Go to Desktop") - Me.ButtonDesktop.UseVisualStyleBackColor = True - ' - 'ButtonHisFolder - ' - Me.ButtonHisFolder.Image = Global.VectoAuxiliaries.My.Resources.Resources.favorites - Me.ButtonHisFolder.Location = New System.Drawing.Point(112, 2) - Me.ButtonHisFolder.Name = "ButtonHisFolder" - Me.ButtonHisFolder.Size = New System.Drawing.Size(24, 24) - Me.ButtonHisFolder.TabIndex = 24 - Me.ButtonHisFolder.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonHisFolder, "Select from recent directories / favorites") - Me.ButtonHisFolder.UseVisualStyleBackColor = True - ' - 'ButtonFolderBack - ' - Me.ButtonFolderBack.Image = CType(resources.GetObject("ButtonFolderBack.Image"), System.Drawing.Image) - Me.ButtonFolderBack.Location = New System.Drawing.Point(60, 2) - Me.ButtonFolderBack.Name = "ButtonFolderBack" - Me.ButtonFolderBack.Size = New System.Drawing.Size(24, 24) - Me.ButtonFolderBack.TabIndex = 20 - Me.ButtonFolderBack.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonFolderBack, "Move up one directory level") - Me.ButtonFolderBack.UseVisualStyleBackColor = True - ' - 'TextBoxSearchFolder - ' - Me.TextBoxSearchFolder.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxSearchFolder.Location = New System.Drawing.Point(37, 269) - Me.TextBoxSearchFolder.Name = "TextBoxSearchFolder" - Me.TextBoxSearchFolder.Size = New System.Drawing.Size(328, 20) - Me.TextBoxSearchFolder.TabIndex = 15 - ' - 'ListViewFolder - ' - Me.ListViewFolder.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ListViewFolder.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader3}) - Me.ListViewFolder.FullRowSelect = True - Me.ListViewFolder.GridLines = True - Me.ListViewFolder.HideSelection = False - Me.ListViewFolder.Location = New System.Drawing.Point(-2, 27) - Me.ListViewFolder.MultiSelect = False - Me.ListViewFolder.Name = "ListViewFolder" - Me.ListViewFolder.Size = New System.Drawing.Size(367, 241) - Me.ListViewFolder.SmallImageList = Me.ImageList1 - Me.ListViewFolder.TabIndex = 10 - Me.ListViewFolder.UseCompatibleStateImageBehavior = False - Me.ListViewFolder.View = System.Windows.Forms.View.Details - ' - 'ColumnHeader3 - ' - Me.ColumnHeader3.Text = "Sub-Directories:" - Me.ColumnHeader3.Width = 368 - ' - 'ImageList1 - ' - Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit - Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) - Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent - ' - 'ComboBoxDrive - ' - Me.ComboBoxDrive.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.ComboBoxDrive.FormattingEnabled = True - Me.ComboBoxDrive.Location = New System.Drawing.Point(3, 3) - Me.ComboBoxDrive.Name = "ComboBoxDrive" - Me.ComboBoxDrive.Size = New System.Drawing.Size(54, 21) - Me.ComboBoxDrive.TabIndex = 5 - ' - 'Label5 - ' - Me.Label5.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(295, 272) - Me.Label5.Name = "Label5" - Me.Label5.Size = New System.Drawing.Size(10, 13) - Me.Label5.TabIndex = 30 - Me.Label5.Text = "." - ' - 'Label2 - ' - Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(3, 272) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(32, 13) - Me.Label2.TabIndex = 29 - Me.Label2.Text = "Filter:" - ' - 'ButtonAll - ' - Me.ButtonAll.Location = New System.Drawing.Point(25, 2) - Me.ButtonAll.Name = "ButtonAll" - Me.ButtonAll.Size = New System.Drawing.Size(71, 24) - Me.ButtonAll.TabIndex = 19 - Me.ButtonAll.Text = "Select All" - Me.ToolTip1.SetToolTip(Me.ButtonAll, "Select All Files") - Me.ButtonAll.UseVisualStyleBackColor = True - ' - 'ComboBoxExt - ' - Me.ComboBoxExt.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ComboBoxExt.FormattingEnabled = True - Me.ComboBoxExt.Location = New System.Drawing.Point(307, 269) - Me.ComboBoxExt.Name = "ComboBoxExt" - Me.ComboBoxExt.Size = New System.Drawing.Size(57, 21) - Me.ComboBoxExt.TabIndex = 20 - ' - 'ButtonHisFile - ' - Me.ButtonHisFile.Image = Global.VectoAuxiliaries.My.Resources.Resources.file_history - Me.ButtonHisFile.Location = New System.Drawing.Point(-1, 2) - Me.ButtonHisFile.Name = "ButtonHisFile" - Me.ButtonHisFile.Size = New System.Drawing.Size(24, 24) - Me.ButtonHisFile.TabIndex = 24 - Me.ButtonHisFile.TabStop = False - Me.ToolTip1.SetToolTip(Me.ButtonHisFile, "Select from recent files") - Me.ButtonHisFile.UseVisualStyleBackColor = True - ' - 'TextBoxSearchFile - ' - Me.TextBoxSearchFile.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxSearchFile.Location = New System.Drawing.Point(36, 269) - Me.TextBoxSearchFile.Name = "TextBoxSearchFile" - Me.TextBoxSearchFile.Size = New System.Drawing.Size(257, 20) - Me.TextBoxSearchFile.TabIndex = 15 - ' - 'ListViewFiles - ' - Me.ListViewFiles.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ListViewFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1}) - Me.ListViewFiles.ContextMenuStrip = Me.ContextMenuFile - Me.ListViewFiles.FullRowSelect = True - Me.ListViewFiles.GridLines = True - Me.ListViewFiles.HideSelection = False - Me.ListViewFiles.Location = New System.Drawing.Point(0, 27) - Me.ListViewFiles.Name = "ListViewFiles" - Me.ListViewFiles.Size = New System.Drawing.Size(367, 241) - Me.ListViewFiles.SmallImageList = Me.ImageList1 - Me.ListViewFiles.TabIndex = 10 - Me.ListViewFiles.UseCompatibleStateImageBehavior = False - Me.ListViewFiles.View = System.Windows.Forms.View.Details - ' - 'ColumnHeader1 - ' - Me.ColumnHeader1.Text = "Files:" - Me.ColumnHeader1.Width = 367 - ' - 'ContextMenuFile - ' - Me.ContextMenuFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) - Me.ContextMenuFile.Name = "ContextMenuFile" - Me.ContextMenuFile.Size = New System.Drawing.Size(148, 48) - ' - 'RenameFileToolStripMenuItem - ' - Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" - Me.RenameFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) - Me.RenameFileToolStripMenuItem.Text = "Rename File..." - ' - 'DeleteFileToolStripMenuItem - ' - Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" - Me.DeleteFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) - Me.DeleteFileToolStripMenuItem.Text = "Delete File..." - ' - 'TextBoxPath - ' - Me.TextBoxPath.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxPath.Location = New System.Drawing.Point(47, 354) - Me.TextBoxPath.Name = "TextBoxPath" - Me.TextBoxPath.Size = New System.Drawing.Size(680, 20) - Me.TextBoxPath.TabIndex = 15 - ' - 'ContextMenuHisFolder - ' - Me.ContextMenuHisFolder.Name = "ContextMenuFolderHis" - Me.ContextMenuHisFolder.Size = New System.Drawing.Size(61, 4) - ' - 'ContextMenuHisFile - ' - Me.ContextMenuHisFile.Name = "ContextMenuFileHis" - Me.ContextMenuHisFile.Size = New System.Drawing.Size(61, 4) - ' - 'ButtonOK - ' - Me.ButtonOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonOK.DialogResult = System.Windows.Forms.DialogResult.OK - Me.ButtonOK.Location = New System.Drawing.Point(574, 383) - Me.ButtonOK.Name = "ButtonOK" - Me.ButtonOK.Size = New System.Drawing.Size(75, 23) - Me.ButtonOK.TabIndex = 20 - Me.ButtonOK.TabStop = False - Me.ButtonOK.Text = "OK" - Me.ButtonOK.UseVisualStyleBackColor = True - ' - 'ButtonCancel - ' - Me.ButtonCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.ButtonCancel.Location = New System.Drawing.Point(652, 383) - Me.ButtonCancel.Name = "ButtonCancel" - Me.ButtonCancel.Size = New System.Drawing.Size(75, 23) - Me.ButtonCancel.TabIndex = 25 - Me.ButtonCancel.TabStop = False - Me.ButtonCancel.Text = "Cancel" - Me.ButtonCancel.UseVisualStyleBackColor = True - ' - 'TextBoxCurrent - ' - Me.TextBoxCurrent.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TextBoxCurrent.Cursor = System.Windows.Forms.Cursors.Hand - Me.TextBoxCurrent.Location = New System.Drawing.Point(5, 17) - Me.TextBoxCurrent.Name = "TextBoxCurrent" - Me.TextBoxCurrent.ReadOnly = True - Me.TextBoxCurrent.Size = New System.Drawing.Size(722, 20) - Me.TextBoxCurrent.TabIndex = 0 - Me.TextBoxCurrent.TabStop = False - ' - 'Label3 - ' - Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) - Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(5, 357) - Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(38, 13) - Me.Label3.TabIndex = 29 - Me.Label3.Text = "Name:" - ' - 'Label4 - ' - Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(4, 3) - Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(89, 13) - Me.Label4.TabIndex = 30 - Me.Label4.Text = "Current Directory:" - ' - 'FB_Dialog - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.CancelButton = Me.ButtonCancel - Me.ClientSize = New System.Drawing.Size(734, 412) - Me.Controls.Add(Me.Label4) - Me.Controls.Add(Me.Label3) - Me.Controls.Add(Me.TextBoxCurrent) - Me.Controls.Add(Me.ButtonCancel) - Me.Controls.Add(Me.ButtonOK) - Me.Controls.Add(Me.TextBoxPath) - Me.Controls.Add(Me.SplitContainer1) - Me.MinimizeBox = False - Me.MinimumSize = New System.Drawing.Size(341, 272) - Me.Name = "FB_Dialog" - Me.ShowIcon = False - Me.ShowInTaskbar = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "File Browser" - Me.SplitContainer1.Panel1.ResumeLayout(False) - Me.SplitContainer1.Panel1.PerformLayout() - Me.SplitContainer1.Panel2.ResumeLayout(False) - Me.SplitContainer1.Panel2.PerformLayout() - CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() - Me.SplitContainer1.ResumeLayout(False) - Me.ContextMenuFile.ResumeLayout(False) - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer - Friend WithEvents ComboBoxDrive As System.Windows.Forms.ComboBox - Friend WithEvents ListViewFolder As System.Windows.Forms.ListView - Friend WithEvents ListViewFiles As System.Windows.Forms.ListView - Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader - Friend WithEvents TextBoxSearchFolder As System.Windows.Forms.TextBox - Friend WithEvents TextBoxPath As System.Windows.Forms.TextBox - Friend WithEvents ButtonFolderBack As System.Windows.Forms.Button - Friend WithEvents ContextMenuHisFolder As System.Windows.Forms.ContextMenuStrip - Friend WithEvents ContextMenuHisFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents ButtonHisFolder As System.Windows.Forms.Button - Friend WithEvents ButtonHisFile As System.Windows.Forms.Button - Friend WithEvents ButtonOK As System.Windows.Forms.Button - Friend WithEvents ButtonCancel As System.Windows.Forms.Button - Friend WithEvents TextBoxCurrent As System.Windows.Forms.TextBox - Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader - Friend WithEvents ButtonDesktop As System.Windows.Forms.Button - Friend WithEvents ContextMenuFile As System.Windows.Forms.ContextMenuStrip - Friend WithEvents RenameFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents DeleteFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem - Friend WithEvents ButtonNewDir As System.Windows.Forms.Button - Friend WithEvents ButtonAll As System.Windows.Forms.Button - Friend WithEvents Label1 As System.Windows.Forms.Label - Friend WithEvents Label3 As System.Windows.Forms.Label - Friend WithEvents Label4 As System.Windows.Forms.Label - Friend WithEvents ImageList1 As System.Windows.Forms.ImageList - Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip - Friend WithEvents Label5 As System.Windows.Forms.Label - Friend WithEvents Label2 As System.Windows.Forms.Label - Friend WithEvents ComboBoxExt As System.Windows.Forms.ComboBox - Friend WithEvents TextBoxSearchFile As System.Windows.Forms.TextBox - -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ +Partial Class FB_Dialog + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <System.Diagnostics.DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <System.Diagnostics.DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() + Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FB_Dialog)) + Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() + Me.Label1 = New System.Windows.Forms.Label() + Me.ButtonNewDir = New System.Windows.Forms.Button() + Me.ButtonDesktop = New System.Windows.Forms.Button() + Me.ButtonHisFolder = New System.Windows.Forms.Button() + Me.ButtonFolderBack = New System.Windows.Forms.Button() + Me.TextBoxSearchFolder = New System.Windows.Forms.TextBox() + Me.ListViewFolder = New System.Windows.Forms.ListView() + Me.ColumnHeader3 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components) + Me.ComboBoxDrive = New System.Windows.Forms.ComboBox() + Me.Label5 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.ButtonAll = New System.Windows.Forms.Button() + Me.ComboBoxExt = New System.Windows.Forms.ComboBox() + Me.ButtonHisFile = New System.Windows.Forms.Button() + Me.TextBoxSearchFile = New System.Windows.Forms.TextBox() + Me.ListViewFiles = New System.Windows.Forms.ListView() + Me.ColumnHeader1 = CType(New System.Windows.Forms.ColumnHeader(), System.Windows.Forms.ColumnHeader) + Me.ContextMenuFile = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.RenameFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.DeleteFileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() + Me.TextBoxPath = New System.Windows.Forms.TextBox() + Me.ContextMenuHisFolder = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ContextMenuHisFile = New System.Windows.Forms.ContextMenuStrip(Me.components) + Me.ButtonOK = New System.Windows.Forms.Button() + Me.ButtonCancel = New System.Windows.Forms.Button() + Me.TextBoxCurrent = New System.Windows.Forms.TextBox() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) + CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SplitContainer1.Panel1.SuspendLayout() + Me.SplitContainer1.Panel2.SuspendLayout() + Me.SplitContainer1.SuspendLayout() + Me.ContextMenuFile.SuspendLayout() + Me.SuspendLayout() + ' + 'SplitContainer1 + ' + Me.SplitContainer1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.SplitContainer1.Location = New System.Drawing.Point(0, 46) + Me.SplitContainer1.Name = "SplitContainer1" + ' + 'SplitContainer1.Panel1 + ' + Me.SplitContainer1.Panel1.Controls.Add(Me.Label1) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonNewDir) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonDesktop) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonHisFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ButtonFolderBack) + Me.SplitContainer1.Panel1.Controls.Add(Me.TextBoxSearchFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ListViewFolder) + Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxDrive) + ' + 'SplitContainer1.Panel2 + ' + Me.SplitContainer1.Panel2.Controls.Add(Me.Label5) + Me.SplitContainer1.Panel2.Controls.Add(Me.Label2) + Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonAll) + Me.SplitContainer1.Panel2.Controls.Add(Me.ComboBoxExt) + Me.SplitContainer1.Panel2.Controls.Add(Me.ButtonHisFile) + Me.SplitContainer1.Panel2.Controls.Add(Me.TextBoxSearchFile) + Me.SplitContainer1.Panel2.Controls.Add(Me.ListViewFiles) + Me.SplitContainer1.Size = New System.Drawing.Size(734, 292) + Me.SplitContainer1.SplitterDistance = 365 + Me.SplitContainer1.TabIndex = 5 + Me.SplitContainer1.TabStop = False + ' + 'Label1 + ' + Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(3, 272) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(32, 13) + Me.Label1.TabIndex = 28 + Me.Label1.Text = "Filter:" + ' + 'ButtonNewDir + ' + Me.ButtonNewDir.Image = Global.VectoAuxiliaries.My.Resources.Resources.new_dir + Me.ButtonNewDir.Location = New System.Drawing.Point(139, 2) + Me.ButtonNewDir.Name = "ButtonNewDir" + Me.ButtonNewDir.Size = New System.Drawing.Size(24, 24) + Me.ButtonNewDir.TabIndex = 21 + Me.ButtonNewDir.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonNewDir, "Create new Directory") + Me.ButtonNewDir.UseVisualStyleBackColor = True + ' + 'ButtonDesktop + ' + Me.ButtonDesktop.Image = Global.VectoAuxiliaries.My.Resources.Resources.desktop + Me.ButtonDesktop.Location = New System.Drawing.Point(86, 2) + Me.ButtonDesktop.Name = "ButtonDesktop" + Me.ButtonDesktop.Size = New System.Drawing.Size(24, 24) + Me.ButtonDesktop.TabIndex = 22 + Me.ButtonDesktop.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonDesktop, "Go to Desktop") + Me.ButtonDesktop.UseVisualStyleBackColor = True + ' + 'ButtonHisFolder + ' + Me.ButtonHisFolder.Image = Global.VectoAuxiliaries.My.Resources.Resources.favorites + Me.ButtonHisFolder.Location = New System.Drawing.Point(112, 2) + Me.ButtonHisFolder.Name = "ButtonHisFolder" + Me.ButtonHisFolder.Size = New System.Drawing.Size(24, 24) + Me.ButtonHisFolder.TabIndex = 24 + Me.ButtonHisFolder.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonHisFolder, "Select from recent directories / favorites") + Me.ButtonHisFolder.UseVisualStyleBackColor = True + ' + 'ButtonFolderBack + ' + Me.ButtonFolderBack.Image = CType(resources.GetObject("ButtonFolderBack.Image"), System.Drawing.Image) + Me.ButtonFolderBack.Location = New System.Drawing.Point(60, 2) + Me.ButtonFolderBack.Name = "ButtonFolderBack" + Me.ButtonFolderBack.Size = New System.Drawing.Size(24, 24) + Me.ButtonFolderBack.TabIndex = 20 + Me.ButtonFolderBack.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonFolderBack, "Move up one directory level") + Me.ButtonFolderBack.UseVisualStyleBackColor = True + ' + 'TextBoxSearchFolder + ' + Me.TextBoxSearchFolder.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxSearchFolder.Location = New System.Drawing.Point(37, 269) + Me.TextBoxSearchFolder.Name = "TextBoxSearchFolder" + Me.TextBoxSearchFolder.Size = New System.Drawing.Size(328, 20) + Me.TextBoxSearchFolder.TabIndex = 15 + ' + 'ListViewFolder + ' + Me.ListViewFolder.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ListViewFolder.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader3}) + Me.ListViewFolder.FullRowSelect = True + Me.ListViewFolder.GridLines = True + Me.ListViewFolder.HideSelection = False + Me.ListViewFolder.Location = New System.Drawing.Point(-2, 27) + Me.ListViewFolder.MultiSelect = False + Me.ListViewFolder.Name = "ListViewFolder" + Me.ListViewFolder.Size = New System.Drawing.Size(367, 241) + Me.ListViewFolder.SmallImageList = Me.ImageList1 + Me.ListViewFolder.TabIndex = 10 + Me.ListViewFolder.UseCompatibleStateImageBehavior = False + Me.ListViewFolder.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader3 + ' + Me.ColumnHeader3.Text = "Sub-Directories:" + Me.ColumnHeader3.Width = 368 + ' + 'ImageList1 + ' + Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit + Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16) + Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent + ' + 'ComboBoxDrive + ' + Me.ComboBoxDrive.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.ComboBoxDrive.FormattingEnabled = True + Me.ComboBoxDrive.Location = New System.Drawing.Point(3, 3) + Me.ComboBoxDrive.Name = "ComboBoxDrive" + Me.ComboBoxDrive.Size = New System.Drawing.Size(54, 21) + Me.ComboBoxDrive.TabIndex = 5 + ' + 'Label5 + ' + Me.Label5.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(295, 272) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(10, 13) + Me.Label5.TabIndex = 30 + Me.Label5.Text = "." + ' + 'Label2 + ' + Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(3, 272) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(32, 13) + Me.Label2.TabIndex = 29 + Me.Label2.Text = "Filter:" + ' + 'ButtonAll + ' + Me.ButtonAll.Location = New System.Drawing.Point(25, 2) + Me.ButtonAll.Name = "ButtonAll" + Me.ButtonAll.Size = New System.Drawing.Size(71, 24) + Me.ButtonAll.TabIndex = 19 + Me.ButtonAll.Text = "Select All" + Me.ToolTip1.SetToolTip(Me.ButtonAll, "Select All Files") + Me.ButtonAll.UseVisualStyleBackColor = True + ' + 'ComboBoxExt + ' + Me.ComboBoxExt.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ComboBoxExt.FormattingEnabled = True + Me.ComboBoxExt.Location = New System.Drawing.Point(307, 269) + Me.ComboBoxExt.Name = "ComboBoxExt" + Me.ComboBoxExt.Size = New System.Drawing.Size(57, 21) + Me.ComboBoxExt.TabIndex = 20 + ' + 'ButtonHisFile + ' + Me.ButtonHisFile.Image = Global.VectoAuxiliaries.My.Resources.Resources.file_history + Me.ButtonHisFile.Location = New System.Drawing.Point(-1, 2) + Me.ButtonHisFile.Name = "ButtonHisFile" + Me.ButtonHisFile.Size = New System.Drawing.Size(24, 24) + Me.ButtonHisFile.TabIndex = 24 + Me.ButtonHisFile.TabStop = False + Me.ToolTip1.SetToolTip(Me.ButtonHisFile, "Select from recent files") + Me.ButtonHisFile.UseVisualStyleBackColor = True + ' + 'TextBoxSearchFile + ' + Me.TextBoxSearchFile.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxSearchFile.Location = New System.Drawing.Point(36, 269) + Me.TextBoxSearchFile.Name = "TextBoxSearchFile" + Me.TextBoxSearchFile.Size = New System.Drawing.Size(257, 20) + Me.TextBoxSearchFile.TabIndex = 15 + ' + 'ListViewFiles + ' + Me.ListViewFiles.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ListViewFiles.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ColumnHeader1}) + Me.ListViewFiles.ContextMenuStrip = Me.ContextMenuFile + Me.ListViewFiles.FullRowSelect = True + Me.ListViewFiles.GridLines = True + Me.ListViewFiles.HideSelection = False + Me.ListViewFiles.Location = New System.Drawing.Point(0, 27) + Me.ListViewFiles.Name = "ListViewFiles" + Me.ListViewFiles.Size = New System.Drawing.Size(367, 241) + Me.ListViewFiles.SmallImageList = Me.ImageList1 + Me.ListViewFiles.TabIndex = 10 + Me.ListViewFiles.UseCompatibleStateImageBehavior = False + Me.ListViewFiles.View = System.Windows.Forms.View.Details + ' + 'ColumnHeader1 + ' + Me.ColumnHeader1.Text = "Files:" + Me.ColumnHeader1.Width = 367 + ' + 'ContextMenuFile + ' + Me.ContextMenuFile.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.RenameFileToolStripMenuItem, Me.DeleteFileToolStripMenuItem}) + Me.ContextMenuFile.Name = "ContextMenuFile" + Me.ContextMenuFile.Size = New System.Drawing.Size(148, 48) + ' + 'RenameFileToolStripMenuItem + ' + Me.RenameFileToolStripMenuItem.Name = "RenameFileToolStripMenuItem" + Me.RenameFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) + Me.RenameFileToolStripMenuItem.Text = "Rename File..." + ' + 'DeleteFileToolStripMenuItem + ' + Me.DeleteFileToolStripMenuItem.Name = "DeleteFileToolStripMenuItem" + Me.DeleteFileToolStripMenuItem.Size = New System.Drawing.Size(147, 22) + Me.DeleteFileToolStripMenuItem.Text = "Delete File..." + ' + 'TextBoxPath + ' + Me.TextBoxPath.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxPath.Location = New System.Drawing.Point(47, 354) + Me.TextBoxPath.Name = "TextBoxPath" + Me.TextBoxPath.Size = New System.Drawing.Size(680, 20) + Me.TextBoxPath.TabIndex = 15 + ' + 'ContextMenuHisFolder + ' + Me.ContextMenuHisFolder.Name = "ContextMenuFolderHis" + Me.ContextMenuHisFolder.Size = New System.Drawing.Size(61, 4) + ' + 'ContextMenuHisFile + ' + Me.ContextMenuHisFile.Name = "ContextMenuFileHis" + Me.ContextMenuHisFile.Size = New System.Drawing.Size(61, 4) + ' + 'ButtonOK + ' + Me.ButtonOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonOK.DialogResult = System.Windows.Forms.DialogResult.OK + Me.ButtonOK.Location = New System.Drawing.Point(574, 383) + Me.ButtonOK.Name = "ButtonOK" + Me.ButtonOK.Size = New System.Drawing.Size(75, 23) + Me.ButtonOK.TabIndex = 20 + Me.ButtonOK.TabStop = False + Me.ButtonOK.Text = "OK" + Me.ButtonOK.UseVisualStyleBackColor = True + ' + 'ButtonCancel + ' + Me.ButtonCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ButtonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.ButtonCancel.Location = New System.Drawing.Point(652, 383) + Me.ButtonCancel.Name = "ButtonCancel" + Me.ButtonCancel.Size = New System.Drawing.Size(75, 23) + Me.ButtonCancel.TabIndex = 25 + Me.ButtonCancel.TabStop = False + Me.ButtonCancel.Text = "Cancel" + Me.ButtonCancel.UseVisualStyleBackColor = True + ' + 'TextBoxCurrent + ' + Me.TextBoxCurrent.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TextBoxCurrent.Cursor = System.Windows.Forms.Cursors.Hand + Me.TextBoxCurrent.Location = New System.Drawing.Point(5, 17) + Me.TextBoxCurrent.Name = "TextBoxCurrent" + Me.TextBoxCurrent.ReadOnly = True + Me.TextBoxCurrent.Size = New System.Drawing.Size(722, 20) + Me.TextBoxCurrent.TabIndex = 0 + Me.TextBoxCurrent.TabStop = False + ' + 'Label3 + ' + Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(5, 357) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(38, 13) + Me.Label3.TabIndex = 29 + Me.Label3.Text = "Name:" + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(4, 3) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(89, 13) + Me.Label4.TabIndex = 30 + Me.Label4.Text = "Current Directory:" + ' + 'FB_Dialog + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.CancelButton = Me.ButtonCancel + Me.ClientSize = New System.Drawing.Size(734, 412) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.TextBoxCurrent) + Me.Controls.Add(Me.ButtonCancel) + Me.Controls.Add(Me.ButtonOK) + Me.Controls.Add(Me.TextBoxPath) + Me.Controls.Add(Me.SplitContainer1) + Me.MinimizeBox = False + Me.MinimumSize = New System.Drawing.Size(341, 272) + Me.Name = "FB_Dialog" + Me.ShowIcon = False + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "File Browser" + Me.SplitContainer1.Panel1.ResumeLayout(False) + Me.SplitContainer1.Panel1.PerformLayout() + Me.SplitContainer1.Panel2.ResumeLayout(False) + Me.SplitContainer1.Panel2.PerformLayout() + CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() + Me.SplitContainer1.ResumeLayout(False) + Me.ContextMenuFile.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer + Friend WithEvents ComboBoxDrive As System.Windows.Forms.ComboBox + Friend WithEvents ListViewFolder As System.Windows.Forms.ListView + Friend WithEvents ListViewFiles As System.Windows.Forms.ListView + Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader + Friend WithEvents TextBoxSearchFolder As System.Windows.Forms.TextBox + Friend WithEvents TextBoxPath As System.Windows.Forms.TextBox + Friend WithEvents ButtonFolderBack As System.Windows.Forms.Button + Friend WithEvents ContextMenuHisFolder As System.Windows.Forms.ContextMenuStrip + Friend WithEvents ContextMenuHisFile As System.Windows.Forms.ContextMenuStrip + Friend WithEvents ButtonHisFolder As System.Windows.Forms.Button + Friend WithEvents ButtonHisFile As System.Windows.Forms.Button + Friend WithEvents ButtonOK As System.Windows.Forms.Button + Friend WithEvents ButtonCancel As System.Windows.Forms.Button + Friend WithEvents TextBoxCurrent As System.Windows.Forms.TextBox + Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader + Friend WithEvents ButtonDesktop As System.Windows.Forms.Button + Friend WithEvents ContextMenuFile As System.Windows.Forms.ContextMenuStrip + Friend WithEvents RenameFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents DeleteFileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem + Friend WithEvents ButtonNewDir As System.Windows.Forms.Button + Friend WithEvents ButtonAll As System.Windows.Forms.Button + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents Label4 As System.Windows.Forms.Label + Friend WithEvents ImageList1 As System.Windows.Forms.ImageList + Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip + Friend WithEvents Label5 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents ComboBoxExt As System.Windows.Forms.ComboBox + Friend WithEvents TextBoxSearchFile As System.Windows.Forms.TextBox + +End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.vb b/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.vb index 771eee79ac5d800c7a6c3fc381bd465c5f7a4202..3256310fbbe0ea77b3fa7d5bcdee0b2b0e68acf7 100644 --- a/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.vb +++ b/VECTOAux/VectoAuxiliaries/UI/FB_Dialog.vb @@ -1,960 +1,960 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Option Infer On -Option Explicit On -Option Strict On - -Imports System.Drawing -Imports System.IO -Imports System.Text -Imports Microsoft.VisualBasic.FileIO -Imports System.Runtime.InteropServices -Imports System.Windows.Forms - -''' <summary> -''' File Browser dialog. Entirely controlled by cFilebrowser class. -''' </summary> -Public Class FB_Dialog - Private _myFolder As String - Private _myFiles() As String - Private _myDrive As String - Private _updateLock As Boolean - Private _initialized As Boolean - Private _myId As String - Private _myExt() As String - Private _lastFile As String - Private _bFileMustExist As Boolean - Private _bOverwriteCheck As Boolean - Private _bMultiFiles As Boolean - Private _noExt As Boolean - Private _bBrowseFolder As Boolean - Private _bForceExt As Boolean - Private _extListSingle As ArrayList - Private _extListMulti As ArrayList - Private _lastExt As String - Private ReadOnly _bLightMode As Boolean - - Private Const FavText As String = "Edit Favorites..." - Private Const EmptyText As String = " " - Private Const NoFavString As String = "<undefined>" - - 'New - Public Sub New(lightMode As Boolean) - ' This call is required by the Windows Form Designer. - InitializeComponent() - ' Append any initialization after the InitializeComponent() call. - _myId = "Default" - _updateLock = False - _initialized = False - _myFolder = "" - _myDrive = "" - _lastFile = "" - _bOverwriteCheck = False - _bFileMustExist = False - _bMultiFiles = False - _noExt = True - _bBrowseFolder = False - _bLightMode = LightMode - ButtonHisFile.Enabled = Not _bLightMode - End Sub - - 'Resize - Private Sub FB_Dialog_Resize(sender As Object, e As EventArgs) Handles Me.ResizeEnd - Resized() - End Sub - - 'Shown - Private Sub FileBrowser_Shown(sender As Object, e As EventArgs) Handles Me.Shown - Resized() - TextBoxPath.Focus() - TextBoxPath.SelectAll() - End Sub - - 'Resized ListView Format - Private Sub Resized() - 'To autosize to the width of the column heading, set the Width property to -2 - ListViewFolder.Columns(0).Width = -2 - 'ListViewFolder.Columns(0).Width -= 1 - ListViewFiles.Columns(0).Width = -2 - 'ListViewFiles.Columns(0).Width -= 1 - End Sub - - 'SplitterMoved - Private Sub SplitContainer1_SplitterMoved(sender As Object, e As SplitterEventArgs) _ - Handles SplitContainer1.SplitterMoved - If _initialized Then Resized() - End Sub - - 'Closing (Overwrite-Check etc) - Private Sub FileBrowser_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing - Dim x As Int32 - Dim path As String - Dim ext As String - Dim hasExt As Boolean - If DialogResult = DialogResult.OK Then - If _bBrowseFolder Then - path = Trim(TextBoxPath.Text) - 'If empty path: use the Current-folder(MyFolder) - If path = "" Then - path = _myFolder - Else - If Mid(path, 2, 1) <> ":" Then path = _myFolder & path - End If - If Not Directory.Exists(path) Then - MsgBox("Directory " & path & " does not exist!", MsgBoxStyle.Critical) - e.Cancel = True - Exit Sub - End If - If Microsoft.VisualBasic.Right(path, 1) <> "\" Then path &= "\" - ReDim _myFiles(0) - _myFiles(0) = path - Else - 'Stop if empty path - If Trim(TextBoxPath.Text) = "" Then - e.Cancel = True - Exit Sub - End If - _lastExt = Trim(ComboBoxExt.Text) - 'Assume Files in array - If Microsoft.VisualBasic.Left(TextBoxPath.Text, 1) = "<" And ListViewFiles.SelectedItems.Count > 0 Then - 'Multiple files selected - ReDim _myFiles(ListViewFiles.SelectedItems.Count - 1) - x = -1 - For Each lv0 As ListViewItem In ListViewFiles.Items - If lv0.Selected Then - x += 1 - _myFiles(x) = _myFolder & lv0.SubItems(0).Text - End If - Next - _bMultiFiles = True - Else - 'Single File - path = Trim(TextBoxPath.Text) - 'Primary extension (eg for bForceExt) - ext = Trim(ComboBoxExt.Text.Split(","c)(0)) - 'If file without path then append path - - - If Mid(path, 2, 1) <> ":" Then path = _myFolder & path - 'If instead of File a Folder is entered: Switch to Folder and Abort - If Directory.Exists(path) Then - SetFolder(path) - e.Cancel = True - Exit Sub - End If - 'Force Extension - If _bForceExt Then - If UCase(IO.Path.GetExtension(path)) <> "." & UCase(ext) Then path &= "." & ext - hasExt = True - Else - 'Check whether specified a File with Ext - hasExt = (Microsoft.VisualBasic.Len(IO.Path.GetExtension(path)) > 1) - End If - 'If File without Extension (after bForceExt question) and it does not exist, then add primary Extension - If Not hasExt Then - If ext <> "*" And ext <> "" Then - If Not File.Exists(path) Then path &= "." & ext - End If - End If - 'Check that File exists - If File.Exists(path) Then - 'Yes: when bOverwriteCheck, check for Overwrite - If _bOverwriteCheck Then - If MsgBox("Overwrite " & path & " ?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then - e.Cancel = True - Exit Sub - End If - End If - Else - 'No: abort if bFileMustExist - If _bFileMustExist Then - MsgBox("The file " & path & " does not exist!", MsgBoxStyle.Critical) - e.Cancel = True - Exit Sub - End If - End If - 'Define MyFiles - ReDim _myFiles(0) - _myFiles(0) = path - _bMultiFiles = False - End If - End If - End If - End Sub - - 'Browse - Custom Dialog - Public Function Browse(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, extMode As tFbExtMode, - multiFile As Boolean, ext As String, title As String) As Boolean - If Not _initialized Then Init() - - 'Load Folder History ContextMenu - For x = 0 To 9 - ContextMenuHisFolder.Items(x).Text = FB_FolderHistory(x) - Next - For x = 10 To 19 - ContextMenuHisFolder.Items(x + 1).Text = FB_FolderHistory(x) - Next - - 'Options - _bOverwriteCheck = overwriteCheck - _bFileMustExist = fileMustExist - _bForceExt = (extMode = tFbExtMode.ForceExt) - - 'Form Config - ListViewFiles.MultiSelect = multiFile - ButtonAll.Visible = multiFile - Me.Title = title - Text = title - - 'Ext-Combobox - ComboBoxExt.Items.Clear() - If _noExt Then - ComboBoxExt.Items.Add("*") - ComboBoxExt.SelectedIndex = 0 - Else - Select Case extMode - Case tFbExtMode.ForceExt - If ext = "" Then ext = _extListSingle(0).ToString - ComboBoxExt.Items.AddRange(_extListSingle.ToArray) - ComboBoxExt.Text = ext - ComboBoxExt.Enabled = False - Case tFbExtMode.MultiExt, tFbExtMode.SingleExt - If extMode = tFbExtMode.MultiExt Then - ComboBoxExt.Items.AddRange(_extListMulti.ToArray) - Else - ComboBoxExt.Items.AddRange(_extListSingle.ToArray) - End If - If ext <> "" Then - ComboBoxExt.Text = ext - Else - ComboBoxExt.Text = _lastExt - End If - ComboBoxExt.Enabled = True - End Select - End If - - - 'Define Path - ' If no path is specified: Last folder, no file name - If path = "" Then path = FB_FolderHistory(0) - - ' If path-length too small (Path is invalid): Last File - If path.Length < 2 Then path = _lastFile - - 'Open Folder - If no folder in the path: Last folder - If fPATH(path) = "" Then - 'If given a file without path - If Trim(FB_FolderHistory(0)) = "" Then - SetFolder("C:\") - Else - SetFolder(FB_FolderHistory(0)) - End If - Else - '...Otherwise: - SetFolder(fPATH(path)) - End If - If _bBrowseFolder Then - FolderUp() - TextBoxPath.Text = path - Else - TextBoxPath.Text = IO.Path.GetFileName(path) - End If - - 'Show form ------------------------------------------------ ---- - ShowDialog() - If DialogResult = DialogResult.OK Then - 'File / Folder History - If _bMultiFiles Then - _lastFile = _myFolder - UpdateHisFolder(_myFolder) - Else - _lastFile = _myFiles(0) - UpdateHisFolder(fPATH(_lastFile)) - If Not _bBrowseFolder Then UpdateHisFile(_lastFile) - End If - 'Update Global History Folder - For x = 0 To 9 - FB_FolderHistory(x) = ContextMenuHisFolder.Items(x).Text - Next - For x = 10 To 19 - FB_FolderHistory(x) = ContextMenuHisFolder.Items(x + 1).Text - Next - Return True - Else - Return False - End If - End Function - - Public Title As String - - 'Close and save File / Folder History - Public Sub SaveAndClose() - 'Folder History - If FB_Init Then - Try - Dim f = My.Computer.FileSystem.OpenTextFileWriter(FB_FilHisDir & "Directories.txt", False, Encoding.UTF8) - For x = 0 To 19 - f.WriteLine(FB_FolderHistory(x)) - Next - f.Close() - f.Dispose() - Catch ex As Exception - End Try - FB_Init = False - End If - 'File History - If _initialized And Not _bLightMode Then - If Not _bBrowseFolder Then - Try - Dim f = My.Computer.FileSystem.OpenTextFileWriter(FB_FilHisDir & _myId & ".txt", False, Encoding.UTF8) - For x = 0 To 9 - f.WriteLine(ContextMenuHisFile.Items(x).Text) - Next - f.Close() - f.Dispose() - Catch ex As Exception - End Try - End If - _initialized = False - End If - - 'Close - Close() - End Sub - - 'Switching to FolderBrowser - Public Sub SetFolderBrowser() - If _initialized Then Exit Sub - - _bBrowseFolder = True - Width = 500 - ListViewFiles.Enabled = False - ButtonHisFile.Enabled = False - TextBoxSearchFile.Enabled = False - SplitContainer1.Panel2Collapsed = True - Text = "Directory Browser" - End Sub - - 'Initialize - Private Sub Init() - _updateLock = True - - 'Initialization for Global File Browser - If Not FB_Init Then GlobalInit() - - 'Load Drive ComboBox - For x = 0 To UBound(FB_Drives) - ComboBoxDrive.Items.Add(FB_Drives(x)) - Next - - 'FolderHistory ContextMenu - ContextMenuHisFolder.Items.Clear() - For x = 0 To 9 - ContextMenuHisFolder.Items.Add("") - Next - ContextMenuHisFolder.Items.Add("-") - For x = 10 To 19 - ContextMenuHisFolder.Items.Add("") - Next - ContextMenuHisFolder.Items.Add("-") - ContextMenuHisFolder.Items.Add(FavText) - - 'FileHistory ContextMenu - If _bBrowseFolder Then - _lastFile = FB_FolderHistory(0) - ElseIf Not _bLightMode Then - For x = 0 To 9 - ContextMenuHisFile.Items.Add("") - Next - If File.Exists(FB_FilHisDir & _myId & ".txt") Then - Dim f = New StreamReader(FB_FilHisDir & _myId & ".txt") - Dim x = -1 - Do While Not f.EndOfStream And x < 9 - x += 1 - Dim line = f.ReadLine - ContextMenuHisFile.Items(x).Text = line - If x = 0 Then _lastFile = line - Loop - f.Close() - f.Dispose() - End If - End If - - 'Extension-ComboBox - If Not _noExt Then - _extListSingle = New ArrayList - _extListMulti = New ArrayList - For x = 0 To UBound(_myExt) - _extListMulti.Add(_myExt(x)) - _extListSingle.AddRange(_myExt(x).Split(","c)) - Next - _extListMulti.Add("*") - _extListSingle.Add("*") - End If - - _initialized = True - _updateLock = False - End Sub - - Private Sub GlobalInit() - - 'Create Drive List - ReDim FB_Drives(UBound(Directory.GetLogicalDrives())) - Dim x = -1 - For Each drive In Directory.GetLogicalDrives() - x += 1 - FB_Drives(x) = Microsoft.VisualBasic.Left(drive, 2) - Next - - 'Read Folder History - For x = 0 To 19 - FB_FolderHistory(x) = EmptyText - Next - If File.Exists(FB_FilHisDir & "Directories.txt") Then - Dim f = New StreamReader(FB_FilHisDir & "Directories.txt") - x = -1 - Do While Not f.EndOfStream And x < 19 - x += 1 - FB_FolderHistory(x) = f.ReadLine() - Loop - f.Dispose() - f.Close() - End If - - FB_Init = True - End Sub - - 'ComboBoxDrive_SelectedIndexChanged - Private Sub ComboBoxDrive_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles ComboBoxDrive.SelectedIndexChanged - If Not _updateLock Then SetFolder(ComboBoxDrive.SelectedItem.ToString) - End Sub - - - 'ButtonFolderBack_Click - Private Sub ButtonFolderBack_Click(sender As Object, e As EventArgs) Handles ButtonFolderBack.Click - FolderUp() - End Sub - - 'TextBoxPath_KeyDown (ENTER) - Private Sub TextBoxPath_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxPath.KeyDown - If e.KeyCode = Keys.Enter Then - Dim path = TextBoxPath.Text - If Directory.Exists(path) Then - If _bBrowseFolder Then - DialogResult = DialogResult.OK - Close() - Else - SetFolder(path) - End If - Else - DialogResult = DialogResult.OK - Close() - End If - End If - End Sub - - 'ListViewFolder_SelectedIndexChanged - Private Sub ListViewFolder_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles ListViewFolder.SelectedIndexChanged - If _bBrowseFolder Then - _updateLock = True - If ListViewFolder.SelectedItems.Count > 0 Then - TextBoxPath.Text = ListViewFolder.SelectedItems.Item(0).Text & "\" - End If - _updateLock = False - End If - End Sub - - 'ListViewFolder_MouseDoubleClick - Private Sub ListViewFolder_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ - Handles ListViewFolder.MouseDoubleClick - If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub - SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) - End Sub - - 'ListViewFolder_KeyDown - Private Sub ListViewFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFolder.KeyDown - If e.KeyCode = Keys.Enter Then - If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub - SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) - End If - End Sub - - 'ListViewFiles_SelectedIndexChanged - Private Sub ListViewFiles_SelectedIndexChanged(sender As Object, e As EventArgs) _ - Handles ListViewFiles.SelectedIndexChanged - _updateLock = True - If ListViewFiles.SelectedItems.Count = 0 Then - TextBoxPath.Text = "" - Else - If ListViewFiles.SelectedItems.Count > 1 Then - TextBoxPath.Text = "<" & ListViewFiles.SelectedItems.Count & " Files selected>" - Else - TextBoxPath.Text = ListViewFiles.SelectedItems.Item(0).Text - TextBoxPath.SelectionStart = TextBoxPath.Text.Length - End If - End If - _updateLock = False - End Sub - - 'ListViewFiles_MouseDoubleClick - Private Sub ListViewFiles_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ - Handles ListViewFiles.MouseDoubleClick - If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub - - DialogResult = DialogResult.OK - Close() - End Sub - - 'ListViewFiles_KeyDown - Private Sub ListViewFiles_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFiles.KeyDown - If e.KeyCode = Keys.Enter Then - If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub - DialogResult = DialogResult.OK - Close() - End If - End Sub - - 'TextBoxSearchFolder_KeyDown - Private Sub TextBoxSearchFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFolder.KeyDown - Dim itemCount = ListViewFolder.Items.Count - Dim noItem = (itemCount = 0) - - Dim selIndex As Integer - If Not noItem Then - If ListViewFolder.SelectedItems.Count = 0 Then - selIndex = -1 - Else - selIndex = ListViewFolder.SelectedIndices(0) - End If - End If - Select Case e.KeyCode - Case Keys.Enter - If noItem Then Exit Sub - If ListViewFolder.SelectedItems.Count = 0 Then ListViewFolder.SelectedIndices.Add(0) - SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) - Case Keys.Up - If Not noItem Then - If selIndex < 1 Then - selIndex = 1 - Else - ListViewFolder.Items(selIndex).Selected = False - End If - ListViewFolder.Items(selIndex - 1).Selected = True - ListViewFolder.Items(selIndex - 1).EnsureVisible() - End If - Case Keys.Down - If Not noItem And selIndex < itemCount - 1 Then - If Not selIndex = -1 Then ListViewFolder.Items(selIndex).Selected = False - ListViewFolder.Items(selIndex + 1).Selected = True - ListViewFolder.Items(selIndex + 1).EnsureVisible() - End If - Case Keys.Back - If TextBoxSearchFolder.Text = "" Then FolderUp() - End Select - End Sub - - 'TextBoxSearchFolder_TextChanged - Private Sub TextBoxSearchFolder_TextChanged(sender As Object, e As EventArgs) Handles TextBoxSearchFolder.TextChanged - If Not _updateLock Then LoadListFolder() - End Sub - - 'TextBoxSearchFile_KeyDown - Private Sub TextBoxSearchFile_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFile.KeyDown - Dim selIndex As Integer - - Dim itemCount = ListViewFiles.Items.Count - Dim noItem = (itemCount = 0) - If Not noItem Then - If ListViewFiles.SelectedItems.Count = 0 Then - selIndex = -1 - Else - selIndex = ListViewFiles.SelectedIndices(0) - End If - End If - Select Case e.KeyCode - Case Keys.Enter - If noItem Then Exit Sub - If ListViewFiles.SelectedItems.Count = 0 Then ListViewFiles.SelectedIndices.Add(0) - DialogResult = DialogResult.OK - Close() - Case Keys.Up - If Not noItem Then - If selIndex < 1 Then - selIndex = 1 - Else - ListViewFiles.Items(selIndex).Selected = False - End If - ListViewFiles.Items(selIndex - 1).Selected = True - ListViewFiles.Items(selIndex - 1).EnsureVisible() - End If - Case Keys.Down - If Not noItem And selIndex < itemCount - 1 Then - If Not selIndex = -1 Then ListViewFiles.Items(selIndex).Selected = False - ListViewFiles.Items(selIndex + 1).Selected = True - ListViewFiles.Items(selIndex + 1).EnsureVisible() - End If - End Select - End Sub - - Private Sub TextBoxSearchFile_TextChanged(sender As Object, e As EventArgs) _ - Handles TextBoxSearchFile.TextChanged, ComboBoxExt.TextChanged - If Not _updateLock Then LoadListFiles() - End Sub - - Private Sub ButtonHisFolder_Click(sender As Object, e As EventArgs) Handles ButtonHisFolder.Click - ContextMenuHisFolder.Show(MousePosition) - End Sub - - - Private Sub ButtonHisFile_Click(sender As Object, e As EventArgs) Handles ButtonHisFile.Click - ContextMenuHisFile.Show(MousePosition) - End Sub - - Private Sub ButtonAll_Click(sender As Object, e As EventArgs) Handles ButtonAll.Click - ListViewFiles.BeginUpdate() - For i = 0 To ListViewFiles.Items.Count - 1 - ListViewFiles.Items(i).Selected = True - Next - ListViewFiles.EndUpdate() - End Sub - - Private Sub ContextMenuHisFile_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ - Handles ContextMenuHisFile.ItemClicked - Dim path = e.ClickedItem.Text.ToString - If path = EmptyText Then Exit Sub - SetFolder(fPATH(path)) - TextBoxPath.Text = IO.Path.GetFileName(path) - End Sub - - Private Sub ContextMenuHisFolder_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ - Handles ContextMenuHisFolder.ItemClicked - - Dim path = e.ClickedItem.Text.ToString - - If path = EmptyText Then Exit Sub - - If path = FavText Then - Dim favdlog = New FB_FavDlog - If favdlog.ShowDialog(Me) = DialogResult.OK Then - For x As Integer = 10 To 19 - path = CType(favdlog.ListBox1.Items(x - 10), String) - If path = NoFavString Then - FB_FolderHistory(x) = EmptyText - Else - FB_FolderHistory(x) = path - End If - ContextMenuHisFolder.Items(x + 1).Text = FB_FolderHistory(x) - Next - End If - Else - SetFolder(path) - End If - End Sub - - Private Sub TextBoxCurrent_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBoxCurrent.MouseClick - Dim newpath = "" - Dim x = TextBoxCurrent.SelectionStart - Dim path = TextBoxCurrent.Text - Dim x1 = path.Length - If x = x1 Then Exit Sub - If x < 4 Then - SetFolder(Microsoft.VisualBasic.Left(path, 2)) - Exit Sub - End If - Do While x1 > x - newpath = path - 'path = Microsoft.VisualBasic.Left(path, x1 - 1) - path = Microsoft.VisualBasic.Left(path, path.LastIndexOf("\")) - x1 = path.Length - Loop - SetFolder(newpath) - End Sub - - Private Sub ButtonDesktop_Click(sender As Object, e As EventArgs) Handles ButtonDesktop.Click - SetFolder(SpecialDirectories.Desktop.ToString) - End Sub - - Private Sub UpdateHisFile(path As String) - If _bLightMode Then Exit Sub - - Dim x As Integer - For x = 0 To 8 - If UCase(ContextMenuHisFile.Items(x).Text.ToString) = UCase(path) Then Exit For - Next - For y = x To 1 Step -1 - ContextMenuHisFile.Items(y).Text = ContextMenuHisFile.Items(y - 1).Text - Next - ContextMenuHisFile.Items(0).Text = path - End Sub - - Private Sub UpdateHisFolder(path As String) - Dim x As Integer - For x = 0 To 8 - If UCase(ContextMenuHisFolder.Items(x).Text.ToString) = UCase(path) Then Exit For - Next - For y = x To 1 Step -1 - ContextMenuHisFolder.Items(y).Text = ContextMenuHisFolder.Items(y - 1).Text - Next - ContextMenuHisFolder.Items(0).Text = path - End Sub - - Public Sub UpdateHistory(path As String) - If Not _initialized Then Init() - UpdateHisFile(path) - path = fPATH(path) - Dim x As Integer - For x = 0 To 8 - If UCase(FB_FolderHistory(x)) = UCase(path) Then Exit For - Next - For y = x To 1 Step -1 - FB_FolderHistory(y) = FB_FolderHistory(y - 1) - Next - FB_FolderHistory(0) = path - End Sub - - 'Change folder - Private Sub SetFolder(path As String) - - 'Abort if no drive specified - If Mid(path, 2, 1) <> ":" Then Exit Sub - - _updateLock = True - - 'Delete Search-fields - TextBoxSearchFile.Text = "" - TextBoxSearchFolder.Text = "" - - 'Set Drive - If _myDrive <> Microsoft.VisualBasic.Left(path, 2) Then - _myDrive = UCase(Microsoft.VisualBasic.Left(path, 2)) - ComboBoxDrive.SelectedItem = _myDrive - End If - - 'Set Folder - _myFolder = path - If Microsoft.VisualBasic.Right(_myFolder, 1) <> "\" Then _myFolder &= "\" - - Me.Text = Me.Title & " " & _myFolder - - LoadListFolder() - LoadListFiles() - - If _bBrowseFolder Then TextBoxPath.Text = "" - - TextBoxCurrent.Text = _myFolder - - 'TextBoxPath.SelectionStart = TextBoxPath.Text.Length - _updateLock = False - End Sub - - 'Folder one level up - Private Sub FolderUp() - If _myFolder <> "" Then - Dim path = Microsoft.VisualBasic.Left(_myFolder, _myFolder.Length - 1) - Dim x = path.LastIndexOf("\") - If x > 0 Then SetFolder(Microsoft.VisualBasic.Left(path, x)) - End If - End Sub - - - Private Structure SHFILEINFO - Public hIcon As IntPtr ' : icon - Public iIcon As Integer ' : icondex - Public dwAttributes As Integer ' : SFGAO_ flags - <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDisplayName As String - <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public szTypeName As String - End Structure - - Private Const SHGFI_ICON = &H100 - Private Const SHGFI_SMALLICON = &H1 - Private Declare Ansi Function SHGetFileInfo Lib "shell32.dll" (pszPath As String, dwFileAttributes As Integer, - ByRef psfi As SHFILEINFO, cbFileInfo As Integer, uFlags As Integer) As IntPtr - - 'Load Folder-List - Private Sub LoadListFolder() - 'Delete Folder-List - ListViewFolder.Items.Clear() - Dim searchPat = "*" & TextBoxSearchFolder.Text & "*" - Try - 'Add Folder - Dim di As New DirectoryInfo(_myFolder) - Dim aryFi = di.GetDirectories(searchPat) - ImageList1.Images.Clear() - Dim shinfo = New SHFILEINFO() - shinfo.szDisplayName = New String(Chr(0), 260) - shinfo.szTypeName = New String(Chr(0), 80) - SHGetFileInfo(_myFolder, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON) - Dim myIcon = Icon.FromHandle(shinfo.hIcon) - ImageList1.Images.Add(myIcon) - For Each fi In aryFi - ListViewFolder.Items.Add(fi.ToString, 0) - Next - Catch ex As Exception - ListViewFolder.Items.Add("<ERROR: " & ex.Message.ToString & ">") - End Try - End Sub - - 'Load File-list - Private Sub LoadListFiles() - 'Abort if bBrowseFolder - If _bBrowseFolder Then Exit Sub - - 'Define Extension-filter - Dim extStr As String() - If Trim(ComboBoxExt.Text.ToString) = "" Then - extStr = New String() {"*"} - Else - extStr = ComboBoxExt.Text.ToString.Split(","c) - End If - - 'Delete File-List - ListViewFiles.Items.Clear() - - Dim searchFile = TextBoxSearchFile.Text - - ListViewFiles.BeginUpdate() - Try - 'Add Folder - Dim di As New DirectoryInfo(_myFolder) - Dim aryFi As FileInfo() - Dim fi As FileInfo - Dim x = -1 - For Each SearchExt In extStr - Dim searchPat = "*" & Trim(searchFile) & "*." & Trim(SearchExt) - aryFi = di.GetFiles(searchPat) - For Each fi In aryFi - x += 1 - Dim shinfo = New SHFILEINFO() - shinfo.szDisplayName = New String(Chr(0), 260) - shinfo.szTypeName = New String(Chr(0), 80) - SHGetFileInfo(Path.Combine(_myFolder, fi.ToString), 0, shinfo, Marshal.SizeOf(shinfo), - SHGFI_ICON Or SHGFI_SMALLICON) - Dim myIcon = Icon.FromHandle(shinfo.hIcon) - ImageList1.Images.Add(myIcon) - ListViewFiles.Items.Add(fi.ToString, x + 1) - Next - Next - Catch ex As Exception - ListViewFiles.Items.Add("<ERROR: " & ex.Message.ToString & ">") - End Try - - ListViewFiles.EndUpdate() - End Sub - - 'Rename File - Private Sub RenameFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ - Handles RenameFileToolStripMenuItem.Click - - If ListViewFiles.SelectedItems.Count = 1 Then - Dim file0 = ListViewFiles.SelectedItems(0).Text - Dim file = file0 -lb1: - file = InputBox("New Filename", "Rename " & file0, file) - If file <> "" Then - If IO.File.Exists(_myFolder & file) Then - MsgBox("File " & file & " already exists!") - GoTo lb1 - End If - Try - My.Computer.FileSystem.RenameFile(_myFolder & file0, file) - LoadListFiles() - Catch ex As Exception - MsgBox("Cannot rename " & file0 & "!") - End Try - End If - End If - End Sub - - 'Delete File - Private Sub DeleteFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ - Handles DeleteFileToolStripMenuItem.Click - Dim c = ListViewFiles.SelectedItems.Count - If c > 0 Then - If c = 1 Then - If MsgBox("Delete " & _myFolder & ListViewFiles.SelectedItems(0).Text & "?", MsgBoxStyle.YesNo) = MsgBoxResult.No _ - Then Exit Sub - Else - If MsgBox("Delete " & c & " files?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub - End If - For x = 0 To c - 1 - Try - File.Delete(_myFolder & ListViewFiles.SelectedItems(x).Text) - Catch ex As Exception - End Try - Next - LoadListFiles() - End If - End Sub - - 'Neuer Ordner - Private Sub ButtonNewDir_Click(sender As Object, e As EventArgs) Handles ButtonNewDir.Click - Dim f = "New Folder" -lb10: - f = InputBox("Create New Folder", "New Folder", f) - If f <> "" Then - If Directory.Exists(_myFolder & f) Then - MsgBox("Folder " & _myFolder & f & " already exists!") - GoTo lb10 - End If - Try - Directory.CreateDirectory(_myFolder & f) - SetFolder(_myFolder & f) - Catch ex As Exception - MsgBox("Cannot create " & f & "!") - End Try - End If - End Sub - - Private Shared Function fPATH(path As String) As String - Dim x = path.LastIndexOf("\") - If x = -1 Then - Return Microsoft.VisualBasic.Left(path, 0) - Else - Return Microsoft.VisualBasic.Left(path, x + 1) - End If - End Function - - Public ReadOnly Property Folder As String - Get - Return _myFolder - End Get - End Property - - Public ReadOnly Property Files As String() - Get - Return _myFiles - End Get - End Property - - Public Property ID As String - Get - Return _myId - End Get - Set(value As String) - _myId = value - End Set - End Property - - Public Property Extensions As String() - Get - Return _myExt - End Get - Set(value As String()) - _myExt = value - _lastExt = _myExt(0) - _noExt = False - End Set - End Property -End Class - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Option Infer On +Option Explicit On +Option Strict On + +Imports System.Drawing +Imports System.IO +Imports System.Text +Imports Microsoft.VisualBasic.FileIO +Imports System.Runtime.InteropServices +Imports System.Windows.Forms + +''' <summary> +''' File Browser dialog. Entirely controlled by cFilebrowser class. +''' </summary> +Public Class FB_Dialog + Private _myFolder As String + Private _myFiles() As String + Private _myDrive As String + Private _updateLock As Boolean + Private _initialized As Boolean + Private _myId As String + Private _myExt() As String + Private _lastFile As String + Private _bFileMustExist As Boolean + Private _bOverwriteCheck As Boolean + Private _bMultiFiles As Boolean + Private _noExt As Boolean + Private _bBrowseFolder As Boolean + Private _bForceExt As Boolean + Private _extListSingle As ArrayList + Private _extListMulti As ArrayList + Private _lastExt As String + Private ReadOnly _bLightMode As Boolean + + Private Const FavText As String = "Edit Favorites..." + Private Const EmptyText As String = " " + Private Const NoFavString As String = "<undefined>" + + 'New + Public Sub New(lightMode As Boolean) + ' This call is required by the Windows Form Designer. + InitializeComponent() + ' Append any initialization after the InitializeComponent() call. + _myId = "Default" + _updateLock = False + _initialized = False + _myFolder = "" + _myDrive = "" + _lastFile = "" + _bOverwriteCheck = False + _bFileMustExist = False + _bMultiFiles = False + _noExt = True + _bBrowseFolder = False + _bLightMode = LightMode + ButtonHisFile.Enabled = Not _bLightMode + End Sub + + 'Resize + Private Sub FB_Dialog_Resize(sender As Object, e As EventArgs) Handles Me.ResizeEnd + Resized() + End Sub + + 'Shown + Private Sub FileBrowser_Shown(sender As Object, e As EventArgs) Handles Me.Shown + Resized() + TextBoxPath.Focus() + TextBoxPath.SelectAll() + End Sub + + 'Resized ListView Format + Private Sub Resized() + 'To autosize to the width of the column heading, set the Width property to -2 + ListViewFolder.Columns(0).Width = -2 + 'ListViewFolder.Columns(0).Width -= 1 + ListViewFiles.Columns(0).Width = -2 + 'ListViewFiles.Columns(0).Width -= 1 + End Sub + + 'SplitterMoved + Private Sub SplitContainer1_SplitterMoved(sender As Object, e As SplitterEventArgs) _ + Handles SplitContainer1.SplitterMoved + If _initialized Then Resized() + End Sub + + 'Closing (Overwrite-Check etc) + Private Sub FileBrowser_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing + Dim x As Int32 + Dim path As String + Dim ext As String + Dim hasExt As Boolean + If DialogResult = DialogResult.OK Then + If _bBrowseFolder Then + path = Trim(TextBoxPath.Text) + 'If empty path: use the Current-folder(MyFolder) + If path = "" Then + path = _myFolder + Else + If Mid(path, 2, 1) <> ":" Then path = _myFolder & path + End If + If Not Directory.Exists(path) Then + MsgBox("Directory " & path & " does not exist!", MsgBoxStyle.Critical) + e.Cancel = True + Exit Sub + End If + If Microsoft.VisualBasic.Right(path, 1) <> "\" Then path &= "\" + ReDim _myFiles(0) + _myFiles(0) = path + Else + 'Stop if empty path + If Trim(TextBoxPath.Text) = "" Then + e.Cancel = True + Exit Sub + End If + _lastExt = Trim(ComboBoxExt.Text) + 'Assume Files in array + If Microsoft.VisualBasic.Left(TextBoxPath.Text, 1) = "<" And ListViewFiles.SelectedItems.Count > 0 Then + 'Multiple files selected + ReDim _myFiles(ListViewFiles.SelectedItems.Count - 1) + x = -1 + For Each lv0 As ListViewItem In ListViewFiles.Items + If lv0.Selected Then + x += 1 + _myFiles(x) = _myFolder & lv0.SubItems(0).Text + End If + Next + _bMultiFiles = True + Else + 'Single File + path = Trim(TextBoxPath.Text) + 'Primary extension (eg for bForceExt) + ext = Trim(ComboBoxExt.Text.Split(","c)(0)) + 'If file without path then append path + + + If Mid(path, 2, 1) <> ":" Then path = _myFolder & path + 'If instead of File a Folder is entered: Switch to Folder and Abort + If Directory.Exists(path) Then + SetFolder(path) + e.Cancel = True + Exit Sub + End If + 'Force Extension + If _bForceExt Then + If UCase(IO.Path.GetExtension(path)) <> "." & UCase(ext) Then path &= "." & ext + hasExt = True + Else + 'Check whether specified a File with Ext + hasExt = (Microsoft.VisualBasic.Len(IO.Path.GetExtension(path)) > 1) + End If + 'If File without Extension (after bForceExt question) and it does not exist, then add primary Extension + If Not hasExt Then + If ext <> "*" And ext <> "" Then + If Not File.Exists(path) Then path &= "." & ext + End If + End If + 'Check that File exists + If File.Exists(path) Then + 'Yes: when bOverwriteCheck, check for Overwrite + If _bOverwriteCheck Then + If MsgBox("Overwrite " & path & " ?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then + e.Cancel = True + Exit Sub + End If + End If + Else + 'No: abort if bFileMustExist + If _bFileMustExist Then + MsgBox("The file " & path & " does not exist!", MsgBoxStyle.Critical) + e.Cancel = True + Exit Sub + End If + End If + 'Define MyFiles + ReDim _myFiles(0) + _myFiles(0) = path + _bMultiFiles = False + End If + End If + End If + End Sub + + 'Browse - Custom Dialog + Public Function Browse(path As String, fileMustExist As Boolean, overwriteCheck As Boolean, extMode As tFbExtMode, + multiFile As Boolean, ext As String, title As String) As Boolean + If Not _initialized Then Init() + + 'Load Folder History ContextMenu + For x = 0 To 9 + ContextMenuHisFolder.Items(x).Text = FB_FolderHistory(x) + Next + For x = 10 To 19 + ContextMenuHisFolder.Items(x + 1).Text = FB_FolderHistory(x) + Next + + 'Options + _bOverwriteCheck = overwriteCheck + _bFileMustExist = fileMustExist + _bForceExt = (extMode = tFbExtMode.ForceExt) + + 'Form Config + ListViewFiles.MultiSelect = multiFile + ButtonAll.Visible = multiFile + Me.Title = title + Text = title + + 'Ext-Combobox + ComboBoxExt.Items.Clear() + If _noExt Then + ComboBoxExt.Items.Add("*") + ComboBoxExt.SelectedIndex = 0 + Else + Select Case extMode + Case tFbExtMode.ForceExt + If ext = "" Then ext = _extListSingle(0).ToString + ComboBoxExt.Items.AddRange(_extListSingle.ToArray) + ComboBoxExt.Text = ext + ComboBoxExt.Enabled = False + Case tFbExtMode.MultiExt, tFbExtMode.SingleExt + If extMode = tFbExtMode.MultiExt Then + ComboBoxExt.Items.AddRange(_extListMulti.ToArray) + Else + ComboBoxExt.Items.AddRange(_extListSingle.ToArray) + End If + If ext <> "" Then + ComboBoxExt.Text = ext + Else + ComboBoxExt.Text = _lastExt + End If + ComboBoxExt.Enabled = True + End Select + End If + + + 'Define Path + ' If no path is specified: Last folder, no file name + If path = "" Then path = FB_FolderHistory(0) + + ' If path-length too small (Path is invalid): Last File + If path.Length < 2 Then path = _lastFile + + 'Open Folder - If no folder in the path: Last folder + If fPATH(path) = "" Then + 'If given a file without path + If Trim(FB_FolderHistory(0)) = "" Then + SetFolder("C:\") + Else + SetFolder(FB_FolderHistory(0)) + End If + Else + '...Otherwise: + SetFolder(fPATH(path)) + End If + If _bBrowseFolder Then + FolderUp() + TextBoxPath.Text = path + Else + TextBoxPath.Text = IO.Path.GetFileName(path) + End If + + 'Show form ------------------------------------------------ ---- + ShowDialog() + If DialogResult = DialogResult.OK Then + 'File / Folder History + If _bMultiFiles Then + _lastFile = _myFolder + UpdateHisFolder(_myFolder) + Else + _lastFile = _myFiles(0) + UpdateHisFolder(fPATH(_lastFile)) + If Not _bBrowseFolder Then UpdateHisFile(_lastFile) + End If + 'Update Global History Folder + For x = 0 To 9 + FB_FolderHistory(x) = ContextMenuHisFolder.Items(x).Text + Next + For x = 10 To 19 + FB_FolderHistory(x) = ContextMenuHisFolder.Items(x + 1).Text + Next + Return True + Else + Return False + End If + End Function + + Public Title As String + + 'Close and save File / Folder History + Public Sub SaveAndClose() + 'Folder History + If FB_Init Then + Try + Dim f = My.Computer.FileSystem.OpenTextFileWriter(FB_FilHisDir & "Directories.txt", False, Encoding.UTF8) + For x = 0 To 19 + f.WriteLine(FB_FolderHistory(x)) + Next + f.Close() + f.Dispose() + Catch ex As Exception + End Try + FB_Init = False + End If + 'File History + If _initialized And Not _bLightMode Then + If Not _bBrowseFolder Then + Try + Dim f = My.Computer.FileSystem.OpenTextFileWriter(FB_FilHisDir & _myId & ".txt", False, Encoding.UTF8) + For x = 0 To 9 + f.WriteLine(ContextMenuHisFile.Items(x).Text) + Next + f.Close() + f.Dispose() + Catch ex As Exception + End Try + End If + _initialized = False + End If + + 'Close + Close() + End Sub + + 'Switching to FolderBrowser + Public Sub SetFolderBrowser() + If _initialized Then Exit Sub + + _bBrowseFolder = True + Width = 500 + ListViewFiles.Enabled = False + ButtonHisFile.Enabled = False + TextBoxSearchFile.Enabled = False + SplitContainer1.Panel2Collapsed = True + Text = "Directory Browser" + End Sub + + 'Initialize + Private Sub Init() + _updateLock = True + + 'Initialization for Global File Browser + If Not FB_Init Then GlobalInit() + + 'Load Drive ComboBox + For x = 0 To UBound(FB_Drives) + ComboBoxDrive.Items.Add(FB_Drives(x)) + Next + + 'FolderHistory ContextMenu + ContextMenuHisFolder.Items.Clear() + For x = 0 To 9 + ContextMenuHisFolder.Items.Add("") + Next + ContextMenuHisFolder.Items.Add("-") + For x = 10 To 19 + ContextMenuHisFolder.Items.Add("") + Next + ContextMenuHisFolder.Items.Add("-") + ContextMenuHisFolder.Items.Add(FavText) + + 'FileHistory ContextMenu + If _bBrowseFolder Then + _lastFile = FB_FolderHistory(0) + ElseIf Not _bLightMode Then + For x = 0 To 9 + ContextMenuHisFile.Items.Add("") + Next + If File.Exists(FB_FilHisDir & _myId & ".txt") Then + Dim f = New StreamReader(FB_FilHisDir & _myId & ".txt") + Dim x = -1 + Do While Not f.EndOfStream And x < 9 + x += 1 + Dim line = f.ReadLine + ContextMenuHisFile.Items(x).Text = line + If x = 0 Then _lastFile = line + Loop + f.Close() + f.Dispose() + End If + End If + + 'Extension-ComboBox + If Not _noExt Then + _extListSingle = New ArrayList + _extListMulti = New ArrayList + For x = 0 To UBound(_myExt) + _extListMulti.Add(_myExt(x)) + _extListSingle.AddRange(_myExt(x).Split(","c)) + Next + _extListMulti.Add("*") + _extListSingle.Add("*") + End If + + _initialized = True + _updateLock = False + End Sub + + Private Sub GlobalInit() + + 'Create Drive List + ReDim FB_Drives(UBound(Directory.GetLogicalDrives())) + Dim x = -1 + For Each drive In Directory.GetLogicalDrives() + x += 1 + FB_Drives(x) = Microsoft.VisualBasic.Left(drive, 2) + Next + + 'Read Folder History + For x = 0 To 19 + FB_FolderHistory(x) = EmptyText + Next + If File.Exists(FB_FilHisDir & "Directories.txt") Then + Dim f = New StreamReader(FB_FilHisDir & "Directories.txt") + x = -1 + Do While Not f.EndOfStream And x < 19 + x += 1 + FB_FolderHistory(x) = f.ReadLine() + Loop + f.Dispose() + f.Close() + End If + + FB_Init = True + End Sub + + 'ComboBoxDrive_SelectedIndexChanged + Private Sub ComboBoxDrive_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles ComboBoxDrive.SelectedIndexChanged + If Not _updateLock Then SetFolder(ComboBoxDrive.SelectedItem.ToString) + End Sub + + + 'ButtonFolderBack_Click + Private Sub ButtonFolderBack_Click(sender As Object, e As EventArgs) Handles ButtonFolderBack.Click + FolderUp() + End Sub + + 'TextBoxPath_KeyDown (ENTER) + Private Sub TextBoxPath_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxPath.KeyDown + If e.KeyCode = Keys.Enter Then + Dim path = TextBoxPath.Text + If Directory.Exists(path) Then + If _bBrowseFolder Then + DialogResult = DialogResult.OK + Close() + Else + SetFolder(path) + End If + Else + DialogResult = DialogResult.OK + Close() + End If + End If + End Sub + + 'ListViewFolder_SelectedIndexChanged + Private Sub ListViewFolder_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles ListViewFolder.SelectedIndexChanged + If _bBrowseFolder Then + _updateLock = True + If ListViewFolder.SelectedItems.Count > 0 Then + TextBoxPath.Text = ListViewFolder.SelectedItems.Item(0).Text & "\" + End If + _updateLock = False + End If + End Sub + + 'ListViewFolder_MouseDoubleClick + Private Sub ListViewFolder_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ + Handles ListViewFolder.MouseDoubleClick + If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub + SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) + End Sub + + 'ListViewFolder_KeyDown + Private Sub ListViewFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFolder.KeyDown + If e.KeyCode = Keys.Enter Then + If ListViewFolder.SelectedItems.Count = 0 Then Exit Sub + SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) + End If + End Sub + + 'ListViewFiles_SelectedIndexChanged + Private Sub ListViewFiles_SelectedIndexChanged(sender As Object, e As EventArgs) _ + Handles ListViewFiles.SelectedIndexChanged + _updateLock = True + If ListViewFiles.SelectedItems.Count = 0 Then + TextBoxPath.Text = "" + Else + If ListViewFiles.SelectedItems.Count > 1 Then + TextBoxPath.Text = "<" & ListViewFiles.SelectedItems.Count & " Files selected>" + Else + TextBoxPath.Text = ListViewFiles.SelectedItems.Item(0).Text + TextBoxPath.SelectionStart = TextBoxPath.Text.Length + End If + End If + _updateLock = False + End Sub + + 'ListViewFiles_MouseDoubleClick + Private Sub ListViewFiles_MouseDoubleClick(sender As Object, e As MouseEventArgs) _ + Handles ListViewFiles.MouseDoubleClick + If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub + + DialogResult = DialogResult.OK + Close() + End Sub + + 'ListViewFiles_KeyDown + Private Sub ListViewFiles_KeyDown(sender As Object, e As KeyEventArgs) Handles ListViewFiles.KeyDown + If e.KeyCode = Keys.Enter Then + If ListViewFiles.SelectedItems.Count = 0 Then Exit Sub + DialogResult = DialogResult.OK + Close() + End If + End Sub + + 'TextBoxSearchFolder_KeyDown + Private Sub TextBoxSearchFolder_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFolder.KeyDown + Dim itemCount = ListViewFolder.Items.Count + Dim noItem = (itemCount = 0) + + Dim selIndex As Integer + If Not noItem Then + If ListViewFolder.SelectedItems.Count = 0 Then + selIndex = -1 + Else + selIndex = ListViewFolder.SelectedIndices(0) + End If + End If + Select Case e.KeyCode + Case Keys.Enter + If noItem Then Exit Sub + If ListViewFolder.SelectedItems.Count = 0 Then ListViewFolder.SelectedIndices.Add(0) + SetFolder(_myFolder & ListViewFolder.SelectedItems.Item(0).Text) + Case Keys.Up + If Not noItem Then + If selIndex < 1 Then + selIndex = 1 + Else + ListViewFolder.Items(selIndex).Selected = False + End If + ListViewFolder.Items(selIndex - 1).Selected = True + ListViewFolder.Items(selIndex - 1).EnsureVisible() + End If + Case Keys.Down + If Not noItem And selIndex < itemCount - 1 Then + If Not selIndex = -1 Then ListViewFolder.Items(selIndex).Selected = False + ListViewFolder.Items(selIndex + 1).Selected = True + ListViewFolder.Items(selIndex + 1).EnsureVisible() + End If + Case Keys.Back + If TextBoxSearchFolder.Text = "" Then FolderUp() + End Select + End Sub + + 'TextBoxSearchFolder_TextChanged + Private Sub TextBoxSearchFolder_TextChanged(sender As Object, e As EventArgs) Handles TextBoxSearchFolder.TextChanged + If Not _updateLock Then LoadListFolder() + End Sub + + 'TextBoxSearchFile_KeyDown + Private Sub TextBoxSearchFile_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBoxSearchFile.KeyDown + Dim selIndex As Integer + + Dim itemCount = ListViewFiles.Items.Count + Dim noItem = (itemCount = 0) + If Not noItem Then + If ListViewFiles.SelectedItems.Count = 0 Then + selIndex = -1 + Else + selIndex = ListViewFiles.SelectedIndices(0) + End If + End If + Select Case e.KeyCode + Case Keys.Enter + If noItem Then Exit Sub + If ListViewFiles.SelectedItems.Count = 0 Then ListViewFiles.SelectedIndices.Add(0) + DialogResult = DialogResult.OK + Close() + Case Keys.Up + If Not noItem Then + If selIndex < 1 Then + selIndex = 1 + Else + ListViewFiles.Items(selIndex).Selected = False + End If + ListViewFiles.Items(selIndex - 1).Selected = True + ListViewFiles.Items(selIndex - 1).EnsureVisible() + End If + Case Keys.Down + If Not noItem And selIndex < itemCount - 1 Then + If Not selIndex = -1 Then ListViewFiles.Items(selIndex).Selected = False + ListViewFiles.Items(selIndex + 1).Selected = True + ListViewFiles.Items(selIndex + 1).EnsureVisible() + End If + End Select + End Sub + + Private Sub TextBoxSearchFile_TextChanged(sender As Object, e As EventArgs) _ + Handles TextBoxSearchFile.TextChanged, ComboBoxExt.TextChanged + If Not _updateLock Then LoadListFiles() + End Sub + + Private Sub ButtonHisFolder_Click(sender As Object, e As EventArgs) Handles ButtonHisFolder.Click + ContextMenuHisFolder.Show(MousePosition) + End Sub + + + Private Sub ButtonHisFile_Click(sender As Object, e As EventArgs) Handles ButtonHisFile.Click + ContextMenuHisFile.Show(MousePosition) + End Sub + + Private Sub ButtonAll_Click(sender As Object, e As EventArgs) Handles ButtonAll.Click + ListViewFiles.BeginUpdate() + For i = 0 To ListViewFiles.Items.Count - 1 + ListViewFiles.Items(i).Selected = True + Next + ListViewFiles.EndUpdate() + End Sub + + Private Sub ContextMenuHisFile_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ + Handles ContextMenuHisFile.ItemClicked + Dim path = e.ClickedItem.Text.ToString + If path = EmptyText Then Exit Sub + SetFolder(fPATH(path)) + TextBoxPath.Text = IO.Path.GetFileName(path) + End Sub + + Private Sub ContextMenuHisFolder_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ + Handles ContextMenuHisFolder.ItemClicked + + Dim path = e.ClickedItem.Text.ToString + + If path = EmptyText Then Exit Sub + + If path = FavText Then + Dim favdlog = New FB_FavDlog + If favdlog.ShowDialog(Me) = DialogResult.OK Then + For x As Integer = 10 To 19 + path = CType(favdlog.ListBox1.Items(x - 10), String) + If path = NoFavString Then + FB_FolderHistory(x) = EmptyText + Else + FB_FolderHistory(x) = path + End If + ContextMenuHisFolder.Items(x + 1).Text = FB_FolderHistory(x) + Next + End If + Else + SetFolder(path) + End If + End Sub + + Private Sub TextBoxCurrent_MouseClick(sender As Object, e As MouseEventArgs) Handles TextBoxCurrent.MouseClick + Dim newpath = "" + Dim x = TextBoxCurrent.SelectionStart + Dim path = TextBoxCurrent.Text + Dim x1 = path.Length + If x = x1 Then Exit Sub + If x < 4 Then + SetFolder(Microsoft.VisualBasic.Left(path, 2)) + Exit Sub + End If + Do While x1 > x + newpath = path + 'path = Microsoft.VisualBasic.Left(path, x1 - 1) + path = Microsoft.VisualBasic.Left(path, path.LastIndexOf("\")) + x1 = path.Length + Loop + SetFolder(newpath) + End Sub + + Private Sub ButtonDesktop_Click(sender As Object, e As EventArgs) Handles ButtonDesktop.Click + SetFolder(SpecialDirectories.Desktop.ToString) + End Sub + + Private Sub UpdateHisFile(path As String) + If _bLightMode Then Exit Sub + + Dim x As Integer + For x = 0 To 8 + If UCase(ContextMenuHisFile.Items(x).Text.ToString) = UCase(path) Then Exit For + Next + For y = x To 1 Step -1 + ContextMenuHisFile.Items(y).Text = ContextMenuHisFile.Items(y - 1).Text + Next + ContextMenuHisFile.Items(0).Text = path + End Sub + + Private Sub UpdateHisFolder(path As String) + Dim x As Integer + For x = 0 To 8 + If UCase(ContextMenuHisFolder.Items(x).Text.ToString) = UCase(path) Then Exit For + Next + For y = x To 1 Step -1 + ContextMenuHisFolder.Items(y).Text = ContextMenuHisFolder.Items(y - 1).Text + Next + ContextMenuHisFolder.Items(0).Text = path + End Sub + + Public Sub UpdateHistory(path As String) + If Not _initialized Then Init() + UpdateHisFile(path) + path = fPATH(path) + Dim x As Integer + For x = 0 To 8 + If UCase(FB_FolderHistory(x)) = UCase(path) Then Exit For + Next + For y = x To 1 Step -1 + FB_FolderHistory(y) = FB_FolderHistory(y - 1) + Next + FB_FolderHistory(0) = path + End Sub + + 'Change folder + Private Sub SetFolder(path As String) + + 'Abort if no drive specified + If Mid(path, 2, 1) <> ":" Then Exit Sub + + _updateLock = True + + 'Delete Search-fields + TextBoxSearchFile.Text = "" + TextBoxSearchFolder.Text = "" + + 'Set Drive + If _myDrive <> Microsoft.VisualBasic.Left(path, 2) Then + _myDrive = UCase(Microsoft.VisualBasic.Left(path, 2)) + ComboBoxDrive.SelectedItem = _myDrive + End If + + 'Set Folder + _myFolder = path + If Microsoft.VisualBasic.Right(_myFolder, 1) <> "\" Then _myFolder &= "\" + + Me.Text = Me.Title & " " & _myFolder + + LoadListFolder() + LoadListFiles() + + If _bBrowseFolder Then TextBoxPath.Text = "" + + TextBoxCurrent.Text = _myFolder + + 'TextBoxPath.SelectionStart = TextBoxPath.Text.Length + _updateLock = False + End Sub + + 'Folder one level up + Private Sub FolderUp() + If _myFolder <> "" Then + Dim path = Microsoft.VisualBasic.Left(_myFolder, _myFolder.Length - 1) + Dim x = path.LastIndexOf("\") + If x > 0 Then SetFolder(Microsoft.VisualBasic.Left(path, x)) + End If + End Sub + + + Private Structure SHFILEINFO + Public hIcon As IntPtr ' : icon + Public iIcon As Integer ' : icondex + Public dwAttributes As Integer ' : SFGAO_ flags + <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public szDisplayName As String + <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public szTypeName As String + End Structure + + Private Const SHGFI_ICON = &H100 + Private Const SHGFI_SMALLICON = &H1 + Private Declare Ansi Function SHGetFileInfo Lib "shell32.dll" (pszPath As String, dwFileAttributes As Integer, + ByRef psfi As SHFILEINFO, cbFileInfo As Integer, uFlags As Integer) As IntPtr + + 'Load Folder-List + Private Sub LoadListFolder() + 'Delete Folder-List + ListViewFolder.Items.Clear() + Dim searchPat = "*" & TextBoxSearchFolder.Text & "*" + Try + 'Add Folder + Dim di As New DirectoryInfo(_myFolder) + Dim aryFi = di.GetDirectories(searchPat) + ImageList1.Images.Clear() + Dim shinfo = New SHFILEINFO() + shinfo.szDisplayName = New String(Chr(0), 260) + shinfo.szTypeName = New String(Chr(0), 80) + SHGetFileInfo(_myFolder, 0, shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON Or SHGFI_SMALLICON) + Dim myIcon = Icon.FromHandle(shinfo.hIcon) + ImageList1.Images.Add(myIcon) + For Each fi In aryFi + ListViewFolder.Items.Add(fi.ToString, 0) + Next + Catch ex As Exception + ListViewFolder.Items.Add("<ERROR: " & ex.Message.ToString & ">") + End Try + End Sub + + 'Load File-list + Private Sub LoadListFiles() + 'Abort if bBrowseFolder + If _bBrowseFolder Then Exit Sub + + 'Define Extension-filter + Dim extStr As String() + If Trim(ComboBoxExt.Text.ToString) = "" Then + extStr = New String() {"*"} + Else + extStr = ComboBoxExt.Text.ToString.Split(","c) + End If + + 'Delete File-List + ListViewFiles.Items.Clear() + + Dim searchFile = TextBoxSearchFile.Text + + ListViewFiles.BeginUpdate() + Try + 'Add Folder + Dim di As New DirectoryInfo(_myFolder) + Dim aryFi As FileInfo() + Dim fi As FileInfo + Dim x = -1 + For Each SearchExt In extStr + Dim searchPat = "*" & Trim(searchFile) & "*." & Trim(SearchExt) + aryFi = di.GetFiles(searchPat) + For Each fi In aryFi + x += 1 + Dim shinfo = New SHFILEINFO() + shinfo.szDisplayName = New String(Chr(0), 260) + shinfo.szTypeName = New String(Chr(0), 80) + SHGetFileInfo(Path.Combine(_myFolder, fi.ToString), 0, shinfo, Marshal.SizeOf(shinfo), + SHGFI_ICON Or SHGFI_SMALLICON) + Dim myIcon = Icon.FromHandle(shinfo.hIcon) + ImageList1.Images.Add(myIcon) + ListViewFiles.Items.Add(fi.ToString, x + 1) + Next + Next + Catch ex As Exception + ListViewFiles.Items.Add("<ERROR: " & ex.Message.ToString & ">") + End Try + + ListViewFiles.EndUpdate() + End Sub + + 'Rename File + Private Sub RenameFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ + Handles RenameFileToolStripMenuItem.Click + + If ListViewFiles.SelectedItems.Count = 1 Then + Dim file0 = ListViewFiles.SelectedItems(0).Text + Dim file = file0 +lb1: + file = InputBox("New Filename", "Rename " & file0, file) + If file <> "" Then + If IO.File.Exists(_myFolder & file) Then + MsgBox("File " & file & " already exists!") + GoTo lb1 + End If + Try + My.Computer.FileSystem.RenameFile(_myFolder & file0, file) + LoadListFiles() + Catch ex As Exception + MsgBox("Cannot rename " & file0 & "!") + End Try + End If + End If + End Sub + + 'Delete File + Private Sub DeleteFileToolStripMenuItem_Click(sender As Object, e As EventArgs) _ + Handles DeleteFileToolStripMenuItem.Click + Dim c = ListViewFiles.SelectedItems.Count + If c > 0 Then + If c = 1 Then + If MsgBox("Delete " & _myFolder & ListViewFiles.SelectedItems(0).Text & "?", MsgBoxStyle.YesNo) = MsgBoxResult.No _ + Then Exit Sub + Else + If MsgBox("Delete " & c & " files?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then Exit Sub + End If + For x = 0 To c - 1 + Try + File.Delete(_myFolder & ListViewFiles.SelectedItems(x).Text) + Catch ex As Exception + End Try + Next + LoadListFiles() + End If + End Sub + + 'Neuer Ordner + Private Sub ButtonNewDir_Click(sender As Object, e As EventArgs) Handles ButtonNewDir.Click + Dim f = "New Folder" +lb10: + f = InputBox("Create New Folder", "New Folder", f) + If f <> "" Then + If Directory.Exists(_myFolder & f) Then + MsgBox("Folder " & _myFolder & f & " already exists!") + GoTo lb10 + End If + Try + Directory.CreateDirectory(_myFolder & f) + SetFolder(_myFolder & f) + Catch ex As Exception + MsgBox("Cannot create " & f & "!") + End Try + End If + End Sub + + Private Shared Function fPATH(path As String) As String + Dim x = path.LastIndexOf("\") + If x = -1 Then + Return Microsoft.VisualBasic.Left(path, 0) + Else + Return Microsoft.VisualBasic.Left(path, x + 1) + End If + End Function + + Public ReadOnly Property Folder As String + Get + Return _myFolder + End Get + End Property + + Public ReadOnly Property Files As String() + Get + Return _myFiles + End Get + End Property + + Public Property ID As String + Get + Return _myId + End Get + Set(value As String) + _myId = value + End Set + End Property + + Public Property Extensions As String() + Get + Return _myExt + End Get + Set(value As String()) + _myExt = value + _lastExt = _myExt(0) + _noExt = False + End Set + End Property +End Class + + diff --git a/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.designer.vb b/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.designer.vb index 08648f65220913d18dce26957dde772943cc8884..05a2b972d3972f5c6d58ae64112af718632157c0 100644 --- a/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.designer.vb +++ b/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.designer.vb @@ -1,128 +1,128 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ -Partial Class FB_FavDlog - Inherits System.Windows.Forms.Form - - 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. - <System.Diagnostics.DebuggerNonUserCode()> _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Wird vom Windows Form-Designer benötigt. - Private components As System.ComponentModel.IContainer - - 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. - 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. - 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. - <System.Diagnostics.DebuggerStepThrough()> _ - Private Sub InitializeComponent() - Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() - Me.OK_Button = New System.Windows.Forms.Button() - Me.Cancel_Button = New System.Windows.Forms.Button() - Me.ListBox1 = New System.Windows.Forms.ListBox() - Me.Label1 = New System.Windows.Forms.Label() - Me.TableLayoutPanel1.SuspendLayout() - Me.SuspendLayout() - ' - 'TableLayoutPanel1 - ' - Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.TableLayoutPanel1.ColumnCount = 2 - Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) - Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) - Me.TableLayoutPanel1.Location = New System.Drawing.Point(326, 173) - Me.TableLayoutPanel1.Name = "TableLayoutPanel1" - Me.TableLayoutPanel1.RowCount = 1 - Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) - Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) - Me.TableLayoutPanel1.TabIndex = 0 - ' - 'OK_Button - ' - Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None - Me.OK_Button.Location = New System.Drawing.Point(3, 3) - Me.OK_Button.Name = "OK_Button" - Me.OK_Button.Size = New System.Drawing.Size(67, 23) - Me.OK_Button.TabIndex = 0 - Me.OK_Button.Text = "OK" - ' - 'Cancel_Button - ' - Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None - Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel - Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) - Me.Cancel_Button.Name = "Cancel_Button" - Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) - Me.Cancel_Button.TabIndex = 1 - Me.Cancel_Button.Text = "Cancel" - ' - 'ListBox1 - ' - Me.ListBox1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ - Or System.Windows.Forms.AnchorStyles.Left) _ - Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.ListBox1.FormattingEnabled = True - Me.ListBox1.Location = New System.Drawing.Point(12, 12) - Me.ListBox1.Name = "ListBox1" - Me.ListBox1.Size = New System.Drawing.Size(460, 134) - Me.ListBox1.TabIndex = 1 - ' - 'Label1 - ' - Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(369, 147) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(106, 13) - Me.Label1.TabIndex = 2 - Me.Label1.Text = "(Double-Click to Edit)" - ' - 'FB_FavDlog - ' - Me.AcceptButton = Me.OK_Button - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit - Me.CancelButton = Me.Cancel_Button - Me.ClientSize = New System.Drawing.Size(484, 208) - Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.ListBox1) - Me.Controls.Add(Me.TableLayoutPanel1) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow - Me.MaximizeBox = False - Me.MaximumSize = New System.Drawing.Size(5000, 242) - Me.MinimizeBox = False - Me.MinimumSize = New System.Drawing.Size(0, 242) - Me.Name = "FB_FavDlog" - Me.ShowIcon = False - Me.ShowInTaskbar = False - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent - Me.Text = "Edit Favorites" - Me.TableLayoutPanel1.ResumeLayout(False) - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel - Friend WithEvents OK_Button As System.Windows.Forms.Button - Friend WithEvents Cancel_Button As System.Windows.Forms.Button - Friend WithEvents ListBox1 As System.Windows.Forms.ListBox - Friend WithEvents Label1 As System.Windows.Forms.Label - -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ +Partial Class FB_FavDlog + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + <System.Diagnostics.DebuggerNonUserCode()> _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + <System.Diagnostics.DebuggerStepThrough()> _ + Private Sub InitializeComponent() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.OK_Button = New System.Windows.Forms.Button() + Me.Cancel_Button = New System.Windows.Forms.Button() + Me.ListBox1 = New System.Windows.Forms.ListBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.TableLayoutPanel1.SuspendLayout() + Me.SuspendLayout() + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.TableLayoutPanel1.ColumnCount = 2 + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Controls.Add(Me.OK_Button, 0, 0) + Me.TableLayoutPanel1.Controls.Add(Me.Cancel_Button, 1, 0) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(326, 173) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 1 + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50.0!)) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(146, 29) + Me.TableLayoutPanel1.TabIndex = 0 + ' + 'OK_Button + ' + Me.OK_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.OK_Button.Location = New System.Drawing.Point(3, 3) + Me.OK_Button.Name = "OK_Button" + Me.OK_Button.Size = New System.Drawing.Size(67, 23) + Me.OK_Button.TabIndex = 0 + Me.OK_Button.Text = "OK" + ' + 'Cancel_Button + ' + Me.Cancel_Button.Anchor = System.Windows.Forms.AnchorStyles.None + Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Cancel_Button.Location = New System.Drawing.Point(76, 3) + Me.Cancel_Button.Name = "Cancel_Button" + Me.Cancel_Button.Size = New System.Drawing.Size(67, 23) + Me.Cancel_Button.TabIndex = 1 + Me.Cancel_Button.Text = "Cancel" + ' + 'ListBox1 + ' + Me.ListBox1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.ListBox1.FormattingEnabled = True + Me.ListBox1.Location = New System.Drawing.Point(12, 12) + Me.ListBox1.Name = "ListBox1" + Me.ListBox1.Size = New System.Drawing.Size(460, 134) + Me.ListBox1.TabIndex = 1 + ' + 'Label1 + ' + Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(369, 147) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(106, 13) + Me.Label1.TabIndex = 2 + Me.Label1.Text = "(Double-Click to Edit)" + ' + 'FB_FavDlog + ' + Me.AcceptButton = Me.OK_Button + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit + Me.CancelButton = Me.Cancel_Button + Me.ClientSize = New System.Drawing.Size(484, 208) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.ListBox1) + Me.Controls.Add(Me.TableLayoutPanel1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow + Me.MaximizeBox = False + Me.MaximumSize = New System.Drawing.Size(5000, 242) + Me.MinimizeBox = False + Me.MinimumSize = New System.Drawing.Size(0, 242) + Me.Name = "FB_FavDlog" + Me.ShowIcon = False + Me.ShowInTaskbar = False + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent + Me.Text = "Edit Favorites" + Me.TableLayoutPanel1.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + Friend WithEvents TableLayoutPanel1 As System.Windows.Forms.TableLayoutPanel + Friend WithEvents OK_Button As System.Windows.Forms.Button + Friend WithEvents Cancel_Button As System.Windows.Forms.Button + Friend WithEvents ListBox1 As System.Windows.Forms.ListBox + Friend WithEvents Label1 As System.Windows.Forms.Label + +End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.vb b/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.vb index df7d5029d833f6da64376ab65419babe7534c607..c6a5bb5ff94d9fbc9d20f53633a25f8a6555f052 100644 --- a/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.vb +++ b/VECTOAux/VectoAuxiliaries/UI/FB_FavDlog.vb @@ -1,62 +1,62 @@ -' Copyright 2014 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Option Infer On - -Imports System.Windows.Forms - -''' <summary> -''' Sub-dialog for File Browser. Entirely controlled by cFilebrowser class (via FB_Dialog). -''' </summary> -''' <remarks></remarks> -Public Class FB_FavDlog - Private Const NoFavString As String = "<empty favorite slot>" - Private Const EmptyText As String = " " - - Private Sub FB_FavDlog_Load(sender As Object, e As EventArgs) Handles Me.Load - For x = 10 To 19 - Dim txt = FB_FolderHistory(x) - If txt = EmptyText Then - ListBox1.Items.Add(NoFavString) - Else - ListBox1.Items.Add(txt) - End If - Next - End Sub - - Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click - DialogResult = DialogResult.OK - Close() - End Sub - - Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click - DialogResult = DialogResult.Cancel - Close() - End Sub - - Private Sub ListBox1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ListBox1.MouseDoubleClick - Dim i = ListBox1.SelectedIndex - Dim txt = ListBox1.Items(i).ToString - - If txt = NoFavString Then txt = "" - - Dim fb = New cFileBrowser("DirBr", True, True) - - If fb.OpenDialog(txt) Then - txt = fb.Files(0) - ListBox1.Items.Insert(i, txt) - ListBox1.Items.RemoveAt(i + 1) - End If - End Sub - - Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged - - End Sub -End Class +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Option Infer On + +Imports System.Windows.Forms + +''' <summary> +''' Sub-dialog for File Browser. Entirely controlled by cFilebrowser class (via FB_Dialog). +''' </summary> +''' <remarks></remarks> +Public Class FB_FavDlog + Private Const NoFavString As String = "<empty favorite slot>" + Private Const EmptyText As String = " " + + Private Sub FB_FavDlog_Load(sender As Object, e As EventArgs) Handles Me.Load + For x = 10 To 19 + Dim txt = FB_FolderHistory(x) + If txt = EmptyText Then + ListBox1.Items.Add(NoFavString) + Else + ListBox1.Items.Add(txt) + End If + Next + End Sub + + Private Sub OK_Button_Click(sender As Object, e As EventArgs) Handles OK_Button.Click + DialogResult = DialogResult.OK + Close() + End Sub + + Private Sub Cancel_Button_Click(sender As Object, e As EventArgs) Handles Cancel_Button.Click + DialogResult = DialogResult.Cancel + Close() + End Sub + + Private Sub ListBox1_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles ListBox1.MouseDoubleClick + Dim i = ListBox1.SelectedIndex + Dim txt = ListBox1.Items(i).ToString + + If txt = NoFavString Then txt = "" + + Dim fb = New cFileBrowser("DirBr", True, True) + + If fb.OpenDialog(txt) Then + txt = fb.Files(0) + ListBox1.Items.Insert(i, txt) + ListBox1.Items.RemoveAt(i + 1) + End If + End Sub + + Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged + + End Sub +End Class diff --git a/VECTOAux/VectoAuxiliaries/UI/FB_Global.vb b/VECTOAux/VectoAuxiliaries/UI/FB_Global.vb index 76fcb09cc045bd879fafeddda1bcb02caca3d544..00e132773356942ce2d5dfd0884747d1675ac5ae 100644 --- a/VECTOAux/VectoAuxiliaries/UI/FB_Global.vb +++ b/VECTOAux/VectoAuxiliaries/UI/FB_Global.vb @@ -1,182 +1,182 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.IO - -''' <summary> -''' Global File Brower properties and cFilebrowser instances. -''' </summary> -''' <remarks></remarks> -Module FB_Global - Public FB_FolderHistory(19) As String - Public FB_Drives() As String - Public FB_Init As Boolean - Public FB_FilHisDir As String - '----------------------------- - Public fbFolder As cFileBrowser - Public fbVECTO As cFileBrowser - Public fbFileLists As cFileBrowser - Public fbVEH As cFileBrowser - Public fbDRI As cFileBrowser - Public fbMAP As cFileBrowser - Public fbFLD As cFileBrowser - - Public fbENG As cFileBrowser - Public fbGBX As cFileBrowser - Public fbACC As cFileBrowser - Public fbAUX As cFileBrowser - - Public fbGBS As cFileBrowser - Public fbTLM As cFileBrowser - Public fbRLM As cFileBrowser - Public fbTCC As cFileBrowser - Public fbCDx As cFileBrowser - - Public fbVMOD As cFileBrowser - - 'Paths - Private MyAppPath As String = My.Application.Info.DirectoryPath & "\" - Private MyConfPath As String = MyAppPath & "Config\" - Private MyDeclPath As String = MyAppPath & "Declaration\" - 'private FB_FilHisDir = MyConfPath & "FileHistory\" - Private HomePath As String = "<HOME>" - Private JobPath As String = "<JOBPATH>" - Private DefVehPath As String = "<VEHDIR>" - Private NoFile As String = "<NOFILE>" - Private EmptyString As String = "<EMPTYSTRING>" - Private Break As String = "<//>" - - Private Normed As String = "NORM" - - Private PauxSply As String = "<AUX_" - -#Region "File path functions" - - - Public Function GetRelativePath(filePath As String, basePath As String) As String - If (String.IsNullOrEmpty(filePath) OrElse String.IsNullOrEmpty(basePath)) Then - Return "" - End If - If (Path.GetDirectoryName(filePath).StartsWith(basePath, StringComparison.OrdinalIgnoreCase)) Then - Return Path.GetFullPath(filePath).Substring(basePath.Length + If(basePath.EndsWith("\"), 0, 1)) - End If - Return filePath - End Function - - - 'When no path is specified, then insert either HomeDir or MainDir Special-folders - Public Function fFileRepl(ByVal file As String, Optional ByVal MainDir As String = "") As String - - Dim ReplPath As String - - 'Trim Path - file = Trim(file) - - 'If empty file => Abort - If file = "" Then Return "" - - 'Replace sKeys - file = Microsoft.VisualBasic.Strings.Replace(file, DefVehPath & "\", MyAppPath & "Default Vehicles\", 1, -1, - CompareMethod.Text) - file = Microsoft.VisualBasic.Strings.Replace(file, DefVehPath & "\", MyAppPath, 1, -1, CompareMethod.Text) - - 'Replace - Determine folder - If MainDir = "" Then - ReplPath = MyAppPath - Else - ReplPath = MainDir - End If - - ' "..\" => One folder-level up - Do While ReplPath.Length > 0 AndAlso Left(file, 3) = "..\" - ReplPath = fPathUp(ReplPath) - file = file.Substring(3) - Loop - - - 'Supplement Path, if not available - If fPATH(file) = "" Then - - Return ReplPath & file - - Else - Return file - End If - End Function - - 'Path one-level-up "C:\temp\ordner1\" >> "C:\temp\" - Private Function fPathUp(ByVal Pfad As String) As String - Dim x As Integer - - Pfad = Pfad.Substring(0, Pfad.Length - 1) - - x = Pfad.LastIndexOf("\") - - If x = -1 Then Return "" - - Return Pfad.Substring(0, x + 1) - End Function - - 'File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" - Public Function fFILE(ByVal Pfad As String, ByVal MitEndung As Boolean) As String - Dim x As Integer - x = Pfad.LastIndexOf("\") + 1 - Pfad = Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) - If Not MitEndung Then - x = Pfad.LastIndexOf(".") - If x > 0 Then Pfad = Microsoft.VisualBasic.Left(Pfad, x) - End If - Return Pfad - End Function - - 'Filename without extension "C:\temp\TEST.txt" >> "C:\temp\TEST" - Public Function fFileWoExt(ByVal Path As String) As String - Return fPATH(Path) & fFILE(Path, False) - End Function - - 'Filename without path if Path = WorkDir or MainDir - Public Function fFileWoDir(ByVal file As String, Optional ByVal MainDir As String = "") As String - Dim path As String - - If MainDir = "" Then - path = MyAppPath - Else - path = MainDir - End If - - If UCase(fPATH(file)) = UCase(path) Then file = fFILE(file, True) - - Return file - End Function - - 'Path alone "C:\temp\TEST.txt" >> "C:\temp\" - ' "TEST.txt" >> "" - Public Function fPATH(ByVal Pfad As String) As String - Dim x As Integer - If Pfad Is Nothing OrElse Pfad.Length < 3 OrElse Pfad.Substring(1, 2) <> ":\" Then Return "" - x = Pfad.LastIndexOf("\") - Return Microsoft.VisualBasic.Left(Pfad, x + 1) - End Function - - 'Extension alone "C:\temp\TEST.txt" >> ".txt" - Public Function fEXT(ByVal Pfad As String) As String - Dim x As Integer - x = Pfad.LastIndexOf(".") - If x = -1 Then - Return "" - Else - Return Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) - End If - End Function - - -#End Region -End Module - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.IO + +''' <summary> +''' Global File Brower properties and cFilebrowser instances. +''' </summary> +''' <remarks></remarks> +Module FB_Global + Public FB_FolderHistory(19) As String + Public FB_Drives() As String + Public FB_Init As Boolean + Public FB_FilHisDir As String + '----------------------------- + Public fbFolder As cFileBrowser + Public fbVECTO As cFileBrowser + Public fbFileLists As cFileBrowser + Public fbVEH As cFileBrowser + Public fbDRI As cFileBrowser + Public fbMAP As cFileBrowser + Public fbFLD As cFileBrowser + + Public fbENG As cFileBrowser + Public fbGBX As cFileBrowser + Public fbACC As cFileBrowser + Public fbAUX As cFileBrowser + + Public fbGBS As cFileBrowser + Public fbTLM As cFileBrowser + Public fbRLM As cFileBrowser + Public fbTCC As cFileBrowser + Public fbCDx As cFileBrowser + + Public fbVMOD As cFileBrowser + + 'Paths + Private MyAppPath As String = My.Application.Info.DirectoryPath & "\" + Private MyConfPath As String = MyAppPath & "Config\" + Private MyDeclPath As String = MyAppPath & "Declaration\" + 'private FB_FilHisDir = MyConfPath & "FileHistory\" + Private HomePath As String = "<HOME>" + Private JobPath As String = "<JOBPATH>" + Private DefVehPath As String = "<VEHDIR>" + Private NoFile As String = "<NOFILE>" + Private EmptyString As String = "<EMPTYSTRING>" + Private Break As String = "<//>" + + Private Normed As String = "NORM" + + Private PauxSply As String = "<AUX_" + +#Region "File path functions" + + + Public Function GetRelativePath(filePath As String, basePath As String) As String + If (String.IsNullOrEmpty(filePath) OrElse String.IsNullOrEmpty(basePath)) Then + Return "" + End If + If (Path.GetDirectoryName(filePath).StartsWith(basePath, StringComparison.OrdinalIgnoreCase)) Then + Return Path.GetFullPath(filePath).Substring(basePath.Length + If(basePath.EndsWith("\"), 0, 1)) + End If + Return filePath + End Function + + + 'When no path is specified, then insert either HomeDir or MainDir Special-folders + Public Function fFileRepl(ByVal file As String, Optional ByVal MainDir As String = "") As String + + Dim ReplPath As String + + 'Trim Path + file = Trim(file) + + 'If empty file => Abort + If file = "" Then Return "" + + 'Replace sKeys + file = Microsoft.VisualBasic.Strings.Replace(file, DefVehPath & "\", MyAppPath & "Default Vehicles\", 1, -1, + CompareMethod.Text) + file = Microsoft.VisualBasic.Strings.Replace(file, DefVehPath & "\", MyAppPath, 1, -1, CompareMethod.Text) + + 'Replace - Determine folder + If MainDir = "" Then + ReplPath = MyAppPath + Else + ReplPath = MainDir + End If + + ' "..\" => One folder-level up + Do While ReplPath.Length > 0 AndAlso Left(file, 3) = "..\" + ReplPath = fPathUp(ReplPath) + file = file.Substring(3) + Loop + + + 'Supplement Path, if not available + If fPATH(file) = "" Then + + Return ReplPath & file + + Else + Return file + End If + End Function + + 'Path one-level-up "C:\temp\ordner1\" >> "C:\temp\" + Private Function fPathUp(ByVal Pfad As String) As String + Dim x As Integer + + Pfad = Pfad.Substring(0, Pfad.Length - 1) + + x = Pfad.LastIndexOf("\") + + If x = -1 Then Return "" + + Return Pfad.Substring(0, x + 1) + End Function + + 'File name without the path "C:\temp\TEST.txt" >> "TEST.txt" oder "TEST" + Public Function fFILE(ByVal Pfad As String, ByVal MitEndung As Boolean) As String + Dim x As Integer + x = Pfad.LastIndexOf("\") + 1 + Pfad = Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) + If Not MitEndung Then + x = Pfad.LastIndexOf(".") + If x > 0 Then Pfad = Microsoft.VisualBasic.Left(Pfad, x) + End If + Return Pfad + End Function + + 'Filename without extension "C:\temp\TEST.txt" >> "C:\temp\TEST" + Public Function fFileWoExt(ByVal Path As String) As String + Return fPATH(Path) & fFILE(Path, False) + End Function + + 'Filename without path if Path = WorkDir or MainDir + Public Function fFileWoDir(ByVal file As String, Optional ByVal MainDir As String = "") As String + Dim path As String + + If MainDir = "" Then + path = MyAppPath + Else + path = MainDir + End If + + If UCase(fPATH(file)) = UCase(path) Then file = fFILE(file, True) + + Return file + End Function + + 'Path alone "C:\temp\TEST.txt" >> "C:\temp\" + ' "TEST.txt" >> "" + Public Function fPATH(ByVal Pfad As String) As String + Dim x As Integer + If Pfad Is Nothing OrElse Pfad.Length < 3 OrElse Pfad.Substring(1, 2) <> ":\" Then Return "" + x = Pfad.LastIndexOf("\") + Return Microsoft.VisualBasic.Left(Pfad, x + 1) + End Function + + 'Extension alone "C:\temp\TEST.txt" >> ".txt" + Public Function fEXT(ByVal Pfad As String) As String + Dim x As Integer + x = Pfad.LastIndexOf(".") + If x = -1 Then + Return "" + Else + Return Microsoft.VisualBasic.Right(Pfad, Microsoft.VisualBasic.Len(Pfad) - x) + End If + End Function + + +#End Region +End Module + diff --git a/VECTOAux/VectoAuxiliaries/UI/VECTO_Types.vb b/VECTOAux/VectoAuxiliaries/UI/VECTO_Types.vb index 073a815c488d4969d450348700053bac812ac89e..6688b5f33354859d85a4352c0cbf3f9ebb49fd2d 100644 --- a/VECTOAux/VectoAuxiliaries/UI/VECTO_Types.vb +++ b/VECTOAux/VectoAuxiliaries/UI/VECTO_Types.vb @@ -1,22 +1,22 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -''' <summary> -''' Determines how file extensions are set in the File Browser -''' </summary> -''' <remarks></remarks> -Public Enum tFbExtMode As Integer - ForceExt = 0 - MultiExt = 1 - SingleExt = 2 -End Enum - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +''' <summary> +''' Determines how file extensions are set in the File Browser +''' </summary> +''' <remarks></remarks> +Public Enum tFbExtMode As Integer + ForceExt = 0 + MultiExt = 1 + SingleExt = 2 +End Enum + + diff --git a/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb b/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb index c5a9c5521bd1e6c259c04b22e9f92679f6fcd3e6..6b3d7f6e8817c6cec6e000729f0614b2925b64e1 100644 --- a/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb +++ b/VECTOAux/VectoAuxiliaries/UI/cFileBrowser.vb @@ -1,164 +1,164 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports System.Collections - -''' <summary> -''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. -''' </summary> -''' <remarks> -''' Usage: -''' 1. Create new instance, preferably in FB_Global, e.g. fbTXT = New cFileBrowser("txt") -''' 2. Define extensions, e.g. fbTXT.Extensions = New String() {"txt","log"} -''' 3. Use OpenDialog, SaveDialog, etc. -''' 4. Call Close method when closing application to write file history, e.g. fbTXT.Close -''' File history is unique for each ID. Folder history is global. -''' </remarks> -Public Class cFileBrowser - Private Initialized As Boolean - Private MyID As String - Private MyExt As String() - Private Dlog As FB_Dialog - Private NoExt As Boolean - Private bFolderBrowser As Boolean - Private bLightMode As Boolean - - ''' <summary> - ''' New cFileBrowser instance - ''' </summary> - ''' <param name="ID">Needed to save the file history when not using LightMode.</param> - ''' <param name="folderBrowser">Browse folders instead of files.</param> - ''' <param name="lightMode">If enabled file history is not saved.</param> - ''' <remarks></remarks> - Public Sub New(ByVal ID As String, Optional ByVal folderBrowser As Boolean = False, - Optional ByVal lightMode As Boolean = False) - Initialized = False - MyID = ID - NoExt = True - bFolderBrowser = folderBrowser - bLightMode = LightMode - End Sub - - ''' <summary> - ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="multiFile">Allow selecting multiple files.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function OpenDialog(ByVal path As String, Optional ByVal multiFile As Boolean = False, - Optional ByVal Ext As String = "") As Boolean - Return CustomDialog(path, True, False, tFbExtMode.MultiExt, MultiFile, Ext, "Open") - End Function - - ''' <summary> - ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="forceExt">Force predefined file extension.</param> - ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function SaveDialog(ByVal path As String, Optional ByVal forceExt As Boolean = True, - Optional ByVal Ext As String = "") As Boolean - Dim x As tFbExtMode - If ForceExt Then - x = tFbExtMode.ForceExt - Else - x = tFbExtMode.SingleExt - End If - Return CustomDialog(path, False, True, x, False, Ext, "Save As") - End Function - - ''' <summary> - ''' Custom open/save dialog. Returns False if cancelled by user, else True. - ''' </summary> - ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> - ''' <param name="fileMustExist">Selected file must exist.</param> - ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> - ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> - ''' <param name="multiFile">Allow to select multiple files.</param> - ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> - ''' <param name="title">Dialog title.</param> - ''' <returns></returns> - ''' <remarks></remarks> - Public Function CustomDialog(ByVal path As String, ByVal fileMustExist As Boolean, ByVal overwriteCheck As Boolean, - ByVal extMode As tFbExtMode, ByVal multiFile As Boolean, ByVal ext As String, - Optional title As String = "File Browser") As Boolean - If Not Initialized Then Init() - Return Dlog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, ext, Title) - End Function - - 'Manually update File History - ''' <summary> - ''' Add file to file history. - ''' </summary> - ''' <param name="path">File to be added to file history.</param> - ''' <remarks></remarks> - Public Sub UpdateHistory(ByVal path As String) - If Not Initialized Then Init() - Dlog.UpdateHistory(Path) - End Sub - - ''' <summary> - ''' Save file history (if not LightMode) and global folder history. - ''' </summary> - ''' <remarks></remarks> - Public Sub Close() - If Initialized Then - Dlog.SaveAndClose() - Initialized = False - End If - Dlog = Nothing - End Sub - - Private Sub Init() - Dlog = New FB_Dialog(bLightMode) - Dlog.ID = MyID - If Not NoExt Then Dlog.Extensions = MyExt - If bFolderBrowser Then Dlog.SetFolderBrowser() - Initialized = True - End Sub - - ''' <summary> - ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property Extensions() As String() - Get - Return MyExt - End Get - Set(ByVal value As String()) - MyExt = value - NoExt = False - End Set - End Property - - ''' <summary> - ''' Selected file(s) oder folder (if FolderBrowser) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public ReadOnly Property Files() As String() - Get - If Initialized Then - Return Dlog.Files - Else - Return New String() {""} - End If - End Get - End Property -End Class - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports System.Collections + +''' <summary> +''' File Browser for Open/Save File dialogs and Folder Browser. Features File History and Favorite Folders. +''' </summary> +''' <remarks> +''' Usage: +''' 1. Create new instance, preferably in FB_Global, e.g. fbTXT = New cFileBrowser("txt") +''' 2. Define extensions, e.g. fbTXT.Extensions = New String() {"txt","log"} +''' 3. Use OpenDialog, SaveDialog, etc. +''' 4. Call Close method when closing application to write file history, e.g. fbTXT.Close +''' File history is unique for each ID. Folder history is global. +''' </remarks> +Public Class cFileBrowser + Private Initialized As Boolean + Private MyID As String + Private MyExt As String() + Private Dlog As FB_Dialog + Private NoExt As Boolean + Private bFolderBrowser As Boolean + Private bLightMode As Boolean + + ''' <summary> + ''' New cFileBrowser instance + ''' </summary> + ''' <param name="ID">Needed to save the file history when not using LightMode.</param> + ''' <param name="folderBrowser">Browse folders instead of files.</param> + ''' <param name="lightMode">If enabled file history is not saved.</param> + ''' <remarks></remarks> + Public Sub New(ByVal ID As String, Optional ByVal folderBrowser As Boolean = False, + Optional ByVal lightMode As Boolean = False) + Initialized = False + MyID = ID + NoExt = True + bFolderBrowser = folderBrowser + bLightMode = LightMode + End Sub + + ''' <summary> + ''' Opens dialog for OPENING files. Selected file must exist. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="multiFile">Allow selecting multiple files.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function OpenDialog(ByVal path As String, Optional ByVal multiFile As Boolean = False, + Optional ByVal Ext As String = "") As Boolean + Return CustomDialog(path, True, False, tFbExtMode.MultiExt, MultiFile, Ext, "Open") + End Function + + ''' <summary> + ''' Opens dialog for SAVING files. If file already exists user will be asked to overwrite. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="forceExt">Force predefined file extension.</param> + ''' <param name="Ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function SaveDialog(ByVal path As String, Optional ByVal forceExt As Boolean = True, + Optional ByVal Ext As String = "") As Boolean + Dim x As tFbExtMode + If ForceExt Then + x = tFbExtMode.ForceExt + Else + x = tFbExtMode.SingleExt + End If + Return CustomDialog(path, False, True, x, False, Ext, "Save As") + End Function + + ''' <summary> + ''' Custom open/save dialog. Returns False if cancelled by user, else True. + ''' </summary> + ''' <param name="path">Initial selected file. If empty the last selected file is used. If file without directoy the last directory will be used.</param> + ''' <param name="fileMustExist">Selected file must exist.</param> + ''' <param name="overwriteCheck">If file already exists user will be asked to overwrite.</param> + ''' <param name="extMode">ForceExt= First predefined extension (or Ext parameter) will be forced (Default for SaveDialog), MultiExt= All files with predefined extensions are shown (Default for OpenDialog), SingleExt= All files with the first predefined extension will be shown.</param> + ''' <param name="multiFile">Allow to select multiple files.</param> + ''' <param name="ext">Set extension. If not defined the first predefined extension is used.</param> + ''' <param name="title">Dialog title.</param> + ''' <returns></returns> + ''' <remarks></remarks> + Public Function CustomDialog(ByVal path As String, ByVal fileMustExist As Boolean, ByVal overwriteCheck As Boolean, + ByVal extMode As tFbExtMode, ByVal multiFile As Boolean, ByVal ext As String, + Optional title As String = "File Browser") As Boolean + If Not Initialized Then Init() + Return Dlog.Browse(path, fileMustExist, overwriteCheck, extMode, multiFile, ext, Title) + End Function + + 'Manually update File History + ''' <summary> + ''' Add file to file history. + ''' </summary> + ''' <param name="path">File to be added to file history.</param> + ''' <remarks></remarks> + Public Sub UpdateHistory(ByVal path As String) + If Not Initialized Then Init() + Dlog.UpdateHistory(Path) + End Sub + + ''' <summary> + ''' Save file history (if not LightMode) and global folder history. + ''' </summary> + ''' <remarks></remarks> + Public Sub Close() + If Initialized Then + Dlog.SaveAndClose() + Initialized = False + End If + Dlog = Nothing + End Sub + + Private Sub Init() + Dlog = New FB_Dialog(bLightMode) + Dlog.ID = MyID + If Not NoExt Then Dlog.Extensions = MyExt + If bFolderBrowser Then Dlog.SetFolderBrowser() + Initialized = True + End Sub + + ''' <summary> + ''' Predefined file extensions. Must be set before Open/Save dialog is used for the first time. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property Extensions() As String() + Get + Return MyExt + End Get + Set(ByVal value As String()) + MyExt = value + NoExt = False + End Set + End Property + + ''' <summary> + ''' Selected file(s) oder folder (if FolderBrowser) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public ReadOnly Property Files() As String() + Get + If Initialized Then + Return Dlog.Files + Else + Return New String() {""} + End If + End Get + End Property +End Class + + diff --git a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb index be7c1ae774d011beb51c67e40f695b1b63eca026..bc17e7d3e476e8843b5182d9585956a6b23caba8 100644 --- a/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb +++ b/VECTOAux/VectoAuxiliaries/UI/frmAuxiliaryConfig.vb @@ -1,1537 +1,1537 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Imports VectoAuxiliaries -Imports VectoAuxiliaries.Electrics -Imports VectoAuxiliaries.Pneumatics -Imports System.ComponentModel -Imports System.Windows.Forms -Imports System.Drawing -Imports VectoAuxiliaries.Hvac -Imports System.IO - - -Public Class frmAuxiliaryConfig - -#Region "Fields" - - Public auxConfig As AuxiliaryConfig - Public originalConfig As AuxiliaryConfig ' required to test if the form is dirty - Private TabColors As Dictionary(Of TabPage, Color) = New Dictionary(Of TabPage, Color)() - Private processing As Boolean = False - Private SecondsIntoCycle As Integer = 0 - Private vectoFile As String = "" - Private aauxPath As String = "" - Private auxFile As String - Private cmFilesList As String() - Private SaveClicked As Boolean - Private electricalConsumerBinding As New BindingList(Of IElectricalConsumer) - - -#End Region - - Private Function ValidateAuxFileName(filename As String) As Boolean - - Dim message As String = String.Empty - - If Not FilePathUtils.ValidateFilePath(filename, ".aaux", message) Then - MessageBox.Show(message) - End If - - Return True - End Function - - 'Constructor - Public Sub New(ByVal fileName As String, ByVal vectoFileName As String) - - - If Not ValidateAuxFileName(fileName) Then - Me.DialogResult = Windows.Forms.DialogResult.Abort - Me.Close() - End If - - - Me.vectoFile = vectoFileName - Me.aauxPath = Path.GetDirectoryName(Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName)) - - ' This call is required by the designer. - InitializeComponent() - - ' Add any initialization after the InitializeComponent() call. - auxFile = Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName) - - Try - - auxConfig = New AuxiliaryConfig(auxFile) - originalConfig = New AuxiliaryConfig(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) - - Catch ex As Exception - - MessageBox.Show("The filename you supplied {0} was invalid or could not be found ", fileName) - Me.DialogResult = Windows.Forms.DialogResult.Abort - Me.Close() - - End Try - End Sub - - 'Validation - -#Region "Validation Helpers" - - Public Function IsPostiveNumber(ByVal test As String) As Boolean - - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False - - Dim number As Single - - If Not Single.TryParse(test, number) Then Return False - - If number <= 0 Then Return False - - - Return True - End Function - - Public Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean - - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False - - Dim number As Single - - If Not Single.TryParse(test, number) Then Return False - - If number < 0 Then Return False - - - Return True - End Function - - Public Function IsNumberBetweenZeroandOne(test As String) As Boolean - - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False - - Dim number As Single - - If Not Single.TryParse(test, number) Then Return False - - If number < 0 OrElse number > 1 Then Return False - - Return True - End Function - - Public Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean - - 'Is this numeric sanity check. - If Not IsNumeric(test) Then Return False - - 'if not integer then return false - - Dim number As Integer - - If Not Integer.TryParse(test, number) Then Return False - - If number < 0 Then Return False - - Return True - End Function - -#End Region - -#Region "Validation Control" - - - '****** PNEUMATIC VALIDATION - Public Sub Validating_PneumaticHandler(sender As Object, e As CancelEventArgs) _ - Handles txtAdBlueNIperMinute.Validating, txtBrakingWithRetarderNIperKG.Validating, - txtBrakingNoRetarderNIperKG.Validating, txtAirControlledSuspensionNIperMinute.Validating, - txtBreakingPerKneelingNIperKGinMM.Validating, txtSmartRegenFractionTotalAirDemand.Validating, - txtPerStopBrakeActuationNIperKG.Validating, txtPerDoorOpeningNI.Validating, - txtOverrunUtilisationForCompressionFraction.Validating, txtNonSmartRegenFractionTotalAirDemand.Validating, - txtDeadVolumeLitres.Validating, txtDeadVolBlowOutsPerLitresperHour.Validating, - txtKneelingHeightMillimeters.Validating, txtCompressorMap.Validating, txtCompressorGearRatio.Validating, - txtCompressorGearEfficiency.Validating, txtActuationsMap.Validating, cboDoors.Validating, - cboAirSuspensionControl.Validating, cboAdBlueDosing.Validating - - e.Cancel = Not Validate_Pneumatics() - End Sub - - Public Function Validate_Pneumatics() As Boolean - - Dim result As Boolean = True - - 'PNEUMATIC AUXILLARIES PART - '*************************** - - - 'AdBlue NI per Minute : txtAdBlueNIperMinute - If Not IsZeroOrPostiveNumber(txtAdBlueNIperMinute.Text) Then - ErrorProvider.SetError(txtAdBlueNIperMinute, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtAdBlueNIperMinute, String.Empty) - End If - - 'Overrun Utilisation For Compression Fraction : txtOverrunUtilisationForCompressionFraction - If Not IsNumberBetweenZeroandOne(txtOverrunUtilisationForCompressionFraction.Text) Then - ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, "Please provide a non negative between 0 and 1.") - result = False - Else - ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, String.Empty) - End If - - 'Braking With Retarder NI per KG : txtBrakingWithRetarderNIperKG - If Not IsZeroOrPostiveNumber(txtBrakingWithRetarderNIperKG.Text) Then - ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, String.Empty) - End If - - 'Braking No Retarder NI per KG : txtBrakingNoRetarderNIperKG - If Not IsZeroOrPostiveNumber(txtBrakingNoRetarderNIperKG.Text) Then - ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, String.Empty) - End If - - 'Breaking Per Kneeling NI per KG in MM : txtBreakingPerKneelingNIperKGinMM - If Not IsZeroOrPostiveNumber(txtBreakingPerKneelingNIperKGinMM.Text) Then - ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, String.Empty) - End If - - 'Per Door Opening NI : txtPerDoorOpeningNI - If Not IsZeroOrPostiveNumber(txtPerDoorOpeningNI.Text) Then - ErrorProvider.SetError(txtPerDoorOpeningNI, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtPerDoorOpeningNI, String.Empty) - End If - - 'Per Stop Brake Actuation NI per KG : txtPerStopBrakeActuationNIperKG - If Not IsZeroOrPostiveNumber(txtPerStopBrakeActuationNIperKG.Text) Then - ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, String.Empty) - End If - - 'Air Controlled Suspension NI per Minute : txtAirControlledSuspensionNIperMinute - If Not IsZeroOrPostiveNumber(txtAirControlledSuspensionNIperMinute.Text) Then - ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, String.Empty) - End If - - 'Non Smart Regen Fraction Total Air Demand : txtNonSmartRegenFractionTotalAirDemand - If Not IsZeroOrPostiveNumber(txtNonSmartRegenFractionTotalAirDemand.Text) Then - ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, String.Empty) - End If - - 'Smart Regen Fraction Total Air Demand : txtSmartRegenFractionTotalAirDemand - If Not IsNumberBetweenZeroandOne(txtSmartRegenFractionTotalAirDemand.Text) Then - ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, "Please provide a non negative between 0 and 1.") - result = False - Else - ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, String.Empty) - End If - - - 'Dead Volume Litres : txtDeadVolumeLitres - If Not IsZeroOrPostiveNumber(txtDeadVolumeLitres.Text) Then - ErrorProvider.SetError(txtDeadVolumeLitres, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtDeadVolumeLitres, String.Empty) - End If - - - 'Dead Vol BlowOuts Per Litresper Hour : txtDeadVolBlowOutsPerLitresperHour - If Not IsZeroOrPostiveNumber(txtDeadVolBlowOutsPerLitresperHour.Text) Then - ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, String.Empty) - End If - - - 'USER CONFIG PART - '***************************************************************************************** - 'Compressor Map path : txtCompressorMap - 'Test for empty after trim - If txtCompressorMap.Text.Trim.Length = 0 Then - ErrorProvider.SetError(txtCompressorMap, "Please enter the localtion of a valid compressor map.") - result = False - Else - ErrorProvider.SetError(txtCompressorMap, String.Empty) - End If - 'Test File is valid - Dim comp As CompressorMap - Try - - comp = New CompressorMap(FilePathUtils.ResolveFilePath(aauxPath, txtCompressorMap.Text)) - comp.Initialise() - ErrorProvider.SetError(txtCompressorMap, String.Empty) - Catch ex As Exception - ErrorProvider.SetError(txtCompressorMap, - "Error : map is invalid or cannot be found, please select a Cvalid compressor map") - result = False - End Try - - 'Compressor Gear Efficiency : txtCompressorGearEfficiency" - If Not IsNumberBetweenZeroandOne(txtCompressorGearEfficiency.Text) Then - ErrorProvider.SetError(txtCompressorGearEfficiency, "Please enter a number between 0 and 1") - result = False - Else - ErrorProvider.SetError(txtCompressorGearEfficiency, String.Empty) - End If - - 'Compressor Gear Ratio : txtCompressorGearRatio - If Not IsPostiveNumber(txtCompressorGearRatio.Text) Then - ErrorProvider.SetError(txtCompressorGearRatio, "Please enter a number greater than 0.") - result = False - Else - ErrorProvider.SetError(txtCompressorGearRatio, String.Empty) - End If - - - 'Actuations Map : txtActuationsMap - If txtActuationsMap.Text.Trim.Length = 0 Then - ErrorProvider.SetError(txtActuationsMap, "Please enter the localtion of a valid Pneumatic Actuations map.") - result = False - Else - ErrorProvider.SetError(txtActuationsMap, String.Empty) - End If - 'Test File is valid - Dim actuations As PneumaticActuationsMAP - Try - - actuations = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(aauxPath, txtActuationsMap.Text)) - actuations.Initialise() - ErrorProvider.SetError(txtActuationsMap, String.Empty) - Catch ex As Exception - ErrorProvider.SetError(txtActuationsMap, - "Error : Pneumatic Actuations map is invalid or cannot be found, please select a valid map") - result = False - End Try - - - 'NOT Required but included here so readers can see this is a positive ommission - '****************************************************************************** - 'Smart Air Compression : chkSmartAirCompression - 'Smart Regeneration : chkSmartRegeneration - 'Retarder Brake : chkRetarderBrake - - 'txtKneelingHeightMillimeters : txtKneelingHeightMillimeters - If Not IsZeroOrPostiveNumber(txtKneelingHeightMillimeters.Text) Then - ErrorProvider.SetError(txtKneelingHeightMillimeters, "Please enter a number greater than 0.") - result = False - Else - ErrorProvider.SetError(txtKneelingHeightMillimeters, String.Empty) - End If - - 'cboAirSuspensionControl : cboAirSuspensionControl - If cboAirSuspensionControl.SelectedIndex < 1 Then - ErrorProvider.SetError(cboAirSuspensionControl, "Please make a selection.") - result = False - Else - ErrorProvider.SetError(cboAirSuspensionControl, String.Empty) - End If - - 'cboAdBlueDosing : cboAdBlueDosing - If cboAdBlueDosing.SelectedIndex < 1 Then - ErrorProvider.SetError(cboAdBlueDosing, "Please make a selection.") - result = False - Else - ErrorProvider.SetError(cboAdBlueDosing, String.Empty) - End If - - 'cboDoors : cboDoors - If cboDoors.SelectedIndex < 1 Then - ErrorProvider.SetError(cboDoors, "Please make a selection.") - result = False - Else - ErrorProvider.SetError(cboDoors, String.Empty) - End If - - - 'Set Tab Color - - UpdateTabStatus("tabPneumaticConfig", result) - - - Return result - End Function - - '***** ELECTRICAL VALIDATION - Public Sub Validating_ElectricsHandler(sender As Object, e As CancelEventArgs) _ - Handles txtPowernetVoltage.Validating, txtAlternatorMapPath.Validating, txtAlternatorGearEfficiency.Validating, - txtDoorActuationTimeSeconds.Validating, txtStoredEnergyEfficiency.Validating - - e.Cancel = Not Validate_Electrics() - End Sub - - Public Function Validate_Electrics() As Boolean - - Dim result As Boolean = True - - - 'Powernet Voltage : txtPowernetVoltage - If Not IsPostiveNumber(txtPowernetVoltage.Text) Then - ErrorProvider.SetError(txtPowernetVoltage, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtPowernetVoltage, String.Empty) - End If - - - 'Alternator Map path : txtAlternatorMapPath - 'Test for empty after trim - If txtAlternatorMapPath.Text.Trim.Length = 0 Then - ErrorProvider.SetError(txtAlternatorMapPath, "Please enter the localtion of a valid alternator map.") - result = False - Else - ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) - End If - - 'Test File is valid - Dim alt As ICombinedAlternator - Try - alt = New CombinedAlternator(FilePathUtils.ResolveFilePath(aauxPath, txtAlternatorMapPath.Text)) - ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) - Catch ex As Exception - ErrorProvider.SetError(txtAlternatorMapPath, - "Error : map is invalid or cannot be found, please select a valid alternator map") - result = False - End Try - - - 'Alternator Gear Efficiency : txtAlternatorGearEfficiency - If Not IsNumberBetweenZeroandOne(txtAlternatorGearEfficiency.Text) Then - ErrorProvider.SetError(txtAlternatorGearEfficiency, "Please enter a number between 0 an 1") - result = False - Else - ErrorProvider.SetError(txtAlternatorGearEfficiency, String.Empty) - End If - - - 'Door Action Time : txtDoorActuationTimeSeconds - If Not IsPostiveNumber(txtDoorActuationTimeSeconds.Text) Then - ErrorProvider.SetError(txtDoorActuationTimeSeconds, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtDoorActuationTimeSeconds, String.Empty) - End If - - 'Stored Energy Efficiency : txtStoredEnergyEfficiency - If Not IsPostiveNumber(txtStoredEnergyEfficiency.Text) Then - ErrorProvider.SetError(txtStoredEnergyEfficiency, "Please provide a non negative number.") - result = False - Else - ErrorProvider.SetError(txtStoredEnergyEfficiency, String.Empty) - End If - - - UpdateTabStatus("tabElectricalConfig", result) - - - Return result - End Function - - '****** HVAC VALIDATION - Public Sub Validating_HVACHandler(sender As Object, e As CancelEventArgs) _ - Handles txtSSMFilePath.Validating, txtBusDatabaseFilePath.Validating - - e.Cancel = Not Validate_HVAC() - End Sub - - Public Function Validate_HVAC() As Boolean - - Dim result As Boolean = True - Dim message As String = "" - - 'Validate abdb - Bus Database - Dim abdbFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text) - Dim bdb As New BusDatabase() - If bdb.Initialise(abdbFile) Then - ErrorProvider.SetError(txtBusDatabaseFilePath, String.Empty) - Else - result = False - ErrorProvider.SetError(Me.txtBusDatabaseFilePath, "Please choose a valid Steady State Model File (*.ABDB") - End If - - - 'Try ahsm - HVac Steady State Model - Try - - Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text) - Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) - - If ssmTool.Load(ahsmFile) Then - ErrorProvider.SetError(txtSSMFilePath, String.Empty) - Else - result = False - ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") - End If - - Catch ex As Exception - 'Just in case - ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") - result = False - - End Try - - - UpdateTabStatus("tabHVACConfig", result) - - Return result - End Function - - - Public Function ValidateAll() As Boolean - - If Validate_Pneumatics() = False Or Validate_Electrics() = False Or Validate_HVAC() = False Then - Return False - End If - - Return True - End Function - - '***** IMPUTS VALIDATION - -#End Region - - 'Form Controls & Events - Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load - - 'Required for OwnerDraw, this is required in order to color the tabs when a validation error occurs to draw - 'The attention of the user to the fact that attention is required on a particlar tab. - TabColors.Add(tabGeneralConfig, Control.DefaultBackColor) - TabColors.Add(tabElectricalConfig, Control.DefaultBackColor) - TabColors.Add(tabPneumaticConfig, Control.DefaultBackColor) - TabColors.Add(tabHVACConfig, Control.DefaultBackColor) - - - 'This is here only for testing purposes, the actual cycle will be a result of Vecto input. - cboCycle.SelectedIndex = 0 - - 'General Setup of all controls - SetupControls() - - 'Binding Values in Aux environment to the input controls on relevent tabs in the form. - CreateBindings() - - 'This function is neccesary because binding does not occur when the page is invisible, so a track across all of them - 'Is required in order to set the binding. This only needs to be done once at at setup time. after values are set in the - 'Aux environment either by setting defaults of reading and setting from the Auxillaries persistance file. - EnsureBinding() - - - 'Additional atatched events - 'For Tab Coloring, this is the place where the background will get filled on the tab when attention is required. - AddHandler tabMain.DrawItem, New System.Windows.Forms.DrawItemEventHandler(AddressOf tabMain_DrawItem) - - 'Select Electric Tab - tabMain.SelectTab(tabMain.TabPages("tabElectricalConfig")) - - - 'Enabled / Disables Smart Cards based on chkSmartElectrical - SetSmartCardEmabledStatus() - - 'Merge Info data from ElectricalConsumer in a Default set into live set - 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. - auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.MergeInfoData() - End Sub - - Private Sub frmAuxiliaryConfig_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing - - - If Me.DialogResult = Windows.Forms.DialogResult.Cancel Then Return - - Dim result As DialogResult - - If Not File.Exists(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) OrElse - Not auxConfig.ConfigValuesAreTheSameAs(originalConfig) Then - - result = - (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, - MessageBoxIcon.Question)) - - Select Case result - - Case DialogResult.Yes - 'save - If Not SaveFile() Then - e.Cancel = True - End If - - Case DialogResult.No - 'just allow the form to close - 'without saving - Me.DialogResult = Windows.Forms.DialogResult.Cancel - - - Case DialogResult.Cancel - 'cancel the close - e.Cancel = True - Me.DialogResult = Windows.Forms.DialogResult.Cancel - - - End Select - Else - Me.DialogResult = Windows.Forms.DialogResult.Cancel - e.Cancel = False - End If - End Sub - -#Region "GridHandlers" - - Private Sub gvElectricalConsumables_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ - Handles gvElectricalConsumables.CellValidating - - Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) - Dim s As Single - - - If e.ColumnIndex = -1 Then - - e.Cancel = True - Exit Sub - - End If - - If column.ReadOnly Then Return - - Select Case column.Name - - Case "NominalConsumptionAmps" - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - - Case "NumberInActualVehicle" - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - Else - s = Single.Parse(e.FormattedValue.ToString()) - End If - If s Mod 1 > 0 OrElse s < 0 Then - MessageBox.Show("This value must be a positive whole number ( Integer ) ") - e.Cancel = True - End If - - 'Veh Electronics &Engine - If e.RowIndex = 1 Then - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - - If chkSmartElectricals.Checked AndAlso s <> 0 Then - MessageBox.Show("This must be set to 0 in smart mode") - e.Cancel = True - ElseIf Not chkSmartElectricals.Checked AndAlso s <> 1 Then - MessageBox.Show("This must be set to 1 in classic mode") - e.Cancel = True - End If - End If - - 'Exterior Bulb - If e.RowIndex = 14 Then - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - If s <> 1 Then - MessageBox.Show("This must be set 1") - e.Cancel = True - End If - End If - - 'Bonus Bulbs - If e.RowIndex >= 15 AndAlso e.RowIndex <= 19 Then - - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - If s <> 0 AndAlso s <> 1 Then - MessageBox.Show("This must be set to 0 or 1") - e.Cancel = True - End If - - End If - - - Case "PhaseIdle_TractionOn" - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - Else - s = Single.Parse(e.FormattedValue.ToString()) - End If - If s < 0 OrElse s > 1 Then - MessageBox.Show("This must be a value between 0 and 1 ") - e.Cancel = True - End If - - - End Select - End Sub - - Private Sub SmartResult_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ - Handles gvResultsCardIdle.CellValidating, gvResultsCardTraction.CellValidating, gvResultsCardOverrun.CellValidating - - Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) - - If Not IsNumeric(e.FormattedValue) Then - MessageBox.Show("This value must be numeric") - e.Cancel = True - End If - End Sub - - Private Sub resultCard_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) _ - Handles gvResultsCardIdle.CellMouseUp, gvResultsCardTraction.CellMouseUp, gvResultsCardOverrun.CellMouseUp - - Dim dgv As DataGridView = CType(sender, DataGridView) - - - If e.Button = MouseButtons.Right Then - - resultCardContextMenu.Show(dgv, e.Location) - resultCardContextMenu.Show(Cursor.Position) - - End If - End Sub - - Private Sub resultCardContextMenu_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ - Handles resultCardContextMenu.ItemClicked - - Dim menu As ContextMenuStrip = CType(sender, ContextMenuStrip) - - Dim grid As DataGridView = DirectCast(menu.SourceControl, DataGridView) - - Select Case e.ClickedItem.Text - - - Case "Delete" - - For Each selectedRow As DataGridViewRow In grid.SelectedRows - - If Not selectedRow.IsNewRow Then - - grid.Rows.RemoveAt(selectedRow.Index) - - End If - - Next - - Case "Insert" - - - End Select - End Sub - - Private Sub gvElectricalConsumables_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) _ - Handles gvElectricalConsumables.CellFormatting - End Sub - - Private Sub gvElectricalConsumables_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) _ - Handles gvElectricalConsumables.CellBeginEdit - - If e.ColumnIndex = 4 AndAlso e.RowIndex = 0 Then - - MessageBox.Show("This cell is calculated and cannot be edited") - e.Cancel = True - - End If - End Sub - -#End Region - -#Region "Button Handlers" - - Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click - - - If SaveFile() Then - - originalConfig.AssumeValuesOfOther(auxConfig) - Me.Close() - - - End If - End Sub - - Private Function SaveFile() As Boolean - - Dim result As Boolean - - If Not ValidateAll() Then - If _ - (MessageBox.Show("There are invalid values. Do you want so save anyway?", "Save Changes", MessageBoxButtons.YesNo, - MessageBoxIcon.Question) = DialogResult.No) Then - Return False - End If - End If - - result = auxConfig.Save(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) - - If Not result Then MessageBox.Show(String.Format("Unable to Save the file '{0}'", auxFile)) - - Return result - End Function - - Private Function LoadFile() As Boolean - - 'JSON METHOD - Dim result As Boolean - - 'Release existing databindings - UnbindAllControls(Me) - - result = auxConfig.Load(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) - - If Not result Then - MessageBox.Show(String.Format("Unable to load the file '{0}'", auxFile)) - Else - CreateBindings() - End If - - Return result - End Function - - Private Sub btnFuelMap_Click(sender As Object, e As EventArgs) Handles btnFuelMap.Click - - Dim fbAux As New cFileBrowser("AAUXFuelMap", False, False) - - - ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" - Dim fname As String = fFILE(vectoFile, True) - - fbAux.Extensions = New String() {"vmap"} - ' If fbAux.OpenDialog(fFileRepl(fname, fPATH(VECTOfile))) Then - If fbAux.OpenDialog(fPATH(vectoFile)) Then - - txtFuelMap.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) - - End If - End Sub - - Private Sub btnAlternatorMapPath_Click(sender As Object, e As EventArgs) Handles btnAlternatorMapPath.Click - - Dim fbAux As New cFileBrowser("AAUXALT", False, False) - fbAux.Extensions = New String() {"AALT"} - - Dim suppliedAALTPath As String = txtAlternatorMapPath.Text - Dim absoluteAALTPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedAALTPath) - Dim message As String = String.Empty - Dim newFile As Boolean = False - - Dim validAALTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteAALTPath, ".aalt", message) - Dim fileExists As Boolean = File.Exists(absoluteAALTPath) - - If suppliedAALTPath.Length > 0 AndAlso Not validAALTFile Then - MessageBox.Show(message) - Return - End If - - 'If file Exists, Check validity, else fire up a default SSM Config. - If fileExists Then - Try - Dim aaltFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteAALTPath) - Dim combinedAlt As ICombinedAlternator = New CombinedAlternator(aaltFile) - Catch ex As Exception - MessageBox.Show("The supplied .AALT File was invalid, aborting.") - Return - End Try - End If - - If Not fileExists Then - - Dim needToFindOrCreateFile As Boolean = True - While needToFindOrCreateFile - - 'Find / Create file and configure. - If fbAux.CustomDialog(absoluteAALTPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then - txtAlternatorMapPath.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) - suppliedAALTPath = txtAlternatorMapPath.Text - absoluteAALTPath = FilePathUtils.ResolveFilePath(fPATH(vectoFile), suppliedAALTPath) - - If _ - IO.File.Exists(absoluteAALTPath) OrElse - MsgBox("Do you want to create a new .AALT file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - needToFindOrCreateFile = False - newFile = True - End If - Else - needToFindOrCreateFile = False - End If - - End While - - End If - - If fileExists OrElse newFile Then - - Using frm As New frmCombinedAlternators(absoluteAALTPath, New CombinedAlternatorSignals) - 'If Dialog result is OK, then take action else bail - If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then - If suppliedAALTPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then - txtAlternatorMapPath.Text = - If(suppliedAALTPath.Contains(aauxPath), suppliedAALTPath.Replace(aauxPath, ""), suppliedAALTPath) - Else - txtAlternatorMapPath.Text = fFileWoDir(suppliedAALTPath) - End If - Else - Return - End If - End Using - BindingContext(auxConfig.ElectricalUserInputsConfig).EndCurrentEdit() - Validate_Electrics() - - End If - End Sub - - Private Sub btnCompressorMap_Click(sender As Object, e As EventArgs) Handles btnCompressorMap.Click - - - Dim fbAux As New cFileBrowser("AAUXComp", False, False) - - - ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" - Dim fname As String = fFILE(vectoFile, True) - - fbAux.Extensions = New String() {"ACMP"} - If fbAux.OpenDialog(Path.Combine(aauxPath, txtCompressorMap.Text)) Then - - txtCompressorMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) - - End If - - Validate_Pneumatics() - - 'Causes binding to fire - txtCompressorMap.Focus() - End Sub - - Private Sub btnActuationsMap_BindingContextChanged(sender As Object, e As EventArgs) _ - Handles btnActuationsMap.BindingContextChanged - End Sub - - Private Sub btnActuationsMap_Click(sender As Object, e As EventArgs) Handles btnActuationsMap.Click - - Dim fbAux As New cFileBrowser("AAUXPneuAct", False, False) - - ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" - Dim fname As String = fFILE(vectoFile, True) - - fbAux.Extensions = New String() {"APAC"} - If fbAux.OpenDialog(Path.Combine(aauxPath, txtActuationsMap.Text)) Then - - txtActuationsMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) - - End If - - Validate_Pneumatics() - - 'Causes Binding to fire. - txtActuationsMap.Focus() - End Sub - - Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click - - - Me.DialogResult = Windows.Forms.DialogResult.Cancel - Me.Close() - End Sub - - Private Sub btnBusDatabaseSource_Click(sender As Object, e As EventArgs) Handles btnBusDatabaseSource.Click - - Dim fbAux As New cFileBrowser("AAUXBusDB", False, False) - Dim message As String = String.Empty - - - fbAux.Extensions = New String() {"abdb"} - - If fbAux.OpenDialog(Path.Combine(Path.GetDirectoryName(auxFile), txtBusDatabaseFilePath.Text)) Then - - txtBusDatabaseFilePath.Focus() - txtBusDatabaseFilePath.Text = GetRelativePath(fbAux.Files(0), Path.GetDirectoryName(auxFile)) - - Dim busDB As New BusDatabase() - - If Not busDB.Initialise(FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text)) Then - - MessageBox.Show("Unable to load") - - End If - - Validate_HVAC() - End If - End Sub - - Private Sub btnSSMBSource_BindingContextChanged(sender As Object, e As EventArgs) _ - Handles btnSSMBSource.BindingContextChanged - End Sub - - Private Sub btnSSMBSource_Click(sender As Object, e As EventArgs) Handles btnSSMBSource.Click - - Dim fbAux As New cFileBrowser("AAUXSSM", False, False) - fbAux.Extensions = New String() {"AHSM"} - - Dim suppliedSSMPath As String = txtSSMFilePath.Text.Trim() - Dim absoluteSSMPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) - Dim absoluteBusDatabasePath As String = FilePathUtils.ResolveFilePath(aauxPath, - Me.txtBusDatabaseFilePath.Text.Trim()) - Dim message As String = String.Empty - Dim newFile As Boolean = False - - Dim validSSMTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteSSMPath, ".ahsm", message) - Dim fileExists As Boolean = File.Exists(absoluteSSMPath) - - If suppliedSSMPath.Length > 0 AndAlso Not validSSMTFile Then - MessageBox.Show(message) - Return - End If - - 'If file Exists, Check validity, else fire up a default SSM Config. - If File.Exists(absoluteSSMPath) Then - 'is file valid Try ahsm - HVac Steady State Model - Try - Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteSSMPath) - Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) - ssmTool.Load(ahsmFile) - Catch ex As Exception - MessageBox.Show("The supplied AHSM File was invalid, aborting.") - Return - End Try - End If - - If Not fileExists Then - - Dim needToFindOrCreateFile As Boolean = True - While needToFindOrCreateFile - - 'Find / Create file and configure. - If fbAux.CustomDialog(absoluteSSMPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then - txtSSMFilePath.Text = GetRelativePath(fbAux.Files(0), aauxPath) - suppliedSSMPath = txtSSMFilePath.Text - absoluteSSMPath = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) - If _ - IO.File.Exists(absoluteSSMPath) OrElse - MsgBox("Do you want to create a new .AHSM file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then - needToFindOrCreateFile = False - newFile = True - End If - Else - needToFindOrCreateFile = False - End If - - End While - - End If - - If fileExists OrElse newFile Then - - Using frm As New frmHVACTool(absoluteBusDatabasePath, absoluteSSMPath, vectoFile, Not fileExists) - If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then - If suppliedSSMPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then - txtSSMFilePath.Text = - If(suppliedSSMPath.Contains(aauxPath), suppliedSSMPath.Replace(aauxPath, ""), suppliedSSMPath) - Else - txtSSMFilePath.Text = fFileWoDir(suppliedSSMPath) - End If - Else - Return - End If - End Using - BindingContext(auxConfig.HvacUserInputsConfig).EndCurrentEdit() - Validate_HVAC() - - End If - End Sub - -#End Region - - Private Sub chkSmartElectricals_CheckedChanged(sender As Object, e As EventArgs) _ - Handles chkSmartElectricals.CheckedChanged - - SetSmartCardEmabledStatus() - End Sub - -#Region "File Viewer Button Events" - - Private Sub btnAALTOpen_Click(sender As Object, e As EventArgs) Handles btnAALTOpen.Click - - OpenFiles(fFileRepl(Me.txtAlternatorMapPath.Text, fPATH(vectoFile))) - End Sub - - Private Sub btnOpenACMP_Click(sender As Object, e As EventArgs) Handles btnOpenACMP.Click - - - OpenFiles(fFileRepl(Me.txtCompressorMap.Text, fPATH(vectoFile))) - End Sub - - Private Sub btnOpenAPAC_Click(sender As Object, e As EventArgs) Handles btnOpenAPAC.Click - - OpenFiles(fFileRepl(Me.txtActuationsMap.Text, fPATH(vectoFile))) - End Sub - - Private Sub btnOpenAHSM_Click(sender As Object, e As EventArgs) Handles btnOpenAHSM.Click - - OpenFiles(fFileRepl(Me.txtSSMFilePath.Text, fPATH(vectoFile))) - End Sub - - Private Sub btnOpenABDB_Click(sender As Object, e As EventArgs) Handles btnOpenABDB.Click - - - OpenFiles(fFileRepl(Me.txtBusDatabaseFilePath.Text, fPATH(vectoFile))) - End Sub - - -#End Region - - 'Overrides - Protected Overrides Function ProcessCmdKey(ByRef msg As Message, keyData As Keys) As Boolean - - If keyData = Keys.Enter AndAlso Me.AcceptButton Is Nothing Then - - If TypeOf (Me.ActiveControl) Is TextBoxBase Then - Dim box As TextBoxBase = CType(Me.ActiveControl, TextBoxBase) - - If box Is Nothing OrElse Not box.Multiline Then - - Me.SelectNextControl(Me.ActiveControl, True, True, True, True) - Return True - - End If - End If - - End If - - Return MyBase.ProcessCmdKey(msg, keyData) - End Function - - 'Helpers - Private Sub OpenFiles(ParamArray files() As String) - - If files.Length = 0 Then Exit Sub - - cmFilesList = files - - OpenWithToolStripMenuItem.Text = "Open with notepad" - - CmFiles.Show(Cursor.Position) - End Sub - - Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ - Handles OpenWithToolStripMenuItem.Click - If Not FileOpenAlt(cmFilesList(0)) Then MsgBox("Failed to open file!") - End Sub - - Private Sub ShowInFolderToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ - Handles ShowInFolderToolStripMenuItem.Click - If IO.File.Exists(cmFilesList(0)) Then - Try - System.Diagnostics.Process.Start("explorer", "/select,""" & cmFilesList(0) & "") - Catch ex As Exception - MsgBox("Failed to open file!") - End Try - Else - MsgBox("File not found!") - End If - End Sub - -#Region "Tab Header Color Change" - - Private Sub UpdateTabStatus(pageName As String, resultGood As Boolean) - - - Dim page As TabPage = tabMain.TabPages(pageName) - - If Not resultGood Then - - SetTabHeader(page, Color.Red) - - Else - SetTabHeader(page, Control.DefaultBackColor) - - End If - End Sub - - Private Sub SetTabHeader(page As TabPage, color As Color) - - TabColors(page) = color - tabMain.Invalidate() - End Sub - - Private Sub tabMain_DrawItem(sender As Object, e As DrawItemEventArgs) - - Dim br As Brush = New SolidBrush(TabColors(tabMain.TabPages(e.Index))) - - - Using (br) - - e.Graphics.FillRectangle(br, e.Bounds) - Dim sz As SizeF = e.Graphics.MeasureString(tabMain.TabPages(e.Index).Text, e.Font) - e.Graphics.DrawString(tabMain.TabPages(e.Index).Text, e.Font, Brushes.Black, - e.Bounds.Left + (e.Bounds.Width - sz.Width) / 2, e.Bounds.Top + (e.Bounds.Height - sz.Height) / 2 + 1) - - Dim rect As Rectangle = e.Bounds - rect.Offset(-1, -1) - rect.Inflate(1, 1) - ' e.Graphics.DrawRectangle(Pens.DarkGray, rect) - 'e.DrawFocusRectangle() - - End Using - End Sub - - -#End Region - - Public Sub UnbindAllControls(ByRef container As Control) - 'Clear all of the controls within the container object - 'If "Recurse" is true, then also clear controls within any sub-containers - Dim ctrl As Control = Nothing - - For Each ctrl In container.Controls - - ctrl.DataBindings.Clear() - - If ctrl.HasChildren Then - UnbindAllControls(ctrl) - End If - - Next - End Sub - - Private Function GetSSMMAP(ByVal filePath As String, ByRef message As String) As Hvac.IHVACSteadyStateModel - - Dim ssmMap As New Hvac.HVACSteadyStateModel() - - - Try - - If ssmMap.SetValuesFromMap(FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text), message) Then - - Return ssmMap - - End If - - Catch ex As Exception - - MessageBox.Show("Unable to retreive values from map") - - End Try - - Return Nothing - End Function - - Private Sub SetupControls() - - - Dim cIndex As Integer = 0 - - gvElectricalConsumables.AutoGenerateColumns = False - - 'ElectricalConsumerGrid - 'Columns - cIndex = gvElectricalConsumables.Columns.Add("Category", "Category") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Category" - gvElectricalConsumables.Columns(cIndex).MinimumWidth = 150 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - - cIndex = gvElectricalConsumables.Columns.Add("ConsumerName", "Name") - - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "ConsumerName" - gvElectricalConsumables.Columns(cIndex).MinimumWidth = 308 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - - Dim baseVehicle As New DataGridViewCheckBoxColumn(False) - baseVehicle.HeaderText = "Base Vehicle" - cIndex = gvElectricalConsumables.Columns.Add(baseVehicle) - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "BaseVehicle" - gvElectricalConsumables.Columns(cIndex).Width = 75 - gvElectricalConsumables.Columns(cIndex).Visible = False - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Energy included in the calculations of base vehicle" - - cIndex = gvElectricalConsumables.Columns.Add("NominalConsumptionAmps", "Nominal Amps") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NominalConsumptionAmps" - gvElectricalConsumables.Columns(cIndex).Width = 60 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ - With {.BackColor = Color.LightGray} - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Nominal consumption in AMPS" - - cIndex = gvElectricalConsumables.Columns.Add("PhaseIdle_TractionOn", "PhaseIdle/ TractionOn") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "PhaseIdle_TractionOn" - gvElectricalConsumables.Columns(cIndex).Width = 60 - gvElectricalConsumables.Columns(cIndex).ReadOnly = True - gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ - With {.BackColor = Color.LightGray} - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = - "Represents the amount of time (during engine fueling) as " & vbCrLf & - "percentage that the consumer is active during the cycle." - - cIndex = gvElectricalConsumables.Columns.Add("NumberInActualVehicle", "Num in Vehicle") - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NumberInActualVehicle" - gvElectricalConsumables.Columns(cIndex).Width = 55 - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Number of consumables of this" & vbCrLf & - "type installed on the vehicle." - - - 'INFO COLUMN - cIndex = gvElectricalConsumables.Columns.Add("info", "Info") - ' cIndex = gvElectricalConsumables.Columns.Add( New ImageColumn()) - - gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Info" - gvElectricalConsumables.Columns(cIndex).Width = 120 - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter - gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) - gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Further Information" - - ' ResultCard Grids - - 'IDLE - - cIndex = gvResultsCardIdle.Columns.Add("Amps", "Amps") - gvResultsCardIdle.Columns(cIndex).DataPropertyName = "Amps" - gvResultsCardIdle.Columns(cIndex).Width = 65 - - cIndex = gvResultsCardIdle.Columns.Add("SmartAmps", "SmartAmps") - gvResultsCardIdle.Columns(cIndex).DataPropertyName = "SmartAmps" - gvResultsCardIdle.Columns(cIndex).Width = 65 - - 'TRACTION - cIndex = gvResultsCardTraction.Columns.Add("Amps", "Amps") - gvResultsCardTraction.Columns(cIndex).DataPropertyName = "Amps" - gvResultsCardTraction.Columns(cIndex).Width = 65 - - cIndex = gvResultsCardTraction.Columns.Add("SmartAmps", "SmartAmps") - gvResultsCardTraction.Columns(cIndex).DataPropertyName = "SmartAmps" - gvResultsCardTraction.Columns(cIndex).Width = 65 - - 'OVERRUN - cIndex = gvResultsCardOverrun.Columns.Add("Amps", "Amps") - gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "Amps" - gvResultsCardOverrun.Columns(cIndex).Width = 65 - - cIndex = gvResultsCardOverrun.Columns.Add("SmartAmps", "SmartAmps") - gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "SmartAmps" - gvResultsCardOverrun.Columns(cIndex).Width = 65 - End Sub - -#Region "Binding Control" - - Private Sub CreateBindings() - - 'auxConfig.Vecto Bindings - txtPowernetVoltage.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "PowerNetVoltage") - 'txtVehicleWeightKG.DataBindings.Add("Text", auxConfig.VectoInputs, "VehicleWeightKG") - 'cboCycle.DataBindings.Add("Text", auxConfig.VectoInputs, "Cycle") - txtFuelMap.DataBindings.Add("Text", auxConfig.VectoInputs, "FuelMap") - - 'Electricals General - txtAlternatorMapPath.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorMap") - txtAlternatorGearEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorGearEfficiency") - txtDoorActuationTimeSeconds.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "DoorActuationTimeSecond") - txtStoredEnergyEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "StoredEnergyEfficiency") - chkSmartElectricals.DataBindings.Add("Checked", auxConfig.ElectricalUserInputsConfig, "SmartElectrical", False, - DataSourceUpdateMode.OnPropertyChanged) - - - 'Electrical ConsumablesGrid - electricalConsumerBinding = - New BindingList(Of IElectricalConsumer)(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.Items) - gvElectricalConsumables.DataSource = electricalConsumerBinding - - - 'ResultCards - - 'IDLE - Dim idleBinding As BindingList(Of SmartResult) - idleBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardIdle.Results) - idleBinding.AllowNew = True - idleBinding.AllowRemove = True - gvResultsCardIdle.DataSource = idleBinding - - 'TRACTION - Dim tractionBinding As BindingList(Of SmartResult) - tractionBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardTraction.Results) - tractionBinding.AllowNew = True - tractionBinding.AllowRemove = True - gvResultsCardTraction.DataSource = tractionBinding - - 'OVERRUN - Dim overrunBinding As BindingList(Of SmartResult) - overrunBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardOverrun.Results) - overrunBinding.AllowNew = True - overrunBinding.AllowRemove = True - gvResultsCardOverrun.DataSource = overrunBinding - - - 'Pneumatic Auxillaries Binding - txtAdBlueNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "AdBlueNIperMinute") - - txtOverrunUtilisationForCompressionFraction.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "OverrunUtilisationForCompressionFraction") - txtBrakingWithRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "BrakingWithRetarderNIperKG") - txtBrakingNoRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "BrakingNoRetarderNIperKG") - txtBreakingPerKneelingNIperKGinMM.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "BreakingPerKneelingNIperKGinMM", True, DataSourceUpdateMode.OnPropertyChanged, Nothing, "0.########") - txtPerDoorOpeningNI.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "PerDoorOpeningNI") - txtPerStopBrakeActuationNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "PerStopBrakeActuationNIperKG") - txtAirControlledSuspensionNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "AirControlledSuspensionNIperMinute") - txtNonSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "NonSmartRegenFractionTotalAirDemand") - txtSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "SmartRegenFractionTotalAirDemand") - txtDeadVolumeLitres.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "DeadVolumeLitres") - txtDeadVolBlowOutsPerLitresperHour.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, - "DeadVolBlowOutsPerLitresperHour") - - 'Pneumatic UserInputsConfig Binding - txtCompressorMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorMap") - txtCompressorGearEfficiency.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearEfficiency") - txtCompressorGearRatio.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearRatio") - txtActuationsMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "ActuationsMap") - chkSmartAirCompression.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartAirCompression", False, - DataSourceUpdateMode.OnPropertyChanged) - - chkSmartRegeneration.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartRegeneration", False, - DataSourceUpdateMode.OnPropertyChanged) - chkRetarderBrake.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "RetarderBrake") - txtKneelingHeightMillimeters.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "KneelingHeightMillimeters") - cboAirSuspensionControl.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AirSuspensionControl", False) - cboAdBlueDosing.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AdBlueDosing") - cboDoors.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "Doors") - - txtSSMFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "SSMFilePath") - txtBusDatabaseFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "BusDatabasePath") - chkDisableHVAC.DataBindings.Add("Checked", auxConfig.HvacUserInputsConfig, "SSMDisabled", False, - DataSourceUpdateMode.OnPropertyChanged) - - SetSmartCardEmabledStatus() - End Sub - - Private Sub EnsureBinding() - With tabMain - Dim lastSelectedTabIndex As Integer = .SelectedIndex - If lastSelectedTabIndex < 0 OrElse lastSelectedTabIndex > .TabCount Then lastSelectedTabIndex = 0 - For currentTab As Integer = 0 To .TabCount - 1 - .SelectedIndex = currentTab - Next - .SelectedIndex = 0 - End With - - SetSmartCardEmabledStatus() - End Sub - -#End Region - - Protected Sub SetSmartCardEmabledStatus() - - If chkSmartElectricals.Checked Then - - gvResultsCardIdle.Enabled = True - gvResultsCardTraction.Enabled = True - gvResultsCardOverrun.Enabled = True - - gvResultsCardIdle.BackgroundColor = Color.Gray - gvResultsCardTraction.BackgroundColor = Color.Gray - gvResultsCardOverrun.BackgroundColor = Color.Gray - - electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 0 - Else - - gvResultsCardIdle.Enabled = False - gvResultsCardTraction.Enabled = False - gvResultsCardOverrun.Enabled = False - - - gvResultsCardIdle.BackgroundColor = Color.White - gvResultsCardTraction.BackgroundColor = Color.White - gvResultsCardOverrun.BackgroundColor = Color.White - - electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 1 - End If - End Sub - - Public Function FileOpenAlt(ByVal file As String) As Boolean - Dim PSI As New ProcessStartInfo - - If Not IO.File.Exists(file) Then Return False - - PSI.FileName = "notepad.exe" - PSI.Arguments = ChrW(34) & file & ChrW(34) - Try - Process.Start(PSI) - Return True - Catch ex As Exception - Return False - End Try - End Function - - Private Sub chkDisableHVAC_CheckedChanged(sender As Object, e As EventArgs) Handles chkDisableHVAC.CheckedChanged - - If chkDisableHVAC.Checked Then - - txtSSMFilePath.ReadOnly = True - txtBusDatabaseFilePath.ReadOnly = True - btnSSMBSource.Enabled = False - btnBusDatabaseSource.Enabled = False - btnOpenAHSM.Enabled = False - btnOpenABDB.Enabled = False - - Else - - txtSSMFilePath.ReadOnly = False - txtBusDatabaseFilePath.ReadOnly = False - btnSSMBSource.Enabled = True - btnBusDatabaseSource.Enabled = True - btnOpenAHSM.Enabled = True - btnOpenABDB.Enabled = True - - End If - End Sub - - Protected Overrides Sub Finalize() - MyBase.Finalize() - End Sub +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Imports VectoAuxiliaries +Imports VectoAuxiliaries.Electrics +Imports VectoAuxiliaries.Pneumatics +Imports System.ComponentModel +Imports System.Windows.Forms +Imports System.Drawing +Imports VectoAuxiliaries.Hvac +Imports System.IO + + +Public Class frmAuxiliaryConfig + +#Region "Fields" + + Public auxConfig As AuxiliaryConfig + Public originalConfig As AuxiliaryConfig ' required to test if the form is dirty + Private TabColors As Dictionary(Of TabPage, Color) = New Dictionary(Of TabPage, Color)() + Private processing As Boolean = False + Private SecondsIntoCycle As Integer = 0 + Private vectoFile As String = "" + Private aauxPath As String = "" + Private auxFile As String + Private cmFilesList As String() + Private SaveClicked As Boolean + Private electricalConsumerBinding As New BindingList(Of IElectricalConsumer) + + +#End Region + + Private Function ValidateAuxFileName(filename As String) As Boolean + + Dim message As String = String.Empty + + If Not FilePathUtils.ValidateFilePath(filename, ".aaux", message) Then + MessageBox.Show(message) + End If + + Return True + End Function + + 'Constructor + Public Sub New(ByVal fileName As String, ByVal vectoFileName As String) + + + If Not ValidateAuxFileName(fileName) Then + Me.DialogResult = Windows.Forms.DialogResult.Abort + Me.Close() + End If + + + Me.vectoFile = vectoFileName + Me.aauxPath = Path.GetDirectoryName(Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName)) + + ' This call is required by the designer. + InitializeComponent() + + ' Add any initialization after the InitializeComponent() call. + auxFile = Path.Combine(FilePathUtils.filePathOnly(vectoFileName), fileName) + + Try + + auxConfig = New AuxiliaryConfig(auxFile) + originalConfig = New AuxiliaryConfig(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) + + Catch ex As Exception + + MessageBox.Show("The filename you supplied {0} was invalid or could not be found ", fileName) + Me.DialogResult = Windows.Forms.DialogResult.Abort + Me.Close() + + End Try + End Sub + + 'Validation + +#Region "Validation Helpers" + + Public Function IsPostiveNumber(ByVal test As String) As Boolean + + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False + + Dim number As Single + + If Not Single.TryParse(test, number) Then Return False + + If number <= 0 Then Return False + + + Return True + End Function + + Public Function IsZeroOrPostiveNumber(ByVal test As String) As Boolean + + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False + + Dim number As Single + + If Not Single.TryParse(test, number) Then Return False + + If number < 0 Then Return False + + + Return True + End Function + + Public Function IsNumberBetweenZeroandOne(test As String) As Boolean + + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False + + Dim number As Single + + If Not Single.TryParse(test, number) Then Return False + + If number < 0 OrElse number > 1 Then Return False + + Return True + End Function + + Public Function IsIntegerZeroOrPositiveNumber(test As String) As Boolean + + 'Is this numeric sanity check. + If Not IsNumeric(test) Then Return False + + 'if not integer then return false + + Dim number As Integer + + If Not Integer.TryParse(test, number) Then Return False + + If number < 0 Then Return False + + Return True + End Function + +#End Region + +#Region "Validation Control" + + + '****** PNEUMATIC VALIDATION + Public Sub Validating_PneumaticHandler(sender As Object, e As CancelEventArgs) _ + Handles txtAdBlueNIperMinute.Validating, txtBrakingWithRetarderNIperKG.Validating, + txtBrakingNoRetarderNIperKG.Validating, txtAirControlledSuspensionNIperMinute.Validating, + txtBreakingPerKneelingNIperKGinMM.Validating, txtSmartRegenFractionTotalAirDemand.Validating, + txtPerStopBrakeActuationNIperKG.Validating, txtPerDoorOpeningNI.Validating, + txtOverrunUtilisationForCompressionFraction.Validating, txtNonSmartRegenFractionTotalAirDemand.Validating, + txtDeadVolumeLitres.Validating, txtDeadVolBlowOutsPerLitresperHour.Validating, + txtKneelingHeightMillimeters.Validating, txtCompressorMap.Validating, txtCompressorGearRatio.Validating, + txtCompressorGearEfficiency.Validating, txtActuationsMap.Validating, cboDoors.Validating, + cboAirSuspensionControl.Validating, cboAdBlueDosing.Validating + + e.Cancel = Not Validate_Pneumatics() + End Sub + + Public Function Validate_Pneumatics() As Boolean + + Dim result As Boolean = True + + 'PNEUMATIC AUXILLARIES PART + '*************************** + + + 'AdBlue NI per Minute : txtAdBlueNIperMinute + If Not IsZeroOrPostiveNumber(txtAdBlueNIperMinute.Text) Then + ErrorProvider.SetError(txtAdBlueNIperMinute, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtAdBlueNIperMinute, String.Empty) + End If + + 'Overrun Utilisation For Compression Fraction : txtOverrunUtilisationForCompressionFraction + If Not IsNumberBetweenZeroandOne(txtOverrunUtilisationForCompressionFraction.Text) Then + ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, "Please provide a non negative between 0 and 1.") + result = False + Else + ErrorProvider.SetError(txtOverrunUtilisationForCompressionFraction, String.Empty) + End If + + 'Braking With Retarder NI per KG : txtBrakingWithRetarderNIperKG + If Not IsZeroOrPostiveNumber(txtBrakingWithRetarderNIperKG.Text) Then + ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtBrakingWithRetarderNIperKG, String.Empty) + End If + + 'Braking No Retarder NI per KG : txtBrakingNoRetarderNIperKG + If Not IsZeroOrPostiveNumber(txtBrakingNoRetarderNIperKG.Text) Then + ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtBrakingNoRetarderNIperKG, String.Empty) + End If + + 'Breaking Per Kneeling NI per KG in MM : txtBreakingPerKneelingNIperKGinMM + If Not IsZeroOrPostiveNumber(txtBreakingPerKneelingNIperKGinMM.Text) Then + ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtBreakingPerKneelingNIperKGinMM, String.Empty) + End If + + 'Per Door Opening NI : txtPerDoorOpeningNI + If Not IsZeroOrPostiveNumber(txtPerDoorOpeningNI.Text) Then + ErrorProvider.SetError(txtPerDoorOpeningNI, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtPerDoorOpeningNI, String.Empty) + End If + + 'Per Stop Brake Actuation NI per KG : txtPerStopBrakeActuationNIperKG + If Not IsZeroOrPostiveNumber(txtPerStopBrakeActuationNIperKG.Text) Then + ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtPerStopBrakeActuationNIperKG, String.Empty) + End If + + 'Air Controlled Suspension NI per Minute : txtAirControlledSuspensionNIperMinute + If Not IsZeroOrPostiveNumber(txtAirControlledSuspensionNIperMinute.Text) Then + ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtAirControlledSuspensionNIperMinute, String.Empty) + End If + + 'Non Smart Regen Fraction Total Air Demand : txtNonSmartRegenFractionTotalAirDemand + If Not IsZeroOrPostiveNumber(txtNonSmartRegenFractionTotalAirDemand.Text) Then + ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtNonSmartRegenFractionTotalAirDemand, String.Empty) + End If + + 'Smart Regen Fraction Total Air Demand : txtSmartRegenFractionTotalAirDemand + If Not IsNumberBetweenZeroandOne(txtSmartRegenFractionTotalAirDemand.Text) Then + ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, "Please provide a non negative between 0 and 1.") + result = False + Else + ErrorProvider.SetError(txtSmartRegenFractionTotalAirDemand, String.Empty) + End If + + + 'Dead Volume Litres : txtDeadVolumeLitres + If Not IsZeroOrPostiveNumber(txtDeadVolumeLitres.Text) Then + ErrorProvider.SetError(txtDeadVolumeLitres, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtDeadVolumeLitres, String.Empty) + End If + + + 'Dead Vol BlowOuts Per Litresper Hour : txtDeadVolBlowOutsPerLitresperHour + If Not IsZeroOrPostiveNumber(txtDeadVolBlowOutsPerLitresperHour.Text) Then + ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtDeadVolBlowOutsPerLitresperHour, String.Empty) + End If + + + 'USER CONFIG PART + '***************************************************************************************** + 'Compressor Map path : txtCompressorMap + 'Test for empty after trim + If txtCompressorMap.Text.Trim.Length = 0 Then + ErrorProvider.SetError(txtCompressorMap, "Please enter the localtion of a valid compressor map.") + result = False + Else + ErrorProvider.SetError(txtCompressorMap, String.Empty) + End If + 'Test File is valid + Dim comp As CompressorMap + Try + + comp = New CompressorMap(FilePathUtils.ResolveFilePath(aauxPath, txtCompressorMap.Text)) + comp.Initialise() + ErrorProvider.SetError(txtCompressorMap, String.Empty) + Catch ex As Exception + ErrorProvider.SetError(txtCompressorMap, + "Error : map is invalid or cannot be found, please select a Cvalid compressor map") + result = False + End Try + + 'Compressor Gear Efficiency : txtCompressorGearEfficiency" + If Not IsNumberBetweenZeroandOne(txtCompressorGearEfficiency.Text) Then + ErrorProvider.SetError(txtCompressorGearEfficiency, "Please enter a number between 0 and 1") + result = False + Else + ErrorProvider.SetError(txtCompressorGearEfficiency, String.Empty) + End If + + 'Compressor Gear Ratio : txtCompressorGearRatio + If Not IsPostiveNumber(txtCompressorGearRatio.Text) Then + ErrorProvider.SetError(txtCompressorGearRatio, "Please enter a number greater than 0.") + result = False + Else + ErrorProvider.SetError(txtCompressorGearRatio, String.Empty) + End If + + + 'Actuations Map : txtActuationsMap + If txtActuationsMap.Text.Trim.Length = 0 Then + ErrorProvider.SetError(txtActuationsMap, "Please enter the localtion of a valid Pneumatic Actuations map.") + result = False + Else + ErrorProvider.SetError(txtActuationsMap, String.Empty) + End If + 'Test File is valid + Dim actuations As PneumaticActuationsMAP + Try + + actuations = New PneumaticActuationsMAP(FilePathUtils.ResolveFilePath(aauxPath, txtActuationsMap.Text)) + actuations.Initialise() + ErrorProvider.SetError(txtActuationsMap, String.Empty) + Catch ex As Exception + ErrorProvider.SetError(txtActuationsMap, + "Error : Pneumatic Actuations map is invalid or cannot be found, please select a valid map") + result = False + End Try + + + 'NOT Required but included here so readers can see this is a positive ommission + '****************************************************************************** + 'Smart Air Compression : chkSmartAirCompression + 'Smart Regeneration : chkSmartRegeneration + 'Retarder Brake : chkRetarderBrake + + 'txtKneelingHeightMillimeters : txtKneelingHeightMillimeters + If Not IsZeroOrPostiveNumber(txtKneelingHeightMillimeters.Text) Then + ErrorProvider.SetError(txtKneelingHeightMillimeters, "Please enter a number greater than 0.") + result = False + Else + ErrorProvider.SetError(txtKneelingHeightMillimeters, String.Empty) + End If + + 'cboAirSuspensionControl : cboAirSuspensionControl + If cboAirSuspensionControl.SelectedIndex < 1 Then + ErrorProvider.SetError(cboAirSuspensionControl, "Please make a selection.") + result = False + Else + ErrorProvider.SetError(cboAirSuspensionControl, String.Empty) + End If + + 'cboAdBlueDosing : cboAdBlueDosing + If cboAdBlueDosing.SelectedIndex < 1 Then + ErrorProvider.SetError(cboAdBlueDosing, "Please make a selection.") + result = False + Else + ErrorProvider.SetError(cboAdBlueDosing, String.Empty) + End If + + 'cboDoors : cboDoors + If cboDoors.SelectedIndex < 1 Then + ErrorProvider.SetError(cboDoors, "Please make a selection.") + result = False + Else + ErrorProvider.SetError(cboDoors, String.Empty) + End If + + + 'Set Tab Color + + UpdateTabStatus("tabPneumaticConfig", result) + + + Return result + End Function + + '***** ELECTRICAL VALIDATION + Public Sub Validating_ElectricsHandler(sender As Object, e As CancelEventArgs) _ + Handles txtPowernetVoltage.Validating, txtAlternatorMapPath.Validating, txtAlternatorGearEfficiency.Validating, + txtDoorActuationTimeSeconds.Validating, txtStoredEnergyEfficiency.Validating + + e.Cancel = Not Validate_Electrics() + End Sub + + Public Function Validate_Electrics() As Boolean + + Dim result As Boolean = True + + + 'Powernet Voltage : txtPowernetVoltage + If Not IsPostiveNumber(txtPowernetVoltage.Text) Then + ErrorProvider.SetError(txtPowernetVoltage, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtPowernetVoltage, String.Empty) + End If + + + 'Alternator Map path : txtAlternatorMapPath + 'Test for empty after trim + If txtAlternatorMapPath.Text.Trim.Length = 0 Then + ErrorProvider.SetError(txtAlternatorMapPath, "Please enter the localtion of a valid alternator map.") + result = False + Else + ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) + End If + + 'Test File is valid + Dim alt As ICombinedAlternator + Try + alt = New CombinedAlternator(FilePathUtils.ResolveFilePath(aauxPath, txtAlternatorMapPath.Text)) + ErrorProvider.SetError(txtAlternatorMapPath, String.Empty) + Catch ex As Exception + ErrorProvider.SetError(txtAlternatorMapPath, + "Error : map is invalid or cannot be found, please select a valid alternator map") + result = False + End Try + + + 'Alternator Gear Efficiency : txtAlternatorGearEfficiency + If Not IsNumberBetweenZeroandOne(txtAlternatorGearEfficiency.Text) Then + ErrorProvider.SetError(txtAlternatorGearEfficiency, "Please enter a number between 0 an 1") + result = False + Else + ErrorProvider.SetError(txtAlternatorGearEfficiency, String.Empty) + End If + + + 'Door Action Time : txtDoorActuationTimeSeconds + If Not IsPostiveNumber(txtDoorActuationTimeSeconds.Text) Then + ErrorProvider.SetError(txtDoorActuationTimeSeconds, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtDoorActuationTimeSeconds, String.Empty) + End If + + 'Stored Energy Efficiency : txtStoredEnergyEfficiency + If Not IsPostiveNumber(txtStoredEnergyEfficiency.Text) Then + ErrorProvider.SetError(txtStoredEnergyEfficiency, "Please provide a non negative number.") + result = False + Else + ErrorProvider.SetError(txtStoredEnergyEfficiency, String.Empty) + End If + + + UpdateTabStatus("tabElectricalConfig", result) + + + Return result + End Function + + '****** HVAC VALIDATION + Public Sub Validating_HVACHandler(sender As Object, e As CancelEventArgs) _ + Handles txtSSMFilePath.Validating, txtBusDatabaseFilePath.Validating + + e.Cancel = Not Validate_HVAC() + End Sub + + Public Function Validate_HVAC() As Boolean + + Dim result As Boolean = True + Dim message As String = "" + + 'Validate abdb - Bus Database + Dim abdbFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text) + Dim bdb As New BusDatabase() + If bdb.Initialise(abdbFile) Then + ErrorProvider.SetError(txtBusDatabaseFilePath, String.Empty) + Else + result = False + ErrorProvider.SetError(Me.txtBusDatabaseFilePath, "Please choose a valid Steady State Model File (*.ABDB") + End If + + + 'Try ahsm - HVac Steady State Model + Try + + Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text) + Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) + + If ssmTool.Load(ahsmFile) Then + ErrorProvider.SetError(txtSSMFilePath, String.Empty) + Else + result = False + ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") + End If + + Catch ex As Exception + 'Just in case + ErrorProvider.SetError(txtSSMFilePath, "Please choose a valid Steady State Model File (*.AHSM") + result = False + + End Try + + + UpdateTabStatus("tabHVACConfig", result) + + Return result + End Function + + + Public Function ValidateAll() As Boolean + + If Validate_Pneumatics() = False Or Validate_Electrics() = False Or Validate_HVAC() = False Then + Return False + End If + + Return True + End Function + + '***** IMPUTS VALIDATION + +#End Region + + 'Form Controls & Events + Private Sub Dashboard_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + 'Required for OwnerDraw, this is required in order to color the tabs when a validation error occurs to draw + 'The attention of the user to the fact that attention is required on a particlar tab. + TabColors.Add(tabGeneralConfig, Control.DefaultBackColor) + TabColors.Add(tabElectricalConfig, Control.DefaultBackColor) + TabColors.Add(tabPneumaticConfig, Control.DefaultBackColor) + TabColors.Add(tabHVACConfig, Control.DefaultBackColor) + + + 'This is here only for testing purposes, the actual cycle will be a result of Vecto input. + cboCycle.SelectedIndex = 0 + + 'General Setup of all controls + SetupControls() + + 'Binding Values in Aux environment to the input controls on relevent tabs in the form. + CreateBindings() + + 'This function is neccesary because binding does not occur when the page is invisible, so a track across all of them + 'Is required in order to set the binding. This only needs to be done once at at setup time. after values are set in the + 'Aux environment either by setting defaults of reading and setting from the Auxillaries persistance file. + EnsureBinding() + + + 'Additional atatched events + 'For Tab Coloring, this is the place where the background will get filled on the tab when attention is required. + AddHandler tabMain.DrawItem, New System.Windows.Forms.DrawItemEventHandler(AddressOf tabMain_DrawItem) + + 'Select Electric Tab + tabMain.SelectTab(tabMain.TabPages("tabElectricalConfig")) + + + 'Enabled / Disables Smart Cards based on chkSmartElectrical + SetSmartCardEmabledStatus() + + 'Merge Info data from ElectricalConsumer in a Default set into live set + 'This is required because the info is stored in the AAUX file and we do not want to use a persistance stored version. + auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.MergeInfoData() + End Sub + + Private Sub frmAuxiliaryConfig_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + + + If Me.DialogResult = Windows.Forms.DialogResult.Cancel Then Return + + Dim result As DialogResult + + If Not File.Exists(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) OrElse + Not auxConfig.ConfigValuesAreTheSameAs(originalConfig) Then + + result = + (MessageBox.Show("Would you like to save changes before closing?", "Save Changes", MessageBoxButtons.YesNoCancel, + MessageBoxIcon.Question)) + + Select Case result + + Case DialogResult.Yes + 'save + If Not SaveFile() Then + e.Cancel = True + End If + + Case DialogResult.No + 'just allow the form to close + 'without saving + Me.DialogResult = Windows.Forms.DialogResult.Cancel + + + Case DialogResult.Cancel + 'cancel the close + e.Cancel = True + Me.DialogResult = Windows.Forms.DialogResult.Cancel + + + End Select + Else + Me.DialogResult = Windows.Forms.DialogResult.Cancel + e.Cancel = False + End If + End Sub + +#Region "GridHandlers" + + Private Sub gvElectricalConsumables_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ + Handles gvElectricalConsumables.CellValidating + + Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) + Dim s As Single + + + If e.ColumnIndex = -1 Then + + e.Cancel = True + Exit Sub + + End If + + If column.ReadOnly Then Return + + Select Case column.Name + + Case "NominalConsumptionAmps" + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + + Case "NumberInActualVehicle" + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + Else + s = Single.Parse(e.FormattedValue.ToString()) + End If + If s Mod 1 > 0 OrElse s < 0 Then + MessageBox.Show("This value must be a positive whole number ( Integer ) ") + e.Cancel = True + End If + + 'Veh Electronics &Engine + If e.RowIndex = 1 Then + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + + If chkSmartElectricals.Checked AndAlso s <> 0 Then + MessageBox.Show("This must be set to 0 in smart mode") + e.Cancel = True + ElseIf Not chkSmartElectricals.Checked AndAlso s <> 1 Then + MessageBox.Show("This must be set to 1 in classic mode") + e.Cancel = True + End If + End If + + 'Exterior Bulb + If e.RowIndex = 14 Then + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + If s <> 1 Then + MessageBox.Show("This must be set 1") + e.Cancel = True + End If + End If + + 'Bonus Bulbs + If e.RowIndex >= 15 AndAlso e.RowIndex <= 19 Then + + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + If s <> 0 AndAlso s <> 1 Then + MessageBox.Show("This must be set to 0 or 1") + e.Cancel = True + End If + + End If + + + Case "PhaseIdle_TractionOn" + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + Else + s = Single.Parse(e.FormattedValue.ToString()) + End If + If s < 0 OrElse s > 1 Then + MessageBox.Show("This must be a value between 0 and 1 ") + e.Cancel = True + End If + + + End Select + End Sub + + Private Sub SmartResult_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) _ + Handles gvResultsCardIdle.CellValidating, gvResultsCardTraction.CellValidating, gvResultsCardOverrun.CellValidating + + Dim column As DataGridViewColumn = gvElectricalConsumables.Columns(e.ColumnIndex) + + If Not IsNumeric(e.FormattedValue) Then + MessageBox.Show("This value must be numeric") + e.Cancel = True + End If + End Sub + + Private Sub resultCard_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) _ + Handles gvResultsCardIdle.CellMouseUp, gvResultsCardTraction.CellMouseUp, gvResultsCardOverrun.CellMouseUp + + Dim dgv As DataGridView = CType(sender, DataGridView) + + + If e.Button = MouseButtons.Right Then + + resultCardContextMenu.Show(dgv, e.Location) + resultCardContextMenu.Show(Cursor.Position) + + End If + End Sub + + Private Sub resultCardContextMenu_ItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) _ + Handles resultCardContextMenu.ItemClicked + + Dim menu As ContextMenuStrip = CType(sender, ContextMenuStrip) + + Dim grid As DataGridView = DirectCast(menu.SourceControl, DataGridView) + + Select Case e.ClickedItem.Text + + + Case "Delete" + + For Each selectedRow As DataGridViewRow In grid.SelectedRows + + If Not selectedRow.IsNewRow Then + + grid.Rows.RemoveAt(selectedRow.Index) + + End If + + Next + + Case "Insert" + + + End Select + End Sub + + Private Sub gvElectricalConsumables_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) _ + Handles gvElectricalConsumables.CellFormatting + End Sub + + Private Sub gvElectricalConsumables_CellBeginEdit(sender As Object, e As DataGridViewCellCancelEventArgs) _ + Handles gvElectricalConsumables.CellBeginEdit + + If e.ColumnIndex = 4 AndAlso e.RowIndex = 0 Then + + MessageBox.Show("This cell is calculated and cannot be edited") + e.Cancel = True + + End If + End Sub + +#End Region + +#Region "Button Handlers" + + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + + + If SaveFile() Then + + originalConfig.AssumeValuesOfOther(auxConfig) + Me.Close() + + + End If + End Sub + + Private Function SaveFile() As Boolean + + Dim result As Boolean + + If Not ValidateAll() Then + If _ + (MessageBox.Show("There are invalid values. Do you want so save anyway?", "Save Changes", MessageBoxButtons.YesNo, + MessageBoxIcon.Question) = DialogResult.No) Then + Return False + End If + End If + + result = auxConfig.Save(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) + + If Not result Then MessageBox.Show(String.Format("Unable to Save the file '{0}'", auxFile)) + + Return result + End Function + + Private Function LoadFile() As Boolean + + 'JSON METHOD + Dim result As Boolean + + 'Release existing databindings + UnbindAllControls(Me) + + result = auxConfig.Load(FilePathUtils.ResolveFilePath(aauxPath, auxFile)) + + If Not result Then + MessageBox.Show(String.Format("Unable to load the file '{0}'", auxFile)) + Else + CreateBindings() + End If + + Return result + End Function + + Private Sub btnFuelMap_Click(sender As Object, e As EventArgs) Handles btnFuelMap.Click + + Dim fbAux As New cFileBrowser("AAUXFuelMap", False, False) + + + ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" + Dim fname As String = fFILE(vectoFile, True) + + fbAux.Extensions = New String() {"vmap"} + ' If fbAux.OpenDialog(fFileRepl(fname, fPATH(VECTOfile))) Then + If fbAux.OpenDialog(fPATH(vectoFile)) Then + + txtFuelMap.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) + + End If + End Sub + + Private Sub btnAlternatorMapPath_Click(sender As Object, e As EventArgs) Handles btnAlternatorMapPath.Click + + Dim fbAux As New cFileBrowser("AAUXALT", False, False) + fbAux.Extensions = New String() {"AALT"} + + Dim suppliedAALTPath As String = txtAlternatorMapPath.Text + Dim absoluteAALTPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedAALTPath) + Dim message As String = String.Empty + Dim newFile As Boolean = False + + Dim validAALTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteAALTPath, ".aalt", message) + Dim fileExists As Boolean = File.Exists(absoluteAALTPath) + + If suppliedAALTPath.Length > 0 AndAlso Not validAALTFile Then + MessageBox.Show(message) + Return + End If + + 'If file Exists, Check validity, else fire up a default SSM Config. + If fileExists Then + Try + Dim aaltFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteAALTPath) + Dim combinedAlt As ICombinedAlternator = New CombinedAlternator(aaltFile) + Catch ex As Exception + MessageBox.Show("The supplied .AALT File was invalid, aborting.") + Return + End Try + End If + + If Not fileExists Then + + Dim needToFindOrCreateFile As Boolean = True + While needToFindOrCreateFile + + 'Find / Create file and configure. + If fbAux.CustomDialog(absoluteAALTPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then + txtAlternatorMapPath.Text = fFileWoDir(fbAux.Files(0), fPATH(vectoFile)) + suppliedAALTPath = txtAlternatorMapPath.Text + absoluteAALTPath = FilePathUtils.ResolveFilePath(fPATH(vectoFile), suppliedAALTPath) + + If _ + IO.File.Exists(absoluteAALTPath) OrElse + MsgBox("Do you want to create a new .AALT file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + needToFindOrCreateFile = False + newFile = True + End If + Else + needToFindOrCreateFile = False + End If + + End While + + End If + + If fileExists OrElse newFile Then + + Using frm As New frmCombinedAlternators(absoluteAALTPath, New CombinedAlternatorSignals) + 'If Dialog result is OK, then take action else bail + If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then + If suppliedAALTPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then + txtAlternatorMapPath.Text = + If(suppliedAALTPath.Contains(aauxPath), suppliedAALTPath.Replace(aauxPath, ""), suppliedAALTPath) + Else + txtAlternatorMapPath.Text = fFileWoDir(suppliedAALTPath) + End If + Else + Return + End If + End Using + BindingContext(auxConfig.ElectricalUserInputsConfig).EndCurrentEdit() + Validate_Electrics() + + End If + End Sub + + Private Sub btnCompressorMap_Click(sender As Object, e As EventArgs) Handles btnCompressorMap.Click + + + Dim fbAux As New cFileBrowser("AAUXComp", False, False) + + + ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" + Dim fname As String = fFILE(vectoFile, True) + + fbAux.Extensions = New String() {"ACMP"} + If fbAux.OpenDialog(Path.Combine(aauxPath, txtCompressorMap.Text)) Then + + txtCompressorMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) + + End If + + Validate_Pneumatics() + + 'Causes binding to fire + txtCompressorMap.Focus() + End Sub + + Private Sub btnActuationsMap_BindingContextChanged(sender As Object, e As EventArgs) _ + Handles btnActuationsMap.BindingContextChanged + End Sub + + Private Sub btnActuationsMap_Click(sender As Object, e As EventArgs) Handles btnActuationsMap.Click + + Dim fbAux As New cFileBrowser("AAUXPneuAct", False, False) + + ' Dim vectoFile As String = "C:\Users\tb28\Source\Workspaces\VECTO\AuxillaryTestHarness\bin\Debug\vectopath.vecto" + Dim fname As String = fFILE(vectoFile, True) + + fbAux.Extensions = New String() {"APAC"} + If fbAux.OpenDialog(Path.Combine(aauxPath, txtActuationsMap.Text)) Then + + txtActuationsMap.Text = GetRelativePath(fbAux.Files(0), aauxPath) + + End If + + Validate_Pneumatics() + + 'Causes Binding to fire. + txtActuationsMap.Focus() + End Sub + + Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click + + + Me.DialogResult = Windows.Forms.DialogResult.Cancel + Me.Close() + End Sub + + Private Sub btnBusDatabaseSource_Click(sender As Object, e As EventArgs) Handles btnBusDatabaseSource.Click + + Dim fbAux As New cFileBrowser("AAUXBusDB", False, False) + Dim message As String = String.Empty + + + fbAux.Extensions = New String() {"abdb"} + + If fbAux.OpenDialog(Path.Combine(Path.GetDirectoryName(auxFile), txtBusDatabaseFilePath.Text)) Then + + txtBusDatabaseFilePath.Focus() + txtBusDatabaseFilePath.Text = GetRelativePath(fbAux.Files(0), Path.GetDirectoryName(auxFile)) + + Dim busDB As New BusDatabase() + + If Not busDB.Initialise(FilePathUtils.ResolveFilePath(aauxPath, txtBusDatabaseFilePath.Text)) Then + + MessageBox.Show("Unable to load") + + End If + + Validate_HVAC() + End If + End Sub + + Private Sub btnSSMBSource_BindingContextChanged(sender As Object, e As EventArgs) _ + Handles btnSSMBSource.BindingContextChanged + End Sub + + Private Sub btnSSMBSource_Click(sender As Object, e As EventArgs) Handles btnSSMBSource.Click + + Dim fbAux As New cFileBrowser("AAUXSSM", False, False) + fbAux.Extensions = New String() {"AHSM"} + + Dim suppliedSSMPath As String = txtSSMFilePath.Text.Trim() + Dim absoluteSSMPath As String = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) + Dim absoluteBusDatabasePath As String = FilePathUtils.ResolveFilePath(aauxPath, + Me.txtBusDatabaseFilePath.Text.Trim()) + Dim message As String = String.Empty + Dim newFile As Boolean = False + + Dim validSSMTFile As Boolean = FilePathUtils.ValidateFilePath(absoluteSSMPath, ".ahsm", message) + Dim fileExists As Boolean = File.Exists(absoluteSSMPath) + + If suppliedSSMPath.Length > 0 AndAlso Not validSSMTFile Then + MessageBox.Show(message) + Return + End If + + 'If file Exists, Check validity, else fire up a default SSM Config. + If File.Exists(absoluteSSMPath) Then + 'is file valid Try ahsm - HVac Steady State Model + Try + Dim ahsmFile As String = FilePathUtils.ResolveFilePath(aauxPath, absoluteSSMPath) + Dim ssmTool As SSMTOOL = New SSMTOOL(ahsmFile, New HVACConstants, False) + ssmTool.Load(ahsmFile) + Catch ex As Exception + MessageBox.Show("The supplied AHSM File was invalid, aborting.") + Return + End Try + End If + + If Not fileExists Then + + Dim needToFindOrCreateFile As Boolean = True + While needToFindOrCreateFile + + 'Find / Create file and configure. + If fbAux.CustomDialog(absoluteSSMPath, False, False, tFbExtMode.ForceExt, False, String.Empty) Then + txtSSMFilePath.Text = GetRelativePath(fbAux.Files(0), aauxPath) + suppliedSSMPath = txtSSMFilePath.Text + absoluteSSMPath = FilePathUtils.ResolveFilePath(aauxPath, suppliedSSMPath) + If _ + IO.File.Exists(absoluteSSMPath) OrElse + MsgBox("Do you want to create a new .AHSM file?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then + needToFindOrCreateFile = False + newFile = True + End If + Else + needToFindOrCreateFile = False + End If + + End While + + End If + + If fileExists OrElse newFile Then + + Using frm As New frmHVACTool(absoluteBusDatabasePath, absoluteSSMPath, vectoFile, Not fileExists) + If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then + If suppliedSSMPath.Contains(":\") AndAlso Not String.IsNullOrEmpty(aauxPath) Then + txtSSMFilePath.Text = + If(suppliedSSMPath.Contains(aauxPath), suppliedSSMPath.Replace(aauxPath, ""), suppliedSSMPath) + Else + txtSSMFilePath.Text = fFileWoDir(suppliedSSMPath) + End If + Else + Return + End If + End Using + BindingContext(auxConfig.HvacUserInputsConfig).EndCurrentEdit() + Validate_HVAC() + + End If + End Sub + +#End Region + + Private Sub chkSmartElectricals_CheckedChanged(sender As Object, e As EventArgs) _ + Handles chkSmartElectricals.CheckedChanged + + SetSmartCardEmabledStatus() + End Sub + +#Region "File Viewer Button Events" + + Private Sub btnAALTOpen_Click(sender As Object, e As EventArgs) Handles btnAALTOpen.Click + + OpenFiles(fFileRepl(Me.txtAlternatorMapPath.Text, fPATH(vectoFile))) + End Sub + + Private Sub btnOpenACMP_Click(sender As Object, e As EventArgs) Handles btnOpenACMP.Click + + + OpenFiles(fFileRepl(Me.txtCompressorMap.Text, fPATH(vectoFile))) + End Sub + + Private Sub btnOpenAPAC_Click(sender As Object, e As EventArgs) Handles btnOpenAPAC.Click + + OpenFiles(fFileRepl(Me.txtActuationsMap.Text, fPATH(vectoFile))) + End Sub + + Private Sub btnOpenAHSM_Click(sender As Object, e As EventArgs) Handles btnOpenAHSM.Click + + OpenFiles(fFileRepl(Me.txtSSMFilePath.Text, fPATH(vectoFile))) + End Sub + + Private Sub btnOpenABDB_Click(sender As Object, e As EventArgs) Handles btnOpenABDB.Click + + + OpenFiles(fFileRepl(Me.txtBusDatabaseFilePath.Text, fPATH(vectoFile))) + End Sub + + +#End Region + + 'Overrides + Protected Overrides Function ProcessCmdKey(ByRef msg As Message, keyData As Keys) As Boolean + + If keyData = Keys.Enter AndAlso Me.AcceptButton Is Nothing Then + + If TypeOf (Me.ActiveControl) Is TextBoxBase Then + Dim box As TextBoxBase = CType(Me.ActiveControl, TextBoxBase) + + If box Is Nothing OrElse Not box.Multiline Then + + Me.SelectNextControl(Me.ActiveControl, True, True, True, True) + Return True + + End If + End If + + End If + + Return MyBase.ProcessCmdKey(msg, keyData) + End Function + + 'Helpers + Private Sub OpenFiles(ParamArray files() As String) + + If files.Length = 0 Then Exit Sub + + cmFilesList = files + + OpenWithToolStripMenuItem.Text = "Open with notepad" + + CmFiles.Show(Cursor.Position) + End Sub + + Private Sub OpenWithToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ + Handles OpenWithToolStripMenuItem.Click + If Not FileOpenAlt(cmFilesList(0)) Then MsgBox("Failed to open file!") + End Sub + + Private Sub ShowInFolderToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) _ + Handles ShowInFolderToolStripMenuItem.Click + If IO.File.Exists(cmFilesList(0)) Then + Try + System.Diagnostics.Process.Start("explorer", "/select,""" & cmFilesList(0) & "") + Catch ex As Exception + MsgBox("Failed to open file!") + End Try + Else + MsgBox("File not found!") + End If + End Sub + +#Region "Tab Header Color Change" + + Private Sub UpdateTabStatus(pageName As String, resultGood As Boolean) + + + Dim page As TabPage = tabMain.TabPages(pageName) + + If Not resultGood Then + + SetTabHeader(page, Color.Red) + + Else + SetTabHeader(page, Control.DefaultBackColor) + + End If + End Sub + + Private Sub SetTabHeader(page As TabPage, color As Color) + + TabColors(page) = color + tabMain.Invalidate() + End Sub + + Private Sub tabMain_DrawItem(sender As Object, e As DrawItemEventArgs) + + Dim br As Brush = New SolidBrush(TabColors(tabMain.TabPages(e.Index))) + + + Using (br) + + e.Graphics.FillRectangle(br, e.Bounds) + Dim sz As SizeF = e.Graphics.MeasureString(tabMain.TabPages(e.Index).Text, e.Font) + e.Graphics.DrawString(tabMain.TabPages(e.Index).Text, e.Font, Brushes.Black, + e.Bounds.Left + (e.Bounds.Width - sz.Width) / 2, e.Bounds.Top + (e.Bounds.Height - sz.Height) / 2 + 1) + + Dim rect As Rectangle = e.Bounds + rect.Offset(-1, -1) + rect.Inflate(1, 1) + ' e.Graphics.DrawRectangle(Pens.DarkGray, rect) + 'e.DrawFocusRectangle() + + End Using + End Sub + + +#End Region + + Public Sub UnbindAllControls(ByRef container As Control) + 'Clear all of the controls within the container object + 'If "Recurse" is true, then also clear controls within any sub-containers + Dim ctrl As Control = Nothing + + For Each ctrl In container.Controls + + ctrl.DataBindings.Clear() + + If ctrl.HasChildren Then + UnbindAllControls(ctrl) + End If + + Next + End Sub + + Private Function GetSSMMAP(ByVal filePath As String, ByRef message As String) As Hvac.IHVACSteadyStateModel + + Dim ssmMap As New Hvac.HVACSteadyStateModel() + + + Try + + If ssmMap.SetValuesFromMap(FilePathUtils.ResolveFilePath(aauxPath, txtSSMFilePath.Text), message) Then + + Return ssmMap + + End If + + Catch ex As Exception + + MessageBox.Show("Unable to retreive values from map") + + End Try + + Return Nothing + End Function + + Private Sub SetupControls() + + + Dim cIndex As Integer = 0 + + gvElectricalConsumables.AutoGenerateColumns = False + + 'ElectricalConsumerGrid + 'Columns + cIndex = gvElectricalConsumables.Columns.Add("Category", "Category") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Category" + gvElectricalConsumables.Columns(cIndex).MinimumWidth = 150 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + + cIndex = gvElectricalConsumables.Columns.Add("ConsumerName", "Name") + + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "ConsumerName" + gvElectricalConsumables.Columns(cIndex).MinimumWidth = 308 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + + Dim baseVehicle As New DataGridViewCheckBoxColumn(False) + baseVehicle.HeaderText = "Base Vehicle" + cIndex = gvElectricalConsumables.Columns.Add(baseVehicle) + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "BaseVehicle" + gvElectricalConsumables.Columns(cIndex).Width = 75 + gvElectricalConsumables.Columns(cIndex).Visible = False + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Energy included in the calculations of base vehicle" + + cIndex = gvElectricalConsumables.Columns.Add("NominalConsumptionAmps", "Nominal Amps") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NominalConsumptionAmps" + gvElectricalConsumables.Columns(cIndex).Width = 60 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ + With {.BackColor = Color.LightGray} + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Nominal consumption in AMPS" + + cIndex = gvElectricalConsumables.Columns.Add("PhaseIdle_TractionOn", "PhaseIdle/ TractionOn") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "PhaseIdle_TractionOn" + gvElectricalConsumables.Columns(cIndex).Width = 60 + gvElectricalConsumables.Columns(cIndex).ReadOnly = True + gvElectricalConsumables.Columns(cIndex).DefaultCellStyle = New DataGridViewCellStyle() _ + With {.BackColor = Color.LightGray} + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = + "Represents the amount of time (during engine fueling) as " & vbCrLf & + "percentage that the consumer is active during the cycle." + + cIndex = gvElectricalConsumables.Columns.Add("NumberInActualVehicle", "Num in Vehicle") + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "NumberInActualVehicle" + gvElectricalConsumables.Columns(cIndex).Width = 55 + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Number of consumables of this" & vbCrLf & + "type installed on the vehicle." + + + 'INFO COLUMN + cIndex = gvElectricalConsumables.Columns.Add("info", "Info") + ' cIndex = gvElectricalConsumables.Columns.Add( New ImageColumn()) + + gvElectricalConsumables.Columns(cIndex).DataPropertyName = "Info" + gvElectricalConsumables.Columns(cIndex).Width = 120 + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Alignment = DataGridViewContentAlignment.TopCenter + gvElectricalConsumables.Columns(cIndex).HeaderCell.Style.Padding = New Padding(1, 2, 1, 1) + gvElectricalConsumables.Columns(cIndex).HeaderCell.ToolTipText = "Further Information" + + ' ResultCard Grids + + 'IDLE + + cIndex = gvResultsCardIdle.Columns.Add("Amps", "Amps") + gvResultsCardIdle.Columns(cIndex).DataPropertyName = "Amps" + gvResultsCardIdle.Columns(cIndex).Width = 65 + + cIndex = gvResultsCardIdle.Columns.Add("SmartAmps", "SmartAmps") + gvResultsCardIdle.Columns(cIndex).DataPropertyName = "SmartAmps" + gvResultsCardIdle.Columns(cIndex).Width = 65 + + 'TRACTION + cIndex = gvResultsCardTraction.Columns.Add("Amps", "Amps") + gvResultsCardTraction.Columns(cIndex).DataPropertyName = "Amps" + gvResultsCardTraction.Columns(cIndex).Width = 65 + + cIndex = gvResultsCardTraction.Columns.Add("SmartAmps", "SmartAmps") + gvResultsCardTraction.Columns(cIndex).DataPropertyName = "SmartAmps" + gvResultsCardTraction.Columns(cIndex).Width = 65 + + 'OVERRUN + cIndex = gvResultsCardOverrun.Columns.Add("Amps", "Amps") + gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "Amps" + gvResultsCardOverrun.Columns(cIndex).Width = 65 + + cIndex = gvResultsCardOverrun.Columns.Add("SmartAmps", "SmartAmps") + gvResultsCardOverrun.Columns(cIndex).DataPropertyName = "SmartAmps" + gvResultsCardOverrun.Columns(cIndex).Width = 65 + End Sub + +#Region "Binding Control" + + Private Sub CreateBindings() + + 'auxConfig.Vecto Bindings + txtPowernetVoltage.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "PowerNetVoltage") + 'txtVehicleWeightKG.DataBindings.Add("Text", auxConfig.VectoInputs, "VehicleWeightKG") + 'cboCycle.DataBindings.Add("Text", auxConfig.VectoInputs, "Cycle") + txtFuelMap.DataBindings.Add("Text", auxConfig.VectoInputs, "FuelMap") + + 'Electricals General + txtAlternatorMapPath.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorMap") + txtAlternatorGearEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "AlternatorGearEfficiency") + txtDoorActuationTimeSeconds.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "DoorActuationTimeSecond") + txtStoredEnergyEfficiency.DataBindings.Add("Text", auxConfig.ElectricalUserInputsConfig, "StoredEnergyEfficiency") + chkSmartElectricals.DataBindings.Add("Checked", auxConfig.ElectricalUserInputsConfig, "SmartElectrical", False, + DataSourceUpdateMode.OnPropertyChanged) + + + 'Electrical ConsumablesGrid + electricalConsumerBinding = + New BindingList(Of IElectricalConsumer)(auxConfig.ElectricalUserInputsConfig.ElectricalConsumers.Items) + gvElectricalConsumables.DataSource = electricalConsumerBinding + + + 'ResultCards + + 'IDLE + Dim idleBinding As BindingList(Of SmartResult) + idleBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardIdle.Results) + idleBinding.AllowNew = True + idleBinding.AllowRemove = True + gvResultsCardIdle.DataSource = idleBinding + + 'TRACTION + Dim tractionBinding As BindingList(Of SmartResult) + tractionBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardTraction.Results) + tractionBinding.AllowNew = True + tractionBinding.AllowRemove = True + gvResultsCardTraction.DataSource = tractionBinding + + 'OVERRUN + Dim overrunBinding As BindingList(Of SmartResult) + overrunBinding = New BindingList(Of SmartResult)(auxConfig.ElectricalUserInputsConfig.ResultCardOverrun.Results) + overrunBinding.AllowNew = True + overrunBinding.AllowRemove = True + gvResultsCardOverrun.DataSource = overrunBinding + + + 'Pneumatic Auxillaries Binding + txtAdBlueNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "AdBlueNIperMinute") + + txtOverrunUtilisationForCompressionFraction.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "OverrunUtilisationForCompressionFraction") + txtBrakingWithRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "BrakingWithRetarderNIperKG") + txtBrakingNoRetarderNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "BrakingNoRetarderNIperKG") + txtBreakingPerKneelingNIperKGinMM.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "BreakingPerKneelingNIperKGinMM", True, DataSourceUpdateMode.OnPropertyChanged, Nothing, "0.########") + txtPerDoorOpeningNI.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "PerDoorOpeningNI") + txtPerStopBrakeActuationNIperKG.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "PerStopBrakeActuationNIperKG") + txtAirControlledSuspensionNIperMinute.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "AirControlledSuspensionNIperMinute") + txtNonSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "NonSmartRegenFractionTotalAirDemand") + txtSmartRegenFractionTotalAirDemand.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "SmartRegenFractionTotalAirDemand") + txtDeadVolumeLitres.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, "DeadVolumeLitres") + txtDeadVolBlowOutsPerLitresperHour.DataBindings.Add("Text", auxConfig.PneumaticAuxillariesConfig, + "DeadVolBlowOutsPerLitresperHour") + + 'Pneumatic UserInputsConfig Binding + txtCompressorMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorMap") + txtCompressorGearEfficiency.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearEfficiency") + txtCompressorGearRatio.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "CompressorGearRatio") + txtActuationsMap.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "ActuationsMap") + chkSmartAirCompression.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartAirCompression", False, + DataSourceUpdateMode.OnPropertyChanged) + + chkSmartRegeneration.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "SmartRegeneration", False, + DataSourceUpdateMode.OnPropertyChanged) + chkRetarderBrake.DataBindings.Add("Checked", auxConfig.PneumaticUserInputsConfig, "RetarderBrake") + txtKneelingHeightMillimeters.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "KneelingHeightMillimeters") + cboAirSuspensionControl.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AirSuspensionControl", False) + cboAdBlueDosing.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "AdBlueDosing") + cboDoors.DataBindings.Add("Text", auxConfig.PneumaticUserInputsConfig, "Doors") + + txtSSMFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "SSMFilePath") + txtBusDatabaseFilePath.DataBindings.Add("Text", auxConfig.HvacUserInputsConfig, "BusDatabasePath") + chkDisableHVAC.DataBindings.Add("Checked", auxConfig.HvacUserInputsConfig, "SSMDisabled", False, + DataSourceUpdateMode.OnPropertyChanged) + + SetSmartCardEmabledStatus() + End Sub + + Private Sub EnsureBinding() + With tabMain + Dim lastSelectedTabIndex As Integer = .SelectedIndex + If lastSelectedTabIndex < 0 OrElse lastSelectedTabIndex > .TabCount Then lastSelectedTabIndex = 0 + For currentTab As Integer = 0 To .TabCount - 1 + .SelectedIndex = currentTab + Next + .SelectedIndex = 0 + End With + + SetSmartCardEmabledStatus() + End Sub + +#End Region + + Protected Sub SetSmartCardEmabledStatus() + + If chkSmartElectricals.Checked Then + + gvResultsCardIdle.Enabled = True + gvResultsCardTraction.Enabled = True + gvResultsCardOverrun.Enabled = True + + gvResultsCardIdle.BackgroundColor = Color.Gray + gvResultsCardTraction.BackgroundColor = Color.Gray + gvResultsCardOverrun.BackgroundColor = Color.Gray + + electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 0 + Else + + gvResultsCardIdle.Enabled = False + gvResultsCardTraction.Enabled = False + gvResultsCardOverrun.Enabled = False + + + gvResultsCardIdle.BackgroundColor = Color.White + gvResultsCardTraction.BackgroundColor = Color.White + gvResultsCardOverrun.BackgroundColor = Color.White + + electricalConsumerBinding.Single(Function(c) c.Category = "Veh Electronics &Engine").NumberInActualVehicle = 1 + End If + End Sub + + Public Function FileOpenAlt(ByVal file As String) As Boolean + Dim PSI As New ProcessStartInfo + + If Not IO.File.Exists(file) Then Return False + + PSI.FileName = "notepad.exe" + PSI.Arguments = ChrW(34) & file & ChrW(34) + Try + Process.Start(PSI) + Return True + Catch ex As Exception + Return False + End Try + End Function + + Private Sub chkDisableHVAC_CheckedChanged(sender As Object, e As EventArgs) Handles chkDisableHVAC.CheckedChanged + + If chkDisableHVAC.Checked Then + + txtSSMFilePath.ReadOnly = True + txtBusDatabaseFilePath.ReadOnly = True + btnSSMBSource.Enabled = False + btnBusDatabaseSource.Enabled = False + btnOpenAHSM.Enabled = False + btnOpenABDB.Enabled = False + + Else + + txtSSMFilePath.ReadOnly = False + txtBusDatabaseFilePath.ReadOnly = False + btnSSMBSource.Enabled = True + btnBusDatabaseSource.Enabled = True + btnOpenAHSM.Enabled = True + btnOpenABDB.Enabled = True + + End If + End Sub + + Protected Overrides Sub Finalize() + MyBase.Finalize() + End Sub End Class \ No newline at end of file diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb index 4430ca10cae6da03df98a199c25fb8db52b43b34..91fbeb08363b89ef8d3d4c34d8d54b650a38c340 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/Enumerations.vb @@ -1,22 +1,22 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -'Used to classify messages to the invoking host. - -Public Enum AdvancedAuxiliaryMessageType - - Information=1 - Warning=2 - Critical=3 - - -End Enum - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +'Used to classify messages to the invoking host. + +Public Enum AdvancedAuxiliaryMessageType + + Information=1 + Warning=2 + Critical=3 + + +End Enum + diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb index 4b8a27b5c980ca826fa3ad3024166e289fb53b8a..a07e798bf89202a68d4507932c23f8cd52a2c102 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/IAdvancedAuxiliaries.vb @@ -1,145 +1,145 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Public Interface IAdvancedAuxiliaries - ' Inherits IAuxiliaryEvent - - Event AuxiliaryEvent(ByRef sender As Object, ByVal message As String, ByVal messageType As AdvancedAuxiliaryMessageType) - - - 'Information - ReadOnly Property Running As Boolean - - ReadOnly Property AuxiliaryName As String - ReadOnly Property AuxiliaryVersion As String - - - 'Diagnostic Only - Remove when beta over. - ReadOnly Property AA_D_M12_P1X As Joule - ReadOnly Property AA_D_M12_P1Y As Kilogram - ReadOnly Property AA_D_M12_P2X As Joule - ReadOnly Property AA_D_M12_P2Y As Kilogram - ReadOnly Property AA_D_M12_P3X As Joule - ReadOnly Property AA_D_M12_P3Y As Kilogram - ReadOnly Property AA_D_M12_XTAIN As Joule - ReadOnly Property AA_D_M12_INTERP1 As Kilogram - ReadOnly Property AA_D_M12_INTERP2 As Kilogram - - 'Additional Permenent Monitoring Signals - Required by engineering - ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double - ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere - ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double - ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere - ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double - ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere - ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double - ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond - ReadOnly Property AA_OverrunFlag As Boolean - ReadOnly Property AA_EngineIdleFlag As Integer? - ReadOnly Property AA_CompressorFlag As Boolean - ReadOnly Property AA_TotalCycleFC_Grams As Kilogram - ReadOnly Property AA_TotalCycleFC_Litres As Liter - ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt - ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt - ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt - ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt - ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram - ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram - - ''' <summary> - ''' Total Cycle Fuel In Grams - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalFuelGRAMS As Kilogram - - ''' <summary> - ''' Total Cycle Fuel in Litres - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property TotalFuelLITRES As Liter - - ''' <summary> - ''' Total Power Demans At Crank From Auxuliaries (W) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt - - - ''' <summary> - ''' Vecto Inputs - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property VectoInputs As IVectoInputs - - ''' <summary> - ''' Signals From Vecto - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property Signals As ISignals - - ''' <summary> - ''' Configure Auxuliaries ( Launches Config Form ) - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="vectoFilePath"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function Configure(filePath As String, vectoFilePath As String) As Boolean - - ''' <summary> - ''' Validate AAUX file path supplied. - ''' </summary> - ''' <param name="filePath"></param> - ''' <param name="message"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function ValidateAAUXFile(ByVal filePath As String, ByRef message As String) As Boolean - - 'Command - ''' <summary> - ''' Cycle Step - Used to calculate fuelling - ''' </summary> - ''' <param name="seconds"></param> - ''' <param name="message"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function CycleStep(seconds As Second, ByRef message As String) As Boolean - - ''' <summary> - ''' Initialises AAUX Environment ( Begin Processs ) - ''' </summary> - ''' <param name="auxFilePath"></param> - ''' <param name="vectoFilePath"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean - - ''' <summary> - ''' Any Termination Which Needs to be done ( Model depenent ) - ''' </summary> - ''' <param name="message"></param> - ''' <returns></returns> - ''' <remarks></remarks> - Function RunStop(ByRef message As String) As Boolean -End Interface - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Public Interface IAdvancedAuxiliaries + ' Inherits IAuxiliaryEvent + + Event AuxiliaryEvent(ByRef sender As Object, ByVal message As String, ByVal messageType As AdvancedAuxiliaryMessageType) + + + 'Information + ReadOnly Property Running As Boolean + + ReadOnly Property AuxiliaryName As String + ReadOnly Property AuxiliaryVersion As String + + + 'Diagnostic Only - Remove when beta over. + ReadOnly Property AA_D_M12_P1X As Joule + ReadOnly Property AA_D_M12_P1Y As Kilogram + ReadOnly Property AA_D_M12_P2X As Joule + ReadOnly Property AA_D_M12_P2Y As Kilogram + ReadOnly Property AA_D_M12_P3X As Joule + ReadOnly Property AA_D_M12_P3Y As Kilogram + ReadOnly Property AA_D_M12_XTAIN As Joule + ReadOnly Property AA_D_M12_INTERP1 As Kilogram + ReadOnly Property AA_D_M12_INTERP2 As Kilogram + + 'Additional Permenent Monitoring Signals - Required by engineering + ReadOnly Property AA_NonSmartAlternatorsEfficiency As Double + ReadOnly Property AA_SmartIdleCurrent_Amps As Ampere + ReadOnly Property AA_SmartIdleAlternatorsEfficiency As Double + ReadOnly Property AA_SmartTractionCurrent_Amps As Ampere + ReadOnly Property AA_SmartTractionAlternatorEfficiency As Double + ReadOnly Property AA_SmartOverrunCurrent_Amps As Ampere + ReadOnly Property AA_SmartOverrunAlternatorEfficiency As Double + ReadOnly Property AA_CompressorFlowRate_LitrePerSec As NormLiterPerSecond + ReadOnly Property AA_OverrunFlag As Boolean + ReadOnly Property AA_EngineIdleFlag As Integer? + ReadOnly Property AA_CompressorFlag As Boolean + ReadOnly Property AA_TotalCycleFC_Grams As Kilogram + ReadOnly Property AA_TotalCycleFC_Litres As Liter + ReadOnly Property AA_AveragePowerDemandCrankHVACMechanicals As Watt + ReadOnly Property AA_AveragePowerDemandCrankHVACElectricals As Watt + ReadOnly Property AA_AveragePowerDemandCrankElectrics As Watt + ReadOnly Property AA_AveragePowerDemandCrankPneumatics As Watt + ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOff As Kilogram + ReadOnly Property AA_TotalCycleFuelConsumptionCompressorOn As Kilogram + + ''' <summary> + ''' Total Cycle Fuel In Grams + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalFuelGRAMS As Kilogram + + ''' <summary> + ''' Total Cycle Fuel in Litres + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property TotalFuelLITRES As Liter + + ''' <summary> + ''' Total Power Demans At Crank From Auxuliaries (W) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + ReadOnly Property AuxiliaryPowerAtCrankWatts As Watt + + + ''' <summary> + ''' Vecto Inputs + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property VectoInputs As IVectoInputs + + ''' <summary> + ''' Signals From Vecto + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property Signals As ISignals + + ''' <summary> + ''' Configure Auxuliaries ( Launches Config Form ) + ''' </summary> + ''' <param name="filePath"></param> + ''' <param name="vectoFilePath"></param> + ''' <returns></returns> + ''' <remarks></remarks> + Function Configure(filePath As String, vectoFilePath As String) As Boolean + + ''' <summary> + ''' Validate AAUX file path supplied. + ''' </summary> + ''' <param name="filePath"></param> + ''' <param name="message"></param> + ''' <returns></returns> + ''' <remarks></remarks> + Function ValidateAAUXFile(ByVal filePath As String, ByRef message As String) As Boolean + + 'Command + ''' <summary> + ''' Cycle Step - Used to calculate fuelling + ''' </summary> + ''' <param name="seconds"></param> + ''' <param name="message"></param> + ''' <returns></returns> + ''' <remarks></remarks> + Function CycleStep(seconds As Second, ByRef message As String) As Boolean + + ''' <summary> + ''' Initialises AAUX Environment ( Begin Processs ) + ''' </summary> + ''' <param name="auxFilePath"></param> + ''' <param name="vectoFilePath"></param> + ''' <returns></returns> + ''' <remarks></remarks> + Function RunStart(ByVal auxFilePath As String, ByVal vectoFilePath As String) As Boolean + + ''' <summary> + ''' Any Termination Which Needs to be done ( Model depenent ) + ''' </summary> + ''' <param name="message"></param> + ''' <returns></returns> + ''' <remarks></remarks> + Function RunStop(ByRef message As String) As Boolean +End Interface + + diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb index af8ff9864d23b590240dfa0c2b8ce1eb47900f7f..44721ccf1654fd45fabbc944a1378353d32fe982 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/IAuxiliaryEvent.vb @@ -1,17 +1,17 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. - -Public Interface IAuxiliaryEvent - - Event AuxiliaryEvent( ByRef sender As Object, byval message As String, ByVal messageType As AdvancedAuxiliaryMessageType ) - -End interface - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. + +Public Interface IAuxiliaryEvent + + Event AuxiliaryEvent( ByRef sender As Object, byval message As String, ByVal messageType As AdvancedAuxiliaryMessageType ) + +End interface + diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb index c1c6f361faaf10d2d4025b100b1e49f919a2d86a..3d3095e85ab630485a5e42c88b892904f46a6d6a 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/ISignals.vb @@ -1,181 +1,181 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Public Interface ISignals - ''' <summary> - ''' Pre Existing Aux Power (KW) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property PreExistingAuxPower As Watt - - ''' <summary> - ''' Engine Motoring Power (KW) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property EngineMotoringPower As Watt - - ''' <summary> - ''' Engine Driveline Power (KW) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property EngineDrivelinePower As Watt - - ''' <summary> - ''' Smart Electrics - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Should be true if fitted to the vehicle - AAUX Input</remarks> - Property SmartElectrics As Boolean - - ''' <summary> - ''' Clucth Engaged - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property ClutchEngaged As Boolean - - ''' <summary> - ''' Engine Speed 1/NU - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' - Property EngineSpeed As PerSecond - - ''' <summary> - ''' Smart Pneumatics - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>should be true if fitted to the vehicle- AAux Config Input</remarks> - Property SmartPneumatics As Boolean - - ''' <summary> - ''' Total Cycle Time In Seconds - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property TotalCycleTimeSeconds As Integer - - ''' <summary> - ''' Current Cycle Time In Seconds - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>( Will Increment during Cycle )</remarks> - Property CurrentCycleTimeInSeconds As Double - - ''' <summary> - ''' Engine Driveline Torque - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property EngineDrivelineTorque As NewtonMeter - - ''' <summary> - ''' Engine Idle - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property Idle As Boolean - - ''' <summary> - ''' In Neutral - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input</remarks> - Property InNeutral As Boolean - - ''' <summary> - ''' Auxiliary Event Reporting Level - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Can be used by Vecto to choose the level of reporting</remarks> - Property AuxiliaryEventReportingLevel As AdvancedAuxiliaryMessageType - - ''' <summary> - ''' Engine Stopped - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>'Vecto Input - Used to Cut Fueling in AAux model</remarks> - Property EngineStopped As Boolean - - ''' <summary> - ''' WHTC ( Correction factor to be applied ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>'Vecto Input</remarks> - Property WHTC As Double - - ''' <summary> - ''' Declaration Mode - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>Vecto Input - Used to decide if to apply WHTC/Possiblye other things in future</remarks> - Property DeclarationMode As Boolean - - ''' <summary> - ''' Engine Idle Speed ( Associated with the vehicle bein tested ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property EngineIdleSpeed As PerSecond - - ''' <summary> - ''' Pneumatic Overrun Utilisation - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PneumaticOverrunUtilisation As Double - - ''' <summary> - ''' Stored Energy Efficiency - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property StoredEnergyEfficiency As Double - - ''' <summary> - ''' Running Calc - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property RunningCalc As Boolean - - ''' <summary> - ''' Running Calc - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property InternalEnginePower As Watt -End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Public Interface ISignals + ''' <summary> + ''' Pre Existing Aux Power (KW) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property PreExistingAuxPower As Watt + + ''' <summary> + ''' Engine Motoring Power (KW) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property EngineMotoringPower As Watt + + ''' <summary> + ''' Engine Driveline Power (KW) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property EngineDrivelinePower As Watt + + ''' <summary> + ''' Smart Electrics + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Should be true if fitted to the vehicle - AAUX Input</remarks> + Property SmartElectrics As Boolean + + ''' <summary> + ''' Clucth Engaged + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property ClutchEngaged As Boolean + + ''' <summary> + ''' Engine Speed 1/NU + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' + Property EngineSpeed As PerSecond + + ''' <summary> + ''' Smart Pneumatics + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>should be true if fitted to the vehicle- AAux Config Input</remarks> + Property SmartPneumatics As Boolean + + ''' <summary> + ''' Total Cycle Time In Seconds + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property TotalCycleTimeSeconds As Integer + + ''' <summary> + ''' Current Cycle Time In Seconds + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>( Will Increment during Cycle )</remarks> + Property CurrentCycleTimeInSeconds As Double + + ''' <summary> + ''' Engine Driveline Torque + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property EngineDrivelineTorque As NewtonMeter + + ''' <summary> + ''' Engine Idle + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property Idle As Boolean + + ''' <summary> + ''' In Neutral + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input</remarks> + Property InNeutral As Boolean + + ''' <summary> + ''' Auxiliary Event Reporting Level + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Can be used by Vecto to choose the level of reporting</remarks> + Property AuxiliaryEventReportingLevel As AdvancedAuxiliaryMessageType + + ''' <summary> + ''' Engine Stopped + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>'Vecto Input - Used to Cut Fueling in AAux model</remarks> + Property EngineStopped As Boolean + + ''' <summary> + ''' WHTC ( Correction factor to be applied ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>'Vecto Input</remarks> + Property WHTC As Double + + ''' <summary> + ''' Declaration Mode + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>Vecto Input - Used to decide if to apply WHTC/Possiblye other things in future</remarks> + Property DeclarationMode As Boolean + + ''' <summary> + ''' Engine Idle Speed ( Associated with the vehicle bein tested ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property EngineIdleSpeed As PerSecond + + ''' <summary> + ''' Pneumatic Overrun Utilisation + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property PneumaticOverrunUtilisation As Double + + ''' <summary> + ''' Stored Energy Efficiency + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property StoredEnergyEfficiency As Double + + ''' <summary> + ''' Running Calc + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property RunningCalc As Boolean + + ''' <summary> + ''' Running Calc + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property InternalEnginePower As Watt +End Interface diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb index 11e637ce9ef92dd4a6b0b111de163955cc0690f6..491315a4500253780dc6426125310d2d2a77b3a8 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/IVectoInputs.vb @@ -1,55 +1,55 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Public Interface IVectoInputs - ''' <summary> - ''' Vehicle Mass (KG) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property VehicleWeightKG As Kilogram - - ''' <summary> - ''' Cycle ( Urban, Interurban etc ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property Cycle As String - - ''' <summary> - ''' PowerNet Voltage (V) Volts available on the bus by Batteries - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property PowerNetVoltage As Volt - - ''' <summary> - ''' Fuel Map Used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property FuelMap As IFuelConsumptionMap - - Property FuelMapFile As String - - ''' <summary> - ''' Fuel density used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Property FuelDensity As KilogramPerCubicMeter -End Interface +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Public Interface IVectoInputs + ''' <summary> + ''' Vehicle Mass (KG) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property VehicleWeightKG As Kilogram + + ''' <summary> + ''' Cycle ( Urban, Interurban etc ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property Cycle As String + + ''' <summary> + ''' PowerNet Voltage (V) Volts available on the bus by Batteries + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property PowerNetVoltage As Volt + + ''' <summary> + ''' Fuel Map Used in Vecto. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property FuelMap As IFuelConsumptionMap + + Property FuelMapFile As String + + ''' <summary> + ''' Fuel density used in Vecto. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Property FuelDensity As KilogramPerCubicMeter +End Interface diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb index e90d59cb8b4ec87dc85bef713914994adae1b7c4..37e4d27d57631d5e77a317469ddf10ce918f0d27 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/Signals.vb @@ -1,64 +1,64 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports TUGraz.VectoCommon.Utils - -Public Class Signals - Implements ISignals - - 'Backing variables - Private _WHTCCorretion As Single = 1 - Private _smartElectrics As Boolean - - Public Property ClutchEngaged As Boolean Implements ISignals.ClutchEngaged - Public Property EngineDrivelinePower As Watt Implements ISignals.EngineDrivelinePower - Public Property EngineDrivelineTorque As NewtonMeter Implements ISignals.EngineDrivelineTorque - Public Property EngineMotoringPower As Watt Implements ISignals.EngineMotoringPower - Public Property EngineSpeed As PerSecond Implements ISignals.EngineSpeed - - Public Property SmartElectrics As Boolean Implements ISignals.SmartElectrics - Get - Return _smartElectrics - End Get - Set(value As Boolean) - _smartElectrics = value - End Set - End Property - - Public Property SmartPneumatics As Boolean Implements ISignals.SmartPneumatics - Public Property TotalCycleTimeSeconds As Integer Implements ISignals.TotalCycleTimeSeconds - Public Property CurrentCycleTimeInSeconds As Double Implements ISignals.CurrentCycleTimeInSeconds - Public Property PreExistingAuxPower As Watt Implements ISignals.PreExistingAuxPower - Public Property Idle As Boolean Implements ISignals.Idle - Public Property InNeutral As Boolean Implements ISignals.InNeutral - - Public Property AuxiliaryEventReportingLevel As AdvancedAuxiliaryMessageType _ - Implements ISignals.AuxiliaryEventReportingLevel - - Public Property EngineStopped As Boolean Implements ISignals.EngineStopped - Public Property DeclarationMode As Boolean Implements ISignals.DeclarationMode - - Public Property WHTC As Double Implements ISignals.WHTC - Set(value As Double) - _WHTCCorretion = value - End Set - Get - Return _WHTCCorretion - End Get - End Property - - Public Property EngineIdleSpeed As PerSecond Implements ISignals.EngineIdleSpeed - Public Property PneumaticOverrunUtilisation As Double Implements ISignals.PneumaticOverrunUtilisation - Public Property StoredEnergyEfficiency As Double Implements ISignals.StoredEnergyEfficiency - Public Property RunningCalc As Boolean Implements ISignals.RunningCalc - Public Property InternalEnginePower As Watt Implements ISignals.InternalEnginePower -End Class - - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports TUGraz.VectoCommon.Utils + +Public Class Signals + Implements ISignals + + 'Backing variables + Private _WHTCCorretion As Single = 1 + Private _smartElectrics As Boolean + + Public Property ClutchEngaged As Boolean Implements ISignals.ClutchEngaged + Public Property EngineDrivelinePower As Watt Implements ISignals.EngineDrivelinePower + Public Property EngineDrivelineTorque As NewtonMeter Implements ISignals.EngineDrivelineTorque + Public Property EngineMotoringPower As Watt Implements ISignals.EngineMotoringPower + Public Property EngineSpeed As PerSecond Implements ISignals.EngineSpeed + + Public Property SmartElectrics As Boolean Implements ISignals.SmartElectrics + Get + Return _smartElectrics + End Get + Set(value As Boolean) + _smartElectrics = value + End Set + End Property + + Public Property SmartPneumatics As Boolean Implements ISignals.SmartPneumatics + Public Property TotalCycleTimeSeconds As Integer Implements ISignals.TotalCycleTimeSeconds + Public Property CurrentCycleTimeInSeconds As Double Implements ISignals.CurrentCycleTimeInSeconds + Public Property PreExistingAuxPower As Watt Implements ISignals.PreExistingAuxPower + Public Property Idle As Boolean Implements ISignals.Idle + Public Property InNeutral As Boolean Implements ISignals.InNeutral + + Public Property AuxiliaryEventReportingLevel As AdvancedAuxiliaryMessageType _ + Implements ISignals.AuxiliaryEventReportingLevel + + Public Property EngineStopped As Boolean Implements ISignals.EngineStopped + Public Property DeclarationMode As Boolean Implements ISignals.DeclarationMode + + Public Property WHTC As Double Implements ISignals.WHTC + Set(value As Double) + _WHTCCorretion = value + End Set + Get + Return _WHTCCorretion + End Get + End Property + + Public Property EngineIdleSpeed As PerSecond Implements ISignals.EngineIdleSpeed + Public Property PneumaticOverrunUtilisation As Double Implements ISignals.PneumaticOverrunUtilisation + Public Property StoredEnergyEfficiency As Double Implements ISignals.StoredEnergyEfficiency + Public Property RunningCalc As Boolean Implements ISignals.RunningCalc + Public Property InternalEnginePower As Watt Implements ISignals.InternalEnginePower +End Class + + diff --git a/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb b/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb index bf8f81c84d29c764ff0e7f974fbf9549092d1c11..657a8727798307b1c5f71f5b2cd15ca01bf9fdb9 100644 --- a/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb +++ b/VectoCommon/AdvancedAuxiliaryInterfaces/VectoInputs.vb @@ -1,91 +1,91 @@ -' Copyright 2015 European Union. -' Licensed under the EUPL (the 'Licence'); -' -' * You may not use this work except in compliance with the Licence. -' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl -' * Unless required by applicable law or agreed to in writing, -' software distributed under the Licence is distributed on an "AS IS" basis, -' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -' -' See the LICENSE.txt for the specific language governing permissions and limitations. -Imports Newtonsoft.Json -Imports TUGraz.VectoCommon.Utils - -Public Class VectoInputs - Implements IVectoInputs - - ''' <summary> - ''' Name of the Cycle ( Urban, Interurban etc ) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - Public Property Cycle As String Implements IVectoInputs.Cycle - - ''' <summary> - ''' Vehicle Mass (KG) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - <JsonIgnore> - Public Property VehicleWeightKG As Kilogram Implements IVectoInputs.VehicleWeightKG - Get - Return _vehicleWeight.SI(Of Kilogram)() - End Get - Set(value As Kilogram) - _vehicleWeight = value.Value() - End Set - End Property - - <JsonProperty("VehicleWeightKG")> Dim _vehicleWeight As Double - - ''' <summary> - ''' Powernet Voltage (V) - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks>This is the power voltage available in the bus - usually 26.3 Volts</remarks> - <JsonIgnore> - Public Property PowerNetVoltage As Volt Implements IVectoInputs.PowerNetVoltage - Get - Return _powerNetVoltage.SI(Of Volt)() - End Get - Set(value As Volt) - _powerNetVoltage = value.Value() - End Set - End Property - - <JsonProperty("PowerNetVoltage")> Dim _powerNetVoltage As Double - - ''' <summary> - ''' Fuel Map Same One as used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - <JsonIgnore> - Public Property FuelMap As IFuelConsumptionMap Implements IVectoInputs.FuelMap - - <JsonProperty("FuelMap")> - Public Property FuelMapFile As String Implements IVectoInputs.FuelMapFile - - ''' <summary> - ''' Fuel Density as used in Vecto. - ''' </summary> - ''' <value></value> - ''' <returns></returns> - ''' <remarks></remarks> - <JsonIgnore> - Public Property FuelDensity As KilogramPerCubicMeter Implements IVectoInputs.FuelDensity - Get - Return _fuelDensity.SI(Of KilogramPerCubicMeter)() - End Get - Set(value As KilogramPerCubicMeter) - _fuelDensity = value.Value() - End Set - End Property - - <JsonProperty("FuelDensity")> Dim _fuelDensity As Double -End Class - +' Copyright 2017 European Union. +' Licensed under the EUPL (the 'Licence'); +' +' * You may not use this work except in compliance with the Licence. +' * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl +' * Unless required by applicable law or agreed to in writing, +' software distributed under the Licence is distributed on an "AS IS" basis, +' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +' +' See the LICENSE.txt for the specific language governing permissions and limitations. +Imports Newtonsoft.Json +Imports TUGraz.VectoCommon.Utils + +Public Class VectoInputs + Implements IVectoInputs + + ''' <summary> + ''' Name of the Cycle ( Urban, Interurban etc ) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + Public Property Cycle As String Implements IVectoInputs.Cycle + + ''' <summary> + ''' Vehicle Mass (KG) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + <JsonIgnore> + Public Property VehicleWeightKG As Kilogram Implements IVectoInputs.VehicleWeightKG + Get + Return _vehicleWeight.SI(Of Kilogram)() + End Get + Set(value As Kilogram) + _vehicleWeight = value.Value() + End Set + End Property + + <JsonProperty("VehicleWeightKG")> Dim _vehicleWeight As Double + + ''' <summary> + ''' Powernet Voltage (V) + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks>This is the power voltage available in the bus - usually 26.3 Volts</remarks> + <JsonIgnore> + Public Property PowerNetVoltage As Volt Implements IVectoInputs.PowerNetVoltage + Get + Return _powerNetVoltage.SI(Of Volt)() + End Get + Set(value As Volt) + _powerNetVoltage = value.Value() + End Set + End Property + + <JsonProperty("PowerNetVoltage")> Dim _powerNetVoltage As Double + + ''' <summary> + ''' Fuel Map Same One as used in Vecto. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + <JsonIgnore> + Public Property FuelMap As IFuelConsumptionMap Implements IVectoInputs.FuelMap + + <JsonProperty("FuelMap")> + Public Property FuelMapFile As String Implements IVectoInputs.FuelMapFile + + ''' <summary> + ''' Fuel Density as used in Vecto. + ''' </summary> + ''' <value></value> + ''' <returns></returns> + ''' <remarks></remarks> + <JsonIgnore> + Public Property FuelDensity As KilogramPerCubicMeter Implements IVectoInputs.FuelDensity + Get + Return _fuelDensity.SI(Of KilogramPerCubicMeter)() + End Get + Set(value As KilogramPerCubicMeter) + _fuelDensity = value.Value() + End Set + End Property + + <JsonProperty("FuelDensity")> Dim _fuelDensity As Double +End Class + diff --git a/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs b/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs index 78af81434680dbee319b865d4954aec8b70b046c..17297b4677e67f4034a549dad14e00a5b9b03964 100644 --- a/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs +++ b/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs @@ -1,108 +1,108 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Runtime.Serialization; -using TUGraz.VectoCommon.Models; - -namespace TUGraz.VectoCommon.Exceptions -{ - /// <summary> - /// Base Exception for all Exception in VECTO. - /// </summary> - [Serializable] - public class VectoException : Exception - { - protected VectoException(SerializationInfo info, StreamingContext context) : base(info, context) {} - - public VectoException(string message) : base(message) - { - LogManager.Flush(); - } - - public VectoException(string message, Exception innerException) : base(message, innerException) - { - LogManager.Flush(); - } - - public VectoException(string message, params object[] args) - : base(string.Format(message, args)) - { - LogManager.Flush(); - } - - public VectoException(string message, Exception inner, params object[] args) - : base(string.Format(message, args), inner) - { - LogManager.Flush(); - } - } - - /// <summary> - /// Exception when an Input/Output related error occured. - /// </summary> - [Serializable] - public abstract class FileIOException : VectoException - { - protected FileIOException(string message) : base(message) {} - protected FileIOException(string message, Exception inner) : base(message, inner) {} - } - - /// <summary> - /// Exception when the file format is invalid or a file was not found. - /// </summary> - [Serializable] - public class InvalidFileFormatException : FileIOException - { - public InvalidFileFormatException(string message) : base(message) {} - public InvalidFileFormatException(string message, params object[] args) : base(string.Format(message, args)) {} - } - - /// <summary> - /// Exception which gets thrown when the version of a file is not supported. - /// </summary> - [Serializable] - public class UnsupportedFileVersionException : FileIOException - { - public UnsupportedFileVersionException(string message) : base(message) {} - public UnsupportedFileVersionException(string message, Exception inner) : base(message, inner) {} - } - - /// <summary> - /// Exception which gets thrown when an error occurred during read of a vecto csv-file. - /// </summary> - [Serializable] - public class CSVReadException : FileIOException - { - public CSVReadException(string message) : base(message) {} - public CSVReadException(string message, Exception inner) : base(message, inner) {} - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Runtime.Serialization; +using TUGraz.VectoCommon.Models; + +namespace TUGraz.VectoCommon.Exceptions +{ + /// <summary> + /// Base Exception for all Exception in VECTO. + /// </summary> + [Serializable] + public class VectoException : Exception + { + protected VectoException(SerializationInfo info, StreamingContext context) : base(info, context) {} + + public VectoException(string message) : base(message) + { + LogManager.Flush(); + } + + public VectoException(string message, Exception innerException) : base(message, innerException) + { + LogManager.Flush(); + } + + public VectoException(string message, params object[] args) + : base(string.Format(message, args)) + { + LogManager.Flush(); + } + + public VectoException(string message, Exception inner, params object[] args) + : base(string.Format(message, args), inner) + { + LogManager.Flush(); + } + } + + /// <summary> + /// Exception when an Input/Output related error occured. + /// </summary> + [Serializable] + public abstract class FileIOException : VectoException + { + protected FileIOException(string message) : base(message) {} + protected FileIOException(string message, Exception inner) : base(message, inner) {} + } + + /// <summary> + /// Exception when the file format is invalid or a file was not found. + /// </summary> + [Serializable] + public class InvalidFileFormatException : FileIOException + { + public InvalidFileFormatException(string message) : base(message) {} + public InvalidFileFormatException(string message, params object[] args) : base(string.Format(message, args)) {} + } + + /// <summary> + /// Exception which gets thrown when the version of a file is not supported. + /// </summary> + [Serializable] + public class UnsupportedFileVersionException : FileIOException + { + public UnsupportedFileVersionException(string message) : base(message) {} + public UnsupportedFileVersionException(string message, Exception inner) : base(message, inner) {} + } + + /// <summary> + /// Exception which gets thrown when an error occurred during read of a vecto csv-file. + /// </summary> + [Serializable] + public class CSVReadException : FileIOException + { + public CSVReadException(string message) : base(message) {} + public CSVReadException(string message, Exception inner) : base(message, inner) {} + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs b/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs index 8dd07914048d2566ef171fbaa9cb9b7720836f7a..b467b1289cdd008ac08a5fc4d5aee99015a54e94 100644 --- a/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs +++ b/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs @@ -1,98 +1,98 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Runtime.Serialization; -using TUGraz.VectoCommon.Models; - -namespace TUGraz.VectoCommon.Exceptions -{ - [Serializable] - public class VectoSimulationException : VectoException - { - public VectoSimulationException(string msg) : base(msg) {} - public VectoSimulationException(string msg, Exception inner) : base(msg, inner) {} - - //[StringFormatMethod("message")] - public VectoSimulationException(string message, params object[] args) : base(message, args) {} - - //[StringFormatMethod("message")] - public VectoSimulationException(string message, Exception inner, params object[] args) : base(message, inner, args) {} - - protected VectoSimulationException(SerializationInfo info, StreamingContext context) : base(info, context) { } - } - - [Serializable] - public class VectoEngineSpeedTooLowException : VectoSimulationException - { - public VectoEngineSpeedTooLowException(string msg) : base(msg) {} - public VectoEngineSpeedTooLowException(string msg, Exception inner) : base(msg, inner) {} - public VectoEngineSpeedTooLowException(string message, params object[] args) : base(message, args) {} - - public VectoEngineSpeedTooLowException(string message, Exception inner, params object[] args) - : base(message, inner, args) {} - } - - [Serializable] - public class UnexpectedResponseException : VectoSimulationException - { - public override void GetObjectData(SerializationInfo info, StreamingContext context) - { - base.GetObjectData(info, context); - info.AddValue("Response", Response); - } - - protected UnexpectedResponseException(SerializationInfo info, StreamingContext context) : base(info, context) - { - Response = (IResponse)info.GetValue("Response", typeof(IResponse)); - } - - public readonly IResponse Response; - - public UnexpectedResponseException(string message, IResponse resp) - : base(message + Environment.NewLine + "{0}", resp) - { - Response = resp; - } - } - - [Serializable] - public class VectoSearchFailedException : VectoException - { - public VectoSearchFailedException(string message, params object[] args) : base(message, args) {} - } - - [Serializable] - public class VectoSearchAbortedException : VectoException - { - public VectoSearchAbortedException(string message, params object[] args) : base(message, args) { } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Runtime.Serialization; +using TUGraz.VectoCommon.Models; + +namespace TUGraz.VectoCommon.Exceptions +{ + [Serializable] + public class VectoSimulationException : VectoException + { + public VectoSimulationException(string msg) : base(msg) {} + public VectoSimulationException(string msg, Exception inner) : base(msg, inner) {} + + //[StringFormatMethod("message")] + public VectoSimulationException(string message, params object[] args) : base(message, args) {} + + //[StringFormatMethod("message")] + public VectoSimulationException(string message, Exception inner, params object[] args) : base(message, inner, args) {} + + protected VectoSimulationException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } + + [Serializable] + public class VectoEngineSpeedTooLowException : VectoSimulationException + { + public VectoEngineSpeedTooLowException(string msg) : base(msg) {} + public VectoEngineSpeedTooLowException(string msg, Exception inner) : base(msg, inner) {} + public VectoEngineSpeedTooLowException(string message, params object[] args) : base(message, args) {} + + public VectoEngineSpeedTooLowException(string message, Exception inner, params object[] args) + : base(message, inner, args) {} + } + + [Serializable] + public class UnexpectedResponseException : VectoSimulationException + { + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("Response", Response); + } + + protected UnexpectedResponseException(SerializationInfo info, StreamingContext context) : base(info, context) + { + Response = (IResponse)info.GetValue("Response", typeof(IResponse)); + } + + public readonly IResponse Response; + + public UnexpectedResponseException(string message, IResponse resp) + : base(message + Environment.NewLine + "{0}", resp) + { + Response = resp; + } + } + + [Serializable] + public class VectoSearchFailedException : VectoException + { + public VectoSearchFailedException(string message, params object[] args) : base(message, args) {} + } + + [Serializable] + public class VectoSearchAbortedException : VectoException + { + public VectoSearchAbortedException(string message, params object[] args) : base(message, args) { } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/InputData/DataSourceType.cs b/VectoCommon/VectoCommon/InputData/DataSourceType.cs index 917b6b4c6fa7b65b2ab03f177c78c138482ea398..da764556da8a599e192e7669b1f7a7f453083a05 100644 --- a/VectoCommon/VectoCommon/InputData/DataSourceType.cs +++ b/VectoCommon/VectoCommon/InputData/DataSourceType.cs @@ -1,41 +1,41 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.InputData -{ - public enum DataSourceType - { - Embedded, - CSVFile, - JSONFile, - Missing - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.InputData +{ + public enum DataSourceType + { + Embedded, + CSVFile, + JSONFile, + Missing + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs index e0b3dda19ce31af5313ff7bbcfca876ec0de135f..574c9a579db9b7aab3fd3745091b03e61c27f421 100644 --- a/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs +++ b/VectoCommon/VectoCommon/InputData/DeclarationInputData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs index 6ef698ff641aa6892519363d3c418a906b5a7d59..843b776eb5f9803e06f9f05281624e63bb111287 100644 --- a/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs +++ b/VectoCommon/VectoCommon/InputData/EngineeringInputData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs b/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs index 3a4e75c5bc62152eed5b81d803cee818601f2615..16cd627535b02621b2ef2a626409cdbcf3b095fa 100644 --- a/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs +++ b/VectoCommon/VectoCommon/InputData/IInputDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.Linq; namespace TUGraz.VectoCommon.InputData diff --git a/VectoCommon/VectoCommon/InputData/IntegrityStatus.cs b/VectoCommon/VectoCommon/InputData/IntegrityStatus.cs index ecd68c3c9411d094ff4823282dd03f2350bbe345..043b445ec0daf9849cc7f42ca510275fe507b551 100644 --- a/VectoCommon/VectoCommon/InputData/IntegrityStatus.cs +++ b/VectoCommon/VectoCommon/InputData/IntegrityStatus.cs @@ -1,42 +1,42 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.InputData -{ - public enum IntegrityStatus - { - Unknown, - NoDigestProvided, - NotChecked, - DigestValid, - DigestInvalid - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.InputData +{ + public enum IntegrityStatus + { + Unknown, + NoDigestProvided, + NotChecked, + DigestValid, + DigestInvalid + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/InputData/TableData.cs b/VectoCommon/VectoCommon/InputData/TableData.cs index d39590a29b8ea78ad69dc816962f4a3796a8c9d9..081719c601bf50641990fc0ed508777fb8d3fd16 100644 --- a/VectoCommon/VectoCommon/InputData/TableData.cs +++ b/VectoCommon/VectoCommon/InputData/TableData.cs @@ -1,54 +1,54 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; - -namespace TUGraz.VectoCommon.InputData -{ - public class TableData : DataTable - { - public TableData(string fileName, DataSourceType sourceType = DataSourceType.CSVFile) - { - SourceType = sourceType; - Source = fileName; - } - - public TableData() - { - SourceType = DataSourceType.Embedded; - Source = ""; - } - - public DataSourceType SourceType { get; protected set; } - - public string Source { get; protected set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; + +namespace TUGraz.VectoCommon.InputData +{ + public class TableData : DataTable + { + public TableData(string fileName, DataSourceType sourceType = DataSourceType.CSVFile) + { + SourceType = sourceType; + Source = fileName; + } + + public TableData() + { + SourceType = DataSourceType.Embedded; + Source = ""; + } + + public DataSourceType SourceType { get; protected set; } + + public string Source { get; protected set; } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/AngledriveType.cs b/VectoCommon/VectoCommon/Models/AngledriveType.cs index 0c6065efd338b409c7f051f8defd0a06cec089d1..0dd942600798bcf91b1e4068d28cb1019afe9f0e 100644 --- a/VectoCommon/VectoCommon/Models/AngledriveType.cs +++ b/VectoCommon/VectoCommon/Models/AngledriveType.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCommon.Models diff --git a/VectoCommon/VectoCommon/Models/AuxiliaryDemandType.cs b/VectoCommon/VectoCommon/Models/AuxiliaryDemandType.cs index 178755547f98656f9f7e935d7dffe6dd8efd825e..0f119cc161c3d039a4973910197436dc6b3b57d2 100644 --- a/VectoCommon/VectoCommon/Models/AuxiliaryDemandType.cs +++ b/VectoCommon/VectoCommon/Models/AuxiliaryDemandType.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.Models -{ - public enum AuxiliaryDemandType - { - Direct, - Mapping, - Constant - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.Models +{ + public enum AuxiliaryDemandType + { + Direct, + Mapping, + Constant + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/AuxiliaryModel.cs b/VectoCommon/VectoCommon/Models/AuxiliaryModel.cs index 0c5b84981b6ce378bfa47de00e35ca513c4ecec0..1d6b4f007dc0582ff484cdd0faa4b05b2d10791e 100644 --- a/VectoCommon/VectoCommon/Models/AuxiliaryModel.cs +++ b/VectoCommon/VectoCommon/Models/AuxiliaryModel.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace TUGraz.VectoCommon.Models { public enum AuxiliaryModel diff --git a/VectoCommon/VectoCommon/Models/AuxiliaryType.cs b/VectoCommon/VectoCommon/Models/AuxiliaryType.cs index 79240f2b3d9a1e1767122819d79cb1ed07ac40db..bc141ed7286a265d6713c99c2d730aa0a8cd6da8 100644 --- a/VectoCommon/VectoCommon/Models/AuxiliaryType.cs +++ b/VectoCommon/VectoCommon/Models/AuxiliaryType.cs @@ -1,42 +1,42 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.Models -{ - public enum AuxiliaryType - { - Fan, - SteeringPump, - HVAC, - PneumaticSystem, - ElectricSystem - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.Models +{ + public enum AuxiliaryType + { + Fan, + SteeringPump, + HVAC, + PneumaticSystem, + ElectricSystem + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs index a759c05c79740a94050d151aab10a1567ad0d5f8..19d6524dce6fbccbf49c362d0c4b673609e97fe1 100644 --- a/VectoCommon/VectoCommon/Models/AxleConfiguration.cs +++ b/VectoCommon/VectoCommon/Models/AxleConfiguration.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Diagnostics.CodeAnalysis; using TUGraz.VectoCommon.Utils; diff --git a/VectoCommon/VectoCommon/Models/AxleLineType.cs b/VectoCommon/VectoCommon/Models/AxleLineType.cs index fabee912fd425fb7734f920ffddda109554d12fa..35c5d0f322e4e7063157d1ecaecdb2699557247b 100644 --- a/VectoCommon/VectoCommon/Models/AxleLineType.cs +++ b/VectoCommon/VectoCommon/Models/AxleLineType.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCommon.Models diff --git a/VectoCommon/VectoCommon/Models/CertificationMethod.cs b/VectoCommon/VectoCommon/Models/CertificationMethod.cs index 4ef47215e250cf04ade11465b5380ca47bccee4f..e999222417380a485dfca2e33cdd80fe06d0c68e 100644 --- a/VectoCommon/VectoCommon/Models/CertificationMethod.cs +++ b/VectoCommon/VectoCommon/Models/CertificationMethod.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCommon.Models diff --git a/VectoCommon/VectoCommon/Models/CrossWindCorrectionMode.cs b/VectoCommon/VectoCommon/Models/CrossWindCorrectionMode.cs index b49c8cd64fac520bf47554d0a51c04e333aa53a0..4a38441b57e0c0672747ed6bcae371dd5581e590 100644 --- a/VectoCommon/VectoCommon/Models/CrossWindCorrectionMode.cs +++ b/VectoCommon/VectoCommon/Models/CrossWindCorrectionMode.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCommon.Models diff --git a/VectoCommon/VectoCommon/Models/DriverMode.cs b/VectoCommon/VectoCommon/Models/DriverMode.cs index 9ee32c60adfe57526345acd322b993df7adcacbf..3ac569cc6e79e1f7262c814257a8f0da77ae4f84 100644 --- a/VectoCommon/VectoCommon/Models/DriverMode.cs +++ b/VectoCommon/VectoCommon/Models/DriverMode.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.Models -{ - public enum DriverMode - { - Off, - Overspeed, - EcoRoll, - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.Models +{ + public enum DriverMode + { + Off, + Overspeed, + EcoRoll, + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/ExecutionMode.cs b/VectoCommon/VectoCommon/Models/ExecutionMode.cs index 66202daf7cb947cf9f35d11e7a5eca0d93d669c8..641b41989f62ace66101556079732fe5371d9334 100644 --- a/VectoCommon/VectoCommon/Models/ExecutionMode.cs +++ b/VectoCommon/VectoCommon/Models/ExecutionMode.cs @@ -1,39 +1,39 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.Models -{ - public enum ExecutionMode - { - Engineering, - Declaration, - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.Models +{ + public enum ExecutionMode + { + Engineering, + Declaration, + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/FuelType.cs b/VectoCommon/VectoCommon/Models/FuelType.cs index ea1b85a4db38ddf1c1a17e9b01cfa7ff518f9ff0..489b50d6014eec6a04e802609f81ffafedd543d6 100644 --- a/VectoCommon/VectoCommon/Models/FuelType.cs +++ b/VectoCommon/VectoCommon/Models/FuelType.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCommon.Models diff --git a/VectoCommon/VectoCommon/Models/GearboxType.cs b/VectoCommon/VectoCommon/Models/GearboxType.cs index a6060586f142ac0343d0e33df48e8ee60ceed31e..8848ca9d2445f39af630008aef7b4a44391352c4 100644 --- a/VectoCommon/VectoCommon/Models/GearboxType.cs +++ b/VectoCommon/VectoCommon/Models/GearboxType.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/VectoCommon/VectoCommon/Models/IResponse.cs b/VectoCommon/VectoCommon/Models/IResponse.cs index 3af5cdf015d6f1dfce670cb54cdbcfe607b07912..400f385b661d5cb14499856fe908d61bcc703e0e 100644 --- a/VectoCommon/VectoCommon/Models/IResponse.cs +++ b/VectoCommon/VectoCommon/Models/IResponse.cs @@ -1,60 +1,60 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCommon.Models -{ - /// <summary> - /// The Interface for a Response. Carries over result data to higher components. - /// </summary> - public interface IResponse - { - Second AbsTime { get; set; } - Meter SimulationDistance { get; set; } - Second SimulationInterval { get; set; } - MeterPerSquareSecond Acceleration { get; set; } - PerSecond EngineSpeed { get; set; } - OperatingPoint OperatingPoint { get; set; } - object Source { get; set; } - - Watt EnginePowerRequest { get; set; } - Watt ClutchPowerRequest { get; set; } - Watt GearboxPowerRequest { get; set; } - Watt AxlegearPowerRequest { get; set; } - Watt WheelsPowerRequest { get; set; } - Watt VehiclePowerRequest { get; set; } - Watt BrakePower { get; set; } - Watt AngledrivePowerRequest { get; set; } - - Watt AuxiliariesPowerDemand { get; set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCommon.Models +{ + /// <summary> + /// The Interface for a Response. Carries over result data to higher components. + /// </summary> + public interface IResponse + { + Second AbsTime { get; set; } + Meter SimulationDistance { get; set; } + Second SimulationInterval { get; set; } + MeterPerSquareSecond Acceleration { get; set; } + PerSecond EngineSpeed { get; set; } + OperatingPoint OperatingPoint { get; set; } + object Source { get; set; } + + Watt EnginePowerRequest { get; set; } + Watt ClutchPowerRequest { get; set; } + Watt GearboxPowerRequest { get; set; } + Watt AxlegearPowerRequest { get; set; } + Watt WheelsPowerRequest { get; set; } + Watt VehiclePowerRequest { get; set; } + Watt BrakePower { get; set; } + Watt AngledrivePowerRequest { get; set; } + + Watt AuxiliariesPowerDemand { get; set; } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/LoggingObject.cs b/VectoCommon/VectoCommon/Models/LoggingObject.cs index 389518e2ab5e7cff3ed52ac5bf212475749526cb..878ef78d293de600f83bfb1bfa9c76711eac085a 100644 --- a/VectoCommon/VectoCommon/Models/LoggingObject.cs +++ b/VectoCommon/VectoCommon/Models/LoggingObject.cs @@ -1,197 +1,197 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Threading; -using NLog; - -namespace TUGraz.VectoCommon.Models -{ - public static class LogManager - { - public static LoggingObject GetLogger(string fullName) - { - return new LoggingObject(fullName); - } - - public static void Flush() - { - NLog.LogManager.Flush(); - } - - public static void DisableLogging() - { - LoggingObject.LogEnabled = false; - } - - public static void EnableLogging() - { - LoggingObject.LogEnabled = true; - } - } - - /// <summary> - /// Base Object for Logging - /// </summary> - public class LoggingObject - { - // ReSharper disable once InconsistentNaming - private static readonly ThreadLocal<bool> _logEnabled = new ThreadLocal<bool>(() => true); - - public static bool LogEnabled - { - get { return _logEnabled.Value; } - set { _logEnabled.Value = value; } - } - - private readonly Logger _log; - - public LoggingObject() - { - _log = NLog.LogManager.GetLogger(GetType().FullName); - } - - public LoggingObject(string fullName) - { - _log = NLog.LogManager.GetLogger(fullName); - } - - public static LoggingObject Logger<T>() - { - return new LoggingObject(typeof(T).ToString()); - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Debug(string message, params object[] args) - { - if (LogEnabled) { - _log.Debug(message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Debug(Exception e, string message = null, params object[] args) - { - if (LogEnabled) { - _log.Debug(e, message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Warn(string message, params object[] args) - { - if (LogEnabled) { - _log.Warn(message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Warn(Exception e, string message = null, params object[] args) - { - if (LogEnabled) { - _log.Warn(e, message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Error(string message, params object[] args) - { - if (LogEnabled) { - _log.Error(message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Error(Exception e, string message = null, params object[] args) - { - if (LogEnabled) { - _log.Error(e.Message, message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Fatal(string message, params object[] args) - { - if (LogEnabled) { - _log.Fatal(message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Fatal(Exception e, string message = null, params object[] args) - { - if (LogEnabled) { - _log.Fatal(message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Info(string message, params object[] args) - { - if (LogEnabled) { - _log.Info(message, args); - } - } - - /// <summary> - /// Fatal > Error > Warn > Info > Debug > Trace - /// </summary> - public void Info(Exception e, string message = null, params object[] args) - { - if (LogEnabled) { - _log.Info(e, message, args); - } - } - - protected LoggingObject Log - { - get { return this; } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Threading; +using NLog; + +namespace TUGraz.VectoCommon.Models +{ + public static class LogManager + { + public static LoggingObject GetLogger(string fullName) + { + return new LoggingObject(fullName); + } + + public static void Flush() + { + NLog.LogManager.Flush(); + } + + public static void DisableLogging() + { + LoggingObject.LogEnabled = false; + } + + public static void EnableLogging() + { + LoggingObject.LogEnabled = true; + } + } + + /// <summary> + /// Base Object for Logging + /// </summary> + public class LoggingObject + { + // ReSharper disable once InconsistentNaming + private static readonly ThreadLocal<bool> _logEnabled = new ThreadLocal<bool>(() => true); + + public static bool LogEnabled + { + get { return _logEnabled.Value; } + set { _logEnabled.Value = value; } + } + + private readonly Logger _log; + + public LoggingObject() + { + _log = NLog.LogManager.GetLogger(GetType().FullName); + } + + public LoggingObject(string fullName) + { + _log = NLog.LogManager.GetLogger(fullName); + } + + public static LoggingObject Logger<T>() + { + return new LoggingObject(typeof(T).ToString()); + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Debug(string message, params object[] args) + { + if (LogEnabled) { + _log.Debug(message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Debug(Exception e, string message = null, params object[] args) + { + if (LogEnabled) { + _log.Debug(e, message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Warn(string message, params object[] args) + { + if (LogEnabled) { + _log.Warn(message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Warn(Exception e, string message = null, params object[] args) + { + if (LogEnabled) { + _log.Warn(e, message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Error(string message, params object[] args) + { + if (LogEnabled) { + _log.Error(message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Error(Exception e, string message = null, params object[] args) + { + if (LogEnabled) { + _log.Error(e.Message, message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Fatal(string message, params object[] args) + { + if (LogEnabled) { + _log.Fatal(message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Fatal(Exception e, string message = null, params object[] args) + { + if (LogEnabled) { + _log.Fatal(message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Info(string message, params object[] args) + { + if (LogEnabled) { + _log.Info(message, args); + } + } + + /// <summary> + /// Fatal > Error > Warn > Info > Debug > Trace + /// </summary> + public void Info(Exception e, string message = null, params object[] args) + { + if (LogEnabled) { + _log.Info(e, message, args); + } + } + + protected LoggingObject Log + { + get { return this; } + } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/OperatingPoint.cs b/VectoCommon/VectoCommon/Models/OperatingPoint.cs index de0053e38f1f0097e0051b2d3ff7c1dd8c476d43..c5b154f942a2da0103f7c934dd234f9174b2c0e7 100644 --- a/VectoCommon/VectoCommon/Models/OperatingPoint.cs +++ b/VectoCommon/VectoCommon/Models/OperatingPoint.cs @@ -1,49 +1,49 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Diagnostics; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCommon.Models -{ - [DebuggerDisplay("a: {Acceleration}, dt: {SimulationInterval}, ds: {SimulationDistance}")] - public struct OperatingPoint - { - public MeterPerSquareSecond Acceleration; - public Meter SimulationDistance; - public Second SimulationInterval; - - public override string ToString() - { - return string.Format("a: {0}, dt: {1}, ds: {2}", Acceleration, SimulationInterval, SimulationDistance); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Diagnostics; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCommon.Models +{ + [DebuggerDisplay("a: {Acceleration}, dt: {SimulationInterval}, ds: {SimulationDistance}")] + public struct OperatingPoint + { + public MeterPerSquareSecond Acceleration; + public Meter SimulationDistance; + public Second SimulationInterval; + + public override string ToString() + { + return string.Format("a: {0}, dt: {1}, ds: {2}", Acceleration, SimulationInterval, SimulationDistance); + } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Models/RetarderType.cs b/VectoCommon/VectoCommon/Models/RetarderType.cs index e4cf57f7c3751a7030bf75bcda10325d5538f565..4fa16e3926e70946d150a42a97aa97cfab0392a4 100644 --- a/VectoCommon/VectoCommon/Models/RetarderType.cs +++ b/VectoCommon/VectoCommon/Models/RetarderType.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Utils; diff --git a/VectoCommon/VectoCommon/Models/VehicleCategory.cs b/VectoCommon/VectoCommon/Models/VehicleCategory.cs index dc08130576bac5f402c3d7768a49fb6b23d2b47e..af6baf04d0637013b03aae01d733db3a9bf0817f 100644 --- a/VectoCommon/VectoCommon/Models/VehicleCategory.cs +++ b/VectoCommon/VectoCommon/Models/VehicleCategory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCommon.Models diff --git a/VectoCommon/VectoCommon/OutputData/IOutputFileWriter.cs b/VectoCommon/VectoCommon/OutputData/IOutputFileWriter.cs index d1c98b742163d6c9f9d039dfe748cf6fc2fe41ee..12395cafa9481f5a98aade38416e9605b1a44514 100644 --- a/VectoCommon/VectoCommon/OutputData/IOutputFileWriter.cs +++ b/VectoCommon/VectoCommon/OutputData/IOutputFileWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.InputData; namespace TUGraz.VectoCommon.OutputData diff --git a/VectoCommon/VectoCommon/OutputData/IOutputPlugin.cs b/VectoCommon/VectoCommon/OutputData/IOutputPlugin.cs index 173d2dbc7d8ea6372360a399d08e65eb27fcc1c6..d7b93ee0b08628cea4ba621d8fe59cd782d9c18a 100644 --- a/VectoCommon/VectoCommon/OutputData/IOutputPlugin.cs +++ b/VectoCommon/VectoCommon/OutputData/IOutputPlugin.cs @@ -1,42 +1,42 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCommon.OutputData -{ - public interface IOutputPlugin - { - string Key { get; } - - string Name { get; } - - IOutputFileWriter Instance { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCommon.OutputData +{ + public interface IOutputPlugin + { + string Key { get; } + + string Name { get; } + + IOutputFileWriter Instance { get; } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Properties/AssemblyInfo.cs b/VectoCommon/VectoCommon/Properties/AssemblyInfo.cs index 9d0dc7b2be74f2dde46cba93fc9225c2aab1dd10..89587b5b27351eb9a6cdb29703ab1df30b037469 100644 --- a/VectoCommon/VectoCommon/Properties/AssemblyInfo.cs +++ b/VectoCommon/VectoCommon/Properties/AssemblyInfo.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; using System.Runtime.InteropServices; diff --git a/VectoCommon/VectoCommon/Properties/Version.cs b/VectoCommon/VectoCommon/Properties/Version.cs index 3d41901e5e4ad1d5df2a1e32967c4a9cd5e4970a..a1637b2f09e0ce0835c2e92889238421fe845421 100644 --- a/VectoCommon/VectoCommon/Properties/Version.cs +++ b/VectoCommon/VectoCommon/Properties/Version.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; [assembly: AssemblyVersion("3.1.2.903")] [assembly: AssemblyFileVersion("3.1.2.903")] diff --git a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs index 6ef299fc708db5ea9c0cde5256b5a32b4246a38d..5100e9bd642835cccc5417b893dfc0d57ea8ac2d 100644 --- a/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs +++ b/VectoCommon/VectoCommon/Resources/XMLNames.Designer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace TUGraz.VectoCommon.Resources { using System; diff --git a/VectoCommon/VectoCommon/Utils/DoubleExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/DoubleExtensionMethods.cs index b73e64854740a3a31821eb9426fb4af0341e0a54..1c8c8d126998c645b3eb7faffec7640b290050a7 100644 --- a/VectoCommon/VectoCommon/Utils/DoubleExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/DoubleExtensionMethods.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCommon/VectoCommon/Utils/EnumHelper.cs b/VectoCommon/VectoCommon/Utils/EnumHelper.cs index 6090b81e9b5ef6d5ecd844405e3dea9b5be5386c..c9d0c98a7e311f725e0b2c95e99e3271b25bdc7b 100644 --- a/VectoCommon/VectoCommon/Utils/EnumHelper.cs +++ b/VectoCommon/VectoCommon/Utils/EnumHelper.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs index e1f3fd2d4ccf8db596b45b0c5f4fd57eb5db8bf0..56b537ea639f9231b4a1453ce1f2b151ba3e370b 100644 --- a/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/EnumerableExtensionMethods.cs @@ -1,245 +1,245 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using TUGraz.VectoCommon.Models; - -namespace TUGraz.VectoCommon.Utils -{ - public static class EnumerableExtensionMethods - { - public static IEnumerable<double> ToDouble(this IEnumerable<string> self, double? defaultValue = null) - { - return self.Select(s => s.ToDouble(defaultValue)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool SequenceEqualFast<T>(this T[] self, T[] other) where T : IComparable - { - if (self.Equals(other)) { - return true; - } - - if (self.Length != other.Length) { - return false; - } - - // ReSharper disable once LoopCanBeConvertedToQuery - for (var i = 0; i < self.Length; i++) { - if (self[i].CompareTo(other[i]) != 0) { - return self.OrderBy(x => x).SequenceEqual(other.OrderBy(x => x)); - } - } - return true; - } - - public static IList<double> ToDouble(this IEnumerable<SI> self) - { - return self.Select(x => x.Value()).ToList(); - } - - /// <summary> - /// Wraps this object instance into an IEnumerable. - /// </summary> - public static IEnumerable<T> ToEnumerable<T>(this T item) - { - yield return item; - } - - /// <summary> - /// Zips all elements of two enumerable together. If the enumerables dont have the same length an exception is thrown. - /// </summary> - /// <exception cref="System.InvalidOperationException">Enumeration already finished. Thrown if the enumerables dont have the same length.</exception> - public static IEnumerable<TResult> ZipAll<TFirst, TSecond, TResult>(this IEnumerable<TFirst> firstEnumerable, - IEnumerable<TSecond> secondEnumerable, Func<TFirst, TSecond, TResult> resultSelector) - { - using (var first = firstEnumerable.GetEnumerator()) { - using (var second = secondEnumerable.GetEnumerator()) { - while (first.MoveNext() | second.MoveNext()) { - yield return resultSelector(first.Current, second.Current); - } - } - } - } - - /// <summary> - /// Sums up the values of selector. - /// </summary> - /// <returns></returns> - public static TResult Sum<TU, TResult>(this IEnumerable<TU> values, Func<TU, TResult> selector) - where TResult : SIBase<TResult> - { - return values.Select(selector).DefaultIfEmpty().Aggregate((sum, current) => sum + current); - } - - public static T Average<T>(this IEnumerable<T> values) where T : SIBase<T> - { - var valueList = values.ToList(); - return valueList.Any() ? valueList.Aggregate((sum, current) => sum + current) / valueList.Count : null; - } - - public static SI Sum(this IEnumerable<SI> values) - { - return values.DefaultIfEmpty().Aggregate((sum, current) => sum + current); - } - - /// <summary> - /// Get the first two items where the predicate changes from true to false. - /// If the predicate is always true, the last 2 elements are returned. - /// If the predicate is always false, the first 2 elements are returned. - /// </summary> - public static Tuple<T, T> GetSection<T>(this IEnumerable<T> self, Func<T, bool> skip, out int index, - string message = null) - { - var list = self.ToList(); - var skipList = list.Select((arg1, i) => new { skip = skip(arg1) && i < list.Count - 1, i, value = arg1 }); - var p = skipList.SkipWhile(x => x.skip).First(); - index = Math.Max(p.i - 1, 0); - - if (!string.IsNullOrWhiteSpace(message)) { - if (!skip(list[index]) || skip(list[index + 1])) { - LogManager.GetLogger(typeof(T).ToString()).Warn(message); - } - } - - return Tuple.Create(list[index], list[index + 1]); - } - - /// <summary> - /// Get the first two adjacent items where the predicate changes from true to false. - /// If the predicate is always false, the first 2 elements are returned. - /// If the predicate is always true, the last 2 elements are returned. - /// </summary> - public static Tuple<T, T> GetSection<T>(this T[] self, Func<T, bool> predicate) - { - var i = 0; - for (; i < self.Length; i++) { - if (!predicate(self[i])) - break; - } - if (i == 0) { - i = 1; - } else if (i == self.Length) { - i--; - } - return Tuple.Create(self[i - 1], self[i]); - } - - /// <summary> - /// Get the first two adjacent items where the predicate changes from true to false. - /// If the predicate never gets true, the last 2 elements are returned. - /// </summary> - /// <example>GetSection(data => data.X < searchedX); //returns the pair where first < searchedX and second >= searchedX</example>> - public static Tuple<T, T> GetSection<T>(this IEnumerable<T> self, Func<T, bool> predicate, string message = null) - { - int unused; - return self.GetSection(predicate, out unused, message); - } - - public static TSource MinBy<TSource>(this IEnumerable<TSource> source, - Func<TSource, IComparable> projectionToComparable) - { - using (var e = source.GetEnumerator()) { - if (!e.MoveNext()) { - throw new InvalidOperationException("Sequence is empty."); - } - var min = e.Current; - var minProjection = projectionToComparable(e.Current); - - while (e.MoveNext()) { - var currentProjection = projectionToComparable(e.Current); - if (currentProjection.CompareTo(minProjection) < 0) { - min = e.Current; - minProjection = currentProjection; - } - } - return min; - } - } - - public static TSource MaxBy<TSource>(this IEnumerable<TSource> source, - Func<TSource, IComparable> projectionToComparable) - { - using (var e = source.GetEnumerator()) { - if (!e.MoveNext()) { - throw new InvalidOperationException("Sequence is empty."); - } - var max = e.Current; - var maxProjection = projectionToComparable(e.Current); - - while (e.MoveNext()) { - var currentProjection = projectionToComparable(e.Current); - if (currentProjection.CompareTo(maxProjection) > 0) { - max = e.Current; - maxProjection = currentProjection; - } - } - return max; - } - } - - public static IEnumerable<TResult> Pairwise<TSource, TResult>(this IEnumerable<TSource> source, - Func<TSource, TSource, TResult> resultSelector) - { - var previous = default(TSource); - - using (var it = source.GetEnumerator()) { - if (it.MoveNext()) { - previous = it.Current; - } - - while (it.MoveNext()) { - yield return resultSelector(previous, previous = it.Current); - } - } - } - - public static IEnumerable<Tuple<TSource, TSource>> Pairwise<TSource>(this IEnumerable<TSource> source) - { - return Pairwise(source, Tuple.Create); - } - - /// <summary> - /// Repeats the element and returns an Enumerable. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="element"></param> - /// <param name="count"></param> - /// <returns></returns> - public static IEnumerable<T> Repeat<T>(this T element, int count) - { - return Enumerable.Repeat(element, count); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using TUGraz.VectoCommon.Models; + +namespace TUGraz.VectoCommon.Utils +{ + public static class EnumerableExtensionMethods + { + public static IEnumerable<double> ToDouble(this IEnumerable<string> self, double? defaultValue = null) + { + return self.Select(s => s.ToDouble(defaultValue)); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool SequenceEqualFast<T>(this T[] self, T[] other) where T : IComparable + { + if (self.Equals(other)) { + return true; + } + + if (self.Length != other.Length) { + return false; + } + + // ReSharper disable once LoopCanBeConvertedToQuery + for (var i = 0; i < self.Length; i++) { + if (self[i].CompareTo(other[i]) != 0) { + return self.OrderBy(x => x).SequenceEqual(other.OrderBy(x => x)); + } + } + return true; + } + + public static IList<double> ToDouble(this IEnumerable<SI> self) + { + return self.Select(x => x.Value()).ToList(); + } + + /// <summary> + /// Wraps this object instance into an IEnumerable. + /// </summary> + public static IEnumerable<T> ToEnumerable<T>(this T item) + { + yield return item; + } + + /// <summary> + /// Zips all elements of two enumerable together. If the enumerables dont have the same length an exception is thrown. + /// </summary> + /// <exception cref="System.InvalidOperationException">Enumeration already finished. Thrown if the enumerables dont have the same length.</exception> + public static IEnumerable<TResult> ZipAll<TFirst, TSecond, TResult>(this IEnumerable<TFirst> firstEnumerable, + IEnumerable<TSecond> secondEnumerable, Func<TFirst, TSecond, TResult> resultSelector) + { + using (var first = firstEnumerable.GetEnumerator()) { + using (var second = secondEnumerable.GetEnumerator()) { + while (first.MoveNext() | second.MoveNext()) { + yield return resultSelector(first.Current, second.Current); + } + } + } + } + + /// <summary> + /// Sums up the values of selector. + /// </summary> + /// <returns></returns> + public static TResult Sum<TU, TResult>(this IEnumerable<TU> values, Func<TU, TResult> selector) + where TResult : SIBase<TResult> + { + return values.Select(selector).DefaultIfEmpty().Aggregate((sum, current) => sum + current); + } + + public static T Average<T>(this IEnumerable<T> values) where T : SIBase<T> + { + var valueList = values.ToList(); + return valueList.Any() ? valueList.Aggregate((sum, current) => sum + current) / valueList.Count : null; + } + + public static SI Sum(this IEnumerable<SI> values) + { + return values.DefaultIfEmpty().Aggregate((sum, current) => sum + current); + } + + /// <summary> + /// Get the first two items where the predicate changes from true to false. + /// If the predicate is always true, the last 2 elements are returned. + /// If the predicate is always false, the first 2 elements are returned. + /// </summary> + public static Tuple<T, T> GetSection<T>(this IEnumerable<T> self, Func<T, bool> skip, out int index, + string message = null) + { + var list = self.ToList(); + var skipList = list.Select((arg1, i) => new { skip = skip(arg1) && i < list.Count - 1, i, value = arg1 }); + var p = skipList.SkipWhile(x => x.skip).First(); + index = Math.Max(p.i - 1, 0); + + if (!string.IsNullOrWhiteSpace(message)) { + if (!skip(list[index]) || skip(list[index + 1])) { + LogManager.GetLogger(typeof(T).ToString()).Warn(message); + } + } + + return Tuple.Create(list[index], list[index + 1]); + } + + /// <summary> + /// Get the first two adjacent items where the predicate changes from true to false. + /// If the predicate is always false, the first 2 elements are returned. + /// If the predicate is always true, the last 2 elements are returned. + /// </summary> + public static Tuple<T, T> GetSection<T>(this T[] self, Func<T, bool> predicate) + { + var i = 0; + for (; i < self.Length; i++) { + if (!predicate(self[i])) + break; + } + if (i == 0) { + i = 1; + } else if (i == self.Length) { + i--; + } + return Tuple.Create(self[i - 1], self[i]); + } + + /// <summary> + /// Get the first two adjacent items where the predicate changes from true to false. + /// If the predicate never gets true, the last 2 elements are returned. + /// </summary> + /// <example>GetSection(data => data.X < searchedX); //returns the pair where first < searchedX and second >= searchedX</example>> + public static Tuple<T, T> GetSection<T>(this IEnumerable<T> self, Func<T, bool> predicate, string message = null) + { + int unused; + return self.GetSection(predicate, out unused, message); + } + + public static TSource MinBy<TSource>(this IEnumerable<TSource> source, + Func<TSource, IComparable> projectionToComparable) + { + using (var e = source.GetEnumerator()) { + if (!e.MoveNext()) { + throw new InvalidOperationException("Sequence is empty."); + } + var min = e.Current; + var minProjection = projectionToComparable(e.Current); + + while (e.MoveNext()) { + var currentProjection = projectionToComparable(e.Current); + if (currentProjection.CompareTo(minProjection) < 0) { + min = e.Current; + minProjection = currentProjection; + } + } + return min; + } + } + + public static TSource MaxBy<TSource>(this IEnumerable<TSource> source, + Func<TSource, IComparable> projectionToComparable) + { + using (var e = source.GetEnumerator()) { + if (!e.MoveNext()) { + throw new InvalidOperationException("Sequence is empty."); + } + var max = e.Current; + var maxProjection = projectionToComparable(e.Current); + + while (e.MoveNext()) { + var currentProjection = projectionToComparable(e.Current); + if (currentProjection.CompareTo(maxProjection) > 0) { + max = e.Current; + maxProjection = currentProjection; + } + } + return max; + } + } + + public static IEnumerable<TResult> Pairwise<TSource, TResult>(this IEnumerable<TSource> source, + Func<TSource, TSource, TResult> resultSelector) + { + var previous = default(TSource); + + using (var it = source.GetEnumerator()) { + if (it.MoveNext()) { + previous = it.Current; + } + + while (it.MoveNext()) { + yield return resultSelector(previous, previous = it.Current); + } + } + } + + public static IEnumerable<Tuple<TSource, TSource>> Pairwise<TSource>(this IEnumerable<TSource> source) + { + return Pairwise(source, Tuple.Create); + } + + /// <summary> + /// Repeats the element and returns an Enumerable. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="element"></param> + /// <param name="count"></param> + /// <returns></returns> + public static IEnumerable<T> Repeat<T>(this T element, int count) + { + return Enumerable.Repeat(element, count); + } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Utils/IntExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/IntExtensionMethods.cs index fed4bab3c5961165da412df111c4cbaca529784f..7da0f1763a85cc0122cbd738d4eef9791cca4858 100644 --- a/VectoCommon/VectoCommon/Utils/IntExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/IntExtensionMethods.cs @@ -1,75 +1,75 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Diagnostics; - -namespace TUGraz.VectoCommon.Utils -{ - public static class IntExtensionMethods - { - /// <summary> - /// Gets the unit-less SI representation of the number. - /// </summary> - [DebuggerHidden] - public static SI SI(this int value) - { - return new SI(value); - } - - /// <summary> - /// Gets the special SI class of the number. - /// </summary> - /// <param name="d"></param> - /// <returns></returns> - [DebuggerHidden] - public static T SI<T>(this int d) where T : SIBase<T> - { - return SIBase<T>.Create(d); - } - - public static double ToRadian(this int self) - { - return self * Math.PI / 180.0; - } - - /// <summary> - /// Modulo functions which also works on negative Numbers (not like the built-in %-operator which just returns the remainder). - /// </summary> - /// <param name="a"></param> - /// <param name="b"></param> - /// <returns></returns> - public static int Mod(this int a, int b) - { - return (a %= b) < 0 ? a + b : a; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Diagnostics; + +namespace TUGraz.VectoCommon.Utils +{ + public static class IntExtensionMethods + { + /// <summary> + /// Gets the unit-less SI representation of the number. + /// </summary> + [DebuggerHidden] + public static SI SI(this int value) + { + return new SI(value); + } + + /// <summary> + /// Gets the special SI class of the number. + /// </summary> + /// <param name="d"></param> + /// <returns></returns> + [DebuggerHidden] + public static T SI<T>(this int d) where T : SIBase<T> + { + return SIBase<T>.Create(d); + } + + public static double ToRadian(this int self) + { + return self * Math.PI / 180.0; + } + + /// <summary> + /// Modulo functions which also works on negative Numbers (not like the built-in %-operator which just returns the remainder). + /// </summary> + /// <param name="a"></param> + /// <param name="b"></param> + /// <returns></returns> + public static int Mod(this int a, int b) + { + return (a %= b) < 0 ? a + b : a; + } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Utils/SI.cs b/VectoCommon/VectoCommon/Utils/SI.cs index 46b789c03be20eb6b114f1179cfa5534f33daa70..f91353f5c34069d23362aea6a0e4a75cc8fa5cbf 100644 --- a/VectoCommon/VectoCommon/Utils/SI.cs +++ b/VectoCommon/VectoCommon/Utils/SI.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs index 9f05eb3a8320cf5ae6f4a35e5e2550425ab068c0..d7d395b663569f77135561fd1daa4b985f5eea18 100644 --- a/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs @@ -1,97 +1,97 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Text; - -namespace TUGraz.VectoCommon.Utils -{ - public static class StringExtensionMethods - { - public static double ToDouble(this string self, double? defaultValue = null) - { - if (string.IsNullOrWhiteSpace(self)) { - if (defaultValue.HasValue) { - return defaultValue.Value; - } - throw new FormatException("Cannot convert an empty string to a number."); - } - - try { - return double.Parse(self, CultureInfo.InvariantCulture); - } catch (FormatException) { - if (defaultValue.HasValue) { - return defaultValue.Value; - } - throw; - } - } - - public static int ToInt(this string self, int? defaultValue = null) - { - try { - return int.Parse(self, CultureInfo.InvariantCulture); - } catch (FormatException) { - if (defaultValue.HasValue) { - return defaultValue.Value; - } - throw; - } - } - - public static bool ToBoolean(this string self) - { - if (string.IsNullOrEmpty(self)) { - return false; - } - return int.Parse(self) != 0; - } - - public static double IndulgentParse(this string self) - { - return double.Parse(new string(self.Trim().TakeWhile(c => char.IsDigit(c) || c == '.').ToArray()), - CultureInfo.InvariantCulture); - } - - public static Stream ToStream(this string self) - { - return new MemoryStream(Encoding.UTF8.GetBytes(self)); - } - - public static string RemoveWhitespace(this string self) - { - return string.Concat(self.Split()); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; + +namespace TUGraz.VectoCommon.Utils +{ + public static class StringExtensionMethods + { + public static double ToDouble(this string self, double? defaultValue = null) + { + if (string.IsNullOrWhiteSpace(self)) { + if (defaultValue.HasValue) { + return defaultValue.Value; + } + throw new FormatException("Cannot convert an empty string to a number."); + } + + try { + return double.Parse(self, CultureInfo.InvariantCulture); + } catch (FormatException) { + if (defaultValue.HasValue) { + return defaultValue.Value; + } + throw; + } + } + + public static int ToInt(this string self, int? defaultValue = null) + { + try { + return int.Parse(self, CultureInfo.InvariantCulture); + } catch (FormatException) { + if (defaultValue.HasValue) { + return defaultValue.Value; + } + throw; + } + } + + public static bool ToBoolean(this string self) + { + if (string.IsNullOrEmpty(self)) { + return false; + } + return int.Parse(self) != 0; + } + + public static double IndulgentParse(this string self) + { + return double.Parse(new string(self.Trim().TakeWhile(c => char.IsDigit(c) || c == '.').ToArray()), + CultureInfo.InvariantCulture); + } + + public static Stream ToStream(this string self) + { + return new MemoryStream(Encoding.UTF8.GetBytes(self)); + } + + public static string RemoveWhitespace(this string self) + { + return string.Concat(self.Split()); + } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Utils/Validation.cs b/VectoCommon/VectoCommon/Utils/Validation.cs index fc857a7c87d22eed93b925f446f4f51f7d035401..c927e9356815b7f7c669a7469b7038d2385f289e 100644 --- a/VectoCommon/VectoCommon/Utils/Validation.cs +++ b/VectoCommon/VectoCommon/Utils/Validation.cs @@ -1,447 +1,447 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.IO; -using System.Linq; -using System.Reflection; -using TUGraz.VectoCommon.Models; - -namespace TUGraz.VectoCommon.Utils -{ - /// <summary> - /// Helper Class for doing the Validation - /// </summary> - public static class ValidationHelper - { - /// <summary> - /// Validates the specified entity and all its properties recursively. (Extension Method) - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="entity">The entity.</param> - /// <param name="mode">validate the entity for the given execution mode</param> - /// <param name="gbxType"></param> - /// <param name="emsCycle"></param> - /// <returns>Null, if the validation was successfull. Otherwise a list of ValidationResults with the ErrorMessages.</returns> - public static IList<ValidationResult> Validate<T>(this T entity, ExecutionMode mode, GearboxType? gbxType, - bool emsCycle) - { - if (entity == null) { - return new[] { new ValidationResult(string.Format("null value given for {0}", typeof(T))) }; - } - var context = new ValidationContext(entity); - context.ServiceContainer.AddService(typeof(VectoValidationModeServiceContainer), - new VectoValidationModeServiceContainer(mode, gbxType, emsCycle)); - - var results = new List<ValidationResult>(); - Validator.TryValidateObject(entity, context, results, true); - - const BindingFlags flags = - BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | - BindingFlags.FlattenHierarchy; - - var properties = entity.GetType().GetProperties(flags); - foreach (var p in properties) { - var attributes = p.GetAttributes<ValidationAttribute>(entity.GetType()).ToArray(); - if (attributes.Any()) { - var val = p.GetValue(entity); - context.DisplayName = p.Name; - context.MemberName = p.Name; - Validator.TryValidateValue(val, context, results, attributes); - } - } - - var fields = entity.GetType().GetFields(flags); - foreach (var f in fields) { - var attributes = f.GetAttributes<ValidationAttribute>(entity.GetType()).ToArray(); - if (attributes.Any()) { - var val = f.GetValue(entity); - context.DisplayName = f.Name; - context.MemberName = f.Name; - Validator.TryValidateValue(val, context, results, attributes); - } - } - - return results; - } - - /// <summary> - /// Gets the attributes of a member for the current class, parent classes and all interfaces. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="m"></param> - /// <param name="obj"></param> - /// <returns></returns> - private static IEnumerable<T> GetAttributes<T>(this MemberInfo m, Type obj) where T : Attribute - { - var attributes = Enumerable.Empty<T>(); - - const BindingFlags flags = - BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | - BindingFlags.FlattenHierarchy; - var prop = obj.GetProperty(m.Name, flags); - if (prop != null) { - attributes = prop.GetCustomAttributes(typeof(T)) - .Cast<T>() - .Concat(obj.GetInterfaces().SelectMany(m.GetAttributes<T>)); - } - - var field = obj.GetField(m.Name, flags); - if (field != null) { - attributes = - attributes.Concat( - field.GetCustomAttributes(typeof(T)).Cast<T>().Concat(obj.GetInterfaces().SelectMany(m.GetAttributes<T>))); - } - - return attributes; - } - - /// <summary> - /// Determines whether this instance is valid. (Extension Method) - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="entity">The entity.</param> - /// <returns></returns> - public static bool IsValid<T>(this T entity) - { - return Validator.TryValidateObject(entity, new ValidationContext(entity), null, true); - } - } - - public class VectoValidationModeServiceContainer - { - public ExecutionMode Mode { get; protected set; } - public GearboxType? GearboxType { get; protected set; } - public bool IsEMSCycle { get; protected set; } - - public VectoValidationModeServiceContainer(ExecutionMode mode, GearboxType? gbxType, bool isEMSCycle = false) - { - Mode = mode; - GearboxType = gbxType; - IsEMSCycle = isEMSCycle; - } - } - - - /// <summary> - /// Determines that the attributed object should be validated recursively. - /// </summary> - public class ValidateObjectAttribute : ValidationAttribute - { - /// <summary> - /// Validates an object recursively (all elements if its a list, or all fields and properties if its an object). - /// </summary> - /// <param name="value">The value to validate.</param> - /// <param name="validationContext">The context information about the validation operation.</param> - /// <returns> - /// ValidationResult.Success if the validation was successfull. Otherwise the joined ErrorMessages are returned. - /// </returns> - protected override ValidationResult IsValid(object value, ValidationContext validationContext) - { - if (value == null) { - return ValidationResult.Success; - } - - var validationService = - validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - var mode = validationService != null ? validationService.Mode : ExecutionMode.Declaration; - var gbxType = validationService != null ? validationService.GearboxType : GearboxType.MT; - var isEmsCycle = validationService != null && validationService.IsEMSCycle; - - var enumerable = value as IEnumerable; - if (enumerable != null) { - var i = 0; - foreach (var element in enumerable) { - if (element != null) { - var valueType = element.GetType(); - if (valueType.IsGenericType) { - var baseType = valueType.GetGenericTypeDefinition(); - if (baseType == typeof(KeyValuePair<,>)) { - var kvResults = new List<ValidationResult>(); - kvResults.AddRange(valueType.GetProperty("Key").GetValue(element).Validate(mode, gbxType, isEmsCycle)); - kvResults.AddRange(valueType.GetProperty("Value").GetValue(element).Validate(mode, gbxType, isEmsCycle)); - if (kvResults.Any()) { - return new ValidationResult( - string.Format("{1}[{0}] in {1} invalid: {2}", valueType.GetProperty("Key").GetValue(element), - validationContext.DisplayName, - string.Join("\n", kvResults))); - } - } - } - - var results = element.Validate(mode, gbxType, isEmsCycle); - if (results.Any()) { - return new ValidationResult( - string.Format("{1}[{0}] in {1} invalid: {2}", i, validationContext.DisplayName, - string.Join("\n", results))); - } - } - i++; - } - } else { - var results = value.Validate(mode, gbxType, isEmsCycle); - if (!results.Any()) { - return ValidationResult.Success; - } - var messages = results.Select(r => String.Join(", ", r.MemberNames.Distinct())); - if (validationContext.MemberName == "Container" || validationContext.MemberName == "RunData") { - return new ValidationResult(string.Join("\n", results), messages); - } - return new ValidationResult( - string.Format("{{{0}}} invalid: {1}", validationContext.DisplayName, string.Join("\n", results)), messages); - } - - return ValidationResult.Success; - } - } - - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)] - public class RangeOrNaN : RangeAttribute - { - public override bool IsValid(object value) - { - return double.IsNaN((double)value) || base.IsValid(value); - } - - public RangeOrNaN(double minimum, double maximum) : base(minimum, maximum) {} - } - - /// <summary> - /// Attribute which validates the Min-Max Range of an SI Object. - /// </summary> - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)] - public class SIRangeAttribute : RangeAttribute - { - private ExecutionMode? _mode; - private bool? _emsMission; - private string _unit = "-"; - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> - public SIRangeAttribute(int minimum, int maximum, ExecutionMode mode) - : base(minimum, maximum) - { - _mode = mode; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - public SIRangeAttribute(int minimum, int maximum) - : base(minimum, maximum) {} - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> - public SIRangeAttribute(double minimum, double maximum, ExecutionMode mode) - : base(minimum, maximum) - { - _mode = mode; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - public SIRangeAttribute(double minimum, double maximum) - : base(minimum, maximum) {} - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> - public SIRangeAttribute(SI minimum, SI maximum, ExecutionMode mode) - : base(minimum.Value(), maximum.Value()) - { - _mode = mode; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - public SIRangeAttribute(SI minimum, SI maximum) - : base(minimum.Value(), maximum.Value()) {} - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> - /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> - public SIRangeAttribute(int minimum, int maximum, ExecutionMode mode, bool emsMission) - : base(minimum, maximum) - { - _mode = mode; - _emsMission = emsMission; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> - public SIRangeAttribute(int minimum, int maximum, bool emsMission) : base(minimum, maximum) - { - _emsMission = emsMission; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> - /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> - public SIRangeAttribute(double minimum, double maximum, ExecutionMode mode, bool emsMission) - : base(minimum, maximum) - { - _mode = mode; - _emsMission = emsMission; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> - public SIRangeAttribute(double minimum, double maximum, bool emsMission) : base(minimum, maximum) - { - _emsMission = emsMission; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> - /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> - public SIRangeAttribute(SI minimum, SI maximum, ExecutionMode mode, bool emsMission) - : base(minimum.Value(), maximum.Value()) - { - _mode = mode; - _emsMission = emsMission; - } - - /// <summary> - /// Checks the Min-Max Range of SI Objects. - /// </summary> - /// <param name="minimum">The minimum.</param> - /// <param name="maximum">The maximum.</param> - /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> - public SIRangeAttribute(SI minimum, SI maximum, bool emsMission) : base(minimum.Value(), maximum.Value()) - { - _emsMission = emsMission; - } - - /// <summary> - /// Validates that an SI Object is inside the min-max range. - /// </summary> - /// <param name="value">The value to validate.</param> - /// <param name="validationContext">The context information about the validation operation.</param> - /// <returns> - /// ValidationResult.Success if the validation was successfull, otherwise an Instance of ValidationResult with the ErrorMessage. - /// </returns> - protected override ValidationResult IsValid(object value, ValidationContext validationContext) - { - var si = value as SI; - - if (si != null) { - _unit = si.GetUnitString(); - } - var validationService = - validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; - var mode = validationService != null ? validationService.Mode : (ExecutionMode?)null; - var emsMode = validationService != null && validationService.IsEMSCycle; - - if (!_emsMission.HasValue || _emsMission.Value == emsMode) { - if (mode == null) { - return base.IsValid(si != null ? si.Value() : value, validationContext); - } - if (_mode == null || (_mode != null && (_mode.Value == mode))) { - return base.IsValid(si != null ? si.Value() : value, validationContext); - } - return ValidationResult.Success; - } - return ValidationResult.Success; - } - - public override string FormatErrorMessage(string name) - { - const string unitString = "{0} [{1}]"; - - return string.Format(ErrorMessageString, name, string.Format(unitString, Minimum, _unit), - string.Format(unitString, Maximum, _unit)); - } - } - - /// <summary> - /// Attribute which validates a Path. - /// </summary> - public class PathAttribute : ValidationAttribute - { - /// <summary> - /// Validates that a path actually exists. - /// </summary> - /// <param name="value">The value to validate.</param> - /// <param name="validationContext">The context information about the validation operation.</param> - /// <returns> - /// ValidationResult.Success if the validation was successfull, otherwise an Instance of ValidationResult with the ErrorMessage. - /// </returns> - protected override ValidationResult IsValid(object value, ValidationContext validationContext) - { - if (!File.Exists((string)value)) { - return new ValidationResult("File not found: " + (string)value); - } - return ValidationResult.Success; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.IO; +using System.Linq; +using System.Reflection; +using TUGraz.VectoCommon.Models; + +namespace TUGraz.VectoCommon.Utils +{ + /// <summary> + /// Helper Class for doing the Validation + /// </summary> + public static class ValidationHelper + { + /// <summary> + /// Validates the specified entity and all its properties recursively. (Extension Method) + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="entity">The entity.</param> + /// <param name="mode">validate the entity for the given execution mode</param> + /// <param name="gbxType"></param> + /// <param name="emsCycle"></param> + /// <returns>Null, if the validation was successfull. Otherwise a list of ValidationResults with the ErrorMessages.</returns> + public static IList<ValidationResult> Validate<T>(this T entity, ExecutionMode mode, GearboxType? gbxType, + bool emsCycle) + { + if (entity == null) { + return new[] { new ValidationResult(string.Format("null value given for {0}", typeof(T))) }; + } + var context = new ValidationContext(entity); + context.ServiceContainer.AddService(typeof(VectoValidationModeServiceContainer), + new VectoValidationModeServiceContainer(mode, gbxType, emsCycle)); + + var results = new List<ValidationResult>(); + Validator.TryValidateObject(entity, context, results, true); + + const BindingFlags flags = + BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | + BindingFlags.FlattenHierarchy; + + var properties = entity.GetType().GetProperties(flags); + foreach (var p in properties) { + var attributes = p.GetAttributes<ValidationAttribute>(entity.GetType()).ToArray(); + if (attributes.Any()) { + var val = p.GetValue(entity); + context.DisplayName = p.Name; + context.MemberName = p.Name; + Validator.TryValidateValue(val, context, results, attributes); + } + } + + var fields = entity.GetType().GetFields(flags); + foreach (var f in fields) { + var attributes = f.GetAttributes<ValidationAttribute>(entity.GetType()).ToArray(); + if (attributes.Any()) { + var val = f.GetValue(entity); + context.DisplayName = f.Name; + context.MemberName = f.Name; + Validator.TryValidateValue(val, context, results, attributes); + } + } + + return results; + } + + /// <summary> + /// Gets the attributes of a member for the current class, parent classes and all interfaces. + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="m"></param> + /// <param name="obj"></param> + /// <returns></returns> + private static IEnumerable<T> GetAttributes<T>(this MemberInfo m, Type obj) where T : Attribute + { + var attributes = Enumerable.Empty<T>(); + + const BindingFlags flags = + BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | + BindingFlags.FlattenHierarchy; + var prop = obj.GetProperty(m.Name, flags); + if (prop != null) { + attributes = prop.GetCustomAttributes(typeof(T)) + .Cast<T>() + .Concat(obj.GetInterfaces().SelectMany(m.GetAttributes<T>)); + } + + var field = obj.GetField(m.Name, flags); + if (field != null) { + attributes = + attributes.Concat( + field.GetCustomAttributes(typeof(T)).Cast<T>().Concat(obj.GetInterfaces().SelectMany(m.GetAttributes<T>))); + } + + return attributes; + } + + /// <summary> + /// Determines whether this instance is valid. (Extension Method) + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="entity">The entity.</param> + /// <returns></returns> + public static bool IsValid<T>(this T entity) + { + return Validator.TryValidateObject(entity, new ValidationContext(entity), null, true); + } + } + + public class VectoValidationModeServiceContainer + { + public ExecutionMode Mode { get; protected set; } + public GearboxType? GearboxType { get; protected set; } + public bool IsEMSCycle { get; protected set; } + + public VectoValidationModeServiceContainer(ExecutionMode mode, GearboxType? gbxType, bool isEMSCycle = false) + { + Mode = mode; + GearboxType = gbxType; + IsEMSCycle = isEMSCycle; + } + } + + + /// <summary> + /// Determines that the attributed object should be validated recursively. + /// </summary> + public class ValidateObjectAttribute : ValidationAttribute + { + /// <summary> + /// Validates an object recursively (all elements if its a list, or all fields and properties if its an object). + /// </summary> + /// <param name="value">The value to validate.</param> + /// <param name="validationContext">The context information about the validation operation.</param> + /// <returns> + /// ValidationResult.Success if the validation was successfull. Otherwise the joined ErrorMessages are returned. + /// </returns> + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + if (value == null) { + return ValidationResult.Success; + } + + var validationService = + validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; + var mode = validationService != null ? validationService.Mode : ExecutionMode.Declaration; + var gbxType = validationService != null ? validationService.GearboxType : GearboxType.MT; + var isEmsCycle = validationService != null && validationService.IsEMSCycle; + + var enumerable = value as IEnumerable; + if (enumerable != null) { + var i = 0; + foreach (var element in enumerable) { + if (element != null) { + var valueType = element.GetType(); + if (valueType.IsGenericType) { + var baseType = valueType.GetGenericTypeDefinition(); + if (baseType == typeof(KeyValuePair<,>)) { + var kvResults = new List<ValidationResult>(); + kvResults.AddRange(valueType.GetProperty("Key").GetValue(element).Validate(mode, gbxType, isEmsCycle)); + kvResults.AddRange(valueType.GetProperty("Value").GetValue(element).Validate(mode, gbxType, isEmsCycle)); + if (kvResults.Any()) { + return new ValidationResult( + string.Format("{1}[{0}] in {1} invalid: {2}", valueType.GetProperty("Key").GetValue(element), + validationContext.DisplayName, + string.Join("\n", kvResults))); + } + } + } + + var results = element.Validate(mode, gbxType, isEmsCycle); + if (results.Any()) { + return new ValidationResult( + string.Format("{1}[{0}] in {1} invalid: {2}", i, validationContext.DisplayName, + string.Join("\n", results))); + } + } + i++; + } + } else { + var results = value.Validate(mode, gbxType, isEmsCycle); + if (!results.Any()) { + return ValidationResult.Success; + } + var messages = results.Select(r => String.Join(", ", r.MemberNames.Distinct())); + if (validationContext.MemberName == "Container" || validationContext.MemberName == "RunData") { + return new ValidationResult(string.Join("\n", results), messages); + } + return new ValidationResult( + string.Format("{{{0}}} invalid: {1}", validationContext.DisplayName, string.Join("\n", results)), messages); + } + + return ValidationResult.Success; + } + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)] + public class RangeOrNaN : RangeAttribute + { + public override bool IsValid(object value) + { + return double.IsNaN((double)value) || base.IsValid(value); + } + + public RangeOrNaN(double minimum, double maximum) : base(minimum, maximum) {} + } + + /// <summary> + /// Attribute which validates the Min-Max Range of an SI Object. + /// </summary> + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)] + public class SIRangeAttribute : RangeAttribute + { + private ExecutionMode? _mode; + private bool? _emsMission; + private string _unit = "-"; + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> + public SIRangeAttribute(int minimum, int maximum, ExecutionMode mode) + : base(minimum, maximum) + { + _mode = mode; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + public SIRangeAttribute(int minimum, int maximum) + : base(minimum, maximum) {} + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> + public SIRangeAttribute(double minimum, double maximum, ExecutionMode mode) + : base(minimum, maximum) + { + _mode = mode; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + public SIRangeAttribute(double minimum, double maximum) + : base(minimum, maximum) {} + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> + public SIRangeAttribute(SI minimum, SI maximum, ExecutionMode mode) + : base(minimum.Value(), maximum.Value()) + { + _mode = mode; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + public SIRangeAttribute(SI minimum, SI maximum) + : base(minimum.Value(), maximum.Value()) {} + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> + /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> + public SIRangeAttribute(int minimum, int maximum, ExecutionMode mode, bool emsMission) + : base(minimum, maximum) + { + _mode = mode; + _emsMission = emsMission; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> + public SIRangeAttribute(int minimum, int maximum, bool emsMission) : base(minimum, maximum) + { + _emsMission = emsMission; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> + /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> + public SIRangeAttribute(double minimum, double maximum, ExecutionMode mode, bool emsMission) + : base(minimum, maximum) + { + _mode = mode; + _emsMission = emsMission; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> + public SIRangeAttribute(double minimum, double maximum, bool emsMission) : base(minimum, maximum) + { + _emsMission = emsMission; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="mode">if specified the validation is only performed in the corresponding mode</param> + /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> + public SIRangeAttribute(SI minimum, SI maximum, ExecutionMode mode, bool emsMission) + : base(minimum.Value(), maximum.Value()) + { + _mode = mode; + _emsMission = emsMission; + } + + /// <summary> + /// Checks the Min-Max Range of SI Objects. + /// </summary> + /// <param name="minimum">The minimum.</param> + /// <param name="maximum">The maximum.</param> + /// <param name="emsMission">Validation only applies if the mission is an EMS mission</param> + public SIRangeAttribute(SI minimum, SI maximum, bool emsMission) : base(minimum.Value(), maximum.Value()) + { + _emsMission = emsMission; + } + + /// <summary> + /// Validates that an SI Object is inside the min-max range. + /// </summary> + /// <param name="value">The value to validate.</param> + /// <param name="validationContext">The context information about the validation operation.</param> + /// <returns> + /// ValidationResult.Success if the validation was successfull, otherwise an Instance of ValidationResult with the ErrorMessage. + /// </returns> + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + var si = value as SI; + + if (si != null) { + _unit = si.GetUnitString(); + } + var validationService = + validationContext.GetService(typeof(VectoValidationModeServiceContainer)) as VectoValidationModeServiceContainer; + var mode = validationService != null ? validationService.Mode : (ExecutionMode?)null; + var emsMode = validationService != null && validationService.IsEMSCycle; + + if (!_emsMission.HasValue || _emsMission.Value == emsMode) { + if (mode == null) { + return base.IsValid(si != null ? si.Value() : value, validationContext); + } + if (_mode == null || (_mode != null && (_mode.Value == mode))) { + return base.IsValid(si != null ? si.Value() : value, validationContext); + } + return ValidationResult.Success; + } + return ValidationResult.Success; + } + + public override string FormatErrorMessage(string name) + { + const string unitString = "{0} [{1}]"; + + return string.Format(ErrorMessageString, name, string.Format(unitString, Minimum, _unit), + string.Format(unitString, Maximum, _unit)); + } + } + + /// <summary> + /// Attribute which validates a Path. + /// </summary> + public class PathAttribute : ValidationAttribute + { + /// <summary> + /// Validates that a path actually exists. + /// </summary> + /// <param name="value">The value to validate.</param> + /// <param name="validationContext">The context information about the validation operation.</param> + /// <returns> + /// ValidationResult.Success if the validation was successfull, otherwise an Instance of ValidationResult with the ErrorMessage. + /// </returns> + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + if (!File.Exists((string)value)) { + return new ValidationResult("File not found: " + (string)value); + } + return ValidationResult.Success; + } + } } \ No newline at end of file diff --git a/VectoCommon/VectoCommon/Utils/VectoMath.cs b/VectoCommon/VectoCommon/Utils/VectoMath.cs index 6d0684f7d7da9bd695cf4426331223d4f70fc6ee..4a63f351383d5cdeac2a5e9d7a7351f13084cc51 100644 --- a/VectoCommon/VectoCommon/Utils/VectoMath.cs +++ b/VectoCommon/VectoCommon/Utils/VectoMath.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCommon/VectoHashing/IVectoHash.cs b/VectoCommon/VectoHashing/IVectoHash.cs index b7ad1b42c20ac29e46525ceb168c6b9e224d5c79..4a476e39b49070ca1f46ec609b68ffa8d98418fe 100644 --- a/VectoCommon/VectoHashing/IVectoHash.cs +++ b/VectoCommon/VectoHashing/IVectoHash.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Xml.Linq; diff --git a/VectoCommon/VectoHashing/Impl/XmlDsigVectoTransform.cs b/VectoCommon/VectoHashing/Impl/XmlDsigVectoTransform.cs index a9c9d48bec1946416e007a216e258b24bd24d662..685ec972e043705469e0ba444555437d21c9be81 100644 --- a/VectoCommon/VectoHashing/Impl/XmlDsigVectoTransform.cs +++ b/VectoCommon/VectoHashing/Impl/XmlDsigVectoTransform.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Reflection; diff --git a/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs b/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs index 0385308d5b80b4349bcd0e0560cbe107ec73fd5f..57001c4078940fef1d8c30704a3fe749b79e5dbc 100644 --- a/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs +++ b/VectoCommon/VectoHashing/Impl/XmlHashProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Security.Cryptography; using System.Security.Cryptography.Xml; diff --git a/VectoCommon/VectoHashing/Properties/AssemblyInfo.cs b/VectoCommon/VectoHashing/Properties/AssemblyInfo.cs index bfcbbac2f0821e83d12dda09a46b1d40f1fd12c4..27c4ea3afafbf13c498a6a929fb40ba6d420262a 100644 --- a/VectoCommon/VectoHashing/Properties/AssemblyInfo.cs +++ b/VectoCommon/VectoHashing/Properties/AssemblyInfo.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/VectoCommon/VectoHashing/Properties/Version.cs b/VectoCommon/VectoHashing/Properties/Version.cs index 256603680a52f95c88ed2cb7a462d385ed6889c3..42e64f40089351cd75dc6d307d819b5cea3f8a78 100644 --- a/VectoCommon/VectoHashing/Properties/Version.cs +++ b/VectoCommon/VectoHashing/Properties/Version.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; [assembly: AssemblyVersion("0.1.0.127")] [assembly: AssemblyFileVersion("0.1.0.127")] diff --git a/VectoCommon/VectoHashing/Util/XmlDocumentExtensions.cs b/VectoCommon/VectoHashing/Util/XmlDocumentExtensions.cs index 8b6fde08b230ca3b61b58361922562cdebef095c..27e11540dfba94254eac82774663812fe33ca22d 100644 --- a/VectoCommon/VectoHashing/Util/XmlDocumentExtensions.cs +++ b/VectoCommon/VectoHashing/Util/XmlDocumentExtensions.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml; using System.Xml.Linq; diff --git a/VectoCommon/VectoHashing/VectoComponents.cs b/VectoCommon/VectoHashing/VectoComponents.cs index 6eac2d2bea1c25de62fd5fd8f63e1ea530885b13..08f873020f5144e198a9f18c8c4b7783bfc7f4af 100644 --- a/VectoCommon/VectoHashing/VectoComponents.cs +++ b/VectoCommon/VectoHashing/VectoComponents.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Resources; diff --git a/VectoCommon/VectoHashing/VectoHash.cs b/VectoCommon/VectoHashing/VectoHash.cs index e8c68861f31203834e0406db0624635360bf70e9..2ce0602f15d863530c0d39bacdfddace179a6772 100644 --- a/VectoCommon/VectoHashing/VectoHash.cs +++ b/VectoCommon/VectoHashing/VectoHash.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections; using System.Collections.Generic; diff --git a/VectoCommon/VectoHashingTest/BasicHasingTests.cs b/VectoCommon/VectoHashingTest/BasicHasingTests.cs index 85759f1701cd3dfc811d2f04e3a7c332cb9aefa8..db08cc87028b42d6989e94f6df53b2b8d6bb230c 100644 --- a/VectoCommon/VectoHashingTest/BasicHasingTests.cs +++ b/VectoCommon/VectoHashingTest/BasicHasingTests.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Text; using System.Xml; diff --git a/VectoCommon/VectoHashingTest/Properties/AssemblyInfo.cs b/VectoCommon/VectoHashingTest/Properties/AssemblyInfo.cs index 697edd6fd11f60c3a76bde927dc0db3c3dde3454..53ac8190c840df64199d93859fade7ce509cdf2c 100644 --- a/VectoCommon/VectoHashingTest/Properties/AssemblyInfo.cs +++ b/VectoCommon/VectoHashingTest/Properties/AssemblyInfo.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/VectoCommon/VectoHashingTest/Utils/AssertHelper.cs b/VectoCommon/VectoHashingTest/Utils/AssertHelper.cs index 122d5f5755f2b68ea00a37c3f9c4dd55c7400f29..21dee8b5b92e32164b9562e53486587e7e5bb3e4 100644 --- a/VectoCommon/VectoHashingTest/Utils/AssertHelper.cs +++ b/VectoCommon/VectoHashingTest/Utils/AssertHelper.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/VectoCommon/VectoHashingTest/VectoHashTest.cs b/VectoCommon/VectoHashingTest/VectoHashTest.cs index 1d1ac4a21869adabd7f7172139939f176b953b81..2a6c5c43ea742558568b64662e0cb0bc01664fb7 100644 --- a/VectoCommon/VectoHashingTest/VectoHashTest.cs +++ b/VectoCommon/VectoHashingTest/VectoHashTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Linq; diff --git a/VectoConsole/Program.cs b/VectoConsole/Program.cs index c24a86067cb4d81e5338625bf783b71edba0c86f..c40f91769e4cfd49ed076e9a922a9d8d522affd9 100644 --- a/VectoConsole/Program.cs +++ b/VectoConsole/Program.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoConsole/Properties/AssemblyInfo.cs b/VectoConsole/Properties/AssemblyInfo.cs index 044e6d2e0196c01179f820dbe981b77d877b8aa1..5b4b6d8764b7204e48264d5663320294f087c0a5 100644 --- a/VectoConsole/Properties/AssemblyInfo.cs +++ b/VectoConsole/Properties/AssemblyInfo.cs @@ -1,44 +1,44 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("Vecto Console")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("European Union")] -[assembly: AssemblyProduct("Vecto Console")] -[assembly: AssemblyCopyright("Copyright © 2012-2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Vecto Console")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("European Union")] +[assembly: AssemblyProduct("Vecto Console")] +[assembly: AssemblyCopyright("Copyright © 2012-2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] [assembly: Guid("29bc5a9a-40b4-4e43-a86b-cee6298b6a73")] \ No newline at end of file diff --git a/VectoConsole/Properties/Version.cs b/VectoConsole/Properties/Version.cs index ff03ab9d2bd6db691aeac948bf2b3c4776155443..cc9d06cc5c3bfabe288953ae34851ccc6962387b 100644 --- a/VectoConsole/Properties/Version.cs +++ b/VectoConsole/Properties/Version.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; [assembly: AssemblyVersion("3.1.1.810")] [assembly: AssemblyFileVersion("3.1.1.810")] diff --git a/VectoCore/ModelbasedTests/DriverStrategy/CoastingTests.cs b/VectoCore/ModelbasedTests/DriverStrategy/CoastingTests.cs index f7fa2073d8e64a10cb2785c06e4d711b7e46ea5c..60aab5b6b548ade84b5001203debcb2102276f4b 100644 --- a/VectoCore/ModelbasedTests/DriverStrategy/CoastingTests.cs +++ b/VectoCore/ModelbasedTests/DriverStrategy/CoastingTests.cs @@ -1,130 +1,130 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Tests.Integration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.ModelbasedTests.DriverStrategy -{ - [TestFixture] - public class CoastingTests - { - [TestFixtureSetUp] - public void DisableLogging() - { - //LogManager.DisableLogging(); -#if TRACE - GraphWriter.Enable(); -#else - GraphWriter.Disable(); -#endif - - GraphWriter.Xfields = new[] { ModalResultField.dist }; - - GraphWriter.Yfields = new[] { - ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, - ModalResultField.P_eng_out, /*ModalResultField.T_eng_fcmap, */ ModalResultField.FCMap, - }; - GraphWriter.PlotDrivingMode = true; - GraphWriter.Series1Label = "Vecto 3"; - } - - [Test, - TestCase(60, 20, 0), - TestCase(60, 20, 0.6), - TestCase(60, 20, 1.4), - TestCase(60, 20, 2.7), - TestCase(60, 20, 3.3), - TestCase(60, 20, 3.7), - TestCase(60, 35, 5.3), - TestCase(50, 47.5, -2.1), - TestCase(65, 62.5, -0.8), - TestCase(60, 50, 5.6), - TestCase(80, 40, 4.0), - TestCase(65, 60, 4.7), - TestCase(70, 62.5, 4.6), - TestCase(75, 65, 4.5), - ] - public void Truck_Coasting_Test(double v1, double v2, double slope) - { - Assert.IsTrue(v1 > v2); - - var cycle = new[] { - // <s>,<v>,<grad>,<stop> - string.Format(CultureInfo.InvariantCulture, " 0, {0}, {2}, 0", v1, v2, slope), - string.Format(CultureInfo.InvariantCulture, "1000, {1}, {2}, 0", v1, v2, slope), - string.Format(CultureInfo.InvariantCulture, "1100, {1}, 0, 0", v1, v2, slope) - }; - System.IO.Directory.CreateDirectory(string.Format(@"Coast_{0}_{1}", v1, v2, slope)); - var slopePrefix = ""; - if (!slope.IsEqual(0)) { - slopePrefix = slope > 0 ? "uh_" : "dh_"; - } - var modFile = string.Format(@"Coast_{0}_{1}\Truck_Coast_{0}_{1}_{3}{2:0.0}.vmod", v1, v2, Math.Abs(slope), - slopePrefix); - var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); - var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFile); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFile); - } - - [Ignore, Test, - TestCase(40), - TestCase(45), - TestCase(50), - TestCase(55), - TestCase(60), - TestCase(65), - TestCase(70), - TestCase(75), - TestCase(80), - ] - public void Truck_Coasting_Variability_Test(double v1) - { - const double vStep = 2.5; - const double vMin = 40; - Assert.IsTrue(vMin - vStep > 0); - for (var v2 = vMin; v2 <= v1 - vStep; v2 += vStep) { - for (var slope = -6.0; slope <= 6; slope += 0.1) { - Truck_Coasting_Test(v1, v2, slope); - } - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Tests.Integration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.ModelbasedTests.DriverStrategy +{ + [TestFixture] + public class CoastingTests + { + [TestFixtureSetUp] + public void DisableLogging() + { + //LogManager.DisableLogging(); +#if TRACE + GraphWriter.Enable(); +#else + GraphWriter.Disable(); +#endif + + GraphWriter.Xfields = new[] { ModalResultField.dist }; + + GraphWriter.Yfields = new[] { + ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, + ModalResultField.P_eng_out, /*ModalResultField.T_eng_fcmap, */ ModalResultField.FCMap, + }; + GraphWriter.PlotDrivingMode = true; + GraphWriter.Series1Label = "Vecto 3"; + } + + [Test, + TestCase(60, 20, 0), + TestCase(60, 20, 0.6), + TestCase(60, 20, 1.4), + TestCase(60, 20, 2.7), + TestCase(60, 20, 3.3), + TestCase(60, 20, 3.7), + TestCase(60, 35, 5.3), + TestCase(50, 47.5, -2.1), + TestCase(65, 62.5, -0.8), + TestCase(60, 50, 5.6), + TestCase(80, 40, 4.0), + TestCase(65, 60, 4.7), + TestCase(70, 62.5, 4.6), + TestCase(75, 65, 4.5), + ] + public void Truck_Coasting_Test(double v1, double v2, double slope) + { + Assert.IsTrue(v1 > v2); + + var cycle = new[] { + // <s>,<v>,<grad>,<stop> + string.Format(CultureInfo.InvariantCulture, " 0, {0}, {2}, 0", v1, v2, slope), + string.Format(CultureInfo.InvariantCulture, "1000, {1}, {2}, 0", v1, v2, slope), + string.Format(CultureInfo.InvariantCulture, "1100, {1}, 0, 0", v1, v2, slope) + }; + System.IO.Directory.CreateDirectory(string.Format(@"Coast_{0}_{1}", v1, v2, slope)); + var slopePrefix = ""; + if (!slope.IsEqual(0)) { + slopePrefix = slope > 0 ? "uh_" : "dh_"; + } + var modFile = string.Format(@"Coast_{0}_{1}\Truck_Coast_{0}_{1}_{3}{2:0.0}.vmod", v1, v2, Math.Abs(slope), + slopePrefix); + var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); + var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFile); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFile); + } + + [Ignore, Test, + TestCase(40), + TestCase(45), + TestCase(50), + TestCase(55), + TestCase(60), + TestCase(65), + TestCase(70), + TestCase(75), + TestCase(80), + ] + public void Truck_Coasting_Variability_Test(double v1) + { + const double vStep = 2.5; + const double vMin = 40; + Assert.IsTrue(vMin - vStep > 0); + for (var v2 = vMin; v2 <= v1 - vStep; v2 += vStep) { + for (var slope = -6.0; slope <= 6; slope += 0.1) { + Truck_Coasting_Test(v1, v2, slope); + } + } + } + } } \ No newline at end of file diff --git a/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs b/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs index 052da517cdf08d63162b452bb8d6154eb38c4388..b85b65cf8f6061d62562fc2f34230d2bb2372e17 100644 --- a/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs +++ b/VectoCore/ModelbasedTests/DriverStrategy/SimpleCycles.cs @@ -1,133 +1,133 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Tests.Integration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.ModelbasedTests.DriverStrategy -{ - [TestFixture] - public class SimpleCycles - { - [TestFixtureSetUp] - public void Init() - { - //LogManager.DisableLogging(); -#if TRACE - GraphWriter.Enable(); -#else - GraphWriter.Disable(); -#endif - GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; - - GraphWriter.Yfields = new[] { - ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, - ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap - }; - GraphWriter.Series1Label = "Vecto 3"; - } - - private static string GetSlopeString(double slope) - { - var slopeStr = slope > 0 - ? Math.Abs(slope).ToString("uphill_#") - : slope < 0 - ? Math.Abs(slope).ToString("downhill_#") - : "level"; - return slopeStr; - } - - [Category("LongRunning"), - TestCase(0, 80), TestCase(80, 0), TestCase(80, 80), - TestCase(0, 60), TestCase(60, 0), TestCase(60, 60), - TestCase(0, 40), TestCase(40, 0), TestCase(40, 40), - TestCase(0, 20), TestCase(20, 0), TestCase(20, 20), - ] - public void Truck_AllSlopes(double v1, double v2) - { - var slopes = new[] { 25, 20, 15, 10, 5, 3, 1, 0, -1, -3, -5, -10, -15, -20, -25 }; - - foreach (var slope in slopes) { - try { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var modFileName = string.Format(CultureInfo.InvariantCulture, "Truck_{0}_{1}_{2}.vmod", v1, v2, - GetSlopeString(slope)); - var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); - var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFileName); - - run.Run(); - - Assert.IsTrue(run.FinishedWithoutErrors, "Truck Run (v1: {0}, v2: {1}, slope: {2}) failed.", v1, v2, slope); - GraphWriter.Write(modFileName); - } catch (Exception ex) { - Assert.Fail("Truck Run (v1: {0}, v2: {1}, slope: {2}) failed: {3}", v1, v2, slope, ex); - } - } - } - - [Category("LongRunning"), - TestCase(0, 80), TestCase(80, 0), TestCase(80, 80), - TestCase(0, 60), TestCase(60, 0), TestCase(60, 60), - TestCase(0, 40), TestCase(40, 0), TestCase(40, 40), - TestCase(0, 20), TestCase(20, 0), TestCase(20, 20), - ] - public void Coach_AllSlopes(double v1, double v2) - { - var slopes = new[] { 15, 12, 10, 7, 5, 3, 1, 0, -1, -3, -5, -7, -10, -12, -15 }; - - foreach (var slope in slopes) { - try { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var modFileName = string.Format(CultureInfo.InvariantCulture, "Coach_{0}_{1}_{2}.vmod", v1, v2, - GetSlopeString(slope)); - var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); - var run = CoachPowerTrain.CreateEngineeringRun(cycleData, modFileName); - - run.Run(); - - Assert.IsTrue(run.FinishedWithoutErrors, "Truck Run (v1: {0}, v2: {1}, slope: {2}) failed.", v1, v2, slope); - GraphWriter.Write(modFileName); - } catch (Exception ex) { - Assert.Fail("Truck Run (v1: {0}, v2: {1}, slope: {2}) failed: {3}", v1, v2, slope, ex); - } - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Tests.Integration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.ModelbasedTests.DriverStrategy +{ + [TestFixture] + public class SimpleCycles + { + [TestFixtureSetUp] + public void Init() + { + //LogManager.DisableLogging(); +#if TRACE + GraphWriter.Enable(); +#else + GraphWriter.Disable(); +#endif + GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; + + GraphWriter.Yfields = new[] { + ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, + ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap + }; + GraphWriter.Series1Label = "Vecto 3"; + } + + private static string GetSlopeString(double slope) + { + var slopeStr = slope > 0 + ? Math.Abs(slope).ToString("uphill_#") + : slope < 0 + ? Math.Abs(slope).ToString("downhill_#") + : "level"; + return slopeStr; + } + + [Category("LongRunning"), + TestCase(0, 80), TestCase(80, 0), TestCase(80, 80), + TestCase(0, 60), TestCase(60, 0), TestCase(60, 60), + TestCase(0, 40), TestCase(40, 0), TestCase(40, 40), + TestCase(0, 20), TestCase(20, 0), TestCase(20, 20), + ] + public void Truck_AllSlopes(double v1, double v2) + { + var slopes = new[] { 25, 20, 15, 10, 5, 3, 1, 0, -1, -3, -5, -10, -15, -20, -25 }; + + foreach (var slope in slopes) { + try { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var modFileName = string.Format(CultureInfo.InvariantCulture, "Truck_{0}_{1}_{2}.vmod", v1, v2, + GetSlopeString(slope)); + var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); + var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFileName); + + run.Run(); + + Assert.IsTrue(run.FinishedWithoutErrors, "Truck Run (v1: {0}, v2: {1}, slope: {2}) failed.", v1, v2, slope); + GraphWriter.Write(modFileName); + } catch (Exception ex) { + Assert.Fail("Truck Run (v1: {0}, v2: {1}, slope: {2}) failed: {3}", v1, v2, slope, ex); + } + } + } + + [Category("LongRunning"), + TestCase(0, 80), TestCase(80, 0), TestCase(80, 80), + TestCase(0, 60), TestCase(60, 0), TestCase(60, 60), + TestCase(0, 40), TestCase(40, 0), TestCase(40, 40), + TestCase(0, 20), TestCase(20, 0), TestCase(20, 20), + ] + public void Coach_AllSlopes(double v1, double v2) + { + var slopes = new[] { 15, 12, 10, 7, 5, 3, 1, 0, -1, -3, -5, -7, -10, -12, -15 }; + + foreach (var slope in slopes) { + try { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var modFileName = string.Format(CultureInfo.InvariantCulture, "Coach_{0}_{1}_{2}.vmod", v1, v2, + GetSlopeString(slope)); + var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); + var run = CoachPowerTrain.CreateEngineeringRun(cycleData, modFileName); + + run.Run(); + + Assert.IsTrue(run.FinishedWithoutErrors, "Truck Run (v1: {0}, v2: {1}, slope: {2}) failed.", v1, v2, slope); + GraphWriter.Write(modFileName); + } catch (Exception ex) { + Assert.Fail("Truck Run (v1: {0}, v2: {1}, slope: {2}) failed: {3}", v1, v2, slope, ex); + } + } + } + } } \ No newline at end of file diff --git a/VectoCore/ModelbasedTests/Properties/AssemblyInfo.cs b/VectoCore/ModelbasedTests/Properties/AssemblyInfo.cs index 3b953b3b3493990c36ec04a3a504ee05628df07a..51a90374f1100b638a8440b90b2015eeb8f67f81 100644 --- a/VectoCore/ModelbasedTests/Properties/AssemblyInfo.cs +++ b/VectoCore/ModelbasedTests/Properties/AssemblyInfo.cs @@ -1,67 +1,67 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Allgemeine Informationen über eine Assembly werden über folgende -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("ModelbasedTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ModelbasedTests")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("8cd3693c-c9f2-4845-bbb6-85e23ed622ef")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern -// durch Einsatz von '*', wie in nachfolgendem Beispiel: -// [Assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über folgende +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("ModelbasedTests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ModelbasedTests")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Wenn ComVisible auf "false" festgelegt wird, sind die Typen innerhalb dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("8cd3693c-c9f2-4845-bbb6-85e23ed622ef")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern +// durch Einsatz von '*', wie in nachfolgendem Beispiel: +// [Assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index 3641ab2a9f69758c1fcc0bb78daa80927c9722c0..39866f24b040a941f7486b21034505e4851b898c 100644 --- a/VectoCore/VectoCore/Configuration/Constants.cs +++ b/VectoCore/VectoCore/Configuration/Constants.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/InputData/AuxiliaryFileHelper.cs b/VectoCore/VectoCore/InputData/AuxiliaryFileHelper.cs index ff3733b9bfc2fd15f7613fec00118b9e9fc07f35..6f6d3bfcb857faa124b22996acb5c3c694467406 100644 --- a/VectoCore/VectoCore/InputData/AuxiliaryFileHelper.cs +++ b/VectoCore/VectoCore/InputData/AuxiliaryFileHelper.cs @@ -1,74 +1,74 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; -using System.IO; -using System.Text; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Impl; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.InputData -{ - public static class AuxiliaryFileHelper - { - public static void FillAuxiliaryDataInputData(AuxiliaryDataInputData auxData, string auxFile) - { - try { - var stream = new StreamReader(auxFile); - stream.ReadLine(); // skip header "Transmission ration to engine rpm [-]" - auxData.TransmissionRatio = stream.ReadLine().IndulgentParse(); - stream.ReadLine(); // skip header "Efficiency to engine [-]" - auxData.EfficiencyToEngine = stream.ReadLine().IndulgentParse(); - stream.ReadLine(); // skip header "Efficiency auxiliary to supply [-]" - auxData.EfficiencyToSupply = stream.ReadLine().IndulgentParse(); - - var table = VectoCSVFile.ReadStream(new MemoryStream(Encoding.UTF8.GetBytes(stream.ReadToEnd())), source: auxFile); - foreach (DataRow row in table.Rows) { - if (AuxiliaryDataReader.HeaderIsValid(table.Columns)) { - row[AuxiliaryDataReader.Fields.MechPower] = - row.ParseDouble(AuxiliaryDataReader.Fields.MechPower).SI().Kilo.Watt.Value(); - row[AuxiliaryDataReader.Fields.SupplyPower] = - row.ParseDouble(AuxiliaryDataReader.Fields.SupplyPower).SI().Kilo.Watt.Value(); - } else { - row[1] = row.ParseDouble(1).SI().Kilo.Watt.Value(); - row[2] = row.ParseDouble(2).SI().Kilo.Watt.Value(); - } - } - auxData.DemandMap = table; - } catch (FileNotFoundException e) { - throw new VectoException("Auxiliary file not found: " + auxFile, e); - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; +using System.IO; +using System.Text; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Impl; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.InputData +{ + public static class AuxiliaryFileHelper + { + public static void FillAuxiliaryDataInputData(AuxiliaryDataInputData auxData, string auxFile) + { + try { + var stream = new StreamReader(auxFile); + stream.ReadLine(); // skip header "Transmission ration to engine rpm [-]" + auxData.TransmissionRatio = stream.ReadLine().IndulgentParse(); + stream.ReadLine(); // skip header "Efficiency to engine [-]" + auxData.EfficiencyToEngine = stream.ReadLine().IndulgentParse(); + stream.ReadLine(); // skip header "Efficiency auxiliary to supply [-]" + auxData.EfficiencyToSupply = stream.ReadLine().IndulgentParse(); + + var table = VectoCSVFile.ReadStream(new MemoryStream(Encoding.UTF8.GetBytes(stream.ReadToEnd())), source: auxFile); + foreach (DataRow row in table.Rows) { + if (AuxiliaryDataReader.HeaderIsValid(table.Columns)) { + row[AuxiliaryDataReader.Fields.MechPower] = + row.ParseDouble(AuxiliaryDataReader.Fields.MechPower).SI().Kilo.Watt.Value(); + row[AuxiliaryDataReader.Fields.SupplyPower] = + row.ParseDouble(AuxiliaryDataReader.Fields.SupplyPower).SI().Kilo.Watt.Value(); + } else { + row[1] = row.ParseDouble(1).SI().Kilo.Watt.Value(); + row[2] = row.ParseDouble(2).SI().Kilo.Watt.Value(); + } + } + auxData.DemandMap = table; + } catch (FileNotFoundException e) { + throw new VectoException("Auxiliary file not found: " + auxFile, e); + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs index 09458a755462727b2034e92c4760930df0d1f491..c31323bed471769f058132d46d28ceb7114923e3 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONComponentInputData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Xml.Linq; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs index 40c51b99237df7b314571c3891e69e39f783980a..bf8d8e57a5c19e2e4b8aaed3ac557377677a299c 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONEngineData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using Newtonsoft.Json.Linq; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs index 53f8f9d710f044357290eb380309baf20e6b95de..4a0aaca25f61f92a241022b8024e2d2114fac47f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONGearboxData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs index 90a1b7ae8e3c65dbe313b11051d1d3957b767244..b6b2f19eb55689a195e71e0aef3f912f0574eb1d 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs index 763032db0e060df0e9a120e207b5959b0544a387..c406af6f577cce116208b59668c8b6012643e388 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index 1c94164cb9175244aa8207c95e59bed08f75cae5..6c23a3f3a27fda1aa029a141982343f60d4c8a5e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JsonExtensionMethods.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JsonExtensionMethods.cs index dbca65e7297f3f8afb1c151dcb97294a6f281022..db43c51e42d39d5b1f13281fff63313d863e265d 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JsonExtensionMethods.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JsonExtensionMethods.cs @@ -1,67 +1,67 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Newtonsoft.Json.Linq; -using TUGraz.VectoCommon.Exceptions; - -namespace TUGraz.VectoCore.InputData.FileIO.JSON -{ - public static class JsonExtensionMethods - { - public static JToken GetEx(this JObject jobject, string property) - { - var val = jobject[property]; - if (val == null) { - throw new InvalidFileFormatException("Key {0} not found", property); - } - return val; - } - - public static JToken GetEx(this JToken jtoken, string property) - { - var val = jtoken[property]; - if (val == null) { - throw new InvalidFileFormatException("Key {0} not found", property); - } - return val; - } - - public static T GetEx<T>(this JObject value, string property) - { - return GetEx(value, property).Value<T>(); - } - - public static T GetEx<T>(this JToken value, string property) - { - return GetEx(value, property).Value<T>(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Newtonsoft.Json.Linq; +using TUGraz.VectoCommon.Exceptions; + +namespace TUGraz.VectoCore.InputData.FileIO.JSON +{ + public static class JsonExtensionMethods + { + public static JToken GetEx(this JObject jobject, string property) + { + var val = jobject[property]; + if (val == null) { + throw new InvalidFileFormatException("Key {0} not found", property); + } + return val; + } + + public static JToken GetEx(this JToken jtoken, string property) + { + var val = jtoken[property]; + if (val == null) { + throw new InvalidFileFormatException("Key {0} not found", property); + } + return val; + } + + public static T GetEx<T>(this JObject value, string property) + { + return GetEx(value, property).Value<T>(); + } + + public static T GetEx<T>(this JToken value, string property) + { + return GetEx(value, property).Value<T>(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs index 479a93f1ab839308aa5141e4ba1a3784d25505ee..84b7c3e0bf3a96c85bffcc62d082261eeeca3b8b 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/AbstractDeclarationXMLComponentDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Linq; using System.Xml; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs index f921a8d1e2af6810696526f7a344c6fd1532ee4f..5f09cd70afed282a71a28a8e3990f15090cdf75b 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAirdragDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Resources; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAngledriveDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAngledriveDataProvider.cs index c3ec4ce802a0f56004a6be8d9ac2a57af9c296b3..09de364e5a1efd6eea072b88275fb26a3cf7d541 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAngledriveDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAngledriveDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAuxiliaryDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAuxiliaryDataProvider.cs index 5ab4647ef05aec0906f3c22900b2aba2d7d44e97..bb1e8cc69fa086ed4a5e7a21b418fcac1143c091 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAuxiliaryDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAuxiliaryDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs index 6fc74dfd724de6ccb284eded5c5390abf7d2087e..8b62b9ec98e65f175b3bad14e61bc9722417ebcb 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationAxlegearDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs index 7802aaed52e94ea61d8b5530dbd3ba65031c9628..76b683eb75cee947b6b3d85ecdc7e8d60d205339 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationDriverDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.InputData.Impl; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationEngineDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationEngineDataProvider.cs index 35f1d686164c6834947c2d4be69098eb9f67a7d1..9db7af4ac37722edb8053e0dd6fb90d6b9bf09fc 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationEngineDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationEngineDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs index 3c026c86b60c00c0b0ec7b8488076c29da396993..d8e995f4782a3f00455147fe519e9cf735b1ec2e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationGearboxDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Xml; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs index f0efac2e7f92d84b7fa686bf1a4bdd8f84bef534..dbc91c985c0752e5a61a0f8c643c87d2d9f9687a 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationInputDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Xml; using System.Xml.Linq; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationJobInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationJobInputDataProvider.cs index b14c82c3c0434a03b1912267b18e5d5926ec4cea..583166874d3e467de267c56c8076425bd9ea1668 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationJobInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationJobInputDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Resources; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationRetarderDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationRetarderDataProvider.cs index a62dc6e0bb44d8a3a39d3495ea05b9524480b03b..f13861ad1680ea92c38ab84abd5e92e0290097ea 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationRetarderDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationRetarderDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationTorqueConverterDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationTorqueConverterDataProvider.cs index 9e69cf1e07e16739a170197f4876eef336c0d7d8..0a2e3bf6528f674ffb6ab9bc297f1d46a165deb7 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationTorqueConverterDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationTorqueConverterDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Resources; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs index 8ccdc2d5b4149977de835720726e3e907fc0de3d..88f881aeedff39c3588bdf179771683f33994bad 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/XMLDeclarationVehicleDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs index e6095be978448cdb88ae04a31493b0de3fd3ebe0..3c91f09a198339d28523e4b04bbba671b8c54302 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/AbstractEngineeringXMLComponentDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Xml; using System.Xml.XPath; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs index 534f23669ecddd7819b1a2903b8428c4fa2ae36b..ed40f61f058801fc414b04046610088f61e232b5 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAirdragDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs index d0780b1a3d4c3ef5f5aaf6468a43fbaf14aafa5f..cbc9d310edd04d11c6136b5c08d492d01da045e1 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAngledriveDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAuxiliaryDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAuxiliaryDataProvider.cs index 00a4bdb234d5684d5854383a9c6d768be5385a98..88d19a8bdaa490f1cb83cb0b994d1c71c2c9578f 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAuxiliaryDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAuxiliaryDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs index 6a7316a1e9dc75ec6f3d0affbda64f98d1debb50..83a15cc185a262428ca0b6558693ede7089a0f61 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringAxlegearDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringDriverDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringDriverDataProvider.cs index 94de59bd8e5ca698fb5c80aa563ff576afc11f50..bfa2fcfa3079805a78338c28764dda165be3b88c 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringDriverDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringDriverDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Xml; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs index 433866eab031864040c15ff80d297724cb7c64ad..d7eb33d6156ed19c3ec1628af781770699551fe3 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringEngineDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs index bce5f00c55661b80963c361d1f92f75b01e4fa93..3440ad834b7ea7bbcd83aa9cef7f086c6183eda0 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringGearboxDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Xml; using System.Xml.XPath; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs index c18a55d51f1b02d2a622d33bd5854e118de0bc2e..5d40e4ce5c52129d48f98d3cac1c0e40cf8139d9 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringInputDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Xml; using System.Xml.Schema; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs index 546ae85752aee4d55523d594607ec0ee8a8ddbae..50d44c5e76a300a9df74e5c2b42d21ad16baf2c9 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringJobInputDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.IO; using System.Xml; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs index c4a62ea94b51ecbcbb3d740a9302dc4960a5f516..082df62445e03740890803f62b4fec7fa265ea70 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringRetarderDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringTorqueConverterDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringTorqueConverterDataProvider.cs index d4499ab450cab43286c5706f8d159a220fe30828..dec48e55ba2d8bb076983f0b171e7eeb0c6d4bce 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringTorqueConverterDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringTorqueConverterDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Xml.XPath; using TUGraz.IVT.VectoXML; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs index 51c7aa0cac35f8c51cb6e7fe3b57be4a26f7f114..c20feb6f484102dc51423a4e7ec74a61c2ebae1e 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Engineering/XMLEngineeringVehicleDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCore/InputData/IVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/IVectoRunDataFactory.cs index 46a7c79e493dca27dd8aa4ff074b279f8e981e26..860fd3163f52388fb6ab5ec327854e4e8b250782 100644 --- a/VectoCore/VectoCore/InputData/IVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/IVectoRunDataFactory.cs @@ -1,41 +1,41 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using TUGraz.VectoCore.Models.Simulation.Data; - -namespace TUGraz.VectoCore.InputData -{ - public interface IVectoRunDataFactory - { - IEnumerable<VectoRunData> NextRun(); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using TUGraz.VectoCore.Models.Simulation.Data; + +namespace TUGraz.VectoCore.InputData +{ + public interface IVectoRunDataFactory + { + IEnumerable<VectoRunData> NextRun(); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Impl/InputData.cs b/VectoCore/VectoCore/InputData/Impl/InputData.cs index 2cf2e38474fb9c16315d837e51ac4af51003be1d..5e882eedeff0805e80451c0e8bd9d5026be3f9f0 100644 --- a/VectoCore/VectoCore/InputData/Impl/InputData.cs +++ b/VectoCore/VectoCore/InputData/Impl/InputData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs index b91df9cffcd4bf39c1c1d2fdbe8625aeb423ac97..81b9967772394c114f0b0885373ef0fc275b7b77 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/AccelerationCurveReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs index a12bcf233bf31659457ac9be1d377d5d9e2611c5..be864ab0b00fc36ee78b6ed399265c5158ddd835 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/AuxiliaryDataReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Data; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs index d1017ec3c3817f47e928ad749fcea0c241b9456c..9873af7612cdac9a278f8f15b41a791f642d8c87 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/CrossWindCorrectionCurveReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Data; using System.Diagnostics; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs index 2fb38d0b9648298f7764c2c9984fe481b63f818f..33cd4a36b7536917e163da7a828217ced675234a 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/PTOIdleLossMapReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using System.IO; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/RetarderLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/RetarderLossMapReader.cs index 673a0fb9cace6a3f271cd68fc55f475349783609..9e0d74024441ad80b7b17efff35e1c7ace8a1770 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/RetarderLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/RetarderLossMapReader.cs @@ -1,100 +1,100 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.InputData.Reader.ComponentData -{ - public static class RetarderLossMapReader - { - /// <summary> - /// Read the retarder loss map from a file. - /// </summary> - public static RetarderLossMap ReadFromFile(string fileName) - { - try { - return Create(VectoCSVFile.Read(fileName)); - } catch (Exception ex) { - throw new VectoException("ERROR while loading RetarderLossMap: " + ex.Message); - } - } - - /// <summary> - /// Create the retarder loss map from an appropriate datatable. (2 columns: Retarder Speed, Torque Loss) - /// </summary> - public static RetarderLossMap Create(DataTable data) - { - if (data.Columns.Count != 2) { - throw new VectoException("RetarderLossMap Data File must consist of 2 columns: {0}, {1}", Fields.RetarderSpeed, - Fields.TorqueLoss); - } - - if (data.Rows.Count < 2) { - throw new VectoException("RetarderLossMap must contain at least 2 entries."); - } - - if (!data.Columns.Contains(Fields.RetarderSpeed) || !data.Columns.Contains(Fields.TorqueLoss)) { - data.Columns[0].ColumnName = Fields.RetarderSpeed; - data.Columns[1].ColumnName = Fields.TorqueLoss; - LoggingObject.Logger<RetarderLossMap>().Warn( - "RetarderLossMap: Header Line is not valid. Expected: '{0}, {1}', Got: '{2}'. Falling back to column index.", - Fields.RetarderSpeed, Fields.TorqueLoss, - string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); - } - - return new RetarderLossMap(data.Rows.Cast<DataRow>() - .Select(row => new RetarderLossMap.RetarderLossEntry { - RetarderSpeed = row.ParseDouble(Fields.RetarderSpeed).RPMtoRad(), - TorqueLoss = row.ParseDouble(Fields.TorqueLoss).SI<NewtonMeter>() - }).OrderBy(e => e.RetarderSpeed).ToArray()); - } - - public static class Fields - { - /// <summary> - /// [rpm] - /// </summary> - public const string RetarderSpeed = "Retarder Speed"; - - /// <summary> - /// [Nm] - /// </summary> - public const string TorqueLoss = "Torque Loss"; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.InputData.Reader.ComponentData +{ + public static class RetarderLossMapReader + { + /// <summary> + /// Read the retarder loss map from a file. + /// </summary> + public static RetarderLossMap ReadFromFile(string fileName) + { + try { + return Create(VectoCSVFile.Read(fileName)); + } catch (Exception ex) { + throw new VectoException("ERROR while loading RetarderLossMap: " + ex.Message); + } + } + + /// <summary> + /// Create the retarder loss map from an appropriate datatable. (2 columns: Retarder Speed, Torque Loss) + /// </summary> + public static RetarderLossMap Create(DataTable data) + { + if (data.Columns.Count != 2) { + throw new VectoException("RetarderLossMap Data File must consist of 2 columns: {0}, {1}", Fields.RetarderSpeed, + Fields.TorqueLoss); + } + + if (data.Rows.Count < 2) { + throw new VectoException("RetarderLossMap must contain at least 2 entries."); + } + + if (!data.Columns.Contains(Fields.RetarderSpeed) || !data.Columns.Contains(Fields.TorqueLoss)) { + data.Columns[0].ColumnName = Fields.RetarderSpeed; + data.Columns[1].ColumnName = Fields.TorqueLoss; + LoggingObject.Logger<RetarderLossMap>().Warn( + "RetarderLossMap: Header Line is not valid. Expected: '{0}, {1}', Got: '{2}'. Falling back to column index.", + Fields.RetarderSpeed, Fields.TorqueLoss, + string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); + } + + return new RetarderLossMap(data.Rows.Cast<DataRow>() + .Select(row => new RetarderLossMap.RetarderLossEntry { + RetarderSpeed = row.ParseDouble(Fields.RetarderSpeed).RPMtoRad(), + TorqueLoss = row.ParseDouble(Fields.TorqueLoss).SI<NewtonMeter>() + }).OrderBy(e => e.RetarderSpeed).ToArray()); + } + + public static class Fields + { + /// <summary> + /// [rpm] + /// </summary> + public const string RetarderSpeed = "Retarder Speed"; + + /// <summary> + /// [Nm] + /// </summary> + public const string TorqueLoss = "Torque Loss"; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs index 5562408687062c31720e6ffab784c42d7308e249..d08185fda8ac3a0fd5df4f161d9e71152cab023b 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TorqueConverterDataReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Data; using System.IO; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs index 4ab5e65d5704f55d2ab793fbd8054709b255095c..78735f939277c17912244edf57700a2c39fba9e3 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/TransmissionLossMapReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs index 5244265f0a0b6eb5a8f370a7cadfab1eb7cb2b1e..edf3a2f26af5344b3bfc634c08d7cea4a75c4201 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/AbstractSimulationDataAdapter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs index bb171f162efe4b97dfff0a91dd79020303431b83..df3cc851b0f88cd2f4cdf8f25c335d2f749a7280 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/DeclarationDataAdapter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index d89d71235c50cabb507a5816cfd59f3ba6ae498d..50c771198b3326f4d8956c1f7f706ec0dc98b286 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs index fb8f0496c6ad9b0e8d757fbbd5b34189dd3e2130..ba0e80a3f8fe23a3efe162ae70b7258edc7a785d 100644 --- a/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/DrivingCycleDataReader.cs @@ -1,704 +1,704 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.InputData.Reader -{ - public static class DrivingCycleDataReader - { - /// <summary> - /// Detects the appropriate cycle type for a cycle in a DataTable. - /// </summary> - /// <param name="cycleData">The cycle data.</param> - /// <returns></returns> - /// <exception cref="VectoException">CycleFile Format is unknown.</exception> - public static CycleType DetectCycleType(DataTable cycleData) - { - var cols = cycleData.Columns; - - if (PTOCycleDataParser.ValidateHeader(cols, false)) { - return CycleType.PTO; - } - - if (PWheelCycleDataParser.ValidateHeader(cols, false)) { - return CycleType.PWheel; - } - if (MeasuredSpeedGearDataParser.ValidateHeader(cols, false)) { - return CycleType.MeasuredSpeedGear; - } - if (MeasuredSpeedDataParser.ValidateHeader(cols, false)) { - return CycleType.MeasuredSpeed; - } - if (EngineOnlyCycleDataParser.ValidateHeader(cols, false)) { - return CycleType.EngineOnly; - } - if (DistanceBasedCycleDataParser.ValidateHeader(cols, false)) { - return CycleType.DistanceBased; - } - throw new VectoException("CycleFile format is unknown."); - } - - private static ICycleDataParser GetDataParser(CycleType type) - { - switch (type) { - case CycleType.EngineOnly: - return new EngineOnlyCycleDataParser(); - case CycleType.DistanceBased: - return new DistanceBasedCycleDataParser(); - case CycleType.PWheel: - return new PWheelCycleDataParser(); - case CycleType.MeasuredSpeedGear: - return new MeasuredSpeedGearDataParser(); - case CycleType.MeasuredSpeed: - return new MeasuredSpeedDataParser(); - case CycleType.PTO: - return new PTOCycleDataParser(); - default: - throw new ArgumentOutOfRangeException("Cycle Type", type.ToString()); - } - } - - /// <summary> - /// Reads a cycle from a file. - /// </summary> - /// <param name="fileName">Name of the file.</param> - /// <param name="type">The type.</param> - /// <param name="crossWindRequired"></param> - /// <returns></returns> - /// <exception cref="VectoException">ERROR while reading DrivingCycle File: + ex.Message</exception> - public static DrivingCycleData ReadFromFile(string fileName, CycleType type, bool crossWindRequired) - { - try { - var stream = File.OpenRead(fileName); - return ReadFromStream(stream, type, Path.GetFileNameWithoutExtension(fileName), crossWindRequired); - } catch (Exception ex) { - throw new VectoException("ERROR while opening DrivingCycle File: " + ex.Message, ex); - } - } - - /// <summary> - /// Reads the cycle from a stream. - /// </summary> - /// <param name="stream">The stream.</param> - /// <param name="type">The type.</param> - /// <param name="crossWindRequired"></param> - /// <param name="name">the name of the cycle</param> - /// <returns></returns> - public static DrivingCycleData ReadFromStream(Stream stream, CycleType type, string name, bool crossWindRequired) - { - try { - return ReadFromDataTable(VectoCSVFile.ReadStream(stream), type, name, crossWindRequired); - } catch (Exception ex) { - throw new VectoException("ERROR while reading DrivingCycle Stream: " + ex.Message, ex); - } - } - - /// <summary> - /// Creates a cycle from a DataTable with automatic determination of Cycle Type. - /// </summary> - /// <param name="data">The cycle data.</param> - /// <param name="name">The name.</param> - /// <param name="crossWindRequired"></param> - /// <returns></returns> - public static DrivingCycleData ReadFromDataTable(DataTable data, string name, bool crossWindRequired) - { - if (data == null) { - LogManager.GetLogger(typeof(DrivingCycleDataReader).FullName) - .Warn("Invalid data for DrivingCycle -- dataTable is null"); - throw new VectoException("Invalid data for DrivingCycle -- dataTable is null"); - } - return ReadFromDataTable(data, DetectCycleType(data), name, crossWindRequired); - } - - /// <summary> - /// Creates a cycle from a DataTable - /// </summary> - /// <param name="data">The cycle data.</param> - /// <param name="type">The type.</param> - /// <param name="name">The name.</param> - /// <param name="crossWindRequired"></param> - /// <returns></returns> - public static DrivingCycleData ReadFromDataTable(DataTable data, CycleType type, string name, bool crossWindRequired) - { - if (data == null) { - LogManager.GetLogger(typeof(DrivingCycleDataReader).FullName) - .Warn("Invalid data for DrivingCycle -- dataTable is null"); - throw new VectoException("Invalid data for DrivingCycle -- dataTable is null"); - } - var entries = GetDataParser(type).Parse(data, crossWindRequired).ToList(); - - if (type == CycleType.DistanceBased) { - entries = FilterDrivingCycleEntries(entries); - } - if (type == CycleType.MeasuredSpeed || type == CycleType.MeasuredSpeedGear) { - entries = ComputeAltitudeTimeBased(entries); - } - var cycle = new DrivingCycleData { - Entries = entries, - CycleType = type, - Name = name - }; - return cycle; - } - - private static List<DrivingCycleData.DrivingCycleEntry> ComputeAltitudeTimeBased( - List<DrivingCycleData.DrivingCycleEntry> entries) - { - var current = entries.First(); - current.Altitude = 0.SI<Meter>(); - var altitude = current.Altitude; - var lastTime = entries.First().Time; - foreach (var drivingCycleEntry in entries) { - altitude += drivingCycleEntry.VehicleTargetSpeed * (drivingCycleEntry.Time - lastTime) * - drivingCycleEntry.RoadGradient; - drivingCycleEntry.Altitude = altitude; - lastTime = drivingCycleEntry.Time; - } - return entries; - } - - private static List<DrivingCycleData.DrivingCycleEntry> FilterDrivingCycleEntries( - List<DrivingCycleData.DrivingCycleEntry> entries) - { - var filtered = new List<DrivingCycleData.DrivingCycleEntry>(); - var current = entries.First(); - current.Altitude = 0.SI<Meter>(); - filtered.Add(current); - var distance = current.Distance; - var altitude = current.Altitude; - for (var i = 0; i < entries.Count; i++) { - var entry = entries[i]; - if (!entry.StoppingTime.IsEqual(0) && !entry.VehicleTargetSpeed.IsEqual(0)) { - throw new VectoException( - "Error in DrivingCycle: stop time specified but target-speed > 0! Distance: {0}, stop-time: {1}, target speed: {2}", - entry.Distance, entry.StoppingTime, entry.VehicleTargetSpeed); - } - if (entry.Distance < distance) { - throw new VectoException( - "Error in DrivingCycle: distance entry is smaller than last distance! last distance: {0}, current distance: {1} ", - distance, entry.Distance); - } - if (i > 0) { - altitude += (entry.Distance - distance) * entries[i - 1].RoadGradientPercent / 100.0; - } - entry.Altitude = altitude; - // if something changes in the cycle, add it to the filtered cycle but always add last entry - if (!CycleEntriesAreEqual(current, entry) || i == entries.Count - 1) { - entry.Altitude = altitude; - filtered.Add(entry); - current = entry; - } - if (!entry.StoppingTime.IsEqual(0) && entry.VehicleTargetSpeed.IsEqual(0)) { - // vehicle stops. duplicate current distance entry with 0 waiting time - var tmp = new DrivingCycleData.DrivingCycleEntry(entry) { - StoppingTime = 0.SI<Second>(), - PTOActive = false, - RoadGradient = entry.RoadGradient, - VehicleTargetSpeed = i < entries.Count - 1 ? entries[i + 1].VehicleTargetSpeed : 0.SI<MeterPerSecond>() - }; - filtered.Add(tmp); - current = tmp; - } - - distance = entry.Distance; - } - LogManager.GetLogger(typeof(DrivingCycleDataReader).FullName) - .Info("Data loaded. Number of Entries: {0}, filtered Entries: {1}", entries.Count, filtered.Count); - entries = filtered; - - AdjustDistanceAfterStop(entries); - - return entries; - } - - private static void AdjustDistanceAfterStop(List<DrivingCycleData.DrivingCycleEntry> entries) - { - using (var currentIt = entries.GetEnumerator()) { - using (var nextIt = entries.GetEnumerator()) { - nextIt.MoveNext(); - while (currentIt.MoveNext() && nextIt.MoveNext()) { - if (currentIt.Current != null && !currentIt.Current.StoppingTime.IsEqual(0)) { - if (nextIt.Current != null) { - nextIt.Current.Distance = currentIt.Current.Distance; - } - } - } - } - } - } - - private static bool CycleEntriesAreEqual(DrivingCycleData.DrivingCycleEntry first, - DrivingCycleData.DrivingCycleEntry second) - { - if (first.Distance.IsEqual(second.Distance)) { - return true; - } - - if (first.VehicleTargetSpeed != second.VehicleTargetSpeed) { - return false; - } - - if (!first.RoadGradient.IsEqual(second.RoadGradient, Constants.SimulationSettings.DrivingCycleRoadGradientTolerance)) { - return false; - } - - if (!(first.StoppingTime.IsEqual(0) && second.StoppingTime.IsEqual(0))) { - return false; - } - - if (first.AdditionalAuxPowerDemand != second.AdditionalAuxPowerDemand) { - return false; - } - - if (first.AuxiliarySupplyPower.Count != second.AuxiliarySupplyPower.Count) { - return false; - } - - if (!first.AuxiliarySupplyPower.SequenceEqual(second.AuxiliarySupplyPower)) { - return false; - } - - return true; - } - - public static class Fields - { - public const string PTOTorque = "PTO Torque"; - public const string EngineSpeedFull = "Engine speed"; - public const string PWheel = "Pwheel"; - public const string Distance = "s"; - public const string Time = "t"; - public const string VehicleSpeed = "v"; - public const string RoadGradient = "grad"; - public const string StoppingTime = "stop"; - public const string EngineSpeed = "n"; - public const string Gear = "gear"; - public const string AdditionalAuxPowerDemand = "Padd"; - public const string AirSpeedRelativeToVehicle = "vair_res"; - public const string WindYawAngle = "vair_beta"; - public const string EnginePower = "Pe"; - public const string EngineTorque = "Me"; - public const string TorqueConverterActive = "tc_active"; - public const string PTOActive = "PTO"; - } - - #region DataParser - - private interface ICycleDataParser - { - /// <summary> - /// Parses a datatable to a list of drivingcycleentries for the current implementation. - /// </summary> - /// <param name="table"></param> - /// <param name="crossWindRequired"></param> - /// <returns></returns> - IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired); - } - - private abstract class AbstractCycleDataParser : LoggingObject, ICycleDataParser - { - protected static bool CheckColumns(DataColumnCollection header, IEnumerable<string> allowedCols, - IEnumerable<string> requiredCols, bool throwExceptions, bool allowAux) - { - var headerStr = header.Cast<DataColumn>().Select(col => col.ColumnName.ToLowerInvariant()).ToArray(); - - var diff = headerStr.GroupBy(c => c).Where(g => g.Count() > 2).SelectMany(g => g).ToList(); - if (diff.Any()) { - if (throwExceptions) { - throw new VectoException("Column(s) defined more than once: " + string.Join(", ", diff.OrderBy(x => x))); - } - return false; - } - - if (allowAux) { - headerStr = headerStr.Where(c => !c.ToUpper().StartsWith(Constants.Auxiliaries.Prefix)).ToArray(); - } - - diff = headerStr.Except(allowedCols.Select(x => x.ToLowerInvariant())).ToList(); - if (diff.Any()) { - if (throwExceptions) { - throw new VectoException("Column(s) not allowed: " + string.Join(", ", diff)); - } - return false; - } - - diff = requiredCols.Select(x => x.ToLowerInvariant()).Except(headerStr).ToList(); - if (diff.Any()) { - if (throwExceptions) { - throw new VectoException("Column(s) required: " + string.Join(", ", diff)); - } - return false; - } - return true; - } - - protected static bool CheckComboColumns(DataColumnCollection header, string[] cols, bool throwExceptions) - { - var colCount = header.Cast<DataColumn>() - .Select(col => col.ColumnName.ToLowerInvariant()) - .Intersect(cols.Select(x => x.ToLowerInvariant())).Count(); - - if (colCount != 0 && colCount != cols.Length) { - if (throwExceptions) { - throw new VectoException("Either all columns have to be defined or none of them: {0}", string.Join(", ", cols)); - } - return false; - } - - return true; - } - - public abstract IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired); - } - - private class DistanceBasedCycleDataParser : AbstractCycleDataParser - { - public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) - { - ValidateHeader(table.Columns); - - return table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { - Distance = row.ParseDouble(Fields.Distance).SI<Meter>(), - VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), - RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), - StoppingTime = row.ParseDouble(Fields.StoppingTime).SI<Second>(), - AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), - AngularVelocity = row.ParseDoubleOrGetDefault(Fields.EngineSpeed).RPMtoRad(), - Gear = (uint)row.ParseDoubleOrGetDefault(Fields.Gear), - AirSpeedRelativeToVehicle = - crossWindRequired ? row.ParseDouble(Fields.AirSpeedRelativeToVehicle).KMPHtoMeterPerSecond() : null, - WindYawAngle = crossWindRequired ? row.ParseDoubleOrGetDefault(Fields.WindYawAngle) : 0, - AuxiliarySupplyPower = row.GetAuxiliaries(), - PTOActive = table.Columns.Contains(Fields.PTOActive) && row.Field<string>(Fields.PTOActive) == "1" - }); - } - - public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) - { - var requiredCols = new[] { - Fields.Distance, - Fields.VehicleSpeed, - Fields.StoppingTime - }; - - var allowedCols = new[] { - Fields.Distance, - Fields.VehicleSpeed, - Fields.StoppingTime, - Fields.AdditionalAuxPowerDemand, - Fields.RoadGradient, - Fields.AirSpeedRelativeToVehicle, - Fields.WindYawAngle, - Fields.PTOActive - }; - - const bool allowAux = true; - - return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux) && - CheckComboColumns(header, new[] { Fields.AirSpeedRelativeToVehicle, Fields.WindYawAngle }, throwExceptions); - } - } - - /// <summary> - /// Parser for EngineOnly Cycles. - /// </summary> - // <t>, <n>, (<Pe>|<Me>)[, <Padd>] - private class EngineOnlyCycleDataParser : AbstractCycleDataParser - { - public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) - { - ValidateHeader(table.Columns); - - var absTime = 0; - foreach (DataRow row in table.Rows) { - var entry = new DrivingCycleData.DrivingCycleEntry { - Time = row.ParseDoubleOrGetDefault(Fields.Time, absTime).SI<Second>(), - AngularVelocity = row.ParseDoubleOrGetDefault(Fields.EngineSpeed).RPMtoRad(), - AdditionalAuxPowerDemand = - row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), - AuxiliarySupplyPower = row.GetAuxiliaries() - }; - - if (row.Table.Columns.Contains(Fields.EngineTorque)) { - if (row.Field<string>(Fields.EngineTorque).Equals("<DRAG>")) { - entry.Drag = true; - } else { - entry.Torque = row.ParseDouble(Fields.EngineTorque).SI<NewtonMeter>(); - } - } else { - if (row.Field<string>(Fields.EnginePower).Equals("<DRAG>")) { - entry.Drag = true; - } else { - entry.Torque = row.ParseDouble(Fields.EnginePower).SI().Kilo.Watt.Cast<Watt>() / entry.AngularVelocity; - } - } - absTime += 1; - - yield return entry; - } - } - - public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) - { - var requiredCols = new[] { - //Fields.Time not needed --> if missing 1 second resolution is assumed - Fields.EngineSpeed - }; - - var allowedCols = new[] { - Fields.Time, - Fields.EngineSpeed, - Fields.EngineTorque, - Fields.EnginePower, - Fields.AdditionalAuxPowerDemand - }; - - const bool allowAux = false; - - if (!CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux)) { - return false; - } - - var containsNone = !header.Contains(Fields.EngineTorque) && !header.Contains(Fields.EnginePower); - if (containsNone) { - if (throwExceptions) { - throw new VectoException("Column(s) missing: Either column '{0}' or column '{1}' must be defined.", - Fields.EngineTorque, Fields.EnginePower); - } - return false; - } - - var containsBoth = header.Contains(Fields.EngineTorque) && header.Contains(Fields.EnginePower); - if (containsBoth) { - LogManager.GetLogger(typeof(EngineOnlyCycleDataParser).FullName) - .Warn("Found column '{0}' and column '{1}': Only column '{0}' will be used.", - Fields.EngineTorque, Fields.EnginePower); - } - return true; - } - } - - /// <summary> - /// Parser for PWheel (SiCo) Mode. - /// </summary> - // <t>, <Pwheel>, <Gear>, <n>, <Padd> - private class PWheelCycleDataParser : AbstractCycleDataParser - { - public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) - { - ValidateHeader(table.Columns); - - var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { - Time = row.ParseDouble(Fields.Time).SI<Second>(), - PWheel = row.ParseDouble(Fields.PWheel).SI().Kilo.Watt.Cast<Watt>(), - Gear = (uint)row.ParseDouble(Fields.Gear), - AngularVelocity = row.ParseDouble(Fields.EngineSpeed).RPMtoRad(), - AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), - }).ToArray(); - - return entries; - } - - public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) - { - var requiredCols = new[] { - Fields.Time, - Fields.PWheel, - Fields.Gear, - Fields.EngineSpeed - }; - var allowedCols = new[] { - Fields.Time, - Fields.PWheel, - Fields.Gear, - Fields.EngineSpeed, - Fields.AdditionalAuxPowerDemand - }; - - return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux: false); - } - } - - /// <summary> - /// Parser for Measured Speed Mode Option 1. - /// </summary> - // <t>, <v>[, <grad>, <Padd>, <vair_res>, <vair_beta>, Aux_...] - private class MeasuredSpeedDataParser : AbstractCycleDataParser - { - public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) - { - ValidateHeader(table.Columns); - - var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { - Time = row.ParseDouble(Fields.Time).SI<Second>(), - VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), - RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), - AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), - AirSpeedRelativeToVehicle = - crossWindRequired ? row.ParseDouble(Fields.AirSpeedRelativeToVehicle).KMPHtoMeterPerSecond() : null, - WindYawAngle = crossWindRequired ? row.ParseDouble(Fields.WindYawAngle) : 0, - AuxiliarySupplyPower = row.GetAuxiliaries() - }).ToArray(); - - return entries; - } - - public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) - { - var requiredCols = new[] { - Fields.Time, - Fields.VehicleSpeed - }; - - var allowedCols = new[] { - Fields.Time, - Fields.VehicleSpeed, - Fields.AdditionalAuxPowerDemand, - Fields.RoadGradient, - Fields.AirSpeedRelativeToVehicle, - Fields.WindYawAngle - }; - - const bool allowAux = true; - - return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux) && - CheckComboColumns(header, new[] { Fields.AirSpeedRelativeToVehicle, Fields.WindYawAngle }, throwExceptions); - } - } - - /// <summary> - /// Parser for Measured Speed Mode Option 2. - /// </summary> - // <t>, <v>, <n>, <gear>[, <tc_active>, <grad>, <Padd>, <vair_res>, <vair_beta>, Aux_...] - private class MeasuredSpeedGearDataParser : AbstractCycleDataParser - { - public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) - { - ValidateHeader(table.Columns); - - var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { - Time = row.ParseDouble(Fields.Time).SI<Second>(), - VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), - RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), - AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), - AngularVelocity = row.ParseDoubleOrGetDefault(Fields.EngineSpeed).RPMtoRad(), - Gear = (uint)row.ParseDouble(Fields.Gear), - TorqueConverterActive = table.Columns.Contains(Fields.TorqueConverterActive) - ? row.ParseBoolean(Fields.TorqueConverterActive) - : (bool?)null, - AirSpeedRelativeToVehicle = crossWindRequired - ? row.ParseDouble(Fields.AirSpeedRelativeToVehicle).KMPHtoMeterPerSecond() - : null, - WindYawAngle = crossWindRequired ? row.ParseDoubleOrGetDefault(Fields.WindYawAngle) : 0, - AuxiliarySupplyPower = row.GetAuxiliaries() - }).ToArray(); - - return entries; - } - - public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) - { - var requiredCols = new[] { - Fields.Time, - Fields.VehicleSpeed, - Fields.Gear - }; - var allowedCols = new[] { - Fields.Time, - Fields.VehicleSpeed, - Fields.EngineSpeed, - Fields.Gear, - Fields.TorqueConverterActive, - Fields.AdditionalAuxPowerDemand, - Fields.RoadGradient, - Fields.AirSpeedRelativeToVehicle, - Fields.WindYawAngle - }; - - const bool allowAux = true; - - return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux) && - CheckComboColumns(header, new[] { Fields.AirSpeedRelativeToVehicle, Fields.WindYawAngle }, throwExceptions); - } - } - - /// <summary> - /// Parser for PTO Cycles. - /// </summary> - // <t> [s], <Engine Speed> [rpm], <PTO Torque> [Nm] - private class PTOCycleDataParser : AbstractCycleDataParser - { - public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) - { - ValidateHeader(table.Columns); - - var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { - Time = row.ParseDouble(Fields.Time).SI<Second>(), - AngularVelocity = row.ParseDouble(Fields.EngineSpeedFull).RPMtoRad(), - Torque = row.ParseDouble(Fields.PTOTorque).SI<NewtonMeter>() - }).ToArray(); - - return entries; - } - - public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) - { - var requiredCols = new[] { - Fields.Time, - Fields.EngineSpeedFull, - Fields.PTOTorque - }; - var allowedCols = new[] { - Fields.Time, - Fields.EngineSpeedFull, - Fields.PTOTorque - }; - - const bool allowAux = false; - - return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux); - } - } - } - - #endregion +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.InputData.Reader +{ + public static class DrivingCycleDataReader + { + /// <summary> + /// Detects the appropriate cycle type for a cycle in a DataTable. + /// </summary> + /// <param name="cycleData">The cycle data.</param> + /// <returns></returns> + /// <exception cref="VectoException">CycleFile Format is unknown.</exception> + public static CycleType DetectCycleType(DataTable cycleData) + { + var cols = cycleData.Columns; + + if (PTOCycleDataParser.ValidateHeader(cols, false)) { + return CycleType.PTO; + } + + if (PWheelCycleDataParser.ValidateHeader(cols, false)) { + return CycleType.PWheel; + } + if (MeasuredSpeedGearDataParser.ValidateHeader(cols, false)) { + return CycleType.MeasuredSpeedGear; + } + if (MeasuredSpeedDataParser.ValidateHeader(cols, false)) { + return CycleType.MeasuredSpeed; + } + if (EngineOnlyCycleDataParser.ValidateHeader(cols, false)) { + return CycleType.EngineOnly; + } + if (DistanceBasedCycleDataParser.ValidateHeader(cols, false)) { + return CycleType.DistanceBased; + } + throw new VectoException("CycleFile format is unknown."); + } + + private static ICycleDataParser GetDataParser(CycleType type) + { + switch (type) { + case CycleType.EngineOnly: + return new EngineOnlyCycleDataParser(); + case CycleType.DistanceBased: + return new DistanceBasedCycleDataParser(); + case CycleType.PWheel: + return new PWheelCycleDataParser(); + case CycleType.MeasuredSpeedGear: + return new MeasuredSpeedGearDataParser(); + case CycleType.MeasuredSpeed: + return new MeasuredSpeedDataParser(); + case CycleType.PTO: + return new PTOCycleDataParser(); + default: + throw new ArgumentOutOfRangeException("Cycle Type", type.ToString()); + } + } + + /// <summary> + /// Reads a cycle from a file. + /// </summary> + /// <param name="fileName">Name of the file.</param> + /// <param name="type">The type.</param> + /// <param name="crossWindRequired"></param> + /// <returns></returns> + /// <exception cref="VectoException">ERROR while reading DrivingCycle File: + ex.Message</exception> + public static DrivingCycleData ReadFromFile(string fileName, CycleType type, bool crossWindRequired) + { + try { + var stream = File.OpenRead(fileName); + return ReadFromStream(stream, type, Path.GetFileNameWithoutExtension(fileName), crossWindRequired); + } catch (Exception ex) { + throw new VectoException("ERROR while opening DrivingCycle File: " + ex.Message, ex); + } + } + + /// <summary> + /// Reads the cycle from a stream. + /// </summary> + /// <param name="stream">The stream.</param> + /// <param name="type">The type.</param> + /// <param name="crossWindRequired"></param> + /// <param name="name">the name of the cycle</param> + /// <returns></returns> + public static DrivingCycleData ReadFromStream(Stream stream, CycleType type, string name, bool crossWindRequired) + { + try { + return ReadFromDataTable(VectoCSVFile.ReadStream(stream), type, name, crossWindRequired); + } catch (Exception ex) { + throw new VectoException("ERROR while reading DrivingCycle Stream: " + ex.Message, ex); + } + } + + /// <summary> + /// Creates a cycle from a DataTable with automatic determination of Cycle Type. + /// </summary> + /// <param name="data">The cycle data.</param> + /// <param name="name">The name.</param> + /// <param name="crossWindRequired"></param> + /// <returns></returns> + public static DrivingCycleData ReadFromDataTable(DataTable data, string name, bool crossWindRequired) + { + if (data == null) { + LogManager.GetLogger(typeof(DrivingCycleDataReader).FullName) + .Warn("Invalid data for DrivingCycle -- dataTable is null"); + throw new VectoException("Invalid data for DrivingCycle -- dataTable is null"); + } + return ReadFromDataTable(data, DetectCycleType(data), name, crossWindRequired); + } + + /// <summary> + /// Creates a cycle from a DataTable + /// </summary> + /// <param name="data">The cycle data.</param> + /// <param name="type">The type.</param> + /// <param name="name">The name.</param> + /// <param name="crossWindRequired"></param> + /// <returns></returns> + public static DrivingCycleData ReadFromDataTable(DataTable data, CycleType type, string name, bool crossWindRequired) + { + if (data == null) { + LogManager.GetLogger(typeof(DrivingCycleDataReader).FullName) + .Warn("Invalid data for DrivingCycle -- dataTable is null"); + throw new VectoException("Invalid data for DrivingCycle -- dataTable is null"); + } + var entries = GetDataParser(type).Parse(data, crossWindRequired).ToList(); + + if (type == CycleType.DistanceBased) { + entries = FilterDrivingCycleEntries(entries); + } + if (type == CycleType.MeasuredSpeed || type == CycleType.MeasuredSpeedGear) { + entries = ComputeAltitudeTimeBased(entries); + } + var cycle = new DrivingCycleData { + Entries = entries, + CycleType = type, + Name = name + }; + return cycle; + } + + private static List<DrivingCycleData.DrivingCycleEntry> ComputeAltitudeTimeBased( + List<DrivingCycleData.DrivingCycleEntry> entries) + { + var current = entries.First(); + current.Altitude = 0.SI<Meter>(); + var altitude = current.Altitude; + var lastTime = entries.First().Time; + foreach (var drivingCycleEntry in entries) { + altitude += drivingCycleEntry.VehicleTargetSpeed * (drivingCycleEntry.Time - lastTime) * + drivingCycleEntry.RoadGradient; + drivingCycleEntry.Altitude = altitude; + lastTime = drivingCycleEntry.Time; + } + return entries; + } + + private static List<DrivingCycleData.DrivingCycleEntry> FilterDrivingCycleEntries( + List<DrivingCycleData.DrivingCycleEntry> entries) + { + var filtered = new List<DrivingCycleData.DrivingCycleEntry>(); + var current = entries.First(); + current.Altitude = 0.SI<Meter>(); + filtered.Add(current); + var distance = current.Distance; + var altitude = current.Altitude; + for (var i = 0; i < entries.Count; i++) { + var entry = entries[i]; + if (!entry.StoppingTime.IsEqual(0) && !entry.VehicleTargetSpeed.IsEqual(0)) { + throw new VectoException( + "Error in DrivingCycle: stop time specified but target-speed > 0! Distance: {0}, stop-time: {1}, target speed: {2}", + entry.Distance, entry.StoppingTime, entry.VehicleTargetSpeed); + } + if (entry.Distance < distance) { + throw new VectoException( + "Error in DrivingCycle: distance entry is smaller than last distance! last distance: {0}, current distance: {1} ", + distance, entry.Distance); + } + if (i > 0) { + altitude += (entry.Distance - distance) * entries[i - 1].RoadGradientPercent / 100.0; + } + entry.Altitude = altitude; + // if something changes in the cycle, add it to the filtered cycle but always add last entry + if (!CycleEntriesAreEqual(current, entry) || i == entries.Count - 1) { + entry.Altitude = altitude; + filtered.Add(entry); + current = entry; + } + if (!entry.StoppingTime.IsEqual(0) && entry.VehicleTargetSpeed.IsEqual(0)) { + // vehicle stops. duplicate current distance entry with 0 waiting time + var tmp = new DrivingCycleData.DrivingCycleEntry(entry) { + StoppingTime = 0.SI<Second>(), + PTOActive = false, + RoadGradient = entry.RoadGradient, + VehicleTargetSpeed = i < entries.Count - 1 ? entries[i + 1].VehicleTargetSpeed : 0.SI<MeterPerSecond>() + }; + filtered.Add(tmp); + current = tmp; + } + + distance = entry.Distance; + } + LogManager.GetLogger(typeof(DrivingCycleDataReader).FullName) + .Info("Data loaded. Number of Entries: {0}, filtered Entries: {1}", entries.Count, filtered.Count); + entries = filtered; + + AdjustDistanceAfterStop(entries); + + return entries; + } + + private static void AdjustDistanceAfterStop(List<DrivingCycleData.DrivingCycleEntry> entries) + { + using (var currentIt = entries.GetEnumerator()) { + using (var nextIt = entries.GetEnumerator()) { + nextIt.MoveNext(); + while (currentIt.MoveNext() && nextIt.MoveNext()) { + if (currentIt.Current != null && !currentIt.Current.StoppingTime.IsEqual(0)) { + if (nextIt.Current != null) { + nextIt.Current.Distance = currentIt.Current.Distance; + } + } + } + } + } + } + + private static bool CycleEntriesAreEqual(DrivingCycleData.DrivingCycleEntry first, + DrivingCycleData.DrivingCycleEntry second) + { + if (first.Distance.IsEqual(second.Distance)) { + return true; + } + + if (first.VehicleTargetSpeed != second.VehicleTargetSpeed) { + return false; + } + + if (!first.RoadGradient.IsEqual(second.RoadGradient, Constants.SimulationSettings.DrivingCycleRoadGradientTolerance)) { + return false; + } + + if (!(first.StoppingTime.IsEqual(0) && second.StoppingTime.IsEqual(0))) { + return false; + } + + if (first.AdditionalAuxPowerDemand != second.AdditionalAuxPowerDemand) { + return false; + } + + if (first.AuxiliarySupplyPower.Count != second.AuxiliarySupplyPower.Count) { + return false; + } + + if (!first.AuxiliarySupplyPower.SequenceEqual(second.AuxiliarySupplyPower)) { + return false; + } + + return true; + } + + public static class Fields + { + public const string PTOTorque = "PTO Torque"; + public const string EngineSpeedFull = "Engine speed"; + public const string PWheel = "Pwheel"; + public const string Distance = "s"; + public const string Time = "t"; + public const string VehicleSpeed = "v"; + public const string RoadGradient = "grad"; + public const string StoppingTime = "stop"; + public const string EngineSpeed = "n"; + public const string Gear = "gear"; + public const string AdditionalAuxPowerDemand = "Padd"; + public const string AirSpeedRelativeToVehicle = "vair_res"; + public const string WindYawAngle = "vair_beta"; + public const string EnginePower = "Pe"; + public const string EngineTorque = "Me"; + public const string TorqueConverterActive = "tc_active"; + public const string PTOActive = "PTO"; + } + + #region DataParser + + private interface ICycleDataParser + { + /// <summary> + /// Parses a datatable to a list of drivingcycleentries for the current implementation. + /// </summary> + /// <param name="table"></param> + /// <param name="crossWindRequired"></param> + /// <returns></returns> + IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired); + } + + private abstract class AbstractCycleDataParser : LoggingObject, ICycleDataParser + { + protected static bool CheckColumns(DataColumnCollection header, IEnumerable<string> allowedCols, + IEnumerable<string> requiredCols, bool throwExceptions, bool allowAux) + { + var headerStr = header.Cast<DataColumn>().Select(col => col.ColumnName.ToLowerInvariant()).ToArray(); + + var diff = headerStr.GroupBy(c => c).Where(g => g.Count() > 2).SelectMany(g => g).ToList(); + if (diff.Any()) { + if (throwExceptions) { + throw new VectoException("Column(s) defined more than once: " + string.Join(", ", diff.OrderBy(x => x))); + } + return false; + } + + if (allowAux) { + headerStr = headerStr.Where(c => !c.ToUpper().StartsWith(Constants.Auxiliaries.Prefix)).ToArray(); + } + + diff = headerStr.Except(allowedCols.Select(x => x.ToLowerInvariant())).ToList(); + if (diff.Any()) { + if (throwExceptions) { + throw new VectoException("Column(s) not allowed: " + string.Join(", ", diff)); + } + return false; + } + + diff = requiredCols.Select(x => x.ToLowerInvariant()).Except(headerStr).ToList(); + if (diff.Any()) { + if (throwExceptions) { + throw new VectoException("Column(s) required: " + string.Join(", ", diff)); + } + return false; + } + return true; + } + + protected static bool CheckComboColumns(DataColumnCollection header, string[] cols, bool throwExceptions) + { + var colCount = header.Cast<DataColumn>() + .Select(col => col.ColumnName.ToLowerInvariant()) + .Intersect(cols.Select(x => x.ToLowerInvariant())).Count(); + + if (colCount != 0 && colCount != cols.Length) { + if (throwExceptions) { + throw new VectoException("Either all columns have to be defined or none of them: {0}", string.Join(", ", cols)); + } + return false; + } + + return true; + } + + public abstract IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired); + } + + private class DistanceBasedCycleDataParser : AbstractCycleDataParser + { + public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) + { + ValidateHeader(table.Columns); + + return table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { + Distance = row.ParseDouble(Fields.Distance).SI<Meter>(), + VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), + RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), + StoppingTime = row.ParseDouble(Fields.StoppingTime).SI<Second>(), + AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), + AngularVelocity = row.ParseDoubleOrGetDefault(Fields.EngineSpeed).RPMtoRad(), + Gear = (uint)row.ParseDoubleOrGetDefault(Fields.Gear), + AirSpeedRelativeToVehicle = + crossWindRequired ? row.ParseDouble(Fields.AirSpeedRelativeToVehicle).KMPHtoMeterPerSecond() : null, + WindYawAngle = crossWindRequired ? row.ParseDoubleOrGetDefault(Fields.WindYawAngle) : 0, + AuxiliarySupplyPower = row.GetAuxiliaries(), + PTOActive = table.Columns.Contains(Fields.PTOActive) && row.Field<string>(Fields.PTOActive) == "1" + }); + } + + public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) + { + var requiredCols = new[] { + Fields.Distance, + Fields.VehicleSpeed, + Fields.StoppingTime + }; + + var allowedCols = new[] { + Fields.Distance, + Fields.VehicleSpeed, + Fields.StoppingTime, + Fields.AdditionalAuxPowerDemand, + Fields.RoadGradient, + Fields.AirSpeedRelativeToVehicle, + Fields.WindYawAngle, + Fields.PTOActive + }; + + const bool allowAux = true; + + return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux) && + CheckComboColumns(header, new[] { Fields.AirSpeedRelativeToVehicle, Fields.WindYawAngle }, throwExceptions); + } + } + + /// <summary> + /// Parser for EngineOnly Cycles. + /// </summary> + // <t>, <n>, (<Pe>|<Me>)[, <Padd>] + private class EngineOnlyCycleDataParser : AbstractCycleDataParser + { + public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) + { + ValidateHeader(table.Columns); + + var absTime = 0; + foreach (DataRow row in table.Rows) { + var entry = new DrivingCycleData.DrivingCycleEntry { + Time = row.ParseDoubleOrGetDefault(Fields.Time, absTime).SI<Second>(), + AngularVelocity = row.ParseDoubleOrGetDefault(Fields.EngineSpeed).RPMtoRad(), + AdditionalAuxPowerDemand = + row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), + AuxiliarySupplyPower = row.GetAuxiliaries() + }; + + if (row.Table.Columns.Contains(Fields.EngineTorque)) { + if (row.Field<string>(Fields.EngineTorque).Equals("<DRAG>")) { + entry.Drag = true; + } else { + entry.Torque = row.ParseDouble(Fields.EngineTorque).SI<NewtonMeter>(); + } + } else { + if (row.Field<string>(Fields.EnginePower).Equals("<DRAG>")) { + entry.Drag = true; + } else { + entry.Torque = row.ParseDouble(Fields.EnginePower).SI().Kilo.Watt.Cast<Watt>() / entry.AngularVelocity; + } + } + absTime += 1; + + yield return entry; + } + } + + public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) + { + var requiredCols = new[] { + //Fields.Time not needed --> if missing 1 second resolution is assumed + Fields.EngineSpeed + }; + + var allowedCols = new[] { + Fields.Time, + Fields.EngineSpeed, + Fields.EngineTorque, + Fields.EnginePower, + Fields.AdditionalAuxPowerDemand + }; + + const bool allowAux = false; + + if (!CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux)) { + return false; + } + + var containsNone = !header.Contains(Fields.EngineTorque) && !header.Contains(Fields.EnginePower); + if (containsNone) { + if (throwExceptions) { + throw new VectoException("Column(s) missing: Either column '{0}' or column '{1}' must be defined.", + Fields.EngineTorque, Fields.EnginePower); + } + return false; + } + + var containsBoth = header.Contains(Fields.EngineTorque) && header.Contains(Fields.EnginePower); + if (containsBoth) { + LogManager.GetLogger(typeof(EngineOnlyCycleDataParser).FullName) + .Warn("Found column '{0}' and column '{1}': Only column '{0}' will be used.", + Fields.EngineTorque, Fields.EnginePower); + } + return true; + } + } + + /// <summary> + /// Parser for PWheel (SiCo) Mode. + /// </summary> + // <t>, <Pwheel>, <Gear>, <n>, <Padd> + private class PWheelCycleDataParser : AbstractCycleDataParser + { + public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) + { + ValidateHeader(table.Columns); + + var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { + Time = row.ParseDouble(Fields.Time).SI<Second>(), + PWheel = row.ParseDouble(Fields.PWheel).SI().Kilo.Watt.Cast<Watt>(), + Gear = (uint)row.ParseDouble(Fields.Gear), + AngularVelocity = row.ParseDouble(Fields.EngineSpeed).RPMtoRad(), + AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), + }).ToArray(); + + return entries; + } + + public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) + { + var requiredCols = new[] { + Fields.Time, + Fields.PWheel, + Fields.Gear, + Fields.EngineSpeed + }; + var allowedCols = new[] { + Fields.Time, + Fields.PWheel, + Fields.Gear, + Fields.EngineSpeed, + Fields.AdditionalAuxPowerDemand + }; + + return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux: false); + } + } + + /// <summary> + /// Parser for Measured Speed Mode Option 1. + /// </summary> + // <t>, <v>[, <grad>, <Padd>, <vair_res>, <vair_beta>, Aux_...] + private class MeasuredSpeedDataParser : AbstractCycleDataParser + { + public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) + { + ValidateHeader(table.Columns); + + var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { + Time = row.ParseDouble(Fields.Time).SI<Second>(), + VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), + RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), + AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), + AirSpeedRelativeToVehicle = + crossWindRequired ? row.ParseDouble(Fields.AirSpeedRelativeToVehicle).KMPHtoMeterPerSecond() : null, + WindYawAngle = crossWindRequired ? row.ParseDouble(Fields.WindYawAngle) : 0, + AuxiliarySupplyPower = row.GetAuxiliaries() + }).ToArray(); + + return entries; + } + + public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) + { + var requiredCols = new[] { + Fields.Time, + Fields.VehicleSpeed + }; + + var allowedCols = new[] { + Fields.Time, + Fields.VehicleSpeed, + Fields.AdditionalAuxPowerDemand, + Fields.RoadGradient, + Fields.AirSpeedRelativeToVehicle, + Fields.WindYawAngle + }; + + const bool allowAux = true; + + return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux) && + CheckComboColumns(header, new[] { Fields.AirSpeedRelativeToVehicle, Fields.WindYawAngle }, throwExceptions); + } + } + + /// <summary> + /// Parser for Measured Speed Mode Option 2. + /// </summary> + // <t>, <v>, <n>, <gear>[, <tc_active>, <grad>, <Padd>, <vair_res>, <vair_beta>, Aux_...] + private class MeasuredSpeedGearDataParser : AbstractCycleDataParser + { + public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) + { + ValidateHeader(table.Columns); + + var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { + Time = row.ParseDouble(Fields.Time).SI<Second>(), + VehicleTargetSpeed = row.ParseDouble(Fields.VehicleSpeed).KMPHtoMeterPerSecond(), + RoadGradient = VectoMath.InclinationToAngle(row.ParseDoubleOrGetDefault(Fields.RoadGradient) / 100.0), + AdditionalAuxPowerDemand = row.ParseDoubleOrGetDefault(Fields.AdditionalAuxPowerDemand).SI().Kilo.Watt.Cast<Watt>(), + AngularVelocity = row.ParseDoubleOrGetDefault(Fields.EngineSpeed).RPMtoRad(), + Gear = (uint)row.ParseDouble(Fields.Gear), + TorqueConverterActive = table.Columns.Contains(Fields.TorqueConverterActive) + ? row.ParseBoolean(Fields.TorqueConverterActive) + : (bool?)null, + AirSpeedRelativeToVehicle = crossWindRequired + ? row.ParseDouble(Fields.AirSpeedRelativeToVehicle).KMPHtoMeterPerSecond() + : null, + WindYawAngle = crossWindRequired ? row.ParseDoubleOrGetDefault(Fields.WindYawAngle) : 0, + AuxiliarySupplyPower = row.GetAuxiliaries() + }).ToArray(); + + return entries; + } + + public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) + { + var requiredCols = new[] { + Fields.Time, + Fields.VehicleSpeed, + Fields.Gear + }; + var allowedCols = new[] { + Fields.Time, + Fields.VehicleSpeed, + Fields.EngineSpeed, + Fields.Gear, + Fields.TorqueConverterActive, + Fields.AdditionalAuxPowerDemand, + Fields.RoadGradient, + Fields.AirSpeedRelativeToVehicle, + Fields.WindYawAngle + }; + + const bool allowAux = true; + + return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux) && + CheckComboColumns(header, new[] { Fields.AirSpeedRelativeToVehicle, Fields.WindYawAngle }, throwExceptions); + } + } + + /// <summary> + /// Parser for PTO Cycles. + /// </summary> + // <t> [s], <Engine Speed> [rpm], <PTO Torque> [Nm] + private class PTOCycleDataParser : AbstractCycleDataParser + { + public override IEnumerable<DrivingCycleData.DrivingCycleEntry> Parse(DataTable table, bool crossWindRequired) + { + ValidateHeader(table.Columns); + + var entries = table.Rows.Cast<DataRow>().Select(row => new DrivingCycleData.DrivingCycleEntry { + Time = row.ParseDouble(Fields.Time).SI<Second>(), + AngularVelocity = row.ParseDouble(Fields.EngineSpeedFull).RPMtoRad(), + Torque = row.ParseDouble(Fields.PTOTorque).SI<NewtonMeter>() + }).ToArray(); + + return entries; + } + + public static bool ValidateHeader(DataColumnCollection header, bool throwExceptions = true) + { + var requiredCols = new[] { + Fields.Time, + Fields.EngineSpeedFull, + Fields.PTOTorque + }; + var allowedCols = new[] { + Fields.Time, + Fields.EngineSpeedFull, + Fields.PTOTorque + }; + + const bool allowAux = false; + + return CheckColumns(header, allowedCols, requiredCols, throwExceptions, allowAux); + } + } + } + + #endregion } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs b/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs index dca2a2c2b7d73f5648178f329a8e313f94cef61d..c8eb1db895ba4625d37aecdc695a38ebbcfa893e 100644 --- a/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/FullLoadCurveReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs index 19ce6d7b24031f9b9c244b8a5658a639fe92bd41..99b9a05a567f7fdae998099264f16f84e5a7ae94 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DeclarationModeVectoRunDataFactory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs b/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs index 2759be4d7c6f04f8b6865a409d7db111d1dc8cb3..8569f8018550c90a17f8b70de99b314d7bd423a2 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/DrivingCycleProxy.cs @@ -1,61 +1,61 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.Linq; -using TUGraz.VectoCore.Models.SimulationComponent.Data; - -namespace TUGraz.VectoCore.InputData.Reader.Impl -{ - public class DrivingCycleProxy : IDrivingCycleData - { - public DrivingCycleProxy(DrivingCycleData cycle, string name) - { - Name = name; - CycleType = cycle.CycleType; - Entries = cycle.Entries; - } - - public List<DrivingCycleData.DrivingCycleEntry> Entries { get; private set; } - - public string Name { get; private set; } - - public CycleType CycleType { get; private set; } - - public void Finish() - { - Entries = new List<DrivingCycleData.DrivingCycleEntry>() { - Entries.First(), - Entries.Last() - }; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.InputData.Reader.Impl +{ + public class DrivingCycleProxy : IDrivingCycleData + { + public DrivingCycleProxy(DrivingCycleData cycle, string name) + { + Name = name; + CycleType = cycle.CycleType; + Entries = cycle.Entries; + } + + public List<DrivingCycleData.DrivingCycleEntry> Entries { get; private set; } + + public string Name { get; private set; } + + public CycleType CycleType { get; private set; } + + public void Finish() + { + Entries = new List<DrivingCycleData.DrivingCycleEntry>() { + Entries.First(), + Entries.Last() + }; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/EngineOnlyVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/EngineOnlyVectoRunDataFactory.cs index d5c91e579d67c63b7c5a4b38d7e59ad716ccd913..6b0e0fe5f8909d62f7466d997f2195af0914d95b 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/EngineOnlyVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/EngineOnlyVectoRunDataFactory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs index f16c058a67a08083728de558d540c4457639851b..9a1a7935dbb04f8c4b24252b2334b0d3601559bb 100644 --- a/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs +++ b/VectoCore/VectoCore/InputData/Reader/Impl/EngineeringModeVectoRunDataFactory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Linq; using System.Runtime.CompilerServices; diff --git a/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs b/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs index c38b34afd9a052c9193f07ec184f20c98e42616f..b4534b88271947b8ae7fee9563f52afbbf2aa977 100644 --- a/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ShiftPolygonReader.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/JsonKeys.Designer.cs b/VectoCore/VectoCore/JsonKeys.Designer.cs index 47d36fd960165ed72fe038a70fbd12c2aea2ed1d..38e4ec913c44dd21c042cee6a8fd15f12f53f598 100644 --- a/VectoCore/VectoCore/JsonKeys.Designer.cs +++ b/VectoCore/VectoCore/JsonKeys.Designer.cs @@ -1,849 +1,849 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCore { - using System; - - - /// <summary> - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. - /// </summary> - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class JsonKeys { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal JsonKeys() { - } - - /// <summary> - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TUGraz.VectoCore.JsonKeys", typeof(JsonKeys).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// <summary> - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. - /// </summary> - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die VACC ähnelt. - /// </summary> - internal static string DriverData_AccelerationCurve { - get { - return ResourceManager.GetString("DriverData_AccelerationCurve", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Dec ähnelt. - /// </summary> - internal static string DriverData_Lookahead_Deceleration { - get { - return ResourceManager.GetString("DriverData_Lookahead_Deceleration", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Enabled ähnelt. - /// </summary> - internal static string DriverData_Lookahead_Enabled { - get { - return ResourceManager.GetString("DriverData_Lookahead_Enabled", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die MinSpeed ähnelt. - /// </summary> - internal static string DriverData_Lookahead_MinSpeed { - get { - return ResourceManager.GetString("DriverData_Lookahead_MinSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die LAC ähnelt. - /// </summary> - internal static string DriverData_LookaheadCoasting { - get { - return ResourceManager.GetString("DriverData_LookaheadCoasting", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die OverSpeedEcoRoll ähnelt. - /// </summary> - internal static string DriverData_OverspeedEcoRoll { - get { - return ResourceManager.GetString("DriverData_OverspeedEcoRoll", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die MinSpeed ähnelt. - /// </summary> - internal static string DriverData_OverspeedEcoRoll_MinSpeed { - get { - return ResourceManager.GetString("DriverData_OverspeedEcoRoll_MinSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Mode ähnelt. - /// </summary> - internal static string DriverData_OverspeedEcoRoll_Mode { - get { - return ResourceManager.GetString("DriverData_OverspeedEcoRoll_Mode", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die OverSpeed ähnelt. - /// </summary> - internal static string DriverData_OverspeedEcoRoll_OverSpeed { - get { - return ResourceManager.GetString("DriverData_OverspeedEcoRoll_OverSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die UnderSpeed ähnelt. - /// </summary> - internal static string DriverData_OverspeedEcoRoll_UnderSpeed { - get { - return ResourceManager.GetString("DriverData_OverspeedEcoRoll_UnderSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die StartStop ähnelt. - /// </summary> - internal static string DriverData_StartStop { - get { - return ResourceManager.GetString("DriverData_StartStop", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Delay ähnelt. - /// </summary> - internal static string DriverData_StartStop_Delay { - get { - return ResourceManager.GetString("DriverData_StartStop_Delay", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Enabled ähnelt. - /// </summary> - internal static string DriverData_StartStop_Enabled { - get { - return ResourceManager.GetString("DriverData_StartStop_Enabled", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die MaxSpeed ähnelt. - /// </summary> - internal static string DriverData_StartStop_MaxSpeed { - get { - return ResourceManager.GetString("DriverData_StartStop_MaxSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die MinTime ähnelt. - /// </summary> - internal static string DriverData_StartStop_MinTime { - get { - return ResourceManager.GetString("DriverData_StartStop_MinTime", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Displacement ähnelt. - /// </summary> - internal static string Engine_Displacement { - get { - return ResourceManager.GetString("Engine_Displacement", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die FuelMap ähnelt. - /// </summary> - internal static string Engine_FuelConsumptionMap { - get { - return ResourceManager.GetString("Engine_FuelConsumptionMap", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die FullLoadCurve ähnelt. - /// </summary> - internal static string Engine_FullLoadCurveFile { - get { - return ResourceManager.GetString("Engine_FullLoadCurveFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die IdlingSpeed ähnelt. - /// </summary> - internal static string Engine_IdleSpeed { - get { - return ResourceManager.GetString("Engine_IdleSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. - /// </summary> - internal static string Engine_Inertia { - get { - return ResourceManager.GetString("Engine_Inertia", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die ModelName ähnelt. - /// </summary> - internal static string Engine_ModelName { - get { - return ResourceManager.GetString("Engine_ModelName", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die WHTC-Motorway ähnelt. - /// </summary> - internal static string Engine_WHTC_Motorway { - get { - return ResourceManager.GetString("Engine_WHTC_Motorway", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die WHTC-Rural ähnelt. - /// </summary> - internal static string Engine_WHTC_Rural { - get { - return ResourceManager.GetString("Engine_WHTC_Rural", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die WHTC-Urban ähnelt. - /// </summary> - internal static string Engine_WHTC_Urban { - get { - return ResourceManager.GetString("Engine_WHTC_Urban", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die EaryShiftUp ähnelt. - /// </summary> - internal static string Gearbox_EarlyShiftUp { - get { - return ResourceManager.GetString("Gearbox_EarlyShiftUp", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Efficiency ähnelt. - /// </summary> - internal static string Gearbox_Gear_Efficiency { - get { - return ResourceManager.GetString("Gearbox_Gear_Efficiency", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die FullLoadCurve ähnelt. - /// </summary> - internal static string Gearbox_Gear_FullLoadCurveFile { - get { - return ResourceManager.GetString("Gearbox_Gear_FullLoadCurveFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die LossMap ähnelt. - /// </summary> - internal static string Gearbox_Gear_LossMapFile { - get { - return ResourceManager.GetString("Gearbox_Gear_LossMapFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Ratio ähnelt. - /// </summary> - internal static string Gearbox_Gear_Ratio { - get { - return ResourceManager.GetString("Gearbox_Gear_Ratio", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die ShiftPolygon ähnelt. - /// </summary> - internal static string Gearbox_Gear_ShiftPolygonFile { - get { - return ResourceManager.GetString("Gearbox_Gear_ShiftPolygonFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die TCactive ähnelt. - /// </summary> - internal static string Gearbox_Gear_TCactive { - get { - return ResourceManager.GetString("Gearbox_Gear_TCactive", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die GearboxType ähnelt. - /// </summary> - internal static string Gearbox_GearboxType { - get { - return ResourceManager.GetString("Gearbox_GearboxType", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Gears ähnelt. - /// </summary> - internal static string Gearbox_Gears { - get { - return ResourceManager.GetString("Gearbox_Gears", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. - /// </summary> - internal static string Gearbox_Inertia { - get { - return ResourceManager.GetString("Gearbox_Inertia", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die ModelName ähnelt. - /// </summary> - internal static string Gearbox_ModelName { - get { - return ResourceManager.GetString("Gearbox_ModelName", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die ShiftTime ähnelt. - /// </summary> - internal static string Gearbox_ShiftTime { - get { - return ResourceManager.GetString("Gearbox_ShiftTime", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die SkipGears ähnelt. - /// </summary> - internal static string Gearbox_SkipGears { - get { - return ResourceManager.GetString("Gearbox_SkipGears", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die StartAcc ähnelt. - /// </summary> - internal static string Gearbox_StartAcceleration { - get { - return ResourceManager.GetString("Gearbox_StartAcceleration", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die StartSpeed ähnelt. - /// </summary> - internal static string Gearbox_StartSpeed { - get { - return ResourceManager.GetString("Gearbox_StartSpeed", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die StartTqReserve ähnelt. - /// </summary> - internal static string Gearbox_StartTorqueReserve { - get { - return ResourceManager.GetString("Gearbox_StartTorqueReserve", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die TorqueConverter ähnelt. - /// </summary> - internal static string Gearbox_TorqueConverter { - get { - return ResourceManager.GetString("Gearbox_TorqueConverter", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. - /// </summary> - internal static string Gearbox_TorqueConverter_Inertia { - get { - return ResourceManager.GetString("Gearbox_TorqueConverter_Inertia", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die RefRPM ähnelt. - /// </summary> - internal static string Gearbox_TorqueConverter_ReferenceRPM { - get { - return ResourceManager.GetString("Gearbox_TorqueConverter_ReferenceRPM", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die File ähnelt. - /// </summary> - internal static string Gearbox_TorqueConverter_TCMap { - get { - return ResourceManager.GetString("Gearbox_TorqueConverter_TCMap", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die TqReserve ähnelt. - /// </summary> - internal static string Gearbox_TorqueReserve { - get { - return ResourceManager.GetString("Gearbox_TorqueReserve", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die TracInt ähnelt. - /// </summary> - internal static string Gearbox_TractionInterruption { - get { - return ResourceManager.GetString("Gearbox_TractionInterruption", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Cycles ähnelt. - /// </summary> - internal static string Job_Cycles { - get { - return ResourceManager.GetString("Job_Cycles", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die EngineOnlyMode ähnelt. - /// </summary> - internal static string Job_EngineOnlyMode { - get { - return ResourceManager.GetString("Job_EngineOnlyMode", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Body ähnelt. - /// </summary> - internal static string JsonBody { - get { - return ResourceManager.GetString("JsonBody", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Header ähnelt. - /// </summary> - internal static string JsonHeader { - get { - return ResourceManager.GetString("JsonHeader", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die FileVersion ähnelt. - /// </summary> - internal static string JsonHeader_FileVersion { - get { - return ResourceManager.GetString("JsonHeader_FileVersion", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die SavedInDeclMode ähnelt. - /// </summary> - internal static string SavedInDeclMode { - get { - return ResourceManager.GetString("SavedInDeclMode", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Angledrive ähnelt. - /// </summary> - internal static string Vehicle_Angledrive { - get { - return ResourceManager.GetString("Vehicle_Angledrive", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Efficiency ähnelt. - /// </summary> - internal static string Vehicle_Angledrive_Efficiency { - get { - return ResourceManager.GetString("Vehicle_Angledrive_Efficiency", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die LossMap ähnelt. - /// </summary> - internal static string Vehicle_Angledrive_LossMapFile { - get { - return ResourceManager.GetString("Vehicle_Angledrive_LossMapFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Ratio ähnelt. - /// </summary> - internal static string Vehicle_Angledrive_Ratio { - get { - return ResourceManager.GetString("Vehicle_Angledrive_Ratio", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. - /// </summary> - internal static string Vehicle_Angledrive_Type { - get { - return ResourceManager.GetString("Vehicle_Angledrive_Type", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die AxleConfig ähnelt. - /// </summary> - internal static string Vehicle_AxleConfiguration { - get { - return ResourceManager.GetString("Vehicle_AxleConfiguration", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Axles ähnelt. - /// </summary> - internal static string Vehicle_AxleConfiguration_Axles { - get { - return ResourceManager.GetString("Vehicle_AxleConfiguration_Axles", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. - /// </summary> - internal static string Vehicle_AxleConfiguration_Type { - get { - return ResourceManager.GetString("Vehicle_AxleConfiguration_Type", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. - /// </summary> - internal static string Vehicle_Axles_Inertia { - get { - return ResourceManager.GetString("Vehicle_Axles_Inertia", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die RRCISO ähnelt. - /// </summary> - internal static string Vehicle_Axles_RollResistanceCoefficient { - get { - return ResourceManager.GetString("Vehicle_Axles_RollResistanceCoefficient", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die TwinTyres ähnelt. - /// </summary> - internal static string Vehicle_Axles_TwinTyres { - get { - return ResourceManager.GetString("Vehicle_Axles_TwinTyres", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die FzISO ähnelt. - /// </summary> - internal static string Vehicle_Axles_TyreTestLoad { - get { - return ResourceManager.GetString("Vehicle_Axles_TyreTestLoad", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Wheels ähnelt. - /// </summary> - internal static string Vehicle_Axles_Wheels { - get { - return ResourceManager.GetString("Vehicle_Axles_Wheels", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die CurbWeight ähnelt. - /// </summary> - internal static string Vehicle_CurbWeight { - get { - return ResourceManager.GetString("Vehicle_CurbWeight", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die CurbWeightExtra ähnelt. - /// </summary> - internal static string Vehicle_CurbWeightExtra { - get { - return ResourceManager.GetString("Vehicle_CurbWeightExtra", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die CdA ähnelt. - /// </summary> - internal static string Vehicle_DragCoefficient { - get { - return ResourceManager.GetString("Vehicle_DragCoefficient", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die CdA2 ähnelt. - /// </summary> - internal static string Vehicle_DragCoefficientRigidTruck { - get { - return ResourceManager.GetString("Vehicle_DragCoefficientRigidTruck", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die rdyn ähnelt. - /// </summary> - internal static string Vehicle_DynamicTyreRadius { - get { - return ResourceManager.GetString("Vehicle_DynamicTyreRadius", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die EngineFile ähnelt. - /// </summary> - internal static string Vehicle_EngineFile { - get { - return ResourceManager.GetString("Vehicle_EngineFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die GearboxFile ähnelt. - /// </summary> - internal static string Vehicle_GearboxFile { - get { - return ResourceManager.GetString("Vehicle_GearboxFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die MassMax ähnelt. - /// </summary> - internal static string Vehicle_GrossVehicleMassRating { - get { - return ResourceManager.GetString("Vehicle_GrossVehicleMassRating", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Loading ähnelt. - /// </summary> - internal static string Vehicle_Loading { - get { - return ResourceManager.GetString("Vehicle_Loading", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die PTO ähnelt. - /// </summary> - internal static string Vehicle_PTO { - get { - return ResourceManager.GetString("Vehicle_PTO", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Cycle ähnelt. - /// </summary> - internal static string Vehicle_PTO_Cycle { - get { - return ResourceManager.GetString("Vehicle_PTO_Cycle", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die LossMap ähnelt. - /// </summary> - internal static string Vehicle_PTO_LossMapFile { - get { - return ResourceManager.GetString("Vehicle_PTO_LossMapFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. - /// </summary> - internal static string Vehicle_PTO_Type { - get { - return ResourceManager.GetString("Vehicle_PTO_Type", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Retarder ähnelt. - /// </summary> - internal static string Vehicle_Retarder { - get { - return ResourceManager.GetString("Vehicle_Retarder", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die File ähnelt. - /// </summary> - internal static string Vehicle_Retarder_LossMapFile { - get { - return ResourceManager.GetString("Vehicle_Retarder_LossMapFile", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Ratio ähnelt. - /// </summary> - internal static string Vehicle_Retarder_Ratio { - get { - return ResourceManager.GetString("Vehicle_Retarder_Ratio", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. - /// </summary> - internal static string Vehicle_Retarder_Type { - get { - return ResourceManager.GetString("Vehicle_Retarder_Type", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die Rim ähnelt. - /// </summary> - internal static string Vehicle_Rim { - get { - return ResourceManager.GetString("Vehicle_Rim", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die VehCat ähnelt. - /// </summary> - internal static string Vehicle_VehicleCategory { - get { - return ResourceManager.GetString("Vehicle_VehicleCategory", resourceCulture); - } - } - - /// <summary> - /// Sucht eine lokalisierte Zeichenfolge, die VehicleFile ähnelt. - /// </summary> - internal static string Vehicle_VehicleFile { - get { - return ResourceManager.GetString("Vehicle_VehicleFile", resourceCulture); - } - } - } -} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCore { + using System; + + + /// <summary> + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// </summary> + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class JsonKeys { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal JsonKeys() { + } + + /// <summary> + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TUGraz.VectoCore.JsonKeys", typeof(JsonKeys).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die VACC ähnelt. + /// </summary> + internal static string DriverData_AccelerationCurve { + get { + return ResourceManager.GetString("DriverData_AccelerationCurve", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Dec ähnelt. + /// </summary> + internal static string DriverData_Lookahead_Deceleration { + get { + return ResourceManager.GetString("DriverData_Lookahead_Deceleration", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Enabled ähnelt. + /// </summary> + internal static string DriverData_Lookahead_Enabled { + get { + return ResourceManager.GetString("DriverData_Lookahead_Enabled", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die MinSpeed ähnelt. + /// </summary> + internal static string DriverData_Lookahead_MinSpeed { + get { + return ResourceManager.GetString("DriverData_Lookahead_MinSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die LAC ähnelt. + /// </summary> + internal static string DriverData_LookaheadCoasting { + get { + return ResourceManager.GetString("DriverData_LookaheadCoasting", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die OverSpeedEcoRoll ähnelt. + /// </summary> + internal static string DriverData_OverspeedEcoRoll { + get { + return ResourceManager.GetString("DriverData_OverspeedEcoRoll", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die MinSpeed ähnelt. + /// </summary> + internal static string DriverData_OverspeedEcoRoll_MinSpeed { + get { + return ResourceManager.GetString("DriverData_OverspeedEcoRoll_MinSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Mode ähnelt. + /// </summary> + internal static string DriverData_OverspeedEcoRoll_Mode { + get { + return ResourceManager.GetString("DriverData_OverspeedEcoRoll_Mode", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die OverSpeed ähnelt. + /// </summary> + internal static string DriverData_OverspeedEcoRoll_OverSpeed { + get { + return ResourceManager.GetString("DriverData_OverspeedEcoRoll_OverSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die UnderSpeed ähnelt. + /// </summary> + internal static string DriverData_OverspeedEcoRoll_UnderSpeed { + get { + return ResourceManager.GetString("DriverData_OverspeedEcoRoll_UnderSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die StartStop ähnelt. + /// </summary> + internal static string DriverData_StartStop { + get { + return ResourceManager.GetString("DriverData_StartStop", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Delay ähnelt. + /// </summary> + internal static string DriverData_StartStop_Delay { + get { + return ResourceManager.GetString("DriverData_StartStop_Delay", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Enabled ähnelt. + /// </summary> + internal static string DriverData_StartStop_Enabled { + get { + return ResourceManager.GetString("DriverData_StartStop_Enabled", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die MaxSpeed ähnelt. + /// </summary> + internal static string DriverData_StartStop_MaxSpeed { + get { + return ResourceManager.GetString("DriverData_StartStop_MaxSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die MinTime ähnelt. + /// </summary> + internal static string DriverData_StartStop_MinTime { + get { + return ResourceManager.GetString("DriverData_StartStop_MinTime", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Displacement ähnelt. + /// </summary> + internal static string Engine_Displacement { + get { + return ResourceManager.GetString("Engine_Displacement", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die FuelMap ähnelt. + /// </summary> + internal static string Engine_FuelConsumptionMap { + get { + return ResourceManager.GetString("Engine_FuelConsumptionMap", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die FullLoadCurve ähnelt. + /// </summary> + internal static string Engine_FullLoadCurveFile { + get { + return ResourceManager.GetString("Engine_FullLoadCurveFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die IdlingSpeed ähnelt. + /// </summary> + internal static string Engine_IdleSpeed { + get { + return ResourceManager.GetString("Engine_IdleSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. + /// </summary> + internal static string Engine_Inertia { + get { + return ResourceManager.GetString("Engine_Inertia", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die ModelName ähnelt. + /// </summary> + internal static string Engine_ModelName { + get { + return ResourceManager.GetString("Engine_ModelName", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die WHTC-Motorway ähnelt. + /// </summary> + internal static string Engine_WHTC_Motorway { + get { + return ResourceManager.GetString("Engine_WHTC_Motorway", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die WHTC-Rural ähnelt. + /// </summary> + internal static string Engine_WHTC_Rural { + get { + return ResourceManager.GetString("Engine_WHTC_Rural", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die WHTC-Urban ähnelt. + /// </summary> + internal static string Engine_WHTC_Urban { + get { + return ResourceManager.GetString("Engine_WHTC_Urban", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die EaryShiftUp ähnelt. + /// </summary> + internal static string Gearbox_EarlyShiftUp { + get { + return ResourceManager.GetString("Gearbox_EarlyShiftUp", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Efficiency ähnelt. + /// </summary> + internal static string Gearbox_Gear_Efficiency { + get { + return ResourceManager.GetString("Gearbox_Gear_Efficiency", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die FullLoadCurve ähnelt. + /// </summary> + internal static string Gearbox_Gear_FullLoadCurveFile { + get { + return ResourceManager.GetString("Gearbox_Gear_FullLoadCurveFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die LossMap ähnelt. + /// </summary> + internal static string Gearbox_Gear_LossMapFile { + get { + return ResourceManager.GetString("Gearbox_Gear_LossMapFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Ratio ähnelt. + /// </summary> + internal static string Gearbox_Gear_Ratio { + get { + return ResourceManager.GetString("Gearbox_Gear_Ratio", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die ShiftPolygon ähnelt. + /// </summary> + internal static string Gearbox_Gear_ShiftPolygonFile { + get { + return ResourceManager.GetString("Gearbox_Gear_ShiftPolygonFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die TCactive ähnelt. + /// </summary> + internal static string Gearbox_Gear_TCactive { + get { + return ResourceManager.GetString("Gearbox_Gear_TCactive", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die GearboxType ähnelt. + /// </summary> + internal static string Gearbox_GearboxType { + get { + return ResourceManager.GetString("Gearbox_GearboxType", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Gears ähnelt. + /// </summary> + internal static string Gearbox_Gears { + get { + return ResourceManager.GetString("Gearbox_Gears", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. + /// </summary> + internal static string Gearbox_Inertia { + get { + return ResourceManager.GetString("Gearbox_Inertia", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die ModelName ähnelt. + /// </summary> + internal static string Gearbox_ModelName { + get { + return ResourceManager.GetString("Gearbox_ModelName", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die ShiftTime ähnelt. + /// </summary> + internal static string Gearbox_ShiftTime { + get { + return ResourceManager.GetString("Gearbox_ShiftTime", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die SkipGears ähnelt. + /// </summary> + internal static string Gearbox_SkipGears { + get { + return ResourceManager.GetString("Gearbox_SkipGears", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die StartAcc ähnelt. + /// </summary> + internal static string Gearbox_StartAcceleration { + get { + return ResourceManager.GetString("Gearbox_StartAcceleration", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die StartSpeed ähnelt. + /// </summary> + internal static string Gearbox_StartSpeed { + get { + return ResourceManager.GetString("Gearbox_StartSpeed", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die StartTqReserve ähnelt. + /// </summary> + internal static string Gearbox_StartTorqueReserve { + get { + return ResourceManager.GetString("Gearbox_StartTorqueReserve", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die TorqueConverter ähnelt. + /// </summary> + internal static string Gearbox_TorqueConverter { + get { + return ResourceManager.GetString("Gearbox_TorqueConverter", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. + /// </summary> + internal static string Gearbox_TorqueConverter_Inertia { + get { + return ResourceManager.GetString("Gearbox_TorqueConverter_Inertia", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die RefRPM ähnelt. + /// </summary> + internal static string Gearbox_TorqueConverter_ReferenceRPM { + get { + return ResourceManager.GetString("Gearbox_TorqueConverter_ReferenceRPM", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die File ähnelt. + /// </summary> + internal static string Gearbox_TorqueConverter_TCMap { + get { + return ResourceManager.GetString("Gearbox_TorqueConverter_TCMap", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die TqReserve ähnelt. + /// </summary> + internal static string Gearbox_TorqueReserve { + get { + return ResourceManager.GetString("Gearbox_TorqueReserve", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die TracInt ähnelt. + /// </summary> + internal static string Gearbox_TractionInterruption { + get { + return ResourceManager.GetString("Gearbox_TractionInterruption", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Cycles ähnelt. + /// </summary> + internal static string Job_Cycles { + get { + return ResourceManager.GetString("Job_Cycles", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die EngineOnlyMode ähnelt. + /// </summary> + internal static string Job_EngineOnlyMode { + get { + return ResourceManager.GetString("Job_EngineOnlyMode", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Body ähnelt. + /// </summary> + internal static string JsonBody { + get { + return ResourceManager.GetString("JsonBody", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Header ähnelt. + /// </summary> + internal static string JsonHeader { + get { + return ResourceManager.GetString("JsonHeader", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die FileVersion ähnelt. + /// </summary> + internal static string JsonHeader_FileVersion { + get { + return ResourceManager.GetString("JsonHeader_FileVersion", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die SavedInDeclMode ähnelt. + /// </summary> + internal static string SavedInDeclMode { + get { + return ResourceManager.GetString("SavedInDeclMode", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Angledrive ähnelt. + /// </summary> + internal static string Vehicle_Angledrive { + get { + return ResourceManager.GetString("Vehicle_Angledrive", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Efficiency ähnelt. + /// </summary> + internal static string Vehicle_Angledrive_Efficiency { + get { + return ResourceManager.GetString("Vehicle_Angledrive_Efficiency", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die LossMap ähnelt. + /// </summary> + internal static string Vehicle_Angledrive_LossMapFile { + get { + return ResourceManager.GetString("Vehicle_Angledrive_LossMapFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Ratio ähnelt. + /// </summary> + internal static string Vehicle_Angledrive_Ratio { + get { + return ResourceManager.GetString("Vehicle_Angledrive_Ratio", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. + /// </summary> + internal static string Vehicle_Angledrive_Type { + get { + return ResourceManager.GetString("Vehicle_Angledrive_Type", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die AxleConfig ähnelt. + /// </summary> + internal static string Vehicle_AxleConfiguration { + get { + return ResourceManager.GetString("Vehicle_AxleConfiguration", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Axles ähnelt. + /// </summary> + internal static string Vehicle_AxleConfiguration_Axles { + get { + return ResourceManager.GetString("Vehicle_AxleConfiguration_Axles", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. + /// </summary> + internal static string Vehicle_AxleConfiguration_Type { + get { + return ResourceManager.GetString("Vehicle_AxleConfiguration_Type", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Inertia ähnelt. + /// </summary> + internal static string Vehicle_Axles_Inertia { + get { + return ResourceManager.GetString("Vehicle_Axles_Inertia", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die RRCISO ähnelt. + /// </summary> + internal static string Vehicle_Axles_RollResistanceCoefficient { + get { + return ResourceManager.GetString("Vehicle_Axles_RollResistanceCoefficient", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die TwinTyres ähnelt. + /// </summary> + internal static string Vehicle_Axles_TwinTyres { + get { + return ResourceManager.GetString("Vehicle_Axles_TwinTyres", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die FzISO ähnelt. + /// </summary> + internal static string Vehicle_Axles_TyreTestLoad { + get { + return ResourceManager.GetString("Vehicle_Axles_TyreTestLoad", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Wheels ähnelt. + /// </summary> + internal static string Vehicle_Axles_Wheels { + get { + return ResourceManager.GetString("Vehicle_Axles_Wheels", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die CurbWeight ähnelt. + /// </summary> + internal static string Vehicle_CurbWeight { + get { + return ResourceManager.GetString("Vehicle_CurbWeight", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die CurbWeightExtra ähnelt. + /// </summary> + internal static string Vehicle_CurbWeightExtra { + get { + return ResourceManager.GetString("Vehicle_CurbWeightExtra", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die CdA ähnelt. + /// </summary> + internal static string Vehicle_DragCoefficient { + get { + return ResourceManager.GetString("Vehicle_DragCoefficient", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die CdA2 ähnelt. + /// </summary> + internal static string Vehicle_DragCoefficientRigidTruck { + get { + return ResourceManager.GetString("Vehicle_DragCoefficientRigidTruck", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die rdyn ähnelt. + /// </summary> + internal static string Vehicle_DynamicTyreRadius { + get { + return ResourceManager.GetString("Vehicle_DynamicTyreRadius", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die EngineFile ähnelt. + /// </summary> + internal static string Vehicle_EngineFile { + get { + return ResourceManager.GetString("Vehicle_EngineFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die GearboxFile ähnelt. + /// </summary> + internal static string Vehicle_GearboxFile { + get { + return ResourceManager.GetString("Vehicle_GearboxFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die MassMax ähnelt. + /// </summary> + internal static string Vehicle_GrossVehicleMassRating { + get { + return ResourceManager.GetString("Vehicle_GrossVehicleMassRating", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Loading ähnelt. + /// </summary> + internal static string Vehicle_Loading { + get { + return ResourceManager.GetString("Vehicle_Loading", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die PTO ähnelt. + /// </summary> + internal static string Vehicle_PTO { + get { + return ResourceManager.GetString("Vehicle_PTO", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Cycle ähnelt. + /// </summary> + internal static string Vehicle_PTO_Cycle { + get { + return ResourceManager.GetString("Vehicle_PTO_Cycle", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die LossMap ähnelt. + /// </summary> + internal static string Vehicle_PTO_LossMapFile { + get { + return ResourceManager.GetString("Vehicle_PTO_LossMapFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. + /// </summary> + internal static string Vehicle_PTO_Type { + get { + return ResourceManager.GetString("Vehicle_PTO_Type", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Retarder ähnelt. + /// </summary> + internal static string Vehicle_Retarder { + get { + return ResourceManager.GetString("Vehicle_Retarder", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die File ähnelt. + /// </summary> + internal static string Vehicle_Retarder_LossMapFile { + get { + return ResourceManager.GetString("Vehicle_Retarder_LossMapFile", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Ratio ähnelt. + /// </summary> + internal static string Vehicle_Retarder_Ratio { + get { + return ResourceManager.GetString("Vehicle_Retarder_Ratio", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Type ähnelt. + /// </summary> + internal static string Vehicle_Retarder_Type { + get { + return ResourceManager.GetString("Vehicle_Retarder_Type", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die Rim ähnelt. + /// </summary> + internal static string Vehicle_Rim { + get { + return ResourceManager.GetString("Vehicle_Rim", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die VehCat ähnelt. + /// </summary> + internal static string Vehicle_VehicleCategory { + get { + return ResourceManager.GetString("Vehicle_VehicleCategory", resourceCulture); + } + } + + /// <summary> + /// Sucht eine lokalisierte Zeichenfolge, die VehicleFile ähnelt. + /// </summary> + internal static string Vehicle_VehicleFile { + get { + return ResourceManager.GetString("Vehicle_VehicleFile", resourceCulture); + } + } + } +} diff --git a/VectoCore/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs b/VectoCore/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs index cf5034ef7485621dbfa03a03787c791532e145b8..eda96750fedb112efcc16e3f89baba1b041fddd7 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/IDriverDemandPort.cs @@ -1,99 +1,99 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - /// <summary> - /// Defines a method to acquire an DriverDemand in port. - /// </summary> - public interface IDriverDemandInProvider - { - /// <summary> - /// Returns the inport to connect it to another outport. - /// </summary> - /// <returns></returns> - IDriverDemandInPort InPort(); - } - - /// <summary> - /// Defines a method to acquire an DriverDemand out port. - /// </summary> - public interface IDriverDemandOutProvider - { - /// <summary> - /// Returns the outport to send requests to. - /// </summary> - /// <returns></returns> - IDriverDemandOutPort OutPort(); - } - - //=============================================== - - - /// <summary> - /// Defines a connect method to connect the inport to an outport. - /// </summary> - public interface IDriverDemandInPort - { - /// <summary> - /// Connects the inport to another outport. - /// </summary> - void Connect(IDriverDemandOutPort other); - } - - /// <summary> - /// Defines a request method for a DriverDemand-Out-Port. - /// </summary> - public interface IDriverDemandOutPort - { - IResponse Request(Second absTime, Second dt, MeterPerSquareSecond acceleration, Radian gradient, bool dryRun = false); - - /// <summary> - /// Initialize the powertrain component to drive at the given steady state - /// </summary> - /// <param name="vehicleSpeed"></param> - /// <param name="roadGradient"></param> - /// <returns></returns> - IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient); - - /// <summary> - /// Pre-Initialize the powertrain when the vehicle is stopped with an assumed start acceleration to find correct drive-off gear - /// </summary> - /// <param name="vehicleSpeed"></param> - /// <param name="startAcceleration"></param> - /// <param name="roadGradient"></param> - /// <returns></returns> - IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an DriverDemand in port. + /// </summary> + public interface IDriverDemandInProvider + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + /// <returns></returns> + IDriverDemandInPort InPort(); + } + + /// <summary> + /// Defines a method to acquire an DriverDemand out port. + /// </summary> + public interface IDriverDemandOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + IDriverDemandOutPort OutPort(); + } + + //=============================================== + + + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface IDriverDemandInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(IDriverDemandOutPort other); + } + + /// <summary> + /// Defines a request method for a DriverDemand-Out-Port. + /// </summary> + public interface IDriverDemandOutPort + { + IResponse Request(Second absTime, Second dt, MeterPerSquareSecond acceleration, Radian gradient, bool dryRun = false); + + /// <summary> + /// Initialize the powertrain component to drive at the given steady state + /// </summary> + /// <param name="vehicleSpeed"></param> + /// <param name="roadGradient"></param> + /// <returns></returns> + IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient); + + /// <summary> + /// Pre-Initialize the powertrain when the vehicle is stopped with an assumed start acceleration to find correct drive-off gear + /// </summary> + /// <param name="vehicleSpeed"></param> + /// <param name="startAcceleration"></param> + /// <param name="roadGradient"></param> + /// <returns></returns> + IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs b/VectoCore/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs index 523f40c4cf5a003ea4d3edff3e6e571876e5e172..f4fc189dbd2389d0177aef99d2fe5cd8f6f4382e 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/IDrivingCyclePort.cs @@ -1,105 +1,105 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - /// <summary> - /// Defines a method to acquire an DriverDemand in port. - /// </summary> - public interface IDrivingCycleInProvider - { - /// <summary> - /// Returns the inport to connect it to another outport. - /// </summary> - /// <returns></returns> - IDrivingCycleInPort InPort(); - } - - /// <summary> - /// Defines a method to acquire an DriverDemand out port. - /// </summary> - public interface IDrivingCycleOutProvider - { - /// <summary> - /// Returns the outport to send requests to. - /// </summary> - /// <returns></returns> - IDrivingCycleOutPort OutPort(); - } - - - //============================================================= - - - /// <summary> - /// Defines a connect method to connect the inport to an outport. - /// </summary> - public interface IDrivingCycleInPort - { - /// <summary> - /// Connects the inport to another outport. - /// </summary> - void Connect(IDrivingCycleOutPort other); - } - - /// <summary> - /// Defines a request method for a DriverDemand-Out-Port. - /// </summary> - public interface IDrivingCycleOutPort - { - /// <summary> - /// Requests the Outport with the given velocity [m/s] and road gradient [rad]. - /// </summary> - /// <param name="absTime">[s]</param> - /// <param name="ds"></param> - /// <param name="targetVelocity">[m/s]</param> - /// <param name="gradient">[rad]</param> - IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient); - - /// <summary> - /// Requests the outport to simulate the given time interval - /// </summary> - /// <param name="absTime"></param> - /// <param name="dt"></param> - /// <param name="targetVelocity"></param> - /// <param name="gradient"></param> - /// <returns></returns> - IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient); - - IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient); - - - IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an DriverDemand in port. + /// </summary> + public interface IDrivingCycleInProvider + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + /// <returns></returns> + IDrivingCycleInPort InPort(); + } + + /// <summary> + /// Defines a method to acquire an DriverDemand out port. + /// </summary> + public interface IDrivingCycleOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + IDrivingCycleOutPort OutPort(); + } + + + //============================================================= + + + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface IDrivingCycleInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(IDrivingCycleOutPort other); + } + + /// <summary> + /// Defines a request method for a DriverDemand-Out-Port. + /// </summary> + public interface IDrivingCycleOutPort + { + /// <summary> + /// Requests the Outport with the given velocity [m/s] and road gradient [rad]. + /// </summary> + /// <param name="absTime">[s]</param> + /// <param name="ds"></param> + /// <param name="targetVelocity">[m/s]</param> + /// <param name="gradient">[rad]</param> + IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient); + + /// <summary> + /// Requests the outport to simulate the given time interval + /// </summary> + /// <param name="absTime"></param> + /// <param name="dt"></param> + /// <param name="targetVelocity"></param> + /// <param name="gradient"></param> + /// <returns></returns> + IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient); + + IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient); + + + IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Connector/Ports/IFvPort.cs b/VectoCore/VectoCore/Models/Connector/Ports/IFvPort.cs index f3a0e1a5e1ec736b176aa2654cbfb2922321d432..2270e226fff480077a036ca0565ce82e41941bfa 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/IFvPort.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/IFvPort.cs @@ -1,92 +1,92 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - /// <summary> - /// Defines a method to acquire an Fv in port. - /// </summary> - public interface IFvInProvider - { - /// <summary> - /// Returns the inport to connect it to another outport. - /// </summary> - /// <returns></returns> - IFvInPort InPort(); - } - - /// <summary> - /// Defines a method to acquire an Fv out port. - /// </summary> - public interface IFvOutProvider - { - /// <summary> - /// Returns the outport to send requests to. - /// </summary> - /// <returns></returns> - IFvOutPort OutPort(); - } - - // ================================================== - - - /// <summary> - /// Defines a connect method to connect the inport to an outport. - /// </summary> - public interface IFvInPort - { - /// <summary> - /// Connects the inport to another outport. - /// </summary> - void Connect(IFvOutPort other); - } - - /// <summary> - /// Defines a request method for a Fv-Out-Port. - /// </summary> - public interface IFvOutPort - { - /// <summary> - /// Requests the Outport with the given force [N] and vehicle velocity [m/s]. - /// </summary> - /// <param name="absTime">[s]</param> - /// <param name="dt">[s]</param> - /// <param name="force">[N]</param> - /// <param name="velocity">[m/s]</param> - /// <param name="dryRun"></param> - IResponse Request(Second absTime, Second dt, Newton force, MeterPerSecond velocity, bool dryRun = false); - - IResponse Initialize(Newton vehicleForce, MeterPerSecond vehicleSpeed); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an Fv in port. + /// </summary> + public interface IFvInProvider + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + /// <returns></returns> + IFvInPort InPort(); + } + + /// <summary> + /// Defines a method to acquire an Fv out port. + /// </summary> + public interface IFvOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + IFvOutPort OutPort(); + } + + // ================================================== + + + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface IFvInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(IFvOutPort other); + } + + /// <summary> + /// Defines a request method for a Fv-Out-Port. + /// </summary> + public interface IFvOutPort + { + /// <summary> + /// Requests the Outport with the given force [N] and vehicle velocity [m/s]. + /// </summary> + /// <param name="absTime">[s]</param> + /// <param name="dt">[s]</param> + /// <param name="force">[N]</param> + /// <param name="velocity">[m/s]</param> + /// <param name="dryRun"></param> + IResponse Request(Second absTime, Second dt, Newton force, MeterPerSecond velocity, bool dryRun = false); + + IResponse Initialize(Newton vehicleForce, MeterPerSecond vehicleSpeed); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Connector/Ports/ISimulationPort.cs b/VectoCore/VectoCore/Models/Connector/Ports/ISimulationPort.cs index 1a47f3d5b9fc215ce695906dd358fec98310b8a3..c2dd13bf19cdb2bcc0bde754a30c7f43ff93e379 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/ISimulationPort.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/ISimulationPort.cs @@ -1,70 +1,70 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - /// <summary> - /// Defines a method to acquire an DriverCycle Demand out port. - /// </summary> - public interface ISimulationOutProvider - { - /// <summary> - /// Returns the outport to send requests to. - /// </summary> - /// <returns></returns> - ISimulationOutPort OutPort(); - } - - //======================================================================== - - /// <summary> - /// Defines a method to request the outport. - /// </summary> - public interface ISimulationOutPort - { - /// <summary> - /// Requests a demand for a specific absolute time and a time interval dt. - /// </summary> - /// <param name="absTime">The absolute time of the simulation.</param> - /// <param name="ds"></param> - /// <returns></returns> - IResponse Request(Second absTime, Meter ds); - - IResponse Request(Second absTime, Second dt); - - IResponse Initialize(); - - double Progress { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an DriverCycle Demand out port. + /// </summary> + public interface ISimulationOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + /// <returns></returns> + ISimulationOutPort OutPort(); + } + + //======================================================================== + + /// <summary> + /// Defines a method to request the outport. + /// </summary> + public interface ISimulationOutPort + { + /// <summary> + /// Requests a demand for a specific absolute time and a time interval dt. + /// </summary> + /// <param name="absTime">The absolute time of the simulation.</param> + /// <param name="ds"></param> + /// <returns></returns> + IResponse Request(Second absTime, Meter ds); + + IResponse Request(Second absTime, Second dt); + + IResponse Initialize(); + + double Progress { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Connector/Ports/ITnPort.cs b/VectoCore/VectoCore/Models/Connector/Ports/ITnPort.cs index d01b8ad59877f78f773ebb6167be30b0b1e65c1d..e247b51617c809c07d344b1a983c7223d26bbd82 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/ITnPort.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/ITnPort.cs @@ -1,82 +1,82 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Connector.Ports -{ - /// <summary> - /// Defines a method to acquire an Tn in port. - /// </summary> - public interface ITnInProvider - { - /// <summary> - /// Returns the inport to connect it to another outport. - /// </summary> - ITnInPort InPort(); - } - - /// <summary> - /// Defines a method to acquire an Tn out port. - /// </summary> - public interface ITnOutProvider - { - /// <summary> - /// Returns the outport to send requests to. - /// </summary> - ITnOutPort OutPort(); - } - - /// <summary> - /// Defines a connect method to connect the inport to an outport. - /// </summary> - public interface ITnInPort - { - /// <summary> - /// Connects the inport to another outport. - /// </summary> - void Connect(ITnOutPort other); - } - - /// <summary> - /// Defines a request method for a Tn-Out-Port. - /// </summary> - public interface ITnOutPort - { - /// <summary> - /// Requests the Outport with the given torque [Nm] and angularVelocity [rad/s]. - /// </summary> - IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false); - - IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Connector.Ports +{ + /// <summary> + /// Defines a method to acquire an Tn in port. + /// </summary> + public interface ITnInProvider + { + /// <summary> + /// Returns the inport to connect it to another outport. + /// </summary> + ITnInPort InPort(); + } + + /// <summary> + /// Defines a method to acquire an Tn out port. + /// </summary> + public interface ITnOutProvider + { + /// <summary> + /// Returns the outport to send requests to. + /// </summary> + ITnOutPort OutPort(); + } + + /// <summary> + /// Defines a connect method to connect the inport to an outport. + /// </summary> + public interface ITnInPort + { + /// <summary> + /// Connects the inport to another outport. + /// </summary> + void Connect(ITnOutPort other); + } + + /// <summary> + /// Defines a request method for a Tn-Out-Port. + /// </summary> + public interface ITnOutPort + { + /// <summary> + /// Requests the Outport with the given torque [Nm] and angularVelocity [rad/s]. + /// </summary> + IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false); + + IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs index 8b46f81891aeaebfda5070c47525b859cdbde03d..952236e912c1410ecdb362b594388d9d8042b10b 100644 --- a/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs +++ b/VectoCore/VectoCore/Models/Connector/Ports/Impl/Response.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Declaration/AirDrag.cs b/VectoCore/VectoCore/Models/Declaration/AirDrag.cs index 9a210e0d3a1fa845e9f33f7fb1b42053b33b2c90..7906969d149da9931cd4a3cb3c4fcfaa8a8c987f 100644 --- a/VectoCore/VectoCore/Models/Declaration/AirDrag.cs +++ b/VectoCore/VectoCore/Models/Declaration/AirDrag.cs @@ -1,76 +1,76 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; -using System.Diagnostics; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class AirDrag : LookupData<string, AirDrag.Entry> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VCDV.parameters.csv"; } - } - - protected override string ErrorMessage - { - get { return "AirDrag Lookup Error: no value found. Key: '{0}'"; } - } - - protected override void ParseData(DataTable table) - { - Data = table.Rows.Cast<DataRow>().ToDictionary( - row => row.Field<string>("Parameters"), - row => new Entry(row.ParseDouble("a1").SI<SquareMeter>(), - row.ParseDouble("a2").SI<SquareMeter>(), - row.ParseDouble("a3").SI<SquareMeter>())); - } - - [DebuggerDisplay("A1: {A1}, A2: {A2}, A3: {A3}")] - public struct Entry - { - public readonly SquareMeter A1; - public readonly SquareMeter A2; - public readonly SquareMeter A3; - - public Entry(SquareMeter a1, SquareMeter a2, SquareMeter a3) - { - A1 = a1; - A2 = a2; - A3 = a3; - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; +using System.Diagnostics; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class AirDrag : LookupData<string, AirDrag.Entry> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VCDV.parameters.csv"; } + } + + protected override string ErrorMessage + { + get { return "AirDrag Lookup Error: no value found. Key: '{0}'"; } + } + + protected override void ParseData(DataTable table) + { + Data = table.Rows.Cast<DataRow>().ToDictionary( + row => row.Field<string>("Parameters"), + row => new Entry(row.ParseDouble("a1").SI<SquareMeter>(), + row.ParseDouble("a2").SI<SquareMeter>(), + row.ParseDouble("a3").SI<SquareMeter>())); + } + + [DebuggerDisplay("A1: {A1}, A2: {A2}, A3: {A3}")] + public struct Entry + { + public readonly SquareMeter A1; + public readonly SquareMeter A2; + public readonly SquareMeter A3; + + public Entry(SquareMeter a1, SquareMeter a2, SquareMeter a3) + { + A1 = a1; + A2 = a2; + A3 = a3; + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs b/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs index 220ea8293d9c4efc6ec796e5635b54673b7ee177..347fccdba1d9df7c427f5e711eceb968851ca4d1 100644 --- a/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs +++ b/VectoCore/VectoCore/Models/Declaration/AuxiliaryTypeHelper.cs @@ -1,92 +1,92 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCore.Configuration; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public static class AuxiliaryTypeHelper - { - private static readonly Dictionary<AuxiliaryType, string> AuxToStr = new Dictionary<AuxiliaryType, string> { - { AuxiliaryType.Fan, Constants.Auxiliaries.Names.Fan }, - { AuxiliaryType.SteeringPump, Constants.Auxiliaries.Names.SteeringPump }, - { AuxiliaryType.HVAC, Constants.Auxiliaries.Names.HeatingVentilationAirCondition }, - { AuxiliaryType.PneumaticSystem, Constants.Auxiliaries.Names.PneumaticSystem }, - { AuxiliaryType.ElectricSystem, Constants.Auxiliaries.Names.ElectricSystem }, - }; - - private static readonly Dictionary<AuxiliaryType, string> AuxToKey = new Dictionary<AuxiliaryType, string> { - { AuxiliaryType.Fan, Constants.Auxiliaries.IDs.Fan }, - { AuxiliaryType.SteeringPump, Constants.Auxiliaries.IDs.SteeringPump }, - { AuxiliaryType.HVAC, Constants.Auxiliaries.IDs.HeatingVentilationAirCondition }, - { AuxiliaryType.PneumaticSystem, Constants.Auxiliaries.IDs.PneumaticSystem }, - { AuxiliaryType.ElectricSystem, Constants.Auxiliaries.IDs.ElectricSystem }, - }; - - private static readonly Dictionary<string, AuxiliaryType> StrToAux = AuxToStr.ToDictionary(kv => kv.Value, - kv => kv.Key); - - public static AuxiliaryType Parse(string s) - { - AuxiliaryType aux; - return StrToAux.TryGetValue(s, out aux) ? aux : AuxiliaryType.Fan; - } - - public static AuxiliaryType ParseKey(string s) - { - return AuxToKey.FirstOrDefault(x => x.Value.Equals(s, StringComparison.InvariantCultureIgnoreCase)).Key; - } - - public static string ToString(AuxiliaryType t) - { - return AuxToStr[t]; - } - - public static string GetAuxKey(AuxiliaryType t) - { - return AuxToKey[t]; - } - - public static string Key(this AuxiliaryType t) - { - return AuxToKey[t]; - } - - public static string Name(this AuxiliaryType t) - { - return AuxToStr[t]; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Configuration; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public static class AuxiliaryTypeHelper + { + private static readonly Dictionary<AuxiliaryType, string> AuxToStr = new Dictionary<AuxiliaryType, string> { + { AuxiliaryType.Fan, Constants.Auxiliaries.Names.Fan }, + { AuxiliaryType.SteeringPump, Constants.Auxiliaries.Names.SteeringPump }, + { AuxiliaryType.HVAC, Constants.Auxiliaries.Names.HeatingVentilationAirCondition }, + { AuxiliaryType.PneumaticSystem, Constants.Auxiliaries.Names.PneumaticSystem }, + { AuxiliaryType.ElectricSystem, Constants.Auxiliaries.Names.ElectricSystem }, + }; + + private static readonly Dictionary<AuxiliaryType, string> AuxToKey = new Dictionary<AuxiliaryType, string> { + { AuxiliaryType.Fan, Constants.Auxiliaries.IDs.Fan }, + { AuxiliaryType.SteeringPump, Constants.Auxiliaries.IDs.SteeringPump }, + { AuxiliaryType.HVAC, Constants.Auxiliaries.IDs.HeatingVentilationAirCondition }, + { AuxiliaryType.PneumaticSystem, Constants.Auxiliaries.IDs.PneumaticSystem }, + { AuxiliaryType.ElectricSystem, Constants.Auxiliaries.IDs.ElectricSystem }, + }; + + private static readonly Dictionary<string, AuxiliaryType> StrToAux = AuxToStr.ToDictionary(kv => kv.Value, + kv => kv.Key); + + public static AuxiliaryType Parse(string s) + { + AuxiliaryType aux; + return StrToAux.TryGetValue(s, out aux) ? aux : AuxiliaryType.Fan; + } + + public static AuxiliaryType ParseKey(string s) + { + return AuxToKey.FirstOrDefault(x => x.Value.Equals(s, StringComparison.InvariantCultureIgnoreCase)).Key; + } + + public static string ToString(AuxiliaryType t) + { + return AuxToStr[t]; + } + + public static string GetAuxKey(AuxiliaryType t) + { + return AuxToKey[t]; + } + + public static string Key(this AuxiliaryType t) + { + return AuxToKey[t]; + } + + public static string Name(this AuxiliaryType t) + { + return AuxToStr[t]; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/Axle.cs b/VectoCore/VectoCore/Models/Declaration/Axle.cs index 6e638a2722980feef418a5c94964f615b85ceda3..371ac5231afec5f3457e2f0d002a6af3d337e41f 100644 --- a/VectoCore/VectoCore/Models/Declaration/Axle.cs +++ b/VectoCore/VectoCore/Models/Declaration/Axle.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs index fb8d082597fc48c6facd9e7043d97200948cd510..d1215b3ed7871137a52891742a30613667ab6652 100644 --- a/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs +++ b/VectoCore/VectoCore/Models/Declaration/DeclarationData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Data; using System.Linq; diff --git a/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs b/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs index 0c30cdb5ad51bde37d3e69da9f7169a0e52a14fb..4c9d90ef465111e095004010cc87e8e066806260 100644 --- a/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs +++ b/VectoCore/VectoCore/Models/Declaration/ElectricSystem.cs @@ -1,114 +1,114 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class ElectricSystem : LookupData<MissionType, string, Watt>, IDeclarationAuxiliaryTable - { - private readonly Alternator _alternator = new Alternator(); - - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.ES-Tech.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for Electric System. Mission: '{0}', Technology: '{1}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (DataRow row in table.Rows) { - var name = row.Field<string>("technology"); - foreach (DataColumn col in table.Columns) { - if (col.Caption != "technology") { - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = - row.ParseDouble(col).SI<Watt>(); - } - } - } - } - - public override Watt Lookup(MissionType missionType, string technology = null) - { - if (string.IsNullOrWhiteSpace(technology)) { - technology = "Standard technology"; - } - var value = base.Lookup(missionType, technology); - return value / _alternator.Lookup(missionType); - } - - internal sealed class Alternator : LookupData<MissionType, string, double> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.ALT-Tech.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for Alternator. Mission: '{0}', Technology: '{1}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (DataRow row in table.Rows) { - var name = row.Field<string>("technology"); - foreach (DataColumn col in table.Columns) { - if (col.Caption != "technology") { - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = row.ParseDouble(col); - } - } - } - } - - public override double Lookup(MissionType missionType, string technology = null) - { - if (string.IsNullOrWhiteSpace(technology)) { - technology = "Standard alternator efficiency"; - } - return base.Lookup(missionType, technology); - } - } - - public string[] GetTechnologies() - { - return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class ElectricSystem : LookupData<MissionType, string, Watt>, IDeclarationAuxiliaryTable + { + private readonly Alternator _alternator = new Alternator(); + + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.ES-Tech.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for Electric System. Mission: '{0}', Technology: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) { + var name = row.Field<string>("technology"); + foreach (DataColumn col in table.Columns) { + if (col.Caption != "technology") { + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = + row.ParseDouble(col).SI<Watt>(); + } + } + } + } + + public override Watt Lookup(MissionType missionType, string technology = null) + { + if (string.IsNullOrWhiteSpace(technology)) { + technology = "Standard technology"; + } + var value = base.Lookup(missionType, technology); + return value / _alternator.Lookup(missionType); + } + + internal sealed class Alternator : LookupData<MissionType, string, double> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.ALT-Tech.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for Alternator. Mission: '{0}', Technology: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) { + var name = row.Field<string>("technology"); + foreach (DataColumn col in table.Columns) { + if (col.Caption != "technology") { + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = row.ParseDouble(col); + } + } + } + } + + public override double Lookup(MissionType missionType, string technology = null) + { + if (string.IsNullOrWhiteSpace(technology)) { + technology = "Standard alternator efficiency"; + } + return base.Lookup(missionType, technology); + } + } + + public string[] GetTechnologies() + { + return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/Fan.cs b/VectoCore/VectoCore/Models/Declaration/Fan.cs index 9c78944315e16f8cb5fbb863fa0c9ca39af1fec4..6a35c66ede7c0641af79320544ca830db54a029a 100644 --- a/VectoCore/VectoCore/Models/Declaration/Fan.cs +++ b/VectoCore/VectoCore/Models/Declaration/Fan.cs @@ -1,78 +1,78 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class Fan : LookupData<MissionType, string, Watt>, IDeclarationAuxiliaryTable - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.Fan-Tech.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for Fan. Mission: '{0}', Technology: '{1}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (DataRow row in table.Rows) { - var name = row.Field<string>("technology"); - - foreach (DataColumn col in table.Columns) { - if (col.Caption != "technology") { - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = row.ParseDouble(col).SI<Watt>(); - } - } - } - } - - public override Watt Lookup(MissionType mission, string technology = null) - { - if (string.IsNullOrWhiteSpace(technology)) { - technology = "Crankshaft mounted - Electronically controlled visco clutch"; - } - return base.Lookup(mission, technology); - } - - public string[] GetTechnologies() - { - return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class Fan : LookupData<MissionType, string, Watt>, IDeclarationAuxiliaryTable + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.Fan-Tech.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for Fan. Mission: '{0}', Technology: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) { + var name = row.Field<string>("technology"); + + foreach (DataColumn col in table.Columns) { + if (col.Caption != "technology") { + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), name)] = row.ParseDouble(col).SI<Watt>(); + } + } + } + } + + public override Watt Lookup(MissionType mission, string technology = null) + { + if (string.IsNullOrWhiteSpace(technology)) { + technology = "Crankshaft mounted - Electronically controlled visco clutch"; + } + return base.Lookup(mission, technology); + } + + public string[] GetTechnologies() + { + return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/FuelData.cs b/VectoCore/VectoCore/Models/Declaration/FuelData.cs index 6a90f2a395fce849dd11a55bf60935153fadff5a..e925bfcd173d38f5229d5d487dcd52f83e5e24c7 100644 --- a/VectoCore/VectoCore/Models/Declaration/FuelData.cs +++ b/VectoCore/VectoCore/Models/Declaration/FuelData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using System.Linq; diff --git a/VectoCore/VectoCore/Models/Declaration/HVAC.cs b/VectoCore/VectoCore/Models/Declaration/HVAC.cs index 07d882b97899192456c75877522c6b3be49fbfe4..5a59d415340dc4a61d732e0aa73cf5120e6655e1 100644 --- a/VectoCore/VectoCore/Models/Declaration/HVAC.cs +++ b/VectoCore/VectoCore/Models/Declaration/HVAC.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/Models/Declaration/IDeclarationAuxiliaryTable.cs b/VectoCore/VectoCore/Models/Declaration/IDeclarationAuxiliaryTable.cs index d6405498b5046eb41ff7c23776d6d81865c33274..e245c17a9017d12dee4f4cd08cee0bf12576a9ec 100644 --- a/VectoCore/VectoCore/Models/Declaration/IDeclarationAuxiliaryTable.cs +++ b/VectoCore/VectoCore/Models/Declaration/IDeclarationAuxiliaryTable.cs @@ -1,38 +1,38 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCore.Models.Declaration -{ - public interface IDeclarationAuxiliaryTable - { - string[] GetTechnologies(); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCore.Models.Declaration +{ + public interface IDeclarationAuxiliaryTable + { + string[] GetTechnologies(); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/LACDecisionFactor.cs b/VectoCore/VectoCore/Models/Declaration/LACDecisionFactor.cs index e754864a834e2025fa04f6e867c266ea7ca12821..6a9200d734c93ceb99593782edb18b15a944b402 100644 --- a/VectoCore/VectoCore/Models/Declaration/LACDecisionFactor.cs +++ b/VectoCore/VectoCore/Models/Declaration/LACDecisionFactor.cs @@ -1,180 +1,180 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - /// <summary> - /// Class for Look Ahead Coasting Decision Factor (DF_coast) - /// </summary> - public sealed class LACDecisionFactor - { - private readonly LACDecisionFactorVTarget _vTarget; - private readonly LACDecisionFactorVdrop _vDrop; - private readonly double _offset; - private readonly double _scaling; - - public LACDecisionFactor() - { - _offset = DeclarationData.Driver.LookAhead.DecisionFactorCoastingOffset; - _scaling = DeclarationData.Driver.LookAhead.DecisionFactorCoastingScaling; - _vTarget = new LACDecisionFactorVTarget(); - _vDrop = new LACDecisionFactorVdrop(); - } - - public LACDecisionFactor(double offset, double scaling, DataTable vTargetLookup, DataTable vDropLookup) - { - _offset = offset; - _scaling = scaling; - _vTarget = new LACDecisionFactorVTarget(vTargetLookup); - _vDrop = new LACDecisionFactorVdrop(vDropLookup); - } - - public double Lookup(MeterPerSecond targetVelocity, MeterPerSecond velocityDrop) - { - // normalize values from [0 .. 1] to [2.5 .. 1] - return _offset - _scaling * _vTarget.Lookup(targetVelocity) * _vDrop.Lookup(velocityDrop); - } - - public sealed class LACDecisionFactorVdrop : LookupData<MeterPerSecond, double> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".LAC-DF-Vdrop.csv"; } - } - - protected override string ErrorMessage - { - get { throw new System.NotImplementedException(); } - } - - public LACDecisionFactorVdrop() {} - - public LACDecisionFactorVdrop(DataTable vDrop) - { - ParseData(vDrop ?? ReadCsvResource(ResourceId)); - } - - public override double Lookup(MeterPerSecond targetVelocity) - { - var section = Data.GetSection(kv => kv.Key < targetVelocity); - return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value, section.Item2.Value, - targetVelocity); - } - - protected override void ParseData(DataTable table) - { - if (table.Columns.Count < 2) { - throw new VectoException("LAC Decision Factor File for Vdrop must consist of at least 2 columns."); - } - - if (table.Rows.Count < 2) { - throw new VectoException( - "LAC Decision Factor File for Vdrop must consist of at least two lines with numeric values (below file header)"); - } - - if (table.Columns.Contains(Fields.VelocityDrop) && table.Columns.Contains(Fields.DecisionFactor)) { - Data = table.Rows.Cast<DataRow>() - .ToDictionary(r => r.ParseDouble(Fields.VelocityDrop).KMPHtoMeterPerSecond(), - r => r.ParseDouble(Fields.DecisionFactor)); - } else { - Data = table.Rows.Cast<DataRow>() - .ToDictionary(r => r.ParseDouble(0).KMPHtoMeterPerSecond(), r => r.ParseDouble(1)); - } - } - - public static class Fields - { - public const string DecisionFactor = "decision_factor"; - public const string VelocityDrop = "v_drop"; - } - } - - public sealed class LACDecisionFactorVTarget : LookupData<MeterPerSecond, double> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".LAC-DF-Vtarget.csv"; } - } - - protected override string ErrorMessage - { - get { throw new System.NotImplementedException(); } - } - - public LACDecisionFactorVTarget() {} - - public LACDecisionFactorVTarget(DataTable vTargetLookup) - { - ParseData(vTargetLookup ?? ReadCsvResource(ResourceId)); - } - - public override double Lookup(MeterPerSecond targetVelocity) - { - var section = Data.GetSection(kv => kv.Key < targetVelocity); - return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value, section.Item2.Value, - targetVelocity); - } - - protected override void ParseData(DataTable table) - { - if (table.Columns.Count < 2) { - throw new VectoException("LAC Decision Factor File for Vtarget must consist of at least 2 columns."); - } - - if (table.Rows.Count < 2) { - throw new VectoException( - "LAC Decision Factor File for Vtarget must consist of at least two lines with numeric values (below file header)"); - } - - if (table.Columns.Contains(Fields.TargetVelocity) && table.Columns.Contains(Fields.DecisionFactor)) { - Data = table.Rows.Cast<DataRow>() - .ToDictionary(r => r.ParseDouble(Fields.TargetVelocity).KMPHtoMeterPerSecond(), - r => r.ParseDouble(Fields.DecisionFactor)); - } else { - Data = table.Rows.Cast<DataRow>() - .ToDictionary(r => r.ParseDouble(0).KMPHtoMeterPerSecond(), r => r.ParseDouble(1)); - } - } - - public static class Fields - { - public const string TargetVelocity = "v_target"; - public const string DecisionFactor = "decision_factor"; - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + /// <summary> + /// Class for Look Ahead Coasting Decision Factor (DF_coast) + /// </summary> + public sealed class LACDecisionFactor + { + private readonly LACDecisionFactorVTarget _vTarget; + private readonly LACDecisionFactorVdrop _vDrop; + private readonly double _offset; + private readonly double _scaling; + + public LACDecisionFactor() + { + _offset = DeclarationData.Driver.LookAhead.DecisionFactorCoastingOffset; + _scaling = DeclarationData.Driver.LookAhead.DecisionFactorCoastingScaling; + _vTarget = new LACDecisionFactorVTarget(); + _vDrop = new LACDecisionFactorVdrop(); + } + + public LACDecisionFactor(double offset, double scaling, DataTable vTargetLookup, DataTable vDropLookup) + { + _offset = offset; + _scaling = scaling; + _vTarget = new LACDecisionFactorVTarget(vTargetLookup); + _vDrop = new LACDecisionFactorVdrop(vDropLookup); + } + + public double Lookup(MeterPerSecond targetVelocity, MeterPerSecond velocityDrop) + { + // normalize values from [0 .. 1] to [2.5 .. 1] + return _offset - _scaling * _vTarget.Lookup(targetVelocity) * _vDrop.Lookup(velocityDrop); + } + + public sealed class LACDecisionFactorVdrop : LookupData<MeterPerSecond, double> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".LAC-DF-Vdrop.csv"; } + } + + protected override string ErrorMessage + { + get { throw new System.NotImplementedException(); } + } + + public LACDecisionFactorVdrop() {} + + public LACDecisionFactorVdrop(DataTable vDrop) + { + ParseData(vDrop ?? ReadCsvResource(ResourceId)); + } + + public override double Lookup(MeterPerSecond targetVelocity) + { + var section = Data.GetSection(kv => kv.Key < targetVelocity); + return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value, section.Item2.Value, + targetVelocity); + } + + protected override void ParseData(DataTable table) + { + if (table.Columns.Count < 2) { + throw new VectoException("LAC Decision Factor File for Vdrop must consist of at least 2 columns."); + } + + if (table.Rows.Count < 2) { + throw new VectoException( + "LAC Decision Factor File for Vdrop must consist of at least two lines with numeric values (below file header)"); + } + + if (table.Columns.Contains(Fields.VelocityDrop) && table.Columns.Contains(Fields.DecisionFactor)) { + Data = table.Rows.Cast<DataRow>() + .ToDictionary(r => r.ParseDouble(Fields.VelocityDrop).KMPHtoMeterPerSecond(), + r => r.ParseDouble(Fields.DecisionFactor)); + } else { + Data = table.Rows.Cast<DataRow>() + .ToDictionary(r => r.ParseDouble(0).KMPHtoMeterPerSecond(), r => r.ParseDouble(1)); + } + } + + public static class Fields + { + public const string DecisionFactor = "decision_factor"; + public const string VelocityDrop = "v_drop"; + } + } + + public sealed class LACDecisionFactorVTarget : LookupData<MeterPerSecond, double> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".LAC-DF-Vtarget.csv"; } + } + + protected override string ErrorMessage + { + get { throw new System.NotImplementedException(); } + } + + public LACDecisionFactorVTarget() {} + + public LACDecisionFactorVTarget(DataTable vTargetLookup) + { + ParseData(vTargetLookup ?? ReadCsvResource(ResourceId)); + } + + public override double Lookup(MeterPerSecond targetVelocity) + { + var section = Data.GetSection(kv => kv.Key < targetVelocity); + return VectoMath.Interpolate(section.Item1.Key, section.Item2.Key, section.Item1.Value, section.Item2.Value, + targetVelocity); + } + + protected override void ParseData(DataTable table) + { + if (table.Columns.Count < 2) { + throw new VectoException("LAC Decision Factor File for Vtarget must consist of at least 2 columns."); + } + + if (table.Rows.Count < 2) { + throw new VectoException( + "LAC Decision Factor File for Vtarget must consist of at least two lines with numeric values (below file header)"); + } + + if (table.Columns.Contains(Fields.TargetVelocity) && table.Columns.Contains(Fields.DecisionFactor)) { + Data = table.Rows.Cast<DataRow>() + .ToDictionary(r => r.ParseDouble(Fields.TargetVelocity).KMPHtoMeterPerSecond(), + r => r.ParseDouble(Fields.DecisionFactor)); + } else { + Data = table.Rows.Cast<DataRow>() + .ToDictionary(r => r.ParseDouble(0).KMPHtoMeterPerSecond(), r => r.ParseDouble(1)); + } + } + + public static class Fields + { + public const string TargetVelocity = "v_target"; + public const string DecisionFactor = "decision_factor"; + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/LookupData.cs b/VectoCore/VectoCore/Models/Declaration/LookupData.cs index 58919c1ec6f354de56ddd11d7a50681d5fc55f6e..933841f9c4fb0c38702425b2f45a511fb1e7fc9f 100644 --- a/VectoCore/VectoCore/Models/Declaration/LookupData.cs +++ b/VectoCore/VectoCore/Models/Declaration/LookupData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/Models/Declaration/Mission.cs b/VectoCore/VectoCore/Models/Declaration/Mission.cs index d8bee12f5012ffe31e68e02bf6f90a04acb7fb52..2e1fac83d741e53777a232c965a96af38d1b904b 100644 --- a/VectoCore/VectoCore/Models/Declaration/Mission.cs +++ b/VectoCore/VectoCore/Models/Declaration/Mission.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCore/Models/Declaration/MissionType.cs b/VectoCore/VectoCore/Models/Declaration/MissionType.cs index 3b3c54a7286a240b7c7ade04fdd83d67d7ffeaa8..977ec1abbe9bbd127350d967596c128690fda370 100644 --- a/VectoCore/VectoCore/Models/Declaration/MissionType.cs +++ b/VectoCore/VectoCore/Models/Declaration/MissionType.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; namespace TUGraz.VectoCore.Models.Declaration diff --git a/VectoCore/VectoCore/Models/Declaration/PT1.cs b/VectoCore/VectoCore/Models/Declaration/PT1.cs index 09bbb9244f46b00ab7c635380df56d658fb11557..085011993d36a09c8c38a32853a15d12ceca7209 100644 --- a/VectoCore/VectoCore/Models/Declaration/PT1.cs +++ b/VectoCore/VectoCore/Models/Declaration/PT1.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/Models/Declaration/PTOTransmission.cs b/VectoCore/VectoCore/Models/Declaration/PTOTransmission.cs index 5e0a39ba65ef35d7f32feeb98be92bb5c586c643..ffbfd1fe09992698d6005baebbdd03d6b0a355d4 100644 --- a/VectoCore/VectoCore/Models/Declaration/PTOTransmission.cs +++ b/VectoCore/VectoCore/Models/Declaration/PTOTransmission.cs @@ -1,65 +1,65 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class PTOTransmission : LookupData<string, Watt>, IDeclarationAuxiliaryTable - { - public const string NoPTO = "None"; - - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.PTO-tech.csv"; } - } - - protected override string ErrorMessage - { - get { return "PTO Transmission Lookup Error: No value found for PTO Transmission. Technology: '{0}'"; } - } - - protected override void ParseData(DataTable table) - { - Data = table.Rows.Cast<DataRow>().ToDictionary( - r => r.Field<string>("technology"), - r => r.ParseDouble("powerloss").SI<Watt>()); - } - - public string[] GetTechnologies() - { - return Data.Keys.ToArray(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class PTOTransmission : LookupData<string, Watt>, IDeclarationAuxiliaryTable + { + public const string NoPTO = "None"; + + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.PTO-tech.csv"; } + } + + protected override string ErrorMessage + { + get { return "PTO Transmission Lookup Error: No value found for PTO Transmission. Technology: '{0}'"; } + } + + protected override void ParseData(DataTable table) + { + Data = table.Rows.Cast<DataRow>().ToDictionary( + r => r.Field<string>("technology"), + r => r.ParseDouble("powerloss").SI<Watt>()); + } + + public string[] GetTechnologies() + { + return Data.Keys.ToArray(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/Payloads.cs b/VectoCore/VectoCore/Models/Declaration/Payloads.cs index da05124dc1501aa1d6ad572d937d97fd52c2f8ec..1203a2743e97da58e26745287bd0808b86a2d8b6 100644 --- a/VectoCore/VectoCore/Models/Declaration/Payloads.cs +++ b/VectoCore/VectoCore/Models/Declaration/Payloads.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using System.Linq; diff --git a/VectoCore/VectoCore/Models/Declaration/PneumaticSystem.cs b/VectoCore/VectoCore/Models/Declaration/PneumaticSystem.cs index db8997fb8b152fa521d311c4fd650495d1ff198d..4f4194b90a29696a8db9f54f66968853a85d6403 100644 --- a/VectoCore/VectoCore/Models/Declaration/PneumaticSystem.cs +++ b/VectoCore/VectoCore/Models/Declaration/PneumaticSystem.cs @@ -1,69 +1,69 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class PneumaticSystem : LookupData<MissionType, string, Watt>, IDeclarationAuxiliaryTable - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.PS-Table.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for Pneumatic System. Mission: '{0}', Technology: '{1}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (DataRow row in table.Rows) { - var technology = row.Field<string>("technology"); - foreach (DataColumn col in table.Columns) { - if (col.Caption != "technology") { - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), technology)] = row.ParseDouble(col.Caption).SI<Watt>(); - } - } - } - } - - public string[] GetTechnologies() - { - return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class PneumaticSystem : LookupData<MissionType, string, Watt>, IDeclarationAuxiliaryTable + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.PS-Table.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for Pneumatic System. Mission: '{0}', Technology: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) { + var technology = row.Field<string>("technology"); + foreach (DataColumn col in table.Columns) { + if (col.Caption != "technology") { + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), technology)] = row.ParseDouble(col.Caption).SI<Watt>(); + } + } + } + } + + public string[] GetTechnologies() + { + return Data.Keys.Select(x => x.Item2).Distinct().ToArray(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/Segment.cs b/VectoCore/VectoCore/Models/Declaration/Segment.cs index 9dfa065d271b0d0e04406a8fec1d3b2316a4edad..16abc25895037280bf41566fa923085da223b0e7 100644 --- a/VectoCore/VectoCore/Models/Declaration/Segment.cs +++ b/VectoCore/VectoCore/Models/Declaration/Segment.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Declaration/Segments.cs b/VectoCore/VectoCore/Models/Declaration/Segments.cs index 3fe152361c100e093fa640a77e38eeef2f59db1f..73227147dccd376e8732826952b61774dfac6bf4 100644 --- a/VectoCore/VectoCore/Models/Declaration/Segments.cs +++ b/VectoCore/VectoCore/Models/Declaration/Segments.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/Models/Declaration/StandardBodies.cs b/VectoCore/VectoCore/Models/Declaration/StandardBodies.cs index 17d45656832cf8d89a9abed2ec4b8befa260d126..9b34acee42590d6b9733112cfda713842f067a21 100644 --- a/VectoCore/VectoCore/Models/Declaration/StandardBodies.cs +++ b/VectoCore/VectoCore/Models/Declaration/StandardBodies.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs b/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs index f332332523ce42baa8835c5597aee2f648a38495..8b0ec360f361a9866664f2ac8cf29f26b5c5161a 100644 --- a/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs +++ b/VectoCore/VectoCore/Models/Declaration/SteeringPump.cs @@ -1,200 +1,200 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class SteeringPump : IDeclarationAuxiliaryTable - { - private readonly SteeringPumpBaseLine _baseLookup = new SteeringPumpBaseLine(); - private readonly SteeringPumpAxles _axleLookup = new SteeringPumpAxles(); - private readonly SteeringPumpTechnologies _techLookup = new SteeringPumpTechnologies(); - - public Watt Lookup(MissionType mission, VehicleClass hdvClass, IEnumerable<string> technologies) - { - var baseLine = _baseLookup.Lookup(mission, hdvClass); - var power = new SteeringPumpValues<Watt>(0.SI<Watt>(), 0.SI<Watt>(), 0.SI<Watt>()); - var factors = new SteeringPumpValues<double>(0, 0, 0); - var i = 0; - foreach (var technology in technologies) { - i++; - var axles = _axleLookup.Lookup(mission, i); - power.UnloadedFriction += baseLine.UnloadedFriction * axles.UnloadedFriction; - power.Banking += baseLine.Banking * axles.Banking; - power.Steering += baseLine.Steering * axles.Steering; - - var f = _techLookup.Lookup(technology, mission); - factors.UnloadedFriction += f.UnloadedFriction; - factors.Banking += f.Banking; - factors.Steering += f.Steering; - } - - power.UnloadedFriction *= factors.UnloadedFriction / i; - power.Banking *= factors.Banking / i; - power.Steering *= factors.Steering / i; - - return power.UnloadedFriction + power.Banking + power.Steering; - } - - private sealed class SteeringPumpBaseLine : LookupData<MissionType, VehicleClass, SteeringPumpValues<Watt>> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.SP-Table.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for Steering Pump. Mission: '{0}', HDVClass: '{1}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (DataRow row in table.Rows) { - var hdvClass = VehicleClassHelper.Parse(row.Field<string>("hdvclass")); - foreach (DataColumn col in table.Columns) { - if (col.Caption == "hdvclass" || string.IsNullOrWhiteSpace(row.Field<string>(col.Caption))) { - continue; - } - var values = row.Field<string>(col.Caption).Split('/') - .Select(v => v.ToDouble() / 100.0).Concat(0.0.Repeat(3)).SI<Watt>().ToList(); - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), hdvClass)] = new SteeringPumpValues<Watt>(values[0], - values[1], values[2]); - } - } - } - } - - private sealed class SteeringPumpTechnologies : LookupData<string, SteeringPumpValues<double>> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.SP-Tech.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for SteeringPump Technology. Key: '{0}'"; } - } - - protected override void ParseData(DataTable table) - { - Data = table.Rows.Cast<DataRow>().ToDictionary( - key => key.Field<string>("Technology"), - value => new SteeringPumpValues<double>(value.ParseDouble("UF"), value.ParseDouble("B"), value.ParseDouble("S"))); - } - - public override SteeringPumpValues<double> Lookup(string key) - { - throw new InvalidOperationException("Standard lookup is not supported. Use Lookup(string, MissionType) instead."); - } - - /// <summary> - /// Lookup for Steering Pump Technologies. - /// </summary> - /// <param name="tech">The technology string.</param> - /// <param name="mission">Only used when Tech is Electric System.</param> - /// <returns></returns> - public SteeringPumpValues<double> Lookup(string tech, MissionType mission) - { - var values = base.Lookup(tech); - if (tech == "Electric") { - var alternator = new ElectricSystem.Alternator(); - values.Banking /= alternator.Lookup(mission); - values.Steering /= alternator.Lookup(mission); - } - return values; - } - - public string[] GetTechnologies() - { - return Data.Keys.Distinct().ToArray(); - } - } - - private sealed class SteeringPumpAxles : LookupData<MissionType, int, SteeringPumpValues<double>> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.SP-Axles.csv"; } - } - - protected override string ErrorMessage - { - get { return "Auxiliary Lookup Error: No value found for SteeringPump Axle. Mission: '{0}', Axle Count: '{1}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (DataRow row in table.Rows) { - var axleNumber = int.Parse(row.Field<string>("steeredaxles")); - foreach (DataColumn col in table.Columns) { - if (col.Caption == "steeredaxles") { - continue; - } - var field = row.Field<string>(col.Caption); - if (string.IsNullOrWhiteSpace(field)) { - continue; - } - var values = field.Split('/').ToDouble().Concat(0.0.Repeat(3)).ToList(); - Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), axleNumber)] = new SteeringPumpValues<double>(values[0], - values[1], values[2]); - } - } - } - } - - private class SteeringPumpValues<T> - { - public T UnloadedFriction; - public T Banking; - public T Steering; - - public SteeringPumpValues(T unloadedFriction, T banking, T steering) - { - UnloadedFriction = unloadedFriction; - Banking = banking; - Steering = steering; - } - } - - public string[] GetTechnologies() - { - return _techLookup.GetTechnologies(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class SteeringPump : IDeclarationAuxiliaryTable + { + private readonly SteeringPumpBaseLine _baseLookup = new SteeringPumpBaseLine(); + private readonly SteeringPumpAxles _axleLookup = new SteeringPumpAxles(); + private readonly SteeringPumpTechnologies _techLookup = new SteeringPumpTechnologies(); + + public Watt Lookup(MissionType mission, VehicleClass hdvClass, IEnumerable<string> technologies) + { + var baseLine = _baseLookup.Lookup(mission, hdvClass); + var power = new SteeringPumpValues<Watt>(0.SI<Watt>(), 0.SI<Watt>(), 0.SI<Watt>()); + var factors = new SteeringPumpValues<double>(0, 0, 0); + var i = 0; + foreach (var technology in technologies) { + i++; + var axles = _axleLookup.Lookup(mission, i); + power.UnloadedFriction += baseLine.UnloadedFriction * axles.UnloadedFriction; + power.Banking += baseLine.Banking * axles.Banking; + power.Steering += baseLine.Steering * axles.Steering; + + var f = _techLookup.Lookup(technology, mission); + factors.UnloadedFriction += f.UnloadedFriction; + factors.Banking += f.Banking; + factors.Steering += f.Steering; + } + + power.UnloadedFriction *= factors.UnloadedFriction / i; + power.Banking *= factors.Banking / i; + power.Steering *= factors.Steering / i; + + return power.UnloadedFriction + power.Banking + power.Steering; + } + + private sealed class SteeringPumpBaseLine : LookupData<MissionType, VehicleClass, SteeringPumpValues<Watt>> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.SP-Table.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for Steering Pump. Mission: '{0}', HDVClass: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) { + var hdvClass = VehicleClassHelper.Parse(row.Field<string>("hdvclass")); + foreach (DataColumn col in table.Columns) { + if (col.Caption == "hdvclass" || string.IsNullOrWhiteSpace(row.Field<string>(col.Caption))) { + continue; + } + var values = row.Field<string>(col.Caption).Split('/') + .Select(v => v.ToDouble() / 100.0).Concat(0.0.Repeat(3)).SI<Watt>().ToList(); + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), hdvClass)] = new SteeringPumpValues<Watt>(values[0], + values[1], values[2]); + } + } + } + } + + private sealed class SteeringPumpTechnologies : LookupData<string, SteeringPumpValues<double>> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.SP-Tech.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for SteeringPump Technology. Key: '{0}'"; } + } + + protected override void ParseData(DataTable table) + { + Data = table.Rows.Cast<DataRow>().ToDictionary( + key => key.Field<string>("Technology"), + value => new SteeringPumpValues<double>(value.ParseDouble("UF"), value.ParseDouble("B"), value.ParseDouble("S"))); + } + + public override SteeringPumpValues<double> Lookup(string key) + { + throw new InvalidOperationException("Standard lookup is not supported. Use Lookup(string, MissionType) instead."); + } + + /// <summary> + /// Lookup for Steering Pump Technologies. + /// </summary> + /// <param name="tech">The technology string.</param> + /// <param name="mission">Only used when Tech is Electric System.</param> + /// <returns></returns> + public SteeringPumpValues<double> Lookup(string tech, MissionType mission) + { + var values = base.Lookup(tech); + if (tech == "Electric") { + var alternator = new ElectricSystem.Alternator(); + values.Banking /= alternator.Lookup(mission); + values.Steering /= alternator.Lookup(mission); + } + return values; + } + + public string[] GetTechnologies() + { + return Data.Keys.Distinct().ToArray(); + } + } + + private sealed class SteeringPumpAxles : LookupData<MissionType, int, SteeringPumpValues<double>> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".VAUX.SP-Axles.csv"; } + } + + protected override string ErrorMessage + { + get { return "Auxiliary Lookup Error: No value found for SteeringPump Axle. Mission: '{0}', Axle Count: '{1}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (DataRow row in table.Rows) { + var axleNumber = int.Parse(row.Field<string>("steeredaxles")); + foreach (DataColumn col in table.Columns) { + if (col.Caption == "steeredaxles") { + continue; + } + var field = row.Field<string>(col.Caption); + if (string.IsNullOrWhiteSpace(field)) { + continue; + } + var values = field.Split('/').ToDouble().Concat(0.0.Repeat(3)).ToList(); + Data[Tuple.Create(col.Caption.ParseEnum<MissionType>(), axleNumber)] = new SteeringPumpValues<double>(values[0], + values[1], values[2]); + } + } + } + } + + private class SteeringPumpValues<T> + { + public T UnloadedFriction; + public T Banking; + public T Steering; + + public SteeringPumpValues(T unloadedFriction, T banking, T steering) + { + UnloadedFriction = unloadedFriction; + Banking = banking; + Steering = steering; + } + } + + public string[] GetTechnologies() + { + return _techLookup.GetTechnologies(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs b/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs index eae963c5cb8ebc09cabb90181324a654e4fe61ba..9a13004499687a3f500533f9a80d06f7506c2ac3 100644 --- a/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs +++ b/VectoCore/VectoCore/Models/Declaration/VehicleClass.cs @@ -1,78 +1,78 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public enum VehicleClass - { - Class0, - Class1, - Class2, - Class3, - Class4, - Class5, - Class6, - Class7, - Class8, - Class9, - Class10, - Class11, - Class12, - Class13, - Class14, - Class15, - Class16, - Class17, - ClassB1, - ClassB2, - ClassB3, - ClassB4, - ClassB5, - ClassB6 - } - - public static class VehicleClassHelper - { - private const string Prefix = "Class"; - - public static VehicleClass Parse(string text) - { - return (Prefix + text).ParseEnum<VehicleClass>(); - } - - public static string GetClassNumber(this VehicleClass hdvClass) - { - return hdvClass.ToString().Substring(Prefix.Length); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public enum VehicleClass + { + Class0, + Class1, + Class2, + Class3, + Class4, + Class5, + Class6, + Class7, + Class8, + Class9, + Class10, + Class11, + Class12, + Class13, + Class14, + Class15, + Class16, + Class17, + ClassB1, + ClassB2, + ClassB3, + ClassB4, + ClassB5, + ClassB6 + } + + public static class VehicleClassHelper + { + private const string Prefix = "Class"; + + public static VehicleClass Parse(string text) + { + return (Prefix + text).ParseEnum<VehicleClass>(); + } + + public static string GetClassNumber(this VehicleClass hdvClass) + { + return hdvClass.ToString().Substring(Prefix.Length); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/WHTCCorrection.cs b/VectoCore/VectoCore/Models/Declaration/WHTCCorrection.cs index f647443cc000e6535018ee90393f963bb30a913e..48f214845805dfe649099f9247f5a8773dcfbbf8 100644 --- a/VectoCore/VectoCore/Models/Declaration/WHTCCorrection.cs +++ b/VectoCore/VectoCore/Models/Declaration/WHTCCorrection.cs @@ -1,81 +1,81 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Declaration -{ - public sealed class WHTCCorrection - { - private readonly WHTCCorrectionData _data = new WHTCCorrectionData(); - - public double Lookup(MissionType mission, double rural, double urban, double motorway) - { - var entry = _data.Lookup(mission); - return rural * entry.Rural + urban * entry.Urban + motorway * entry.Motorway; - } - - private sealed class WHTCCorrectionData : LookupData<MissionType, Entry> - { - protected override string ResourceId - { - get { return DeclarationData.DeclarationDataResourcePrefix + ".WHTC-Weighting-Factors.csv"; } - } - - protected override string ErrorMessage - { - get { return "WHTC Correction Lookup Error: no value found. Mission: '{0}'"; } - } - - protected override void ParseData(DataTable table) - { - foreach (MissionType mission in Enum.GetValues(typeof(MissionType))) { - if (mission.IsEMS()) { - continue; - } - var values = table.Columns[mission.ToString().ToLower()].Values<string>().ToDouble().ToArray(); - Data[mission] = new Entry { Urban = values[0], Rural = values[1], Motorway = values[2] }; - } - } - } - - private class Entry - { - public double Rural; - public double Urban; - public double Motorway; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Declaration +{ + public sealed class WHTCCorrection + { + private readonly WHTCCorrectionData _data = new WHTCCorrectionData(); + + public double Lookup(MissionType mission, double rural, double urban, double motorway) + { + var entry = _data.Lookup(mission); + return rural * entry.Rural + urban * entry.Urban + motorway * entry.Motorway; + } + + private sealed class WHTCCorrectionData : LookupData<MissionType, Entry> + { + protected override string ResourceId + { + get { return DeclarationData.DeclarationDataResourcePrefix + ".WHTC-Weighting-Factors.csv"; } + } + + protected override string ErrorMessage + { + get { return "WHTC Correction Lookup Error: no value found. Mission: '{0}'"; } + } + + protected override void ParseData(DataTable table) + { + foreach (MissionType mission in Enum.GetValues(typeof(MissionType))) { + if (mission.IsEMS()) { + continue; + } + var values = table.Columns[mission.ToString().ToLower()].Values<string>().ToDouble().ToArray(); + Data[mission] = new Entry { Urban = values[0], Rural = values[1], Motorway = values[2] }; + } + } + } + + private class Entry + { + public double Rural; + public double Urban; + public double Motorway; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Declaration/Wheels.cs b/VectoCore/VectoCore/Models/Declaration/Wheels.cs index 06914b3490d3260febeb3b35e8080a91ab3b0537..c19a08e0a288a8899ae8a80dc1d0ec2b80069ab3 100644 --- a/VectoCore/VectoCore/Models/Declaration/Wheels.cs +++ b/VectoCore/VectoCore/Models/Declaration/Wheels.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using System.Linq; diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs b/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs index 4e2d69db51240f3f03e71c4a6e2479cc9b69bbdf..72e6c0eb97275baee9c8065ba9011451c4e1c17b 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ModalResult.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.ComponentModel; using System.Data; diff --git a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs index c57e730987a8af615866212c1da05f90d5c2ee4a..35b75ac3719839071365fdbc575aea8989fea4c0 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/ModalResultField.cs @@ -1,376 +1,376 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Reflection; -using System.Text.RegularExpressions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Models.Simulation.Data -{ - /// <summary> - /// Enum with field definitions of the Modal Results File (.vmod). - /// </summary> - public enum ModalResultField - { - /// <summary> - /// Time step [s]. - /// Midpoint of the simulated interval. - /// </summary> - [ModalResultField(typeof(SI), caption: "time [s]")] time, - - /// <summary> - /// Simulation interval around the current time step. [s] - /// </summary> - [ModalResultField(typeof(SI), "simulation_interval", "dt [s]")] simulationInterval, - - /// <summary> - /// Engine speed [1/min]. - /// </summary> - [ModalResultField(typeof(SI), caption: "n_eng_avg [1/min]", outputFactor: 60 / (2 * Math.PI))] n_eng_avg, - - /// <summary> - /// [Nm] Engine torque. - /// </summary> - [ModalResultField(typeof(SI), caption: "T_eng_fcmap [Nm]")] T_eng_fcmap, - - /// <summary> - /// [Nm] Full load torque - /// </summary> - [ModalResultField(typeof(SI), caption: "Tq_full [Nm]")] Tq_full, - - /// <summary> - /// [Nm] Motoring torque - /// </summary> - [ModalResultField(typeof(SI), caption: "Tq_drag [Nm]")] Tq_drag, - - /// <summary> - /// [kW] Engine power. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_eng_out [kW]", outputFactor: 1e-3)] P_eng_out, - - /// <summary> - /// [kW] Engine full load power. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_eng_full [kW]", outputFactor: 1e-3)] P_eng_full, - - /// <summary> - /// [kW] Engine drag power. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_eng_drag [kW]", outputFactor: 1e-3)] P_eng_drag, - - /// <summary> - /// [kW] Engine power at clutch (equals Pe minus loss due to rotational inertia Pa Eng). - /// </summary> - [ModalResultField(typeof(SI), caption: "P_clutch_out [kW]", outputFactor: 1e-3)] P_clutch_out, - - /// <summary> - /// [kW] Rotational acceleration power: Engine. - /// </summary> - [ModalResultField(typeof(SI), name: "P_eng_inertia", caption: "P_eng_inertia [kW]", outputFactor: 1e-3)] P_eng_inertia, - - /// <summary> - /// [kW] Total auxiliary power demand . - /// </summary> - [ModalResultField(typeof(SI), caption: "P_aux [kW]", outputFactor: 1e-3)] P_aux, - - /// <summary> - /// [g/h] Fuel consumption from FC map.. - /// </summary> - [ModalResultField(typeof(SI), name: "FC-Map", caption: "FC-Map [g/h]", outputFactor: 3600 * 1000)] FCMap, - - /// <summary> - /// [g/h] Fuel consumption after Auxiliary-Start/Stop Correction. (Based on FC.) - /// </summary> - [ModalResultField(typeof(SI), name: "FC-AUXc", caption: "FC-AUXc [g/h]", outputFactor: 3600 * 1000)] FCAUXc, - - /// <summary> - /// [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.) - /// </summary> - [ModalResultField(typeof(SI), name: "FC-WHTCc", caption: "FC-WHTCc [g/h]", outputFactor: 3600 * 1000)] FCWHTCc, - - /// <summary> - /// [g/h] Fuel consumption after smart auxiliary correction. - /// </summary> - [ModalResultField(typeof(SI), name: "FC-AAUX", caption: "FC-AAUX [g/h]", outputFactor: 3600 * 1000)] FCAAUX, - - /// <summary> - /// [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.) - /// </summary> - [ModalResultField(typeof(SI), name: "FC-Final", caption: "FC-Final [g/h]", outputFactor: 3600 * 1000)] FCFinal, - - /// <summary> - /// [km] Travelled distance. - /// </summary> - [ModalResultField(typeof(SI), caption: "dist [m]")] dist, - - /// <summary> - /// [km/h] Actual vehicle speed. - /// </summary> - [ModalResultField(typeof(SI), caption: "v_act [km/h]", outputFactor: 3.6)] v_act, - - /// <summary> - /// [km/h] Target vehicle speed. - /// </summary> - [ModalResultField(typeof(SI), caption: "v_targ [km/h]", outputFactor: 3.6)] v_targ, - - /// <summary> - /// [m/s2] Vehicle acceleration. - /// </summary> - [ModalResultField(typeof(SI), caption: "acc [m/s^2]")] acc, - - /// <summary> - /// [%] Road gradient. - /// </summary> - [ModalResultField(typeof(SI), caption: "grad [%]")] grad, - - /// <summary> - /// [-] GearData. "0" = clutch opened / neutral. "0.5" = lock-up clutch is open (AT with torque converter only, see - /// Gearbox) - /// </summary> - [ModalResultField(typeof(uint), caption: "Gear [-]")] Gear, - - [ModalResultField(typeof(SI), caption: "n_gbx_out_avg [1/min]", outputFactor: 60 / (2 * Math.PI))] n_gbx_out_avg, - - [ModalResultField(typeof(SI), caption: "T_gbx_out [Nm]")] T_gbx_out, - - /// <summary> - /// [kW] Gearbox losses. - /// </summary> - [ModalResultField(typeof(SI), name: "P_gbx_loss", caption: "P_gbx_loss [kW]", outputFactor: 1e-3)] P_gbx_loss, - - - [ModalResultField(typeof(SI), name: "P_gbx_shift_loss", caption: "P_gbx_shift_loss [kW]", outputFactor: 1e-3)] P_gbx_shift_loss, - - /// <summary> - /// [kW] Losses in differential / axle transmission. - /// </summary> - [ModalResultField(typeof(SI), name: "Ploss Diff", caption: "P_axle_loss [kW]", outputFactor: 1e-3)] P_axle_loss, - - /// <summary> - /// [kW] Losses in angle transmission. - /// </summary> - [ModalResultField(typeof(SI), name: "Ploss Angle", caption: "P_angle_loss [kW]", outputFactor: 1e-3)] P_angle_loss, - - /// <summary> - /// [kW] Retarder losses. - /// </summary> - [ModalResultField(typeof(SI), name: "P_ret_loss", caption: "P_ret_loss [kW]", outputFactor: 1e-3)] P_ret_loss, - - /// <summary> - /// [kW] Rotational acceleration power: Gearbox. - /// </summary> - [ModalResultField(typeof(SI), name: "P_gbx_inertia", caption: "P_gbx_inertia [kW]", outputFactor: 1e-3)] P_gbx_inertia, - - /// <summary> - /// [kW] Vehicle acceleration power. - /// </summary> - [ModalResultField(typeof(SI), name: "P_veh_inertia", caption: "P_veh_inertia [kW]", outputFactor: 1e-3)] P_veh_inertia, - - /// <summary> - /// [kW] Rolling resistance power demand. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_roll [kW]", outputFactor: 1e-3)] P_roll, - - /// <summary> - /// [kW] Air resistance power demand. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_air [kW]", outputFactor: 1e-3)] P_air, - - /// <summary> - /// [kW] Power demand due to road gradient. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_slope [kW]", outputFactor: 1e-3)] P_slope, - - /// <summary> - /// [kW] Total power demand at wheel = sum of rolling, air, acceleration and road gradient resistance. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_wheel_in [kW]", outputFactor: 1e-3)] P_wheel_in, - - /// <summary> - /// [kW] Brake power. Drag power is included in Pe. - /// </summary> - [ModalResultField(typeof(SI), caption: "P_brake_loss [kW]", outputFactor: 1e-3)] P_brake_loss, - - [ModalResultField(typeof(SI), caption: "P_wheel_inertia [kW]", outputFactor: 1e-3)] P_wheel_inertia, - - [ModalResultField(typeof(SI), caption: "P_brake_in [kW]", outputFactor: 1e-3)] P_brake_in, - - [ModalResultField(typeof(SI), caption: "P_axle_in [kW]", outputFactor: 1e-3)] P_axle_in, - - [ModalResultField(typeof(SI), caption: "P_angle_in [kW]", outputFactor: 1e-3)] P_angle_in, - - [ModalResultField(typeof(SI), caption: "P_ret_in [kW]", outputFactor: 1e-3)] P_retarder_in, - - [ModalResultField(typeof(SI), caption: "P_gbx_in [kW]", outputFactor: 1e-3)] P_gbx_in, - - [ModalResultField(typeof(SI), caption: "P_clutch_loss [kW]", outputFactor: 1e-3)] P_clutch_loss, - - [ModalResultField(typeof(SI), caption: "P_trac [kW]", outputFactor: 1e-3)] P_trac, - - [ModalResultField(typeof(SI), caption: "P_eng_fcmap [kW]", outputFactor: 1e-3)] P_eng_fcmap, - - [ModalResultField(typeof(SI), caption: "P_eng_full_stat [kW]", outputFactor: 1e-3)] P_eng_full_stat, - - /// <summary> - /// [kW] Power demand of Auxiliary with ID xxx. See also Aux Dialog and Driving Cycle. - /// </summary> - [ModalResultField(typeof(SI), outputFactor: 1e-3)] P_aux_, - - /// <summary> - /// [-] true/false indicate whether torque converter is locked or not (only applicable for gears with TC) - /// </summary> - [ModalResultField(typeof(int), caption: "TC locked")] TC_Locked, - - /// <summary> - /// [-] Torque converter speed ratio - /// </summary> - [ModalResultField(typeof(double), name: "TCnu")] TorqueConverterSpeedRatio, - - /// <summary> - /// [-] Torque converter torque ratio - /// </summary> - [ModalResultField(typeof(double), name: "TCmu")] TorqueConverterTorqueRatio, - - [ModalResultField(typeof(SI), "P_TC_out [kW]", outputFactor: 1e-3)] P_TC_out, - - /// <summary> - /// [kW] Power loss at the torque converter. - /// </summary> - [ModalResultField(typeof(SI), "P_TC_loss [kW]", outputFactor: 1e-3)] P_TC_loss, - - /// <summary> - /// [Nm] Torque converter output torque - /// </summary> - [ModalResultField(typeof(SI), "T_TC_out")] TC_TorqueOut, - - /// <summary> - /// [1/min] Torque converter output speed - /// </summary> - [ModalResultField(typeof(SI), "n_TC_out", outputFactor: 60 / (2 * Math.PI))] TC_angularSpeedOut, - - /// <summary> - /// [Nm] Torque converter output torque - /// </summary> - [ModalResultField(typeof(SI), "T_TC_in")] TC_TorqueIn, - - /// <summary> - /// [1/min] Torque converter output speed - /// </summary> - [ModalResultField(typeof(SI), "n_TC_in", outputFactor: 60 / (2 * Math.PI))] TC_angularSpeedIn, - - /// <summary> - /// [m] Altitude - /// </summary> - [ModalResultField(typeof(SI))] altitude, - - [ModalResultField(typeof(SI), name: "ds [m]")] simulationDistance, - - [ModalResultField(typeof(DrivingBehavior))] drivingBehavior, - - [ModalResultField(typeof(double), caption: "AA_NonSmartAlternatorsEfficiency [%]")] AA_NonSmartAlternatorsEfficiency, - [ModalResultField(typeof(SI), caption: "AA_SmartIdleCurrent_Amps [A]")] AA_SmartIdleCurrent_Amps, - [ModalResultField(typeof(double), caption: "AA_SmartIdleAlternatorsEfficiency [%]")] AA_SmartIdleAlternatorsEfficiency, - [ModalResultField(typeof(SI), caption: "AA_SmartTractionCurrent_Amps [A]")] AA_SmartTractionCurrent_Amps, - [ModalResultField(typeof(double), caption: "AA_SmartTractionAlternatorEfficiency [%]")] AA_SmartTractionAlternatorEfficiency, - [ModalResultField(typeof(SI), caption: "AA_SmartOverrunCurrent_Amps [A]")] AA_SmartOverrunCurrent_Amps, - [ModalResultField(typeof(double), caption: "AA_SmartOverrunAlternatorEfficiency [%]")] AA_SmartOverrunAlternatorEfficiency, - [ModalResultField(typeof(SI), caption: "AA_CompressorFlowRate_LitrePerSec [Ni L/s]")] AA_CompressorFlowRate_LitrePerSec, - [ModalResultField(typeof(int), caption: "AA_OverrunFlag [bool]")] AA_OverrunFlag, - [ModalResultField(typeof(int), caption: "AA_EngineIdleFlag [bool]")] AA_EngineIdleFlag, - [ModalResultField(typeof(int), caption: "AA_CompressorFlag [bool]")] AA_CompressorFlag, - [ModalResultField(typeof(SI), caption: "AA_TotalCycleFC_Grams [g]", outputFactor: 1000)] AA_TotalCycleFC_Grams, - [ModalResultField(typeof(SI), caption: "AA_TotalCycleFC_Litres [l]")] AA_TotalCycleFC_Litres, - [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankHVACMechanicals [W]")] AA_AveragePowerDemandCrankHVACMechanicals, - [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankHVACElectricals [W]")] AA_AveragePowerDemandCrankHVACElectricals, - [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankElectrics [W]")] AA_AveragePowerDemandCrankElectrics, - [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankPneumatics [W]")] AA_AveragePowerDemandCrankPneumatics, - [ModalResultField(typeof(SI), caption: "AA_TotalCycleFuelConsumptionCompressorOff [g]", outputFactor: 1000)] AA_TotalCycleFuelConsumptionCompressorOff, - [ModalResultField(typeof(SI), caption: "AA_TotalCycleFuelConsumptionCompressorOn [g]", outputFactor: 1000)] AA_TotalCycleFuelConsumptionCompressorOn, - } - - [AttributeUsage(AttributeTargets.Field)] - public class ModalResultFieldAttribute : Attribute - { - internal ModalResultFieldAttribute(Type dataType, string name = null, string caption = null, uint decimals = 4, - double outputFactor = 1, bool showUnit = false) - { - DataType = dataType; - Name = name; - Caption = caption; - Decimals = decimals; - OutputFactor = outputFactor; - ShowUnit = showUnit; - } - - public bool ShowUnit { get; private set; } - public double OutputFactor { get; private set; } - public uint Decimals { get; private set; } - public Type DataType { get; private set; } - public string Name { get; private set; } - public string Caption { get; private set; } - } - - public static class ModalResultFieldExtensionMethods - { - public static string GetName(this ModalResultField field) - { - return GetAttribute(field).Name ?? field.ToString(); - } - - public static string GetCaption(this ModalResultField field) - { - return GetAttribute(field).Caption ?? GetAttribute(field).Name ?? field.ToString(); - } - - public static string GetShortCaption(this ModalResultField field) - { - var caption = GetCaption(field); - return Regex.Replace(caption, @"\[.*?\]|\<|\>", "").Trim(); - } - - public static Type GetDataType(this ModalResultField field) - { - return GetAttribute(field).DataType; - } - - public static ModalResultFieldAttribute GetAttribute(this ModalResultField field) - { - return (ModalResultFieldAttribute)Attribute.GetCustomAttribute(ForValue(field), typeof(ModalResultFieldAttribute)); - } - - private static MemberInfo ForValue(ModalResultField field) - { - return typeof(ModalResultField).GetField(Enum.GetName(typeof(ModalResultField), field)); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Reflection; +using System.Text.RegularExpressions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.Simulation.Data +{ + /// <summary> + /// Enum with field definitions of the Modal Results File (.vmod). + /// </summary> + public enum ModalResultField + { + /// <summary> + /// Time step [s]. + /// Midpoint of the simulated interval. + /// </summary> + [ModalResultField(typeof(SI), caption: "time [s]")] time, + + /// <summary> + /// Simulation interval around the current time step. [s] + /// </summary> + [ModalResultField(typeof(SI), "simulation_interval", "dt [s]")] simulationInterval, + + /// <summary> + /// Engine speed [1/min]. + /// </summary> + [ModalResultField(typeof(SI), caption: "n_eng_avg [1/min]", outputFactor: 60 / (2 * Math.PI))] n_eng_avg, + + /// <summary> + /// [Nm] Engine torque. + /// </summary> + [ModalResultField(typeof(SI), caption: "T_eng_fcmap [Nm]")] T_eng_fcmap, + + /// <summary> + /// [Nm] Full load torque + /// </summary> + [ModalResultField(typeof(SI), caption: "Tq_full [Nm]")] Tq_full, + + /// <summary> + /// [Nm] Motoring torque + /// </summary> + [ModalResultField(typeof(SI), caption: "Tq_drag [Nm]")] Tq_drag, + + /// <summary> + /// [kW] Engine power. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_eng_out [kW]", outputFactor: 1e-3)] P_eng_out, + + /// <summary> + /// [kW] Engine full load power. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_eng_full [kW]", outputFactor: 1e-3)] P_eng_full, + + /// <summary> + /// [kW] Engine drag power. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_eng_drag [kW]", outputFactor: 1e-3)] P_eng_drag, + + /// <summary> + /// [kW] Engine power at clutch (equals Pe minus loss due to rotational inertia Pa Eng). + /// </summary> + [ModalResultField(typeof(SI), caption: "P_clutch_out [kW]", outputFactor: 1e-3)] P_clutch_out, + + /// <summary> + /// [kW] Rotational acceleration power: Engine. + /// </summary> + [ModalResultField(typeof(SI), name: "P_eng_inertia", caption: "P_eng_inertia [kW]", outputFactor: 1e-3)] P_eng_inertia, + + /// <summary> + /// [kW] Total auxiliary power demand . + /// </summary> + [ModalResultField(typeof(SI), caption: "P_aux [kW]", outputFactor: 1e-3)] P_aux, + + /// <summary> + /// [g/h] Fuel consumption from FC map.. + /// </summary> + [ModalResultField(typeof(SI), name: "FC-Map", caption: "FC-Map [g/h]", outputFactor: 3600 * 1000)] FCMap, + + /// <summary> + /// [g/h] Fuel consumption after Auxiliary-Start/Stop Correction. (Based on FC.) + /// </summary> + [ModalResultField(typeof(SI), name: "FC-AUXc", caption: "FC-AUXc [g/h]", outputFactor: 3600 * 1000)] FCAUXc, + + /// <summary> + /// [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.) + /// </summary> + [ModalResultField(typeof(SI), name: "FC-WHTCc", caption: "FC-WHTCc [g/h]", outputFactor: 3600 * 1000)] FCWHTCc, + + /// <summary> + /// [g/h] Fuel consumption after smart auxiliary correction. + /// </summary> + [ModalResultField(typeof(SI), name: "FC-AAUX", caption: "FC-AAUX [g/h]", outputFactor: 3600 * 1000)] FCAAUX, + + /// <summary> + /// [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.) + /// </summary> + [ModalResultField(typeof(SI), name: "FC-Final", caption: "FC-Final [g/h]", outputFactor: 3600 * 1000)] FCFinal, + + /// <summary> + /// [km] Travelled distance. + /// </summary> + [ModalResultField(typeof(SI), caption: "dist [m]")] dist, + + /// <summary> + /// [km/h] Actual vehicle speed. + /// </summary> + [ModalResultField(typeof(SI), caption: "v_act [km/h]", outputFactor: 3.6)] v_act, + + /// <summary> + /// [km/h] Target vehicle speed. + /// </summary> + [ModalResultField(typeof(SI), caption: "v_targ [km/h]", outputFactor: 3.6)] v_targ, + + /// <summary> + /// [m/s2] Vehicle acceleration. + /// </summary> + [ModalResultField(typeof(SI), caption: "acc [m/s^2]")] acc, + + /// <summary> + /// [%] Road gradient. + /// </summary> + [ModalResultField(typeof(SI), caption: "grad [%]")] grad, + + /// <summary> + /// [-] GearData. "0" = clutch opened / neutral. "0.5" = lock-up clutch is open (AT with torque converter only, see + /// Gearbox) + /// </summary> + [ModalResultField(typeof(uint), caption: "Gear [-]")] Gear, + + [ModalResultField(typeof(SI), caption: "n_gbx_out_avg [1/min]", outputFactor: 60 / (2 * Math.PI))] n_gbx_out_avg, + + [ModalResultField(typeof(SI), caption: "T_gbx_out [Nm]")] T_gbx_out, + + /// <summary> + /// [kW] Gearbox losses. + /// </summary> + [ModalResultField(typeof(SI), name: "P_gbx_loss", caption: "P_gbx_loss [kW]", outputFactor: 1e-3)] P_gbx_loss, + + + [ModalResultField(typeof(SI), name: "P_gbx_shift_loss", caption: "P_gbx_shift_loss [kW]", outputFactor: 1e-3)] P_gbx_shift_loss, + + /// <summary> + /// [kW] Losses in differential / axle transmission. + /// </summary> + [ModalResultField(typeof(SI), name: "Ploss Diff", caption: "P_axle_loss [kW]", outputFactor: 1e-3)] P_axle_loss, + + /// <summary> + /// [kW] Losses in angle transmission. + /// </summary> + [ModalResultField(typeof(SI), name: "Ploss Angle", caption: "P_angle_loss [kW]", outputFactor: 1e-3)] P_angle_loss, + + /// <summary> + /// [kW] Retarder losses. + /// </summary> + [ModalResultField(typeof(SI), name: "P_ret_loss", caption: "P_ret_loss [kW]", outputFactor: 1e-3)] P_ret_loss, + + /// <summary> + /// [kW] Rotational acceleration power: Gearbox. + /// </summary> + [ModalResultField(typeof(SI), name: "P_gbx_inertia", caption: "P_gbx_inertia [kW]", outputFactor: 1e-3)] P_gbx_inertia, + + /// <summary> + /// [kW] Vehicle acceleration power. + /// </summary> + [ModalResultField(typeof(SI), name: "P_veh_inertia", caption: "P_veh_inertia [kW]", outputFactor: 1e-3)] P_veh_inertia, + + /// <summary> + /// [kW] Rolling resistance power demand. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_roll [kW]", outputFactor: 1e-3)] P_roll, + + /// <summary> + /// [kW] Air resistance power demand. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_air [kW]", outputFactor: 1e-3)] P_air, + + /// <summary> + /// [kW] Power demand due to road gradient. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_slope [kW]", outputFactor: 1e-3)] P_slope, + + /// <summary> + /// [kW] Total power demand at wheel = sum of rolling, air, acceleration and road gradient resistance. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_wheel_in [kW]", outputFactor: 1e-3)] P_wheel_in, + + /// <summary> + /// [kW] Brake power. Drag power is included in Pe. + /// </summary> + [ModalResultField(typeof(SI), caption: "P_brake_loss [kW]", outputFactor: 1e-3)] P_brake_loss, + + [ModalResultField(typeof(SI), caption: "P_wheel_inertia [kW]", outputFactor: 1e-3)] P_wheel_inertia, + + [ModalResultField(typeof(SI), caption: "P_brake_in [kW]", outputFactor: 1e-3)] P_brake_in, + + [ModalResultField(typeof(SI), caption: "P_axle_in [kW]", outputFactor: 1e-3)] P_axle_in, + + [ModalResultField(typeof(SI), caption: "P_angle_in [kW]", outputFactor: 1e-3)] P_angle_in, + + [ModalResultField(typeof(SI), caption: "P_ret_in [kW]", outputFactor: 1e-3)] P_retarder_in, + + [ModalResultField(typeof(SI), caption: "P_gbx_in [kW]", outputFactor: 1e-3)] P_gbx_in, + + [ModalResultField(typeof(SI), caption: "P_clutch_loss [kW]", outputFactor: 1e-3)] P_clutch_loss, + + [ModalResultField(typeof(SI), caption: "P_trac [kW]", outputFactor: 1e-3)] P_trac, + + [ModalResultField(typeof(SI), caption: "P_eng_fcmap [kW]", outputFactor: 1e-3)] P_eng_fcmap, + + [ModalResultField(typeof(SI), caption: "P_eng_full_stat [kW]", outputFactor: 1e-3)] P_eng_full_stat, + + /// <summary> + /// [kW] Power demand of Auxiliary with ID xxx. See also Aux Dialog and Driving Cycle. + /// </summary> + [ModalResultField(typeof(SI), outputFactor: 1e-3)] P_aux_, + + /// <summary> + /// [-] true/false indicate whether torque converter is locked or not (only applicable for gears with TC) + /// </summary> + [ModalResultField(typeof(int), caption: "TC locked")] TC_Locked, + + /// <summary> + /// [-] Torque converter speed ratio + /// </summary> + [ModalResultField(typeof(double), name: "TCnu")] TorqueConverterSpeedRatio, + + /// <summary> + /// [-] Torque converter torque ratio + /// </summary> + [ModalResultField(typeof(double), name: "TCmu")] TorqueConverterTorqueRatio, + + [ModalResultField(typeof(SI), "P_TC_out [kW]", outputFactor: 1e-3)] P_TC_out, + + /// <summary> + /// [kW] Power loss at the torque converter. + /// </summary> + [ModalResultField(typeof(SI), "P_TC_loss [kW]", outputFactor: 1e-3)] P_TC_loss, + + /// <summary> + /// [Nm] Torque converter output torque + /// </summary> + [ModalResultField(typeof(SI), "T_TC_out")] TC_TorqueOut, + + /// <summary> + /// [1/min] Torque converter output speed + /// </summary> + [ModalResultField(typeof(SI), "n_TC_out", outputFactor: 60 / (2 * Math.PI))] TC_angularSpeedOut, + + /// <summary> + /// [Nm] Torque converter output torque + /// </summary> + [ModalResultField(typeof(SI), "T_TC_in")] TC_TorqueIn, + + /// <summary> + /// [1/min] Torque converter output speed + /// </summary> + [ModalResultField(typeof(SI), "n_TC_in", outputFactor: 60 / (2 * Math.PI))] TC_angularSpeedIn, + + /// <summary> + /// [m] Altitude + /// </summary> + [ModalResultField(typeof(SI))] altitude, + + [ModalResultField(typeof(SI), name: "ds [m]")] simulationDistance, + + [ModalResultField(typeof(DrivingBehavior))] drivingBehavior, + + [ModalResultField(typeof(double), caption: "AA_NonSmartAlternatorsEfficiency [%]")] AA_NonSmartAlternatorsEfficiency, + [ModalResultField(typeof(SI), caption: "AA_SmartIdleCurrent_Amps [A]")] AA_SmartIdleCurrent_Amps, + [ModalResultField(typeof(double), caption: "AA_SmartIdleAlternatorsEfficiency [%]")] AA_SmartIdleAlternatorsEfficiency, + [ModalResultField(typeof(SI), caption: "AA_SmartTractionCurrent_Amps [A]")] AA_SmartTractionCurrent_Amps, + [ModalResultField(typeof(double), caption: "AA_SmartTractionAlternatorEfficiency [%]")] AA_SmartTractionAlternatorEfficiency, + [ModalResultField(typeof(SI), caption: "AA_SmartOverrunCurrent_Amps [A]")] AA_SmartOverrunCurrent_Amps, + [ModalResultField(typeof(double), caption: "AA_SmartOverrunAlternatorEfficiency [%]")] AA_SmartOverrunAlternatorEfficiency, + [ModalResultField(typeof(SI), caption: "AA_CompressorFlowRate_LitrePerSec [Ni L/s]")] AA_CompressorFlowRate_LitrePerSec, + [ModalResultField(typeof(int), caption: "AA_OverrunFlag [bool]")] AA_OverrunFlag, + [ModalResultField(typeof(int), caption: "AA_EngineIdleFlag [bool]")] AA_EngineIdleFlag, + [ModalResultField(typeof(int), caption: "AA_CompressorFlag [bool]")] AA_CompressorFlag, + [ModalResultField(typeof(SI), caption: "AA_TotalCycleFC_Grams [g]", outputFactor: 1000)] AA_TotalCycleFC_Grams, + [ModalResultField(typeof(SI), caption: "AA_TotalCycleFC_Litres [l]")] AA_TotalCycleFC_Litres, + [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankHVACMechanicals [W]")] AA_AveragePowerDemandCrankHVACMechanicals, + [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankHVACElectricals [W]")] AA_AveragePowerDemandCrankHVACElectricals, + [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankElectrics [W]")] AA_AveragePowerDemandCrankElectrics, + [ModalResultField(typeof(SI), caption: "AA_AveragePowerDemandCrankPneumatics [W]")] AA_AveragePowerDemandCrankPneumatics, + [ModalResultField(typeof(SI), caption: "AA_TotalCycleFuelConsumptionCompressorOff [g]", outputFactor: 1000)] AA_TotalCycleFuelConsumptionCompressorOff, + [ModalResultField(typeof(SI), caption: "AA_TotalCycleFuelConsumptionCompressorOn [g]", outputFactor: 1000)] AA_TotalCycleFuelConsumptionCompressorOn, + } + + [AttributeUsage(AttributeTargets.Field)] + public class ModalResultFieldAttribute : Attribute + { + internal ModalResultFieldAttribute(Type dataType, string name = null, string caption = null, uint decimals = 4, + double outputFactor = 1, bool showUnit = false) + { + DataType = dataType; + Name = name; + Caption = caption; + Decimals = decimals; + OutputFactor = outputFactor; + ShowUnit = showUnit; + } + + public bool ShowUnit { get; private set; } + public double OutputFactor { get; private set; } + public uint Decimals { get; private set; } + public Type DataType { get; private set; } + public string Name { get; private set; } + public string Caption { get; private set; } + } + + public static class ModalResultFieldExtensionMethods + { + public static string GetName(this ModalResultField field) + { + return GetAttribute(field).Name ?? field.ToString(); + } + + public static string GetCaption(this ModalResultField field) + { + return GetAttribute(field).Caption ?? GetAttribute(field).Name ?? field.ToString(); + } + + public static string GetShortCaption(this ModalResultField field) + { + var caption = GetCaption(field); + return Regex.Replace(caption, @"\[.*?\]|\<|\>", "").Trim(); + } + + public static Type GetDataType(this ModalResultField field) + { + return GetAttribute(field).DataType; + } + + public static ModalResultFieldAttribute GetAttribute(this ModalResultField field) + { + return (ModalResultFieldAttribute)Attribute.GetCustomAttribute(ForValue(field), typeof(ModalResultFieldAttribute)); + } + + private static MemberInfo ForValue(ModalResultField field) + { + return typeof(ModalResultField).GetField(Enum.GetName(typeof(ModalResultField), field)); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs index 5eb3f3e2c1200ab8988addbe7ff6a464547973ae..37846d8653cff369a62ea4b6d0636c9ad7c2128c 100644 --- a/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs +++ b/VectoCore/VectoCore/Models/Simulation/Data/VectoRunData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs index 9772be92599444e8e7690a4576e5679900d085e2..f2b32f5f5919e7165ec360fe73ef74ba13b4773a 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IAxlegearInfo.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - public interface IAxlegearInfo - { - Watt AxlegearLoss(); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + public interface IAxlegearInfo + { + Watt AxlegearLoss(); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs index a9855472c7d887b7073b537504204524221af6ef..bf215dc2bf4f492ffb798262c9795b570db4d657 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IClutchInfo.cs @@ -1,43 +1,43 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - public interface IClutchInfo - { - /// <summary> - /// Returns if the clutch is closed in the current interval. - /// </summary> - bool ClutchClosed(Second absTime); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + public interface IClutchInfo + { + /// <summary> + /// Returns if the clutch is closed in the current interval. + /// </summary> + bool ClutchClosed(Second absTime); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs index 94cf6d06a3edf198fd708388fc83a0b3cd7f0506..292497a44ed911d50203b64645f6e79fd0f3ddd9 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDataBus.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent; diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs index 74b952668c1e683cd3fad489c11609d0809f1b90..cef9d77aa19e7158d8436e2e9903258597fb3532 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IDriverInfo.cs @@ -1,50 +1,50 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - public enum DrivingBehavior - { - Halted, - Accelerating, - Driving, - Coasting, - Braking, - } - - public interface IDriverInfo - { - DrivingBehavior DriverBehavior { get; } - MeterPerSquareSecond DriverAcceleration { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + public enum DrivingBehavior + { + Halted, + Accelerating, + Driving, + Coasting, + Braking, + } + + public interface IDriverInfo + { + DrivingBehavior DriverBehavior { get; } + MeterPerSquareSecond DriverAcceleration { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IEngineInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IEngineInfo.cs index 811d85d59d5067959c6bc1bff0f03c8929f578de..b368646751d9b2e0ae11566fc0fc7e57483256c7 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IEngineInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IEngineInfo.cs @@ -1,60 +1,60 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - /// <summary> - /// Defines a method to access shared data of the engine. - /// </summary> - public interface IEngineInfo - { - /// <summary> - /// [rad/s] The current engine speed. - /// </summary> - PerSecond EngineSpeed { get; } - - NewtonMeter EngineTorque { get; } - - Watt EngineStationaryFullPower(PerSecond angularSpeed); - - Watt EngineDragPower(PerSecond angularSpeed); - - PerSecond EngineIdleSpeed { get; } - - PerSecond EngineRatedSpeed { get; } - - PerSecond EngineN95hSpeed { get; } - - PerSecond EngineN80hSpeed { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + /// <summary> + /// Defines a method to access shared data of the engine. + /// </summary> + public interface IEngineInfo + { + /// <summary> + /// [rad/s] The current engine speed. + /// </summary> + PerSecond EngineSpeed { get; } + + NewtonMeter EngineTorque { get; } + + Watt EngineStationaryFullPower(PerSecond angularSpeed); + + Watt EngineDragPower(PerSecond angularSpeed); + + PerSecond EngineIdleSpeed { get; } + + PerSecond EngineRatedSpeed { get; } + + PerSecond EngineN95hSpeed { get; } + + PerSecond EngineN80hSpeed { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs index 4781b613aa975ebe15a2741969f478fa152b593a..ba1cf6a0eb2e6691b6dbff4b0267a00450eb41b8 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent; diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IMileageCounter.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IMileageCounter.cs index ebc21c5952c1e1f5747c0315dbc79b803406b2f0..ae45f45a2be484a0d38d5cf0b05aa58916e54b14 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IMileageCounter.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IMileageCounter.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - public interface IMileageCounter - { - Meter Distance { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + public interface IMileageCounter + { + Meter Distance { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IVehicleInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IVehicleInfo.cs index ad5f20d3b6d1dff6c9d403491db45c828579c7d8..72eaa1ccbd0d70e1581820463dea772652d9201a 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IVehicleInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IVehicleInfo.cs @@ -1,63 +1,63 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - /// <summary> - /// Defines a method to access shared data of the vehicle. - /// </summary> - public interface IVehicleInfo - { - /// <summary> - /// Returns the current vehicle speed. - /// </summary> - /// <value></value> - MeterPerSecond VehicleSpeed { get; } - - bool VehicleStopped { get; } - - Kilogram VehicleMass { get; } - - Kilogram VehicleLoading { get; } - - Kilogram TotalMass { get; } - - CubicMeter CargoVolume { get; } - - Newton AirDragResistance(MeterPerSecond previousVelocity, MeterPerSecond nextVelocity); - - Newton RollingResistance(Radian gradient); - - Newton SlopeResistance(Radian gradient); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + /// <summary> + /// Defines a method to access shared data of the vehicle. + /// </summary> + public interface IVehicleInfo + { + /// <summary> + /// Returns the current vehicle speed. + /// </summary> + /// <value></value> + MeterPerSecond VehicleSpeed { get; } + + bool VehicleStopped { get; } + + Kilogram VehicleMass { get; } + + Kilogram VehicleLoading { get; } + + Kilogram TotalMass { get; } + + CubicMeter CargoVolume { get; } + + Newton AirDragResistance(MeterPerSecond previousVelocity, MeterPerSecond nextVelocity); + + Newton RollingResistance(Radian gradient); + + Newton SlopeResistance(Radian gradient); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IWheelsInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IWheelsInfo.cs index 88094d7c3fce7423ea65ba03cf881071f4ce334f..781e5fe815ef3a8d431875c65f8b995bae27628a 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IWheelsInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IWheelsInfo.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.DataBus -{ - public interface IWheelsInfo - { - Kilogram ReducedMassWheels { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.DataBus +{ + public interface IWheelsInfo + { + Kilogram ReducedMassWheels { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/IVectoRun.cs b/VectoCore/VectoCore/Models/Simulation/IVectoRun.cs index e978f6f091a0bffa2638655db93e61a91bbabc52..aba7fae6fdb8acf583747a8ddf9d7bc5a0b87a42 100644 --- a/VectoCore/VectoCore/Models/Simulation/IVectoRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/IVectoRun.cs @@ -1,69 +1,69 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCore.Models.Simulation -{ - /// <summary> - /// Defines the methods for a single vecto run. - /// </summary> - public interface IVectoRun - { - /// <summary> - /// Run the simulation. - /// </summary> - void Run(); - - /// <summary> - /// Cancel the running simulation. - /// </summary> - void Cancel(); - - /// <summary> - /// unique identifier of a single run - /// </summary> - int RunIdentifier { get; } - - string RunName { get; } - string CycleName { get; } - - string RunSuffix { get; } - - double Progress { get; } - - /// <summary> - /// Return the vehicle container. - /// </summary> - /// <returns></returns> - IVehicleContainer GetContainer(); - - bool FinishedWithoutErrors { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCore.Models.Simulation +{ + /// <summary> + /// Defines the methods for a single vecto run. + /// </summary> + public interface IVectoRun + { + /// <summary> + /// Run the simulation. + /// </summary> + void Run(); + + /// <summary> + /// Cancel the running simulation. + /// </summary> + void Cancel(); + + /// <summary> + /// unique identifier of a single run + /// </summary> + int RunIdentifier { get; } + + string RunName { get; } + string CycleName { get; } + + string RunSuffix { get; } + + double Progress { get; } + + /// <summary> + /// Return the vehicle container. + /// </summary> + /// <returns></returns> + IVehicleContainer GetContainer(); + + bool FinishedWithoutErrors { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs index 5ea36cc1c43e70ca7afeb9e09aabec174ccd9efa..b14b1af37372091bb66b52f666a527c72db53975 100644 --- a/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/IVehicleContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs index ba8e4cbf2a337d40895c9fb95fc33594994ea29c..cd8a1d8182426e525aa4950338a181730f1d2127 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/DistanceRun.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/JobContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/JobContainer.cs index c77ea5e0687a545e42922e45b451ef2146d2de32..775c19f5ccd8861a42cccb59e153412c68f7a446 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/JobContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/JobContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index 61e1769e3b13c3b10c9bcb2f3d5bcd2edbc420e2..d9368e83f6a6efb131d79b3a2e2217d3b32ddb95 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Linq; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs index a70fc63fd8a592a130e56e669186d8590b8ad005..8d72fe26083182bd5cedd333b70d9ff088840611 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/TimeRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/TimeRun.cs index fff6b6a0076e72c129c182e8e2ee0076bc623f3e..944cb4602169da2d5e3b541626f24d8cb0a1d3b6 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/TimeRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/TimeRun.cs @@ -1,79 +1,79 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.Simulation.Impl -{ - public class TimeRun : VectoRun - { - public TimeRun(IVehicleContainer container) : base(container) {} - - protected override IResponse DoSimulationStep() - { - dt = Constants.SimulationSettings.MeasuredSpeedTargetTimeInterval; - - var debug = new DebugData(); - var loopCount = 0; - IResponse response; - do { - response = CyclePort.Request(AbsTime, dt); - debug.Add(response); - - response.Switch(). - Case<ResponseSuccess>(r => { dt = r.SimulationInterval; }). - Case<ResponseFailTimeInterval>(r => { dt = r.DeltaT; }). - Case<ResponseCycleFinished>(r => { - FinishedWithoutErrors = true; - Log.Info("========= Driving Cycle Finished"); - }). - Default(r => { throw new VectoException("TimeRun got an unexpected response: {0}", r); }); - if (loopCount++ > Constants.SimulationSettings.MaximumIterationCountForSimulationStep) { - throw new VectoSimulationException("Maximum iteration count for a single simulation interval reached! Aborting!"); - } - } while (!(response is ResponseSuccess || response is ResponseCycleFinished)); - - return response; - } - - protected override IResponse Initialize() - { - Log.Info("Starting {0}", RunIdentifier); - var response = CyclePort.Initialize(); - AbsTime = response.AbsTime; - return response; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.Simulation.Impl +{ + public class TimeRun : VectoRun + { + public TimeRun(IVehicleContainer container) : base(container) {} + + protected override IResponse DoSimulationStep() + { + dt = Constants.SimulationSettings.MeasuredSpeedTargetTimeInterval; + + var debug = new DebugData(); + var loopCount = 0; + IResponse response; + do { + response = CyclePort.Request(AbsTime, dt); + debug.Add(response); + + response.Switch(). + Case<ResponseSuccess>(r => { dt = r.SimulationInterval; }). + Case<ResponseFailTimeInterval>(r => { dt = r.DeltaT; }). + Case<ResponseCycleFinished>(r => { + FinishedWithoutErrors = true; + Log.Info("========= Driving Cycle Finished"); + }). + Default(r => { throw new VectoException("TimeRun got an unexpected response: {0}", r); }); + if (loopCount++ > Constants.SimulationSettings.MaximumIterationCountForSimulationStep) { + throw new VectoSimulationException("Maximum iteration count for a single simulation interval reached! Aborting!"); + } + } while (!(response is ResponseSuccess || response is ResponseCycleFinished)); + + return response; + } + + protected override IResponse Initialize() + { + Log.Info("Starting {0}", RunIdentifier); + var response = CyclePort.Initialize(); + AbsTime = response.AbsTime; + return response; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs index 0bd336c0cee33fb29798e69a5768a676075ededa..635110268b2f5d2a67744421a16dc4430cbfeb0e 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VectoRun.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.ComponentModel.DataAnnotations; using System.Threading; diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index c6022e6d61b21733efdb38f073269d15c7dada32..5a15388371dc50ea5cebbeebb8c193294e4cc58c 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs index d775142198097a738bd32fd62cab239242987819..f84839da581106d6cca69eafa76a4aa9111d7fbd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AccelerationCurve.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AngledriveData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AngledriveData.cs index d76b49a192a17eb38b64bcd20fb317e66d9a7fa5..4044ee9071080278f5d4e189cccd97fcb2e9ea6f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AngledriveData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AngledriveData.cs @@ -1,44 +1,44 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - public class AngledriveData : SimulationComponentData - { - [ValidateObject] public TransmissionData Angledrive; - - public AngledriveType Type; - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + public class AngledriveData : SimulationComponentData + { + [ValidateObject] public TransmissionData Angledrive; + + public AngledriveType Type; + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs index d5eb87ca328db6894fce02ff07e0b2fb22170559..ae310e6a4708699baadf6f1cf85ede3730eefc2e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxSupplyPowerReader.cs @@ -1,62 +1,62 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.Data; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - /// <summary> - /// Reader for Auxiliary Supply Power. Is used by Distance, Time, and EngineOnly based Data Parser. - /// </summary> - public static class AuxSupplyPowerReader - { - /// <summary> - /// Reads Auxiliary Supply Power (defined by AuxSupplyPowerField-Prefix "Aux_"). - /// </summary> - public static Dictionary<string, Watt> GetAuxiliaries(this DataRow row) - { - var aux = new Dictionary<string, Watt>(); - var cols = row.Table.Columns; - var auxLen = Constants.Auxiliaries.Prefix.Length; - for (var i = 0; i < cols.Count; i++) { - var c = cols[i].ColumnName.ToUpper(); - if (c.Length >= auxLen && c.Substring(0, auxLen) == Constants.Auxiliaries.Prefix) { - aux[c.Substring(auxLen)] = (row.ParseDouble(i) * Constants.Kilo).SI<Watt>(); - } - } - return aux; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.Data; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + /// <summary> + /// Reader for Auxiliary Supply Power. Is used by Distance, Time, and EngineOnly based Data Parser. + /// </summary> + public static class AuxSupplyPowerReader + { + /// <summary> + /// Reads Auxiliary Supply Power (defined by AuxSupplyPowerField-Prefix "Aux_"). + /// </summary> + public static Dictionary<string, Watt> GetAuxiliaries(this DataRow row) + { + var aux = new Dictionary<string, Watt>(); + var cols = row.Table.Columns; + var auxLen = Constants.Auxiliaries.Prefix.Length; + for (var i = 0; i < cols.Count; i++) { + var c = cols[i].ColumnName.ToUpper(); + if (c.Length >= auxLen && c.Substring(0, auxLen) == Constants.Auxiliaries.Prefix) { + aux[c.Substring(auxLen)] = (row.ParseDouble(i) * Constants.Kilo).SI<Watt>(); + } + } + return aux; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs index 1ab6911924dfff1b599bdd4bb13b576a35309976..c55ed0fd805b581573ad15027b34cace9509f3b8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AuxiliaryData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs index 3118eec25d6bf887af0b98a75ba673d12ce7989f..0aa224d11ac634c290b5b5790626e99551fc6f0c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/AxleGearData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs index bcb9fd79bf2554ed1dff5dc017a77a76ef3cefcb..df2648c4135fea1807873a5af0515989582162b9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CombustionEngineData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionCdxALookup.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionCdxALookup.cs index 60bd9b1f464a20efd6ac0d385466936127616ecf..9b3e1938c30159f9a66201ef19324913aaeddee6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionCdxALookup.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionCdxALookup.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs index 4d5317e5c598f2d5a3b730655db6f714b4321dd8..c29a191a8d90bf0437f28a2362f6a8521c483440 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CrosswindCorrectionVAirBeta.cs @@ -1,106 +1,106 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - internal class CrosswindCorrectionVAirBeta : LoggingObject, ICrossWindCorrection - { - public SquareMeter AirDragArea { get; protected set; } - - protected List<CrossWindCorrectionCurveReader.AirDragBetaEntry> AirDragEntries; - protected IDataBus DataBus; - - public CrosswindCorrectionVAirBeta(SquareMeter airDragArea, - List<CrossWindCorrectionCurveReader.AirDragBetaEntry> entries) - { - AirDragArea = airDragArea; - AirDragEntries = entries; - } - - public void SetDataBus(IDataBus dataBus) - { - DataBus = dataBus; - } - - public CrossWindCorrectionMode CorrectionMode - { - get { return CrossWindCorrectionMode.VAirBetaLookupTable; } - } - - public Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2) - { - if (DataBus == null) { - throw new VectoException("Databus is not set - can't access vAir, beta!"); - } - var vAir = DataBus.CycleData.LeftSample.AirSpeedRelativeToVehicle; - var beta = DataBus.CycleData.LeftSample.WindYawAngle; - - // F_air(t) = k * CdA_korr * v_air^2 // assumption: v_air = const for the current interval - // P(t) = F_air(t) * v(t) , v(t) = v1 + a * t - // P_avg = 1/T * Integral P(t) dt - // P_avg = k * CdA_korr * v_air^2 * (v1 + v2) / 2 - var airDragForce = (AirDragArea + DeltaCdxA(Math.Abs(beta))) * Physics.AirDensity / 2.0 * vAir * vAir; - var vAverage = (v1 + v2) / 2; - - return (airDragForce * vAverage).Cast<Watt>(); - } - - protected SquareMeter DeltaCdxA(double beta) - { - var idx = FindIndex(beta); - return VectoMath.Interpolate(AirDragEntries[idx - 1].Beta, AirDragEntries[idx].Beta, AirDragEntries[idx - 1].DeltaCdA, - AirDragEntries[idx].DeltaCdA, beta); - } - - protected int FindIndex(double beta) - { - if (beta < AirDragEntries.First().Beta) { - throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta); - } - if (beta > AirDragEntries.Last().Beta) { - throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta); - } - int index; - AirDragEntries.GetSection(x => x.Beta < beta, out index); - return index + 1; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + internal class CrosswindCorrectionVAirBeta : LoggingObject, ICrossWindCorrection + { + public SquareMeter AirDragArea { get; protected set; } + + protected List<CrossWindCorrectionCurveReader.AirDragBetaEntry> AirDragEntries; + protected IDataBus DataBus; + + public CrosswindCorrectionVAirBeta(SquareMeter airDragArea, + List<CrossWindCorrectionCurveReader.AirDragBetaEntry> entries) + { + AirDragArea = airDragArea; + AirDragEntries = entries; + } + + public void SetDataBus(IDataBus dataBus) + { + DataBus = dataBus; + } + + public CrossWindCorrectionMode CorrectionMode + { + get { return CrossWindCorrectionMode.VAirBetaLookupTable; } + } + + public Watt AverageAirDragPowerLoss(MeterPerSecond v1, MeterPerSecond v2) + { + if (DataBus == null) { + throw new VectoException("Databus is not set - can't access vAir, beta!"); + } + var vAir = DataBus.CycleData.LeftSample.AirSpeedRelativeToVehicle; + var beta = DataBus.CycleData.LeftSample.WindYawAngle; + + // F_air(t) = k * CdA_korr * v_air^2 // assumption: v_air = const for the current interval + // P(t) = F_air(t) * v(t) , v(t) = v1 + a * t + // P_avg = 1/T * Integral P(t) dt + // P_avg = k * CdA_korr * v_air^2 * (v1 + v2) / 2 + var airDragForce = (AirDragArea + DeltaCdxA(Math.Abs(beta))) * Physics.AirDensity / 2.0 * vAir * vAir; + var vAverage = (v1 + v2) / 2; + + return (airDragForce * vAverage).Cast<Watt>(); + } + + protected SquareMeter DeltaCdxA(double beta) + { + var idx = FindIndex(beta); + return VectoMath.Interpolate(AirDragEntries[idx - 1].Beta, AirDragEntries[idx].Beta, AirDragEntries[idx - 1].DeltaCdA, + AirDragEntries[idx].DeltaCdA, beta); + } + + protected int FindIndex(double beta) + { + if (beta < AirDragEntries.First().Beta) { + throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta); + } + if (beta > AirDragEntries.Last().Beta) { + throw new VectoSimulationException("Beta / CdxA Lookup table does not cover beta={0}", beta); + } + int index; + AirDragEntries.GetSection(x => x.Beta < beta, out index); + return index + 1; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/CycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/CycleData.cs index 7ebbde40e0a7a476a8f0e1e9ffcbddbd812263b9..b4f388e0269ec27e4d6729ba60a04573cfeb6397 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/CycleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/CycleData.cs @@ -1,58 +1,58 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - public class CycleData - { - /// <summary> - /// The current absolute distance in the driving cycle. - /// </summary> - public Meter AbsDistance; - - /// <summary> - /// The current absolute time in the driving cycle. - /// </summary> - public Second AbsTime; - - /// <summary> - /// The left data sample of the current driving cycle position. (current start point) - /// </summary> - public DrivingCycleData.DrivingCycleEntry LeftSample; - - /// <summary> - /// The right data sample of the current driving cycle position. (current end point) - /// </summary> - public DrivingCycleData.DrivingCycleEntry RightSample; - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + public class CycleData + { + /// <summary> + /// The current absolute distance in the driving cycle. + /// </summary> + public Meter AbsDistance; + + /// <summary> + /// The current absolute time in the driving cycle. + /// </summary> + public Second AbsTime; + + /// <summary> + /// The left data sample of the current driving cycle position. (current start point) + /// </summary> + public DrivingCycleData.DrivingCycleEntry LeftSample; + + /// <summary> + /// The right data sample of the current driving cycle position. (current end point) + /// </summary> + public DrivingCycleData.DrivingCycleEntry RightSample; + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs index dd44953fce634f726e7273da339c5952dd13784a..71887650bc8095af1d4b5b47d578098d65db12b8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DriverData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs index cb135b8e3be607b2a8db28e9c6a02f10eae026cc..97df6a5a1d3eef4a8dc2290df99cb75ff67781ba 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs index f5550f9978c5c08ebd27ecade94b495056f880e2..42ab22f2a3c8f257eb81b2cb46832ab4c07f6d36 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/EngineFullLoadCurve.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs index 10ddce62dc96433df1715a5fe3111b3b85d606ec..f9398b1bd1294f3fe2bd22b1b44c99fd687987f6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMap.cs @@ -1,111 +1,111 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Diagnostics; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine -{ - public class FuelConsumptionMap : SimulationComponentData - { - [Required, ValidateObject] private readonly DelaunayMap _fuelMap; - - protected internal FuelConsumptionMap(DelaunayMap fuelMap) - { - _fuelMap = fuelMap; - } - - /// <summary> - /// Calculates the fuel consumption based on the given fuel map, the angularVelocity and the torque. - /// </summary> - public FuelConsumptionResult GetFuelConsumption(NewtonMeter torque, PerSecond angularVelocity, - bool allowExtrapolation = false) - { - var result = new FuelConsumptionResult(); - // delaunay map needs is initialised with rpm, therefore the angularVelocity has to be converted. - var value = _fuelMap.Interpolate(torque, angularVelocity); - if (value.HasValue) { - result.Value = value.Value.SI().Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>(); - return result; - } - - if (allowExtrapolation) { - result.Value = - _fuelMap.Extrapolate(torque, angularVelocity).SI().Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>(); - result.Extrapolated = true; - return result; - } - - throw new VectoException("FuelConsumptionMap: Interpolation failed. torque: {0}, n: {1}", torque.Value(), - angularVelocity.AsRPM); - } - - public IReadOnlyCollection<Entry> Entries - { - get - { - var entries = _fuelMap.Entries; - var retVal = new Entry[entries.Count]; - var i = 0; - foreach (var entry in entries) { - retVal[i++] = new Entry(entry.Y.SI<PerSecond>(), entry.X.SI<NewtonMeter>(), entry.Z.SI<KilogramPerSecond>()); - } - return retVal; - } - } - - public class Entry - { - [Required, SIRange(0, 5000 * Constants.RPMToRad)] public readonly PerSecond EngineSpeed; - [Required] public readonly NewtonMeter Torque; - [Required, SIRange(0, double.MaxValue)] public readonly KilogramPerSecond FuelConsumption; - - public Entry(PerSecond engineSpeed, NewtonMeter torque, KilogramPerSecond fuelConsumption) - { - EngineSpeed = engineSpeed; - Torque = torque; - FuelConsumption = fuelConsumption; - } - } - - [DebuggerDisplay("{Value} (extrapolated: {Extrapolated})")] - public class FuelConsumptionResult - { - public KilogramPerSecond Value; - public bool Extrapolated; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Diagnostics; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine +{ + public class FuelConsumptionMap : SimulationComponentData + { + [Required, ValidateObject] private readonly DelaunayMap _fuelMap; + + protected internal FuelConsumptionMap(DelaunayMap fuelMap) + { + _fuelMap = fuelMap; + } + + /// <summary> + /// Calculates the fuel consumption based on the given fuel map, the angularVelocity and the torque. + /// </summary> + public FuelConsumptionResult GetFuelConsumption(NewtonMeter torque, PerSecond angularVelocity, + bool allowExtrapolation = false) + { + var result = new FuelConsumptionResult(); + // delaunay map needs is initialised with rpm, therefore the angularVelocity has to be converted. + var value = _fuelMap.Interpolate(torque, angularVelocity); + if (value.HasValue) { + result.Value = value.Value.SI().Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>(); + return result; + } + + if (allowExtrapolation) { + result.Value = + _fuelMap.Extrapolate(torque, angularVelocity).SI().Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>(); + result.Extrapolated = true; + return result; + } + + throw new VectoException("FuelConsumptionMap: Interpolation failed. torque: {0}, n: {1}", torque.Value(), + angularVelocity.AsRPM); + } + + public IReadOnlyCollection<Entry> Entries + { + get + { + var entries = _fuelMap.Entries; + var retVal = new Entry[entries.Count]; + var i = 0; + foreach (var entry in entries) { + retVal[i++] = new Entry(entry.Y.SI<PerSecond>(), entry.X.SI<NewtonMeter>(), entry.Z.SI<KilogramPerSecond>()); + } + return retVal; + } + } + + public class Entry + { + [Required, SIRange(0, 5000 * Constants.RPMToRad)] public readonly PerSecond EngineSpeed; + [Required] public readonly NewtonMeter Torque; + [Required, SIRange(0, double.MaxValue)] public readonly KilogramPerSecond FuelConsumption; + + public Entry(PerSecond engineSpeed, NewtonMeter torque, KilogramPerSecond fuelConsumption) + { + EngineSpeed = engineSpeed; + Torque = torque; + FuelConsumption = fuelConsumption; + } + } + + [DebuggerDisplay("{Value} (extrapolated: {Extrapolated})")] + public class FuelConsumptionResult + { + public KilogramPerSecond Value; + public bool Extrapolated; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMapReader.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMapReader.cs index ea48008b8d92757d1d8f96856cfa8e134e1688ab..28eee815c29658c136fd7def9c156fd83f23f684 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMapReader.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Engine/FuelConsumptionMapReader.cs @@ -1,127 +1,127 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine -{ - public static class FuelConsumptionMapReader - { - public static FuelConsumptionMap ReadFromFile(string fileName) - { - try { - var data = VectoCSVFile.Read(fileName); - return Create(data); - } catch (Exception e) { - throw new VectoException(string.Format("File {0}: {1}", fileName, e.Message), e); - } - } - - public static FuelConsumptionMap Create(DataTable data) - { - var headerValid = HeaderIsValid(data.Columns); - if (!headerValid) { - LoggingObject.Logger<FuelConsumptionMap>().Warn( - "FuelConsumptionMap: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: {3}", - Fields.EngineSpeed, Fields.Torque, Fields.FuelConsumption, - string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); - } - var delaunayMap = new DelaunayMap("FuelConsumptionMap"); - - foreach (DataRow row in data.Rows) { - try { - var entry = headerValid ? CreateFromColumNames(row) : CreateFromColumnIndizes(row); - delaunayMap.AddPoint(entry.Torque.Value(), - (headerValid ? row.ParseDouble(Fields.EngineSpeed) : row.ParseDouble(0)).RPMtoRad().Value(), - entry.FuelConsumption.Value()); - } catch (Exception e) { - throw new VectoException(string.Format("FuelConsumptionMap - Line {0}: {1}", data.Rows.IndexOf(row), e.Message), e); - } - } - - delaunayMap.Triangulate(); - return new FuelConsumptionMap(delaunayMap); - } - - private static bool HeaderIsValid(DataColumnCollection columns) - { - return columns.Contains(Fields.EngineSpeed) && columns.Contains(Fields.Torque) && - columns.Contains(Fields.FuelConsumption); - } - - private static FuelConsumptionMap.Entry CreateFromColumnIndizes(DataRow row) - { - return new FuelConsumptionMap.Entry( - engineSpeed: row.ParseDouble(0).RPMtoRad(), - torque: row.ParseDouble(1).SI<NewtonMeter>(), - fuelConsumption: - row.ParseDouble(2).SI().Gramm.Per.Hour.ConvertTo().Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>() - ); - } - - private static FuelConsumptionMap.Entry CreateFromColumNames(DataRow row) - { - return new FuelConsumptionMap.Entry( - engineSpeed: row.ParseDouble(Fields.EngineSpeed).SI().Rounds.Per.Minute.Cast<PerSecond>(), - torque: row.ParseDouble(Fields.Torque).SI<NewtonMeter>(), - fuelConsumption: - row.ParseDouble(Fields.FuelConsumption) - .SI() - .Gramm.Per.Hour.ConvertTo() - .Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>() - ); - } - - public static class Fields - { - /// <summary> - /// [rpm] - /// </summary> - public const string EngineSpeed = "engine speed"; - - /// <summary> - /// [Nm] - /// </summary> - public const string Torque = "torque"; - - /// <summary> - /// [g/h] - /// </summary> - public const string FuelConsumption = "fuel consumption"; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Engine +{ + public static class FuelConsumptionMapReader + { + public static FuelConsumptionMap ReadFromFile(string fileName) + { + try { + var data = VectoCSVFile.Read(fileName); + return Create(data); + } catch (Exception e) { + throw new VectoException(string.Format("File {0}: {1}", fileName, e.Message), e); + } + } + + public static FuelConsumptionMap Create(DataTable data) + { + var headerValid = HeaderIsValid(data.Columns); + if (!headerValid) { + LoggingObject.Logger<FuelConsumptionMap>().Warn( + "FuelConsumptionMap: Header Line is not valid. Expected: '{0}, {1}, {2}', Got: {3}", + Fields.EngineSpeed, Fields.Torque, Fields.FuelConsumption, + string.Join(", ", data.Columns.Cast<DataColumn>().Select(c => c.ColumnName))); + } + var delaunayMap = new DelaunayMap("FuelConsumptionMap"); + + foreach (DataRow row in data.Rows) { + try { + var entry = headerValid ? CreateFromColumNames(row) : CreateFromColumnIndizes(row); + delaunayMap.AddPoint(entry.Torque.Value(), + (headerValid ? row.ParseDouble(Fields.EngineSpeed) : row.ParseDouble(0)).RPMtoRad().Value(), + entry.FuelConsumption.Value()); + } catch (Exception e) { + throw new VectoException(string.Format("FuelConsumptionMap - Line {0}: {1}", data.Rows.IndexOf(row), e.Message), e); + } + } + + delaunayMap.Triangulate(); + return new FuelConsumptionMap(delaunayMap); + } + + private static bool HeaderIsValid(DataColumnCollection columns) + { + return columns.Contains(Fields.EngineSpeed) && columns.Contains(Fields.Torque) && + columns.Contains(Fields.FuelConsumption); + } + + private static FuelConsumptionMap.Entry CreateFromColumnIndizes(DataRow row) + { + return new FuelConsumptionMap.Entry( + engineSpeed: row.ParseDouble(0).RPMtoRad(), + torque: row.ParseDouble(1).SI<NewtonMeter>(), + fuelConsumption: + row.ParseDouble(2).SI().Gramm.Per.Hour.ConvertTo().Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>() + ); + } + + private static FuelConsumptionMap.Entry CreateFromColumNames(DataRow row) + { + return new FuelConsumptionMap.Entry( + engineSpeed: row.ParseDouble(Fields.EngineSpeed).SI().Rounds.Per.Minute.Cast<PerSecond>(), + torque: row.ParseDouble(Fields.Torque).SI<NewtonMeter>(), + fuelConsumption: + row.ParseDouble(Fields.FuelConsumption) + .SI() + .Gramm.Per.Hour.ConvertTo() + .Kilo.Gramm.Per.Second.Cast<KilogramPerSecond>() + ); + } + + public static class Fields + { + /// <summary> + /// [rpm] + /// </summary> + public const string EngineSpeed = "engine speed"; + + /// <summary> + /// [Nm] + /// </summary> + public const string Torque = "torque"; + + /// <summary> + /// [g/h] + /// </summary> + public const string FuelConsumption = "fuel consumption"; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs index 306828b54ba48bbccdb59340c6f141ddffcc1281..739dd37e2300dd9d3ca20a832a9b932d9f4f0678 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/GearData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.ComponentModel.DataAnnotations; using System.Linq; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs index e093882dbd00e62e485f5c2da0d9af8fddc8b57e..2d9c2dfbc4fd964488af77eab500a610a94ad44b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/ShiftPolygon.cs @@ -1,7 +1,7 @@ /* * This file is part of VECTO. * -* Copyright © 2012-2016 European Union +* Copyright © 2012-2017 European Union * * Developed by Graz University of Technology, * Institute of Internal Combustion Engines and Thermodynamics, diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs index 591212a1e45f7c0c1c5f93f309073e59fafa7398..18b7a47d7e104470f2445ad1a3b93e08e013c09f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TorqueConverterData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs index 6438cf798c45e14398c6a7b5768e5df34e3fe05c..ccc17e5f94578d5f7df4b2ff30145d6d2a194a80 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/Gearbox/TransmissionLossMap.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs index 31d10fc0203ad520e6172958b2f9a472c211d6dd..a4eca6c9b870f8defb0ff5006e6023f417d43ef0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/GearboxData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/ICrossWindCorrection.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/ICrossWindCorrection.cs index 7b96aae29c334f55d62cb371fb9d4ee20eac4505..c610dc2e541bd0d73ed280b8fc22bd371b59e8fe 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/ICrossWindCorrection.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/ICrossWindCorrection.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Simulation.DataBus; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOData.cs index 821ed76d956d35bf6d136363755a94ac4b6984ad..00536b99be021043f7c83665fa2e7631406ee148 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOData.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - public class PTOData : SimulationComponentData - { - public string TransmissionType; - public ILossMap LossMap; - public DrivingCycleData PTOCycle; - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + public class PTOData : SimulationComponentData + { + public string TransmissionType; + public ILossMap LossMap; + public DrivingCycleData PTOCycle; + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOLossMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOLossMap.cs index dc9892dfef2a6f5059a6ebda4fd12cbeeb33b2d4..24929b1180040380b5db1a0a9d834096f1ddfce0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOLossMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/PTOLossMap.cs @@ -1,65 +1,65 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.ComponentModel.DataAnnotations; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - /// <summary> - /// LossMap for PTO Idle losses. - /// </summary> - public class PTOLossMap : SimulationComponentData, ILossMap - { - [ValidateObject] private readonly Entry[] _entries; - - protected internal PTOLossMap(Entry[] entries) - { - _entries = entries; - } - - /// <summary> - /// Calculates the pto torque loss. - /// </summary> - public NewtonMeter GetTorqueLoss(PerSecond angularVelocity) - { - var s = _entries.GetSection(e => e.EngineSpeed < angularVelocity); - return VectoMath.Interpolate(s.Item1.EngineSpeed, s.Item2.EngineSpeed, s.Item1.PTOTorque, s.Item2.PTOTorque, - angularVelocity); - } - - public class Entry - { - [Required, SIRange(0, double.MaxValue)] public PerSecond EngineSpeed; - [Required, SIRange(0, 1000)] public NewtonMeter PTOTorque; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.ComponentModel.DataAnnotations; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + /// <summary> + /// LossMap for PTO Idle losses. + /// </summary> + public class PTOLossMap : SimulationComponentData, ILossMap + { + [ValidateObject] private readonly Entry[] _entries; + + protected internal PTOLossMap(Entry[] entries) + { + _entries = entries; + } + + /// <summary> + /// Calculates the pto torque loss. + /// </summary> + public NewtonMeter GetTorqueLoss(PerSecond angularVelocity) + { + var s = _entries.GetSection(e => e.EngineSpeed < angularVelocity); + return VectoMath.Interpolate(s.Item1.EngineSpeed, s.Item2.EngineSpeed, s.Item1.PTOTorque, s.Item2.PTOTorque, + angularVelocity); + } + + public class Entry + { + [Required, SIRange(0, double.MaxValue)] public PerSecond EngineSpeed; + [Required, SIRange(0, 1000)] public NewtonMeter PTOTorque; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderData.cs index 2e24e532c7e3b2b47b6801805b9261be9f9e2f27..bfbbea174023a0ac042f95630bfb4cdeaac3034c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderData.cs @@ -1,47 +1,47 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - public class RetarderData : SimulationComponentData - { - [ValidateObject] - public RetarderLossMap LossMap { get; internal set; } - - public RetarderType Type { get; internal set; } - - [SIRange(double.Epsilon, double.MaxValue)] - public double Ratio { get; internal set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + public class RetarderData : SimulationComponentData + { + [ValidateObject] + public RetarderLossMap LossMap { get; internal set; } + + public RetarderType Type { get; internal set; } + + [SIRange(double.Epsilon, double.MaxValue)] + public double Ratio { get; internal set; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderLossMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderLossMap.cs index 9faa334d9e81f5c77d520171361878e555556d7a..56940cd50ae6a1a6d2b92eca334abce71f8a71e1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderLossMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/RetarderLossMap.cs @@ -1,84 +1,84 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.ComponentModel.DataAnnotations; -using System.Linq; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Data -{ - /// <summary> - /// LossMap for retarder. - /// </summary> - public class RetarderLossMap : SimulationComponentData, ILossMap - { - [ValidateObject] private readonly RetarderLossEntry[] _entries; - private PerSecond _minSpeed; - private PerSecond _maxSpeed; - - protected internal RetarderLossMap(RetarderLossEntry[] entries) - { - _entries = entries; - } - - /// <summary> - /// Gets the minimal defined speed of the retarder loss map. - /// </summary> - public PerSecond MinSpeed - { - get { return _minSpeed ?? (_minSpeed = _entries.Min(e => e.RetarderSpeed)); } - } - - /// <summary> - /// Gets the maximal defined speed of the retarder loss map. - /// </summary> - public PerSecond MaxSpeed - { - get { return _maxSpeed ?? (_maxSpeed = _entries.Max(e => e.RetarderSpeed)); } - } - - /// <summary> - /// Calculates the retarder losses. - /// </summary> - public NewtonMeter GetTorqueLoss(PerSecond angularVelocity) - { - var s = _entries.GetSection(e => e.RetarderSpeed < angularVelocity); - return VectoMath.Interpolate(s.Item1.RetarderSpeed, s.Item2.RetarderSpeed, s.Item1.TorqueLoss, s.Item2.TorqueLoss, - angularVelocity); - } - - public class RetarderLossEntry - { - [Required, SIRange(0, double.MaxValue)] public PerSecond RetarderSpeed; - [Required, SIRange(0, 500)] public NewtonMeter TorqueLoss; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.ComponentModel.DataAnnotations; +using System.Linq; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Data +{ + /// <summary> + /// LossMap for retarder. + /// </summary> + public class RetarderLossMap : SimulationComponentData, ILossMap + { + [ValidateObject] private readonly RetarderLossEntry[] _entries; + private PerSecond _minSpeed; + private PerSecond _maxSpeed; + + protected internal RetarderLossMap(RetarderLossEntry[] entries) + { + _entries = entries; + } + + /// <summary> + /// Gets the minimal defined speed of the retarder loss map. + /// </summary> + public PerSecond MinSpeed + { + get { return _minSpeed ?? (_minSpeed = _entries.Min(e => e.RetarderSpeed)); } + } + + /// <summary> + /// Gets the maximal defined speed of the retarder loss map. + /// </summary> + public PerSecond MaxSpeed + { + get { return _maxSpeed ?? (_maxSpeed = _entries.Max(e => e.RetarderSpeed)); } + } + + /// <summary> + /// Calculates the retarder losses. + /// </summary> + public NewtonMeter GetTorqueLoss(PerSecond angularVelocity) + { + var s = _entries.GetSection(e => e.RetarderSpeed < angularVelocity); + return VectoMath.Interpolate(s.Item1.RetarderSpeed, s.Item2.RetarderSpeed, s.Item1.TorqueLoss, s.Item2.TorqueLoss, + angularVelocity); + } + + public class RetarderLossEntry + { + [Required, SIRange(0, double.MaxValue)] public PerSecond RetarderSpeed; + [Required, SIRange(0, 500)] public NewtonMeter TorqueLoss; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs index 41740fad5fce5efa6a5a6e111af5af055725876b..cf3b958a6a4feb222c819f4dc2a2cfb41ccc8db1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/SimulationComponentData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.ComponentModel.DataAnnotations; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs index 5dc090583869ca33045e5108fd622338a5180894..95244bc8ab9e073843affa71a204f57cb5a67154 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/VehicleData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs b/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs index 7ec5e4a1306c7df47e501e8de3df602efcdb02f9..01f2800e1ca1f4413b62a7488182d228a50b6b90 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs @@ -1,53 +1,53 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IAuxInProvider - { - IAuxPort Port(); - } - - public interface IAuxOutProvider - { - void Connect(IAuxPort aux); - } - - public interface IAuxPort - { - NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed); - - NewtonMeter TorqueDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, - PerSecond angularSpeed, bool dryRun = false); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IAuxInProvider + { + IAuxPort Port(); + } + + public interface IAuxOutProvider + { + void Connect(IAuxPort aux); + } + + public interface IAuxPort + { + NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed); + + NewtonMeter TorqueDemand(Second absTime, Second dt, NewtonMeter torquePowerTrain, NewtonMeter torqueEngine, + PerSecond angularSpeed, bool dryRun = false); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs b/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs index 2a5e6a72c0c0e3ec4104e20ab9ba081f4dfb0f24..37a511f2ae4f0ef8b9469c791def4e4f202d5c34 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IAxlegear.cs @@ -1,37 +1,37 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IAxlegear : IPowerTrainComponent, IAxlegearInfo {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IAxlegear : IPowerTrainComponent, IAxlegearInfo {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs b/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs index fc8bac0d7aa8aba563477eaa6f1e22070d2b4d8a..1b061cf56f88070bd9e7f9052cf9fac29ec4a4a8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IBrakes - { - Watt BrakePower { get; set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IBrakes + { + Watt BrakePower { get; set; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs index 69c07e5fb1fd2d67e057d34d07960537ab38a29c..5ef8c0f548c80fc89f936d040fe2277fd6da23da 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IClutch.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + namespace TUGraz.VectoCore.Models.SimulationComponent { public interface IClutch : IPowerTrainComponent diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs index 6c2a8e20857d2d9354441e190fa8fcf2cd4a9a95..8795a10f662d2631e54b00ca1566f02cfb7ad15f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/ICombustionEngine.cs @@ -1,44 +1,44 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines Interfaces for a combustion engine. - /// </summary> - public interface ICombustionEngine : ITnOutProvider, IAuxOutProvider, IEngineInfo - { - IIdleController IdleController { get; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines Interfaces for a combustion engine. + /// </summary> + public interface ICombustionEngine : ITnOutProvider, IAuxOutProvider, IEngineInfo + { + IIdleController IdleController { get; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IDriver.cs b/VectoCore/VectoCore/Models/SimulationComponent/IDriver.cs index 91fd7e86427df49f5526470a2f54f44807c625f9..9fb4ccc90cffa207135436346632c17cd3cd3a01 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IDriver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IDriver.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Connector.Ports; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines interfaces for a driver. - /// </summary> - public interface IDriver : IDrivingCycleOutProvider, IDriverDemandInProvider {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines interfaces for a driver. + /// </summary> + public interface IDriver : IDrivingCycleOutProvider, IDriverDemandInProvider {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IDriverActions.cs b/VectoCore/VectoCore/Models/SimulationComponent/IDriverActions.cs index 26e019bc62cb7e24a641066e990c099bcf1242e3..d76fbcf6059e766e6eeede5268112a54309af9f9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IDriverActions.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IDriverActions.cs @@ -1,132 +1,132 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IDriverActions - { - /// <summary> - /// perform an 'acceleration driving action', i.e., accelerate the vehicle to the given target velocity but limit the - /// acceleration by the driver model (acceleration/deceleration curve). The acceleration is adjusted such that the engine - /// is not overloaded. Brakes are not activated. - /// </summary> - /// <param name="absTime"></param> - /// <param name="ds"></param> - /// <param name="targetVelocity"></param> - /// <param name="gradient"></param> - /// <param name="previousResponse"></param> - /// <returns> - /// * ResponseSuccess - /// * ResponseUnderload: engine's operating point is below drag curve (vehicle accelerates more than driver model allows; engine's drag load is not sufficient for limited acceleration - /// * ResponseGearShift: gearbox needs to shift gears, vehicle can not accelerate (traction interruption) - /// </returns> - IResponse DrivingActionAccelerate(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, - IResponse previousResponse = null); - - /// <summary> - /// perform a 'coasting driving action', i.e., the engine is operating at the full drag load. adjust the acceleration such that - /// this operating point is reached - /// </summary> - /// <param name="absTime"></param> - /// <param name="ds"></param> - /// <param name="maxVelocity"></param> - /// <param name="gradient"></param> - /// <returns> - /// * ResponseSuccess - /// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached. - /// * ResponseSpeedLimitExceeded: vehicle accelerates during coasting which would lead to exceeding the given maxVelocity (e.g., driving downhill, engine's drag load is not sufficient) - /// * ResponseUnderload: engine's operating point is below drag curve (vehicle accelerates more than driver model allows; engine's drag load is not sufficient for limited acceleration - /// * ResponseGearShift: gearbox needs to shift gears, vehicle can not accelerate (traction interruption) - /// </returns> - IResponse DrivingActionCoast(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient); - - /// <summary> - /// perform a 'brake driving action', i.e. decelerate the vehicle by using the mechanical brakes to the next target speed - /// the deceleration is limited by the driver's acceleration/deceleration curve. - /// </summary> - /// <param name="absTime"></param> - /// <param name="ds"></param> - /// <param name="nextTargetSpeed"></param> - /// <param name="gradient"></param> - /// <param name="previousResponse"></param> - /// <param name="targetDistance"></param> - /// <returns> - /// * ResponseSuccess - /// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached. - /// </returns> - IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, - IResponse previousResponse = null, Meter targetDistance = null); - - /// <summary> - /// perform a 'roll driving action', i.e., the clutch is open and the vehicle rolls without motoring. adjust the acceleration - /// such that the torque at the gearbox' input (engine side) is zero - /// </summary> - /// <param name="absTime"></param> - /// <param name="ds"></param> - /// <param name="maxVelocity"></param> - /// <param name="gradient"></param> - /// <returns></returns> - IResponse DrivingActionRoll(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient); - - - /// <summary> - /// perform a 'halt driving action', i.e., the vehicle stops for the given amount of time. - /// </summary> - /// <param name="absTime"></param> - /// <param name="dt"></param> - /// <param name="targetVelocity"></param> - /// <param name="gradient"></param> - /// <returns></returns> - IResponse DrivingActionHalt(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient); - - /// <summary> - /// Compute the distance required to decelerate the vehicle from the current velocity to the given target velocity - /// considering the driver's acceleration/deceleration curve - /// </summary> - /// <param name="targetSpeed"></param> - /// <returns></returns> - Meter ComputeDecelerationDistance(MeterPerSecond targetSpeed); - - /// <summary> - /// access the vehicle's data bus to get information from other components. - /// </summary> - IDataBus DataBus { get; } - - DriverData DriverData { get; } - - DrivingBehavior DriverBehavior { set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IDriverActions + { + /// <summary> + /// perform an 'acceleration driving action', i.e., accelerate the vehicle to the given target velocity but limit the + /// acceleration by the driver model (acceleration/deceleration curve). The acceleration is adjusted such that the engine + /// is not overloaded. Brakes are not activated. + /// </summary> + /// <param name="absTime"></param> + /// <param name="ds"></param> + /// <param name="targetVelocity"></param> + /// <param name="gradient"></param> + /// <param name="previousResponse"></param> + /// <returns> + /// * ResponseSuccess + /// * ResponseUnderload: engine's operating point is below drag curve (vehicle accelerates more than driver model allows; engine's drag load is not sufficient for limited acceleration + /// * ResponseGearShift: gearbox needs to shift gears, vehicle can not accelerate (traction interruption) + /// </returns> + IResponse DrivingActionAccelerate(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, + IResponse previousResponse = null); + + /// <summary> + /// perform a 'coasting driving action', i.e., the engine is operating at the full drag load. adjust the acceleration such that + /// this operating point is reached + /// </summary> + /// <param name="absTime"></param> + /// <param name="ds"></param> + /// <param name="maxVelocity"></param> + /// <param name="gradient"></param> + /// <returns> + /// * ResponseSuccess + /// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached. + /// * ResponseSpeedLimitExceeded: vehicle accelerates during coasting which would lead to exceeding the given maxVelocity (e.g., driving downhill, engine's drag load is not sufficient) + /// * ResponseUnderload: engine's operating point is below drag curve (vehicle accelerates more than driver model allows; engine's drag load is not sufficient for limited acceleration + /// * ResponseGearShift: gearbox needs to shift gears, vehicle can not accelerate (traction interruption) + /// </returns> + IResponse DrivingActionCoast(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient); + + /// <summary> + /// perform a 'brake driving action', i.e. decelerate the vehicle by using the mechanical brakes to the next target speed + /// the deceleration is limited by the driver's acceleration/deceleration curve. + /// </summary> + /// <param name="absTime"></param> + /// <param name="ds"></param> + /// <param name="nextTargetSpeed"></param> + /// <param name="gradient"></param> + /// <param name="previousResponse"></param> + /// <param name="targetDistance"></param> + /// <returns> + /// * ResponseSuccess + /// * ResponseDrivingCycleDistanceExceeded: vehicle is at low speed, coasting would lead to stop before ds is reached. + /// </returns> + IResponse DrivingActionBrake(Second absTime, Meter ds, MeterPerSecond nextTargetSpeed, Radian gradient, + IResponse previousResponse = null, Meter targetDistance = null); + + /// <summary> + /// perform a 'roll driving action', i.e., the clutch is open and the vehicle rolls without motoring. adjust the acceleration + /// such that the torque at the gearbox' input (engine side) is zero + /// </summary> + /// <param name="absTime"></param> + /// <param name="ds"></param> + /// <param name="maxVelocity"></param> + /// <param name="gradient"></param> + /// <returns></returns> + IResponse DrivingActionRoll(Second absTime, Meter ds, MeterPerSecond maxVelocity, Radian gradient); + + + /// <summary> + /// perform a 'halt driving action', i.e., the vehicle stops for the given amount of time. + /// </summary> + /// <param name="absTime"></param> + /// <param name="dt"></param> + /// <param name="targetVelocity"></param> + /// <param name="gradient"></param> + /// <returns></returns> + IResponse DrivingActionHalt(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient); + + /// <summary> + /// Compute the distance required to decelerate the vehicle from the current velocity to the given target velocity + /// considering the driver's acceleration/deceleration curve + /// </summary> + /// <param name="targetSpeed"></param> + /// <returns></returns> + Meter ComputeDecelerationDistance(MeterPerSecond targetSpeed); + + /// <summary> + /// access the vehicle's data bus to get information from other components. + /// </summary> + IDataBus DataBus { get; } + + DriverData DriverData { get; } + + DrivingBehavior DriverBehavior { set; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs index de59438ba3e12b4d503e137017b1f656ce60799b..fecf9cd7ccd337ec8386c5372fad7310f4e5e029 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IDriverStrategy.cs @@ -1,45 +1,45 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IDriverStrategy - { - IDriverActions Driver { get; set; } - - IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient); - - IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IDriverStrategy + { + IDriverActions Driver { get; set; } + + IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient); + + IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycle.cs index 98b1e958fe091a5d0dbcf7c7079a760eb698f805..4d7d6cf5854c414ddb1c1d502e8f4307acae8dd4 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycle.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Connector.Ports; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines interfaces for a driver demand driving cycle. - /// </summary> - public interface IDrivingCycle : IDrivingCycleInfo, ISimulationOutProvider, IDrivingCycleInProvider {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines interfaces for a driver demand driving cycle. + /// </summary> + public interface IDrivingCycle : IDrivingCycleInfo, ISimulationOutProvider, IDrivingCycleInProvider {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycleInfo.cs b/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycleInfo.cs index 3eea43638fb2f0f88e4a9383db556e1510b32311..71bde5add4566bebeb517e7a7ac5904b38983b4e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycleInfo.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IDrivingCycleInfo.cs @@ -1,69 +1,69 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.SimulationComponent.Data; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines a method to access shared data of the driving cycle. - /// </summary> - /// - public interface IDrivingCycleInfo - { - /// <summary> - /// Returns the data samples for the current position in the cycle. - /// </summary> - CycleData CycleData { get; } - - bool PTOActive { get; } - - /// <summary> - /// get a single driving-cycle entry at a certain distance ahead - /// altitude is interpolated between sampling points, slope is averaged - /// </summary> - /// <param name="distance"></param> - /// <returns></returns> - DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance); - - Meter Altitude { get; } - - Meter CycleStartDistance { get; } - - IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Meter lookaheadDistance); - - IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Second time); - - void FinishSimulation(); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines a method to access shared data of the driving cycle. + /// </summary> + /// + public interface IDrivingCycleInfo + { + /// <summary> + /// Returns the data samples for the current position in the cycle. + /// </summary> + CycleData CycleData { get; } + + bool PTOActive { get; } + + /// <summary> + /// get a single driving-cycle entry at a certain distance ahead + /// altitude is interpolated between sampling points, slope is averaged + /// </summary> + /// <param name="distance"></param> + /// <returns></returns> + DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance); + + Meter Altitude { get; } + + Meter CycleStartDistance { get; } + + IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Meter lookaheadDistance); + + IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Second time); + + void FinishSimulation(); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs index 13b26e232f0fc905e05029da98b885fc2456aeb9..9f43750e7ca38d466e2a2af6e1734374ef4490a9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IGearbox.cs @@ -1,40 +1,40 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines interfaces for a gearbox. - /// </summary> - public interface IGearbox : IPowerTrainComponent, IGearboxInfo {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines interfaces for a gearbox. + /// </summary> + public interface IGearbox : IPowerTrainComponent, IGearboxInfo {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs index aa2af093b01c72d48f4895058d22be8957b0a5a5..9999b599bcfd12ef9d9dde36a24f974f1a6e34fd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IIdleController.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCore.Models.Connector.Ports; namespace TUGraz.VectoCore.Models.SimulationComponent diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ILossMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/ILossMap.cs index 286ffc79a3e0efad84cb1e0b0d8beaefd39a020a..53f685f5225d3a10e89e4f39b3217c7de1892007 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/ILossMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/ILossMap.cs @@ -1,43 +1,43 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface ILossMap - { - /// <summary> - /// Calculates the torque loss. - /// </summary> - NewtonMeter GetTorqueLoss(PerSecond angularVelocity); - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface ILossMap + { + /// <summary> + /// Calculates the torque loss. + /// </summary> + NewtonMeter GetTorqueLoss(PerSecond angularVelocity); + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IPowerTrainComponent.cs b/VectoCore/VectoCore/Models/SimulationComponent/IPowerTrainComponent.cs index 76bdc5de290204486fb3228676e1cd69ebc493ce..078c9108ed0e668a133a4472c9707757f75a37a9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IPowerTrainComponent.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IPowerTrainComponent.cs @@ -1,37 +1,37 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Connector.Ports; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IPowerTrainComponent : ITnInProvider, ITnOutProvider {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Connector.Ports; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IPowerTrainComponent : ITnInProvider, ITnOutProvider {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs index 609afcc9cdb53c3fcbcff111f968b74640e4451a..46673510b35a0e8a8aae4f17940bc921e20de497 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IShiftStrategy.cs @@ -1,107 +1,107 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Interface for the ShiftStrategy. Decides when to shift and which gear to take. - /// </summary> - public interface IShiftStrategy - { - /// <summary> - /// Checks if a shift operation is required. - /// </summary> - /// <param name="absTime">The abs time.</param> - /// <param name="dt">The dt.</param> - /// <param name="outTorque">The out torque.</param> - /// <param name="outAngularVelocity">The out angular velocity.</param> - /// <param name="inTorque">The in torque.</param> - /// <param name="inAngularVelocity">The in angular velocity.</param> - /// <param name="gear">The current gear.</param> - /// <param name="lastShiftTime">The last shift time.</param> - /// <returns><c>true</c> if a shift is required, <c>false</c> otherwise.</returns> - bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime); - - /// <summary> - /// Returns an appropriate starting gear after a vehicle standstill. - /// </summary> - /// <param name="absTime">The abs time.</param> - /// <param name="dt">The dt.</param> - /// <param name="torque">The torque.</param> - /// <param name="outAngularVelocity">The angular speed.</param> - /// <returns>The initial gear.</returns> - uint InitGear(Second absTime, Second dt, NewtonMeter torque, PerSecond outAngularVelocity); - - /// <summary> - /// Engages a gear. - /// </summary> - /// <param name="absTime">The abs time.</param> - /// <param name="dt">The dt.</param> - /// <param name="outTorque">The out torque.</param> - /// <param name="outAngularVelocity">The out engine speed.</param> - /// <returns>The gear to take.</returns> - uint Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity); - - /// <summary> - /// Disengages a gear. - /// </summary> - /// <param name="absTime">The abs time.</param> - /// <param name="dt">The dt.</param> - /// <param name="outTorque">The out torque.</param> - /// <param name="outEngineSpeed">The out engine speed.</param> - void Disengage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed); - - /// <summary> - /// Gets or sets the gearbox. - /// </summary> - /// <value> - /// The gearbox. - /// </value> - IGearbox Gearbox { get; set; } - - GearInfo NextGear { get; } - } - - public class GearInfo - { - public GearInfo(uint gear, bool tcLocked) - { - Gear = gear; - TorqueConverterLocked = tcLocked; - } - - public uint Gear { get; private set; } - public bool TorqueConverterLocked { get; private set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Interface for the ShiftStrategy. Decides when to shift and which gear to take. + /// </summary> + public interface IShiftStrategy + { + /// <summary> + /// Checks if a shift operation is required. + /// </summary> + /// <param name="absTime">The abs time.</param> + /// <param name="dt">The dt.</param> + /// <param name="outTorque">The out torque.</param> + /// <param name="outAngularVelocity">The out angular velocity.</param> + /// <param name="inTorque">The in torque.</param> + /// <param name="inAngularVelocity">The in angular velocity.</param> + /// <param name="gear">The current gear.</param> + /// <param name="lastShiftTime">The last shift time.</param> + /// <returns><c>true</c> if a shift is required, <c>false</c> otherwise.</returns> + bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + NewtonMeter inTorque, PerSecond inAngularVelocity, uint gear, Second lastShiftTime); + + /// <summary> + /// Returns an appropriate starting gear after a vehicle standstill. + /// </summary> + /// <param name="absTime">The abs time.</param> + /// <param name="dt">The dt.</param> + /// <param name="torque">The torque.</param> + /// <param name="outAngularVelocity">The angular speed.</param> + /// <returns>The initial gear.</returns> + uint InitGear(Second absTime, Second dt, NewtonMeter torque, PerSecond outAngularVelocity); + + /// <summary> + /// Engages a gear. + /// </summary> + /// <param name="absTime">The abs time.</param> + /// <param name="dt">The dt.</param> + /// <param name="outTorque">The out torque.</param> + /// <param name="outAngularVelocity">The out engine speed.</param> + /// <returns>The gear to take.</returns> + uint Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity); + + /// <summary> + /// Disengages a gear. + /// </summary> + /// <param name="absTime">The abs time.</param> + /// <param name="dt">The dt.</param> + /// <param name="outTorque">The out torque.</param> + /// <param name="outEngineSpeed">The out engine speed.</param> + void Disengage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed); + + /// <summary> + /// Gets or sets the gearbox. + /// </summary> + /// <value> + /// The gearbox. + /// </value> + IGearbox Gearbox { get; set; } + + GearInfo NextGear { get; } + } + + public class GearInfo + { + public GearInfo(uint gear, bool tcLocked) + { + Gear = gear; + TorqueConverterLocked = tcLocked; + } + + public uint Gear { get; private set; } + public bool TorqueConverterLocked { get; private set; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IVehicle.cs b/VectoCore/VectoCore/Models/SimulationComponent/IVehicle.cs index 89edb3370f50fd654f49a3d5682c295412500d7d..de966968c0354d2b19c98c5baf5342c77552b461 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IVehicle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IVehicle.cs @@ -1,38 +1,38 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - public interface IVehicle : IFvInProvider, IDriverDemandOutProvider, IVehicleInfo {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + public interface IVehicle : IFvInProvider, IDriverDemandOutProvider, IVehicleInfo {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IWheels.cs b/VectoCore/VectoCore/Models/SimulationComponent/IWheels.cs index 76fd98c51b4b8a0a1516af078a2c03824cbfc406..fdd599a9991090694f3acbc148ccda1f8b0427b0 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IWheels.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IWheels.cs @@ -1,41 +1,41 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Models.SimulationComponent -{ - /// <summary> - /// Defines interfaces for a wheels component. - /// </summary> - public interface IWheels : IFvOutProvider, ITnInProvider, IWheelsInfo {} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Models.SimulationComponent +{ + /// <summary> + /// Defines interfaces for a wheels component. + /// </summary> + public interface IWheels : IFvOutProvider, ITnInProvider, IWheelsInfo {} } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs index eab0e66a3e956350ffda779bfce63e4063890d54..1aa3d8a4ad9e4af5af8a753c9b2cf7514a13cc6b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategy.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index 89f72c6389122bfdb62101c6d657c253b0106a4b..d9f0b0341354b449747a868b53ad183e4080f860 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs index 3b0feaae827d767a72c99d11c724863711ed45aa..d70578e50ffec17b881e327011aab48b359559a8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategy.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Diagnostics.CodeAnalysis; using System.Linq; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs index 27701f2cca2d930ad01372e559140aae0a45879d..c5fc0df602aa043c92b8e4b9d2d43132097d7cd4 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.ComponentModel.DataAnnotations; using System.Diagnostics; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs index 880810ab53e625901ada552047209a003cce8bce..5c737a5e7221330eab0c5dc2cd28c33d67d9bc52 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Angledrive.cs @@ -1,61 +1,61 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - public class Angledrive : TransmissionComponent - { - public Angledrive(IVehicleContainer container, AngledriveData modelData) : base(container, modelData.Angledrive) {} - - public override IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) - { - var retVal = base.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); - retVal.AngledrivePowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; - return retVal; - } - - protected override void DoWriteModalResults(IModalDataContainer container) - { - var avgAngularVelocity = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; - container[ModalResultField.P_angle_loss] = (CurrentState.InTorque - CurrentState.OutTorque / ModelData.Ratio) * - avgAngularVelocity; - container[ModalResultField.P_angle_in] = CurrentState.InTorque * avgAngularVelocity; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class Angledrive : TransmissionComponent + { + public Angledrive(IVehicleContainer container, AngledriveData modelData) : base(container, modelData.Angledrive) {} + + public override IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + bool dryRun = false) + { + var retVal = base.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); + retVal.AngledrivePowerRequest = outTorque * (PreviousState.OutAngularVelocity + CurrentState.OutAngularVelocity) / 2.0; + return retVal; + } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + var avgAngularVelocity = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; + container[ModalResultField.P_angle_loss] = (CurrentState.InTorque - CurrentState.OutTorque / ModelData.Ratio) * + avgAngularVelocity; + container[ModalResultField.P_angle_in] = CurrentState.InTorque * avgAngularVelocity; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs index 2044fa57df3ace8be88d5fc9276363db12f2c0d9..013be9c16d896cf441ab83cd960de5cb20b761d9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Simulation; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs index 3f6a81195d6299f3655502f9833c0e761ea95498..a80ccd2e3860a12da1cfa7cda799a4ff66f985e4 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BaseShiftStrategy.cs @@ -1,92 +1,92 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent.Data; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - public abstract class BaseShiftStrategy : LoggingObject, IShiftStrategy - { - protected readonly IDataBus DataBus; - protected readonly GearboxData ModelData; - - protected BaseShiftStrategy(GearboxData data, IDataBus dataBus) - { - ModelData = data; - DataBus = dataBus; - } - - public abstract bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - NewtonMeter inTorque, - PerSecond inAngularVelocity, uint gear, Second lastShiftTime); - - public abstract uint InitGear(Second absTime, Second dt, NewtonMeter torque, PerSecond outAngularVelocity); - public abstract uint Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity); - public abstract void Disengage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed); - public abstract IGearbox Gearbox { get; set; } - public abstract GearInfo NextGear { get; } - - protected MeterPerSquareSecond EstimateAccelerationForGear(uint gear, PerSecond gbxAngularVelocityOut) - { - if (gear == 0 || gear > ModelData.Gears.Count) { - throw new VectoSimulationException("EstimateAccelerationForGear: invalid gear: {0}", gear); - } - - var vehicleSpeed = DataBus.VehicleSpeed; - - var nextEngineSpeed = gbxAngularVelocityOut * ModelData.Gears[gear].Ratio; - var maxEnginePower = DataBus.EngineStationaryFullPower(nextEngineSpeed); - - var avgSlope = - ((DataBus.CycleLookAhead(Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Altitude - - DataBus.Altitude) / Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Value().SI<Radian>(); - - var airDragLoss = DataBus.AirDragResistance(vehicleSpeed, vehicleSpeed) * DataBus.VehicleSpeed; - var rollResistanceLoss = DataBus.RollingResistance(avgSlope) * DataBus.VehicleSpeed; - var gearboxLoss = ModelData.Gears[gear].LossMap.GetTorqueLoss(gbxAngularVelocityOut, - maxEnginePower / nextEngineSpeed * ModelData.Gears[gear].Ratio).Value * nextEngineSpeed; - //DataBus.GearboxLoss(); - var slopeLoss = DataBus.SlopeResistance(avgSlope) * DataBus.VehicleSpeed; - var axleLoss = DataBus.AxlegearLoss(); - - var accelerationPower = maxEnginePower - gearboxLoss - axleLoss - airDragLoss - rollResistanceLoss - slopeLoss; - - var acceleration = accelerationPower / DataBus.VehicleSpeed / (DataBus.TotalMass + DataBus.ReducedMassWheels); - - return acceleration.Cast<MeterPerSquareSecond>(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public abstract class BaseShiftStrategy : LoggingObject, IShiftStrategy + { + protected readonly IDataBus DataBus; + protected readonly GearboxData ModelData; + + protected BaseShiftStrategy(GearboxData data, IDataBus dataBus) + { + ModelData = data; + DataBus = dataBus; + } + + public abstract bool ShiftRequired(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + NewtonMeter inTorque, + PerSecond inAngularVelocity, uint gear, Second lastShiftTime); + + public abstract uint InitGear(Second absTime, Second dt, NewtonMeter torque, PerSecond outAngularVelocity); + public abstract uint Engage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity); + public abstract void Disengage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outEngineSpeed); + public abstract IGearbox Gearbox { get; set; } + public abstract GearInfo NextGear { get; } + + protected MeterPerSquareSecond EstimateAccelerationForGear(uint gear, PerSecond gbxAngularVelocityOut) + { + if (gear == 0 || gear > ModelData.Gears.Count) { + throw new VectoSimulationException("EstimateAccelerationForGear: invalid gear: {0}", gear); + } + + var vehicleSpeed = DataBus.VehicleSpeed; + + var nextEngineSpeed = gbxAngularVelocityOut * ModelData.Gears[gear].Ratio; + var maxEnginePower = DataBus.EngineStationaryFullPower(nextEngineSpeed); + + var avgSlope = + ((DataBus.CycleLookAhead(Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Altitude - + DataBus.Altitude) / Constants.SimulationSettings.GearboxLookaheadForAccelerationEstimation).Value().SI<Radian>(); + + var airDragLoss = DataBus.AirDragResistance(vehicleSpeed, vehicleSpeed) * DataBus.VehicleSpeed; + var rollResistanceLoss = DataBus.RollingResistance(avgSlope) * DataBus.VehicleSpeed; + var gearboxLoss = ModelData.Gears[gear].LossMap.GetTorqueLoss(gbxAngularVelocityOut, + maxEnginePower / nextEngineSpeed * ModelData.Gears[gear].Ratio).Value * nextEngineSpeed; + //DataBus.GearboxLoss(); + var slopeLoss = DataBus.SlopeResistance(avgSlope) * DataBus.VehicleSpeed; + var axleLoss = DataBus.AxlegearLoss(); + + var accelerationPower = maxEnginePower - gearboxLoss - axleLoss - airDragLoss - rollResistanceLoss - slopeLoss; + + var acceleration = accelerationPower / DataBus.VehicleSpeed / (DataBus.TotalMass + DataBus.ReducedMassWheels); + + return acceleration.Cast<MeterPerSquareSecond>(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs index f9a828660d4f1aa14a99bfdc2e78d1913c316b3e..7241541f117f3dc67b31c9fc5f67b73a9d0c09da 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs @@ -1,97 +1,97 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - public class Brakes : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, - IPowerTrainComponent, ITnOutPort, - ITnInPort, IBrakes - { - public Watt BrakePower { get; set; } - - public Brakes(IVehicleContainer dataBus) : base(dataBus) {} - - public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) - { - BrakePower = 0.SI<Watt>(); - PreviousState.SetState(torque, angularVelocity, torque, angularVelocity); - return DataBus.DriverBehavior == DrivingBehavior.Halted && DataBus.VehicleStopped - ? NextComponent.Initialize(0.SI<NewtonMeter>(), 0.SI<PerSecond>()) - : NextComponent.Initialize(torque, angularVelocity); - } - - public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) - { - var brakeTorque = 0.SI<NewtonMeter>(); - var avgAngularSpeed = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; - - if (!BrakePower.IsEqual(0)) { - if (avgAngularSpeed.IsEqual(0)) { - brakeTorque = -outTorque; - } else { - brakeTorque = BrakePower / avgAngularSpeed; - } - } - - if (!dryRun && BrakePower < 0) { - throw new VectoSimulationException("Negative Braking Power is not allowed!"); - } - CurrentState.SetState(outTorque + brakeTorque, outAngularVelocity, outTorque, outAngularVelocity); - - var retVal = NextComponent.Request(absTime, dt, outTorque + brakeTorque, outAngularVelocity, dryRun); - retVal.BrakePower = brakeTorque * avgAngularSpeed; - return retVal; - } - - protected override void DoWriteModalResults(IModalDataContainer container) - { - container[ModalResultField.P_brake_loss] = BrakePower; - container[ModalResultField.P_brake_in] = CurrentState.InTorque * - (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; - } - - protected override void DoCommitSimulationStep() - { - BrakePower = 0.SI<Watt>(); - base.DoCommitSimulationStep(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class Brakes : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, + IPowerTrainComponent, ITnOutPort, + ITnInPort, IBrakes + { + public Watt BrakePower { get; set; } + + public Brakes(IVehicleContainer dataBus) : base(dataBus) {} + + public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) + { + BrakePower = 0.SI<Watt>(); + PreviousState.SetState(torque, angularVelocity, torque, angularVelocity); + return DataBus.DriverBehavior == DrivingBehavior.Halted && DataBus.VehicleStopped + ? NextComponent.Initialize(0.SI<NewtonMeter>(), 0.SI<PerSecond>()) + : NextComponent.Initialize(torque, angularVelocity); + } + + public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + bool dryRun = false) + { + var brakeTorque = 0.SI<NewtonMeter>(); + var avgAngularSpeed = (PreviousState.OutAngularVelocity + outAngularVelocity) / 2.0; + + if (!BrakePower.IsEqual(0)) { + if (avgAngularSpeed.IsEqual(0)) { + brakeTorque = -outTorque; + } else { + brakeTorque = BrakePower / avgAngularSpeed; + } + } + + if (!dryRun && BrakePower < 0) { + throw new VectoSimulationException("Negative Braking Power is not allowed!"); + } + CurrentState.SetState(outTorque + brakeTorque, outAngularVelocity, outTorque, outAngularVelocity); + + var retVal = NextComponent.Request(absTime, dt, outTorque + brakeTorque, outAngularVelocity, dryRun); + retVal.BrakePower = brakeTorque * avgAngularSpeed; + return retVal; + } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + container[ModalResultField.P_brake_loss] = BrakePower; + container[ModalResultField.P_brake_in] = CurrentState.InTorque * + (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; + } + + protected override void DoCommitSimulationStep() + { + BrakePower = 0.SI<Watt>(); + base.DoCommitSimulationStep(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs index b8336024bb8591483a8ff6b90c9d72793c791aee..4bdde41d73769f9b909f285630a7558e58133ebc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs index 8a5301b7f74888cf28cbccaa2d46e1a0e6e256db..5af38c58dcdf83cf3998edb8dc7c978e5a7f423b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs index 61febfe04e2865a4c4543040cb9e297f94f07a91..aa140f1360ec336a81fd0b1f0eba4ffdeffcfa56 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CombustionEngine.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs index 4be4328c236fe9d573c70511f031368323d4287b..8609584f951d3d9cdcdd94031ff90b85f557cc59 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/CycleGearbox.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index b9791e6430dcd3c7483df8af49a453b9cb99608e..18f0703a596e6b8c0035f22334a71bfa8ee197cc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index ae77ccff9c746b841e8cc14e62836e07210d11c3..207f17c59015785251f2b258189b341a30a84534 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs index a26fd8719e955d0535bf5b8e98277f0f854f2c34..d6427262a92f48cca756403e27ea624d13a4fe1f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Driver.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs index 23fe76fe9670ec7b08e80252827604cafa48df43..b2ef8c304e8fb6c60b14af01b8ee8300cc982c77 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DrivingCycleEnumerator.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCore.Models.SimulationComponent.Data; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyRetarder.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyRetarder.cs index 670ad8033f4cc2194cae9f4c5194c4cc5f5418ef..b1b024c0ac3ed2220ff9e55c3711826bd0db10fd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyRetarder.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyRetarder.cs @@ -1,70 +1,70 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - public class DummyRetarder : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, - IPowerTrainComponent, ITnInPort, ITnOutPort - { - public DummyRetarder(IVehicleContainer dataBus) : base(dataBus) {} - - public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) - { - PreviousState.SetState(torque, angularVelocity, torque, angularVelocity); - return NextComponent.Initialize(torque, angularVelocity); - } - - public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false) - { - CurrentState.SetState(outTorque, outAngularVelocity, outTorque, outAngularVelocity); - return NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); - } - - protected override void DoWriteModalResults(IModalDataContainer container) - { - container[ModalResultField.P_ret_loss] = 0.SI<Watt>(); - - if (CurrentState.InAngularVelocity == null || PreviousState.InAngularVelocity == null) { - container[ModalResultField.P_retarder_in] = 0.SI<Watt>(); - } else { - container[ModalResultField.P_retarder_in] = CurrentState.InTorque * - (CurrentState.InAngularVelocity + PreviousState.InAngularVelocity) / 2.0; - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class DummyRetarder : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, + IPowerTrainComponent, ITnInPort, ITnOutPort + { + public DummyRetarder(IVehicleContainer dataBus) : base(dataBus) {} + + public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) + { + PreviousState.SetState(torque, angularVelocity, torque, angularVelocity); + return NextComponent.Initialize(torque, angularVelocity); + } + + public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun = false) + { + CurrentState.SetState(outTorque, outAngularVelocity, outTorque, outAngularVelocity); + return NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, dryRun); + } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + container[ModalResultField.P_ret_loss] = 0.SI<Watt>(); + + if (CurrentState.InAngularVelocity == null || PreviousState.InAngularVelocity == null) { + container[ModalResultField.P_retarder_in] = 0.SI<Watt>(); + } else { + container[ModalResultField.P_retarder_in] = CurrentState.InTorque * + (CurrentState.InAngularVelocity + PreviousState.InAngularVelocity) / 2.0; + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs index a3368effb0d3756d230a1eb7d67bac13d4b79668..6d6af1d3906989bee915443e595190bd007aa70a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs index 9837ac690fae6f9fe70274b97260d0db795003ba..b8c9ed793ac97afd9baa9e294946a6100185c502 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineOnlyCombustionEngine.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports.Impl; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index 2cd520163f3576e13b747a9768eceec1385f70ec..8ea0d270916aada48966c3ae5065d1389cab16e3 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs index e541ca5304c9c34daae4182f3bfb54e9cda8403a..40870c2630d7c3244ac65828c5538684ca233a2c 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/IdleControllerSwitcher.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs index ff1a63301f24694d6683c2326bf1b7883f4e266f..b267fd62db9afc1f350428b28b7ee499c7b33c92 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MTShiftStrategy.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs index ff169975d52b90ac088289cef4a8633480103702..cecf32836f9773c7399efb08d54627d8efbc3888 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/MeasuredSpeedDrivingCycle.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs index 9229d29059d78067f2e3882afaad8b6c18413e32..7b72402086a706aaef4d389e912fdae45aaee41a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PTOCycleController.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Linq; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs index a4c05cbf38165b325f6bd28e9a269e4c030dc03f..de4431d73f2da57d2d87a4a19a94e6c34cee0c9d 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PWheelCycle.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs index 4b2364963ed7c3fb384949a40b16216894cba2fc..67e0e9125535e42d7c03529c2a56ed003090f7ba 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PowertrainDrivingCycle.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs index d2e4591eda70704e97e26625f1628cd825e10df7..9eaf9eec106aff6b2479de9ea2e5ad98941c6ecd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Retarder.cs @@ -1,106 +1,106 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - /// <summary> - /// Retarder component. - /// </summary> - public class Retarder : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, - IPowerTrainComponent, ITnInPort, - ITnOutPort - { - private readonly RetarderLossMap _lossMap; - private readonly double _ratio; - - /// <summary> - /// Creates a new Retarder. - /// </summary> - /// <param name="container"></param> - /// <param name="lossMap"></param> - /// <param name="ratio"></param> - public Retarder(IVehicleContainer container, RetarderLossMap lossMap, double ratio) : base(container) - { - _lossMap = lossMap; - _ratio = ratio; - } - - public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) - { - var retarderTorqueLoss = _lossMap.GetTorqueLoss(angularVelocity * _ratio) / _ratio; - PreviousState.SetState(torque + retarderTorqueLoss, angularVelocity, torque, angularVelocity); - return NextComponent.Initialize(PreviousState.InTorque, PreviousState.InAngularVelocity); - } - - public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun = false) - { - if (angularVelocity == null) { - return NextComponent.Request(absTime, dt, torque, null, dryRun); - } - var avgAngularSpeed = (PreviousState.InAngularVelocity + angularVelocity) / 2.0; - var retarderTorqueLoss = _lossMap.GetTorqueLoss(avgAngularSpeed * _ratio) / _ratio; - CurrentState.SetState(torque + retarderTorqueLoss, angularVelocity, torque, angularVelocity); - return NextComponent.Request(absTime, dt, CurrentState.InTorque, CurrentState.InAngularVelocity, dryRun); - } - - protected override void DoWriteModalResults(IModalDataContainer container) - { - var avgAngularSpeed = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; - container[ModalResultField.P_ret_loss] = (CurrentState.InTorque - CurrentState.OutTorque) * avgAngularSpeed; - container[ModalResultField.P_retarder_in] = CurrentState.InTorque * avgAngularSpeed; - } - - protected override void DoCommitSimulationStep() - { - var avgAngularSpeed = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; - if (!avgAngularSpeed.IsBetween(_lossMap.MinSpeed, _lossMap.MaxSpeed)) { - Log.Warn( - "Retarder LossMap data was extrapolated: range for loss map is not sufficient: n:{0} (min:{1}, max:{2}), ratio:{3}", - CurrentState.OutAngularVelocity.AsRPM, _lossMap.MinSpeed.AsRPM, _lossMap.MaxSpeed.AsRPM, _ratio); - if (DataBus.ExecutionMode == ExecutionMode.Declaration) { - throw new VectoException( - "Retarder LossMap data was extrapolated in Declaration mode: range for loss map is not sufficient: n:{0} (min:{1}, max:{2}), ratio:{3}", - CurrentState.OutAngularVelocity.AsRPM, _lossMap.MinSpeed.AsRPM, _lossMap.MaxSpeed.AsRPM, _ratio); - } - } - base.DoCommitSimulationStep(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + /// <summary> + /// Retarder component. + /// </summary> + public class Retarder : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, + IPowerTrainComponent, ITnInPort, + ITnOutPort + { + private readonly RetarderLossMap _lossMap; + private readonly double _ratio; + + /// <summary> + /// Creates a new Retarder. + /// </summary> + /// <param name="container"></param> + /// <param name="lossMap"></param> + /// <param name="ratio"></param> + public Retarder(IVehicleContainer container, RetarderLossMap lossMap, double ratio) : base(container) + { + _lossMap = lossMap; + _ratio = ratio; + } + + public IResponse Initialize(NewtonMeter torque, PerSecond angularVelocity) + { + var retarderTorqueLoss = _lossMap.GetTorqueLoss(angularVelocity * _ratio) / _ratio; + PreviousState.SetState(torque + retarderTorqueLoss, angularVelocity, torque, angularVelocity); + return NextComponent.Initialize(PreviousState.InTorque, PreviousState.InAngularVelocity); + } + + public IResponse Request(Second absTime, Second dt, NewtonMeter torque, PerSecond angularVelocity, bool dryRun = false) + { + if (angularVelocity == null) { + return NextComponent.Request(absTime, dt, torque, null, dryRun); + } + var avgAngularSpeed = (PreviousState.InAngularVelocity + angularVelocity) / 2.0; + var retarderTorqueLoss = _lossMap.GetTorqueLoss(avgAngularSpeed * _ratio) / _ratio; + CurrentState.SetState(torque + retarderTorqueLoss, angularVelocity, torque, angularVelocity); + return NextComponent.Request(absTime, dt, CurrentState.InTorque, CurrentState.InAngularVelocity, dryRun); + } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + var avgAngularSpeed = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; + container[ModalResultField.P_ret_loss] = (CurrentState.InTorque - CurrentState.OutTorque) * avgAngularSpeed; + container[ModalResultField.P_retarder_in] = CurrentState.InTorque * avgAngularSpeed; + } + + protected override void DoCommitSimulationStep() + { + var avgAngularSpeed = (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0; + if (!avgAngularSpeed.IsBetween(_lossMap.MinSpeed, _lossMap.MaxSpeed)) { + Log.Warn( + "Retarder LossMap data was extrapolated: range for loss map is not sufficient: n:{0} (min:{1}, max:{2}), ratio:{3}", + CurrentState.OutAngularVelocity.AsRPM, _lossMap.MinSpeed.AsRPM, _lossMap.MaxSpeed.AsRPM, _ratio); + if (DataBus.ExecutionMode == ExecutionMode.Declaration) { + throw new VectoException( + "Retarder LossMap data was extrapolated in Declaration mode: range for loss map is not sufficient: n:{0} (min:{1}, max:{2}), ratio:{3}", + CurrentState.OutAngularVelocity.AsRPM, _lossMap.MinSpeed.AsRPM, _lossMap.MaxSpeed.AsRPM, _ratio); + } + } + base.DoCommitSimulationStep(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs index f459ce7ab4bdfb74bbce3fb5cc5b0c119e7fd252..66fee8da1b2cfe0f9b186020de7914910f8c2f05 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ShiftStrategy.cs @@ -1,109 +1,109 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent.Data; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - /// <summary> - /// Class ShiftStrategy is a base class for shift strategies. Implements some helper methods for checking the shift curves. - /// </summary> - public abstract class ShiftStrategy : BaseShiftStrategy - { - protected bool SkipGears; - protected bool EarlyShiftUp; - protected Gearbox _gearbox; - - protected ShiftStrategy(GearboxData data, IDataBus dataBus) : base(data, dataBus) {} - - public override IGearbox Gearbox - { - get { return _gearbox; } - set { - var myGearbox = value as Gearbox; - if (myGearbox == null) { - throw new VectoException("This shift strategy can't handle gearbox of type {0}", value.GetType()); - } - _gearbox = myGearbox; - } - } - - /// <summary> - /// Tests if the operating point is below the down-shift curve (=outside of shift curve). - /// </summary> - /// <param name="gear">The gear.</param> - /// <param name="inTorque">The in torque.</param> - /// <param name="inEngineSpeed">The in engine speed.</param> - /// <returns><c>true</c> if the operating point is below the down-shift curv; otherwise, <c>false</c>.</returns> - protected bool IsBelowDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) - { - if (gear <= 1) { - return false; - } - return ModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); - } - - protected bool IsAboveDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) - { - if (gear <= 1) { - return true; - } - return ModelData.Gears[gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); - } - - - /// <summary> - /// Tests if the operating point is above the up-shift curve (=outside of shift curve). - /// </summary> - /// <param name="gear">The gear.</param> - /// <param name="inTorque">The in torque.</param> - /// <param name="inEngineSpeed">The in engine speed.</param> - /// <returns><c>true</c> if the operating point is above the up-shift curve; otherwise, <c>false</c>.</returns> - protected bool IsAboveUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) - { - if (gear >= ModelData.Gears.Count) { - return false; - } - return ModelData.Gears[gear].ShiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); - } - - protected bool IsBelowUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) - { - if (gear >= ModelData.Gears.Count) { - return true; - } - return ModelData.Gears[gear].ShiftPolygon.IsBelowUpshiftCurve(inTorque, inEngineSpeed); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + /// <summary> + /// Class ShiftStrategy is a base class for shift strategies. Implements some helper methods for checking the shift curves. + /// </summary> + public abstract class ShiftStrategy : BaseShiftStrategy + { + protected bool SkipGears; + protected bool EarlyShiftUp; + protected Gearbox _gearbox; + + protected ShiftStrategy(GearboxData data, IDataBus dataBus) : base(data, dataBus) {} + + public override IGearbox Gearbox + { + get { return _gearbox; } + set { + var myGearbox = value as Gearbox; + if (myGearbox == null) { + throw new VectoException("This shift strategy can't handle gearbox of type {0}", value.GetType()); + } + _gearbox = myGearbox; + } + } + + /// <summary> + /// Tests if the operating point is below the down-shift curve (=outside of shift curve). + /// </summary> + /// <param name="gear">The gear.</param> + /// <param name="inTorque">The in torque.</param> + /// <param name="inEngineSpeed">The in engine speed.</param> + /// <returns><c>true</c> if the operating point is below the down-shift curv; otherwise, <c>false</c>.</returns> + protected bool IsBelowDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) + { + if (gear <= 1) { + return false; + } + return ModelData.Gears[gear].ShiftPolygon.IsBelowDownshiftCurve(inTorque, inEngineSpeed); + } + + protected bool IsAboveDownShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) + { + if (gear <= 1) { + return true; + } + return ModelData.Gears[gear].ShiftPolygon.IsAboveDownshiftCurve(inTorque, inEngineSpeed); + } + + + /// <summary> + /// Tests if the operating point is above the up-shift curve (=outside of shift curve). + /// </summary> + /// <param name="gear">The gear.</param> + /// <param name="inTorque">The in torque.</param> + /// <param name="inEngineSpeed">The in engine speed.</param> + /// <returns><c>true</c> if the operating point is above the up-shift curve; otherwise, <c>false</c>.</returns> + protected bool IsAboveUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) + { + if (gear >= ModelData.Gears.Count) { + return false; + } + return ModelData.Gears[gear].ShiftPolygon.IsAboveUpshiftCurve(inTorque, inEngineSpeed); + } + + protected bool IsBelowUpShiftCurve(uint gear, NewtonMeter inTorque, PerSecond inEngineSpeed) + { + if (gear >= ModelData.Gears.Count) { + return true; + } + return ModelData.Gears[gear].ShiftPolygon.IsBelowUpshiftCurve(inTorque, inEngineSpeed); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs index 74e54b75309afa23927a763b6a83fd3d05dd8ce3..8a5db4a93a9e679c06d9acde320d7c7e6c109328 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs index 8c435e0c39559b6ba730a64c23b4a3790386a76c..2c08505d6d73d5927c310238855929bfe41f7f38 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs index 94d7d85c572eb0fe970ff8164c908b4cf2169350..5a749e071ff0aa74a8cd1115e933cf0b33739515 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs index eab8b0be2ab39eb625d995fb61d0e24f99087fe7..c78777b7fc246185e015a9a0d1eaa868c4e0acbd 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs @@ -1,102 +1,102 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.OutputData; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Models.SimulationComponent.Impl -{ - public class Wheels : StatefulProviderComponent<Wheels.WheelsState, IFvOutPort, ITnInPort, ITnOutPort>, IWheels, - IFvOutPort, ITnInPort - { - private readonly Meter _dynamicWheelRadius; - private readonly KilogramSquareMeter _totalWheelsInertia; - - public class WheelsState - { - public PerSecond AngularVelocity; - public NewtonMeter TorqueIn; - public NewtonMeter InertiaTorqueLoss; - } - - public Wheels(IVehicleContainer cockpit, Meter rdyn, KilogramSquareMeter totalWheelsInertia) - : base(cockpit) - { - _dynamicWheelRadius = rdyn; - _totalWheelsInertia = totalWheelsInertia; - } - - public IResponse Initialize(Newton force, MeterPerSecond velocity) - { - PreviousState.TorqueIn = force * _dynamicWheelRadius; - PreviousState.AngularVelocity = velocity / _dynamicWheelRadius; - PreviousState.InertiaTorqueLoss = 0.SI<NewtonMeter>(); - - return NextComponent.Initialize(PreviousState.TorqueIn, PreviousState.AngularVelocity); - } - - public IResponse Request(Second absTime, Second dt, Newton force, MeterPerSecond velocity, bool dryRun) - { - Log.Debug("request: force: {0}, velocity: {1}", force, velocity); - - CurrentState.AngularVelocity = velocity / _dynamicWheelRadius; - var avgAngularSpeed = (CurrentState.AngularVelocity + PreviousState.AngularVelocity) / 2.0; - CurrentState.InertiaTorqueLoss = avgAngularSpeed.IsEqual(0.SI<PerSecond>()) - ? 0.SI<NewtonMeter>() - : Formulas.InertiaPower(CurrentState.AngularVelocity, PreviousState.AngularVelocity, _totalWheelsInertia, dt) / - avgAngularSpeed; //(_totalWheelsInertia * avgAngularSpeed / dt).Cast<NewtonMeter>(); - CurrentState.TorqueIn = force * _dynamicWheelRadius + CurrentState.InertiaTorqueLoss; - var retVal = NextComponent.Request(absTime, dt, CurrentState.TorqueIn, CurrentState.AngularVelocity, - dryRun); - - retVal.WheelsPowerRequest = CurrentState.TorqueIn * avgAngularSpeed; - return retVal; - } - - protected override void DoWriteModalResults(IModalDataContainer container) - { - var avgAngularSpeed = (CurrentState.AngularVelocity + PreviousState.AngularVelocity) / 2.0; - - container[ModalResultField.P_wheel_in] = CurrentState.TorqueIn * avgAngularSpeed; - container[ModalResultField.P_wheel_inertia] = CurrentState.InertiaTorqueLoss * avgAngularSpeed; - } - - public Kilogram ReducedMassWheels - { - get { return (_totalWheelsInertia / _dynamicWheelRadius / _dynamicWheelRadius).Cast<Kilogram>(); } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.OutputData; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Models.SimulationComponent.Impl +{ + public class Wheels : StatefulProviderComponent<Wheels.WheelsState, IFvOutPort, ITnInPort, ITnOutPort>, IWheels, + IFvOutPort, ITnInPort + { + private readonly Meter _dynamicWheelRadius; + private readonly KilogramSquareMeter _totalWheelsInertia; + + public class WheelsState + { + public PerSecond AngularVelocity; + public NewtonMeter TorqueIn; + public NewtonMeter InertiaTorqueLoss; + } + + public Wheels(IVehicleContainer cockpit, Meter rdyn, KilogramSquareMeter totalWheelsInertia) + : base(cockpit) + { + _dynamicWheelRadius = rdyn; + _totalWheelsInertia = totalWheelsInertia; + } + + public IResponse Initialize(Newton force, MeterPerSecond velocity) + { + PreviousState.TorqueIn = force * _dynamicWheelRadius; + PreviousState.AngularVelocity = velocity / _dynamicWheelRadius; + PreviousState.InertiaTorqueLoss = 0.SI<NewtonMeter>(); + + return NextComponent.Initialize(PreviousState.TorqueIn, PreviousState.AngularVelocity); + } + + public IResponse Request(Second absTime, Second dt, Newton force, MeterPerSecond velocity, bool dryRun) + { + Log.Debug("request: force: {0}, velocity: {1}", force, velocity); + + CurrentState.AngularVelocity = velocity / _dynamicWheelRadius; + var avgAngularSpeed = (CurrentState.AngularVelocity + PreviousState.AngularVelocity) / 2.0; + CurrentState.InertiaTorqueLoss = avgAngularSpeed.IsEqual(0.SI<PerSecond>()) + ? 0.SI<NewtonMeter>() + : Formulas.InertiaPower(CurrentState.AngularVelocity, PreviousState.AngularVelocity, _totalWheelsInertia, dt) / + avgAngularSpeed; //(_totalWheelsInertia * avgAngularSpeed / dt).Cast<NewtonMeter>(); + CurrentState.TorqueIn = force * _dynamicWheelRadius + CurrentState.InertiaTorqueLoss; + var retVal = NextComponent.Request(absTime, dt, CurrentState.TorqueIn, CurrentState.AngularVelocity, + dryRun); + + retVal.WheelsPowerRequest = CurrentState.TorqueIn * avgAngularSpeed; + return retVal; + } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + var avgAngularSpeed = (CurrentState.AngularVelocity + PreviousState.AngularVelocity) / 2.0; + + container[ModalResultField.P_wheel_in] = CurrentState.TorqueIn * avgAngularSpeed; + container[ModalResultField.P_wheel_inertia] = CurrentState.InertiaTorqueLoss * avgAngularSpeed; + } + + public Kilogram ReducedMassWheels + { + get { return (_totalWheelsInertia / _dynamicWheelRadius / _dynamicWheelRadius).Cast<Kilogram>(); } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs b/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs index 78f76fbbf23356a330a42805f0437e84e7300cd1..c0d50cc2929246c58ba5cb6df1f9bbef2c8c42d1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs @@ -1,7 +1,7 @@ /* * This file is part of VECTO. * -* Copyright © 2012-2016 European Union +* Copyright © 2012-2017 European Union * * Developed by Graz University of Technology, * Institute of Internal Combustion Engines and Thermodynamics, diff --git a/VectoCore/VectoCore/OutputData/DeclarationReport.cs b/VectoCore/VectoCore/OutputData/DeclarationReport.cs index 06e0eb19d3fd776278ce0676b96f432b30247bd1..3ebf64a5186d0987ad6eb90ba3f3d25d3c429998 100644 --- a/VectoCore/VectoCore/OutputData/DeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/DeclarationReport.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Runtime.CompilerServices; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCore/OutputData/FileIO/FileOutputWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/FileOutputWriter.cs index 738ddb1d5a9bb40b05fd1e7e65d8ff4ee3632391..51f3e6f89c743ec023d4f4d87821b569f1386800 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/FileOutputWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/FileOutputWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using System.IO; diff --git a/VectoCore/VectoCore/OutputData/IDataWriter.cs b/VectoCore/VectoCore/OutputData/IDataWriter.cs index cb88ba883440b950d245927e72428badfe499622..e3b40c5fca150c5653a1844cda65a249f74b4753 100644 --- a/VectoCore/VectoCore/OutputData/IDataWriter.cs +++ b/VectoCore/VectoCore/OutputData/IDataWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Data; using System.IO; diff --git a/VectoCore/VectoCore/OutputData/IModalDataContainer.cs b/VectoCore/VectoCore/OutputData/IModalDataContainer.cs index e509c204be80bf3270e5cec2317b3f8bb5ef9749..622d04724afe278f28bc7f2c170bcca68dc41f9a 100644 --- a/VectoCore/VectoCore/OutputData/IModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/IModalDataContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/OutputData/ModFilter/ActualModalDataFilter.cs b/VectoCore/VectoCore/OutputData/ModFilter/ActualModalDataFilter.cs index cb24e263c797495a5f1b11b295bb0f41261d7476..a3535a2aa9c58a30c5b7898f4b5168d1c03827de 100644 --- a/VectoCore/VectoCore/OutputData/ModFilter/ActualModalDataFilter.cs +++ b/VectoCore/VectoCore/OutputData/ModFilter/ActualModalDataFilter.cs @@ -1,170 +1,170 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; - -namespace TUGraz.VectoCore.OutputData.ModFilter -{ - public class ActualModalDataFilter : IModalDataFilter - { - public ModalResults Filter(ModalResults data) - { - var results = (ModalResults)data.Clone(); - - //var dt = 1e-12.SI<Second>(); - //var ds = 1e-12.SI<Meter>(); - - var init = data.Rows[0]; - var v_act = init.Field<MeterPerSecond>((int)ModalResultField.v_act); - var n_engine = init.Field<PerSecond>((int)ModalResultField.n_eng_avg); - var dist = init.Field<Meter>((int)ModalResultField.dist); - var n_gbx_out = init.Field<PerSecond>((int)ModalResultField.n_gbx_out_avg); - - for (var i = 1; i < data.Rows.Count; i++) { - //var prev = data.Rows[i - 1]; - var current = data.Rows[i]; - var start = results.NewRow(); - var end = results.NewRow(); - - start[(int)ModalResultField.time] = current.Field<Second>((int)ModalResultField.time) - - current.Field<Second>((int)ModalResultField.simulationInterval) / 2.0; - end[(int)ModalResultField.time] = current.Field<Second>((int)ModalResultField.time) + - current.Field<Second>((int)ModalResultField.simulationInterval) / 2.0; - - SetConstantValues(current, start, end, - ModalResultField.simulationInterval, - ModalResultField.simulationDistance, - ModalResultField.acc, - ModalResultField.grad, - ModalResultField.Gear, - ModalResultField.TC_Locked); - - start[(int)ModalResultField.v_act] = v_act; - v_act = 2 * current.Field<MeterPerSecond>((int)ModalResultField.v_act) - v_act; - end[(int)ModalResultField.v_act] = v_act; - - SetConstantValues(current, start, end, ModalResultField.v_targ); - - start[(int)ModalResultField.dist] = dist; - dist = current.Field<Meter>((int)ModalResultField.dist); - end[(int)ModalResultField.dist] = dist; - - start[(int)ModalResultField.n_eng_avg] = n_engine; - n_engine = 2 * current.Field<PerSecond>((int)ModalResultField.n_eng_avg) - n_engine; - end[(int)ModalResultField.n_eng_avg] = n_engine; - - start[(int)ModalResultField.n_gbx_out_avg] = n_gbx_out; - n_gbx_out = 2 * current.Field<PerSecond>((int)ModalResultField.n_gbx_out_avg) - n_gbx_out; - end[(int)ModalResultField.n_gbx_out_avg] = n_gbx_out; - - SetConstantValues(current, start, end, - ModalResultField.T_eng_fcmap, - ModalResultField.Tq_full, - ModalResultField.Tq_drag, - ModalResultField.T_gbx_out - ); - - SetConstantValues(current, start, end, - ModalResultField.P_eng_full, - ModalResultField.P_eng_full_stat, - ModalResultField.P_eng_out, - ModalResultField.P_eng_drag, - ModalResultField.P_eng_fcmap, - ModalResultField.P_clutch_out, - ModalResultField.P_clutch_loss, - ModalResultField.P_aux, - ModalResultField.P_eng_inertia, - ModalResultField.P_gbx_in, - ModalResultField.P_gbx_inertia, - ModalResultField.P_gbx_loss, - ModalResultField.P_angle_loss, - ModalResultField.P_retarder_in, - ModalResultField.P_ret_loss, - ModalResultField.P_veh_inertia, - ModalResultField.P_roll, - ModalResultField.P_air, - ModalResultField.P_slope, - ModalResultField.P_wheel_in, - ModalResultField.P_brake_in, - ModalResultField.P_brake_loss, - ModalResultField.P_wheel_inertia, - ModalResultField.P_axle_in, - ModalResultField.P_axle_loss, - ModalResultField.P_angle_in, - ModalResultField.P_angle_loss, - ModalResultField.P_trac); - - SetConstantValues(current, start, end, - ModalResultField.FCMap, - ModalResultField.FCAUXc, - ModalResultField.FCAAUX, - ModalResultField.FCWHTCc, - ModalResultField.FCFinal); - - //--- - results.Rows.Add(start); - results.Rows.Add(end); - } - - return results; - } - - private void SetConstantValues(DataRow current, DataRow start, DataRow end, params ModalResultField[] fields) - { - foreach (var field in fields) { - if (current[(int)field] == DBNull.Value) { - continue; - } - if (field.GetDataType() == typeof(SI)) { - start[(int)field] = current.Field<SI>((int)field); - end[(int)field] = current.Field<SI>((int)field); - } else if (field.GetDataType() == typeof(double)) { - start[(int)field] = current.Field<double>((int)field); - end[(int)field] = current.Field<double>((int)field); - } else if (field.GetDataType() == typeof(int)) { - start[(int)field] = current.Field<int>((int)field); - end[(int)field] = current.Field<int>((int)field); - } else if (field.GetDataType() == typeof(uint)) { - start[(int)field] = current.Field<uint>((int)field); - end[(int)field] = current.Field<uint>((int)field); - } - } - } - - public string ID - { - get { return "sim"; } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; + +namespace TUGraz.VectoCore.OutputData.ModFilter +{ + public class ActualModalDataFilter : IModalDataFilter + { + public ModalResults Filter(ModalResults data) + { + var results = (ModalResults)data.Clone(); + + //var dt = 1e-12.SI<Second>(); + //var ds = 1e-12.SI<Meter>(); + + var init = data.Rows[0]; + var v_act = init.Field<MeterPerSecond>((int)ModalResultField.v_act); + var n_engine = init.Field<PerSecond>((int)ModalResultField.n_eng_avg); + var dist = init.Field<Meter>((int)ModalResultField.dist); + var n_gbx_out = init.Field<PerSecond>((int)ModalResultField.n_gbx_out_avg); + + for (var i = 1; i < data.Rows.Count; i++) { + //var prev = data.Rows[i - 1]; + var current = data.Rows[i]; + var start = results.NewRow(); + var end = results.NewRow(); + + start[(int)ModalResultField.time] = current.Field<Second>((int)ModalResultField.time) - + current.Field<Second>((int)ModalResultField.simulationInterval) / 2.0; + end[(int)ModalResultField.time] = current.Field<Second>((int)ModalResultField.time) + + current.Field<Second>((int)ModalResultField.simulationInterval) / 2.0; + + SetConstantValues(current, start, end, + ModalResultField.simulationInterval, + ModalResultField.simulationDistance, + ModalResultField.acc, + ModalResultField.grad, + ModalResultField.Gear, + ModalResultField.TC_Locked); + + start[(int)ModalResultField.v_act] = v_act; + v_act = 2 * current.Field<MeterPerSecond>((int)ModalResultField.v_act) - v_act; + end[(int)ModalResultField.v_act] = v_act; + + SetConstantValues(current, start, end, ModalResultField.v_targ); + + start[(int)ModalResultField.dist] = dist; + dist = current.Field<Meter>((int)ModalResultField.dist); + end[(int)ModalResultField.dist] = dist; + + start[(int)ModalResultField.n_eng_avg] = n_engine; + n_engine = 2 * current.Field<PerSecond>((int)ModalResultField.n_eng_avg) - n_engine; + end[(int)ModalResultField.n_eng_avg] = n_engine; + + start[(int)ModalResultField.n_gbx_out_avg] = n_gbx_out; + n_gbx_out = 2 * current.Field<PerSecond>((int)ModalResultField.n_gbx_out_avg) - n_gbx_out; + end[(int)ModalResultField.n_gbx_out_avg] = n_gbx_out; + + SetConstantValues(current, start, end, + ModalResultField.T_eng_fcmap, + ModalResultField.Tq_full, + ModalResultField.Tq_drag, + ModalResultField.T_gbx_out + ); + + SetConstantValues(current, start, end, + ModalResultField.P_eng_full, + ModalResultField.P_eng_full_stat, + ModalResultField.P_eng_out, + ModalResultField.P_eng_drag, + ModalResultField.P_eng_fcmap, + ModalResultField.P_clutch_out, + ModalResultField.P_clutch_loss, + ModalResultField.P_aux, + ModalResultField.P_eng_inertia, + ModalResultField.P_gbx_in, + ModalResultField.P_gbx_inertia, + ModalResultField.P_gbx_loss, + ModalResultField.P_angle_loss, + ModalResultField.P_retarder_in, + ModalResultField.P_ret_loss, + ModalResultField.P_veh_inertia, + ModalResultField.P_roll, + ModalResultField.P_air, + ModalResultField.P_slope, + ModalResultField.P_wheel_in, + ModalResultField.P_brake_in, + ModalResultField.P_brake_loss, + ModalResultField.P_wheel_inertia, + ModalResultField.P_axle_in, + ModalResultField.P_axle_loss, + ModalResultField.P_angle_in, + ModalResultField.P_angle_loss, + ModalResultField.P_trac); + + SetConstantValues(current, start, end, + ModalResultField.FCMap, + ModalResultField.FCAUXc, + ModalResultField.FCAAUX, + ModalResultField.FCWHTCc, + ModalResultField.FCFinal); + + //--- + results.Rows.Add(start); + results.Rows.Add(end); + } + + return results; + } + + private void SetConstantValues(DataRow current, DataRow start, DataRow end, params ModalResultField[] fields) + { + foreach (var field in fields) { + if (current[(int)field] == DBNull.Value) { + continue; + } + if (field.GetDataType() == typeof(SI)) { + start[(int)field] = current.Field<SI>((int)field); + end[(int)field] = current.Field<SI>((int)field); + } else if (field.GetDataType() == typeof(double)) { + start[(int)field] = current.Field<double>((int)field); + end[(int)field] = current.Field<double>((int)field); + } else if (field.GetDataType() == typeof(int)) { + start[(int)field] = current.Field<int>((int)field); + end[(int)field] = current.Field<int>((int)field); + } else if (field.GetDataType() == typeof(uint)) { + start[(int)field] = current.Field<uint>((int)field); + end[(int)field] = current.Field<uint>((int)field); + } + } + } + + public string ID + { + get { return "sim"; } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/OutputData/ModFilter/ModalData1HzFilter.cs b/VectoCore/VectoCore/OutputData/ModFilter/ModalData1HzFilter.cs index aaf1c8c3e2e200180e740c85aac20c555f7e7a6a..34fe840434a2264773a2eb9eddb84f57b6fb92ac 100644 --- a/VectoCore/VectoCore/OutputData/ModFilter/ModalData1HzFilter.cs +++ b/VectoCore/VectoCore/OutputData/ModFilter/ModalData1HzFilter.cs @@ -1,232 +1,232 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.OutputData.ModFilter -{ - public class ModalData1HzFilter : IModalDataFilter - { - public ModalResults Filter(ModalResults data) - { - var results = (ModalResults)data.Clone(); - - object[] remainingRow = null; - var gearsList = new Dictionary<object, Second>(3); - - var absTime = 0.SI<Second>(); - var distance = 0.SI<Meter>(); - var v = data.Rows[0].Field<MeterPerSecond>((int)ModalResultField.v_act); - var remainingDt = 0.SI<Second>(); - var vPrevious = v; - - for (var i = 0; i < data.Rows.Count; i++) { - var row = data.Rows[i]; - - var currentDt = row.Field<Second>((int)ModalResultField.simulationInterval); - - if (row.Field<Meter>((int)ModalResultField.dist).IsSmaller(distance, 1e-3)) { - LogManager.GetLogger(typeof(ModalData1HzFilter).FullName).Error("1Hz-Filter: distance must always be increasing."); - } - - // if a remainder and currentDt would exceed 1 second: take remainder and take current row to fill up to 1 second. - if (remainingDt > 0 && remainingDt + currentDt >= 1) { - // calculate values - var dt = 1.SI<Second>() - remainingDt; - var gear = row[(int)ModalResultField.Gear]; - gearsList[gear] = gearsList.GetValueOrZero(gear) + dt; - var a = (MeterPerSquareSecond)row[(int)ModalResultField.acc]; - var ds = dt * v + a / 2 * dt * dt; - if (ds.IsSmaller(0)) { - throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "1"); - } - absTime += dt; - v += dt * a; - distance += ds; - - // write a new row for the combined 1 second - var r = results.NewRow(); - r.ItemArray = AddRow(remainingRow, MultiplyRow(row.ItemArray, dt)); - r[(int)ModalResultField.time] = absTime; - r[(int)ModalResultField.simulationInterval] = 1.SI<Second>(); - r[(int)ModalResultField.Gear] = gearsList.MaxBy(kv => kv.Value).Key; - r[(int)ModalResultField.dist] = distance; - r[(int)ModalResultField.v_act] = (v + vPrevious) / 2; - vPrevious = v; - results.Rows.Add(r); - - // reset remainder - // reduce current dt by already taken diff - gearsList.Clear(); - currentDt -= dt; - remainingDt = 0.SI<Second>(); - remainingRow = null; - } - - // if current row still longer than 1 second: split it to 1 second slices until it is < 1 second - while (currentDt >= 1) { - // calculate values - var dt = 1.SI<Second>(); - currentDt = currentDt - 1.SI<Second>(); - var a = (MeterPerSquareSecond)row[(int)ModalResultField.acc]; - var ds = v * dt + a / 2 * dt * dt; - if (ds.IsSmaller(0)) { - throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "2"); - } - absTime += dt; - v += a * dt; - distance += ds; - - // write a new row for the sliced 1 second - var r = results.NewRow(); - r.ItemArray = row.ItemArray; - r[(int)ModalResultField.time] = absTime; - r[(int)ModalResultField.simulationInterval] = dt; - r[(int)ModalResultField.dist] = distance; - r[(int)ModalResultField.v_act] = (v + vPrevious) / 2; - vPrevious = v; - results.Rows.Add(r); - } - - // if there still is something left in current row: add to weighted values to remainder - if (currentDt > 0) { - // calculate values - var dt = currentDt; - var gear = row[(int)ModalResultField.Gear]; - gearsList[gear] = gearsList.GetValueOrZero(gear) + dt; - var a = (MeterPerSquareSecond)row[(int)ModalResultField.acc]; - var ds = v * dt + a / 2 * dt * dt; - if (ds.IsSmaller(0)) { - throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "3"); - } - absTime += dt; - v += a * dt; - distance += ds; - - // add to remainder - remainingRow = AddRow(remainingRow, MultiplyRow(row.ItemArray, dt)); - remainingDt += dt; - } else { - // reset remainder (just to be sure!) - remainingRow = null; - remainingDt = 0.SI<Second>(); - gearsList.Clear(); - } - } - - // if last row was not enough to full second: take last row as whole second - if (remainingDt > 0) { - // calculate values - var last = data.Rows.Cast<DataRow>().Last(); - var dt = remainingDt; - var a = (MeterPerSquareSecond)last[(int)ModalResultField.acc]; - var ds = v * dt + a / 2 * dt * dt; - if (v.IsEqual(0)) { - ds = 0.SI<Meter>(); - a = 0.SI<MeterPerSquareSecond>(); - } - if (ds.IsSmaller(0)) { - throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "4"); - } - v += a * dt; - distance += ds; - - // write a new row for the last second - var r = results.NewRow(); - r.ItemArray = MultiplyRow(remainingRow, 1 / dt).ToArray(); - r[(int)ModalResultField.time] = VectoMath.Ceiling(absTime); - r[(int)ModalResultField.simulationInterval] = 1.SI<Second>(); - r[(int)ModalResultField.Gear] = gearsList.MaxBy(kv => kv.Value).Key; - r[(int)ModalResultField.dist] = distance; - r[(int)ModalResultField.v_act] = (v + vPrevious) / 2; - results.Rows.Add(r); - } - - return results; - } - - private static IEnumerable<object> MultiplyRow(IEnumerable<object> row, SI dt) - { - return row.Select(val => { - if (val is SI) { - val = (SI)val * dt.Value(); - } else { - val.Switch() - .Case<int>(i => val = i * dt.Value()) - .Case<double>(d => val = d * dt.Value()) - .Case<float>(f => val = f * dt.Value()) - .Case<uint>(ui => val = ui * dt.Value()); - } - return val; - }); - } - - private static object[] AddRow(IEnumerable<object> row, IEnumerable<object> addRow) - { - if (row == null) { - return addRow.ToArray(); - } - if (addRow == null) { - return row.ToArray(); - } - - return row.ZipAll(addRow, (val, addVal) => { - if (val is SI || addVal is SI) { - if (DBNull.Value == val) { - val = addVal; - } else if (DBNull.Value != addVal) { - val = (SI)val + (SI)addVal; - } - } else { - val.Switch() - .Case<int>(i => val = i + (int)addVal) - .Case<double>(d => val = d + (double)addVal) - .Case<float>(f => val = f + (float)addVal) - .Case<uint>(ui => val = ui + (uint)addVal); - } - return val; - }).ToArray(); - } - - public string ID - { - get { return "1Hz"; } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.OutputData.ModFilter +{ + public class ModalData1HzFilter : IModalDataFilter + { + public ModalResults Filter(ModalResults data) + { + var results = (ModalResults)data.Clone(); + + object[] remainingRow = null; + var gearsList = new Dictionary<object, Second>(3); + + var absTime = 0.SI<Second>(); + var distance = 0.SI<Meter>(); + var v = data.Rows[0].Field<MeterPerSecond>((int)ModalResultField.v_act); + var remainingDt = 0.SI<Second>(); + var vPrevious = v; + + for (var i = 0; i < data.Rows.Count; i++) { + var row = data.Rows[i]; + + var currentDt = row.Field<Second>((int)ModalResultField.simulationInterval); + + if (row.Field<Meter>((int)ModalResultField.dist).IsSmaller(distance, 1e-3)) { + LogManager.GetLogger(typeof(ModalData1HzFilter).FullName).Error("1Hz-Filter: distance must always be increasing."); + } + + // if a remainder and currentDt would exceed 1 second: take remainder and take current row to fill up to 1 second. + if (remainingDt > 0 && remainingDt + currentDt >= 1) { + // calculate values + var dt = 1.SI<Second>() - remainingDt; + var gear = row[(int)ModalResultField.Gear]; + gearsList[gear] = gearsList.GetValueOrZero(gear) + dt; + var a = (MeterPerSquareSecond)row[(int)ModalResultField.acc]; + var ds = dt * v + a / 2 * dt * dt; + if (ds.IsSmaller(0)) { + throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "1"); + } + absTime += dt; + v += dt * a; + distance += ds; + + // write a new row for the combined 1 second + var r = results.NewRow(); + r.ItemArray = AddRow(remainingRow, MultiplyRow(row.ItemArray, dt)); + r[(int)ModalResultField.time] = absTime; + r[(int)ModalResultField.simulationInterval] = 1.SI<Second>(); + r[(int)ModalResultField.Gear] = gearsList.MaxBy(kv => kv.Value).Key; + r[(int)ModalResultField.dist] = distance; + r[(int)ModalResultField.v_act] = (v + vPrevious) / 2; + vPrevious = v; + results.Rows.Add(r); + + // reset remainder + // reduce current dt by already taken diff + gearsList.Clear(); + currentDt -= dt; + remainingDt = 0.SI<Second>(); + remainingRow = null; + } + + // if current row still longer than 1 second: split it to 1 second slices until it is < 1 second + while (currentDt >= 1) { + // calculate values + var dt = 1.SI<Second>(); + currentDt = currentDt - 1.SI<Second>(); + var a = (MeterPerSquareSecond)row[(int)ModalResultField.acc]; + var ds = v * dt + a / 2 * dt * dt; + if (ds.IsSmaller(0)) { + throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "2"); + } + absTime += dt; + v += a * dt; + distance += ds; + + // write a new row for the sliced 1 second + var r = results.NewRow(); + r.ItemArray = row.ItemArray; + r[(int)ModalResultField.time] = absTime; + r[(int)ModalResultField.simulationInterval] = dt; + r[(int)ModalResultField.dist] = distance; + r[(int)ModalResultField.v_act] = (v + vPrevious) / 2; + vPrevious = v; + results.Rows.Add(r); + } + + // if there still is something left in current row: add to weighted values to remainder + if (currentDt > 0) { + // calculate values + var dt = currentDt; + var gear = row[(int)ModalResultField.Gear]; + gearsList[gear] = gearsList.GetValueOrZero(gear) + dt; + var a = (MeterPerSquareSecond)row[(int)ModalResultField.acc]; + var ds = v * dt + a / 2 * dt * dt; + if (ds.IsSmaller(0)) { + throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "3"); + } + absTime += dt; + v += a * dt; + distance += ds; + + // add to remainder + remainingRow = AddRow(remainingRow, MultiplyRow(row.ItemArray, dt)); + remainingDt += dt; + } else { + // reset remainder (just to be sure!) + remainingRow = null; + remainingDt = 0.SI<Second>(); + gearsList.Clear(); + } + } + + // if last row was not enough to full second: take last row as whole second + if (remainingDt > 0) { + // calculate values + var last = data.Rows.Cast<DataRow>().Last(); + var dt = remainingDt; + var a = (MeterPerSquareSecond)last[(int)ModalResultField.acc]; + var ds = v * dt + a / 2 * dt * dt; + if (v.IsEqual(0)) { + ds = 0.SI<Meter>(); + a = 0.SI<MeterPerSquareSecond>(); + } + if (ds.IsSmaller(0)) { + throw new VectoSimulationException("1Hz-Filter: simulation distance must not be negative. ds: {0} {1}", ds, "4"); + } + v += a * dt; + distance += ds; + + // write a new row for the last second + var r = results.NewRow(); + r.ItemArray = MultiplyRow(remainingRow, 1 / dt).ToArray(); + r[(int)ModalResultField.time] = VectoMath.Ceiling(absTime); + r[(int)ModalResultField.simulationInterval] = 1.SI<Second>(); + r[(int)ModalResultField.Gear] = gearsList.MaxBy(kv => kv.Value).Key; + r[(int)ModalResultField.dist] = distance; + r[(int)ModalResultField.v_act] = (v + vPrevious) / 2; + results.Rows.Add(r); + } + + return results; + } + + private static IEnumerable<object> MultiplyRow(IEnumerable<object> row, SI dt) + { + return row.Select(val => { + if (val is SI) { + val = (SI)val * dt.Value(); + } else { + val.Switch() + .Case<int>(i => val = i * dt.Value()) + .Case<double>(d => val = d * dt.Value()) + .Case<float>(f => val = f * dt.Value()) + .Case<uint>(ui => val = ui * dt.Value()); + } + return val; + }); + } + + private static object[] AddRow(IEnumerable<object> row, IEnumerable<object> addRow) + { + if (row == null) { + return addRow.ToArray(); + } + if (addRow == null) { + return row.ToArray(); + } + + return row.ZipAll(addRow, (val, addVal) => { + if (val is SI || addVal is SI) { + if (DBNull.Value == val) { + val = addVal; + } else if (DBNull.Value != addVal) { + val = (SI)val + (SI)addVal; + } + } else { + val.Switch() + .Case<int>(i => val = i + (int)addVal) + .Case<double>(d => val = d + (double)addVal) + .Case<float>(f => val = f + (float)addVal) + .Case<uint>(ui => val = ui + (uint)addVal); + } + return val; + }).ToArray(); + } + + public string ID + { + get { return "1Hz"; } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs index df2e9f577d4b338de31d49c6c45523ce9f914b8d..a9d20247dacc6fb2c740ab6b074c2ca9b5f894d5 100644 --- a/VectoCore/VectoCore/OutputData/ModalDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/ModalDataContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs index c5bcf423ce2dfebb0e529f1fb6eb1bf999da8d6c..7a69faf093e6c94035e30fd0dcd67f9ff55a6667 100644 --- a/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs +++ b/VectoCore/VectoCore/OutputData/SummaryDataContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using System.Linq; diff --git a/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs b/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs index d3f9e47c777be109ea39e95b377dfdf1c0f46295..7d6135a18c147fd32461f422c1bce29fd4ebbfe2 100644 --- a/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/AbstractXMLWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Data; using System.Linq; diff --git a/VectoCore/VectoCore/OutputData/XML/AttributeMappings.cs b/VectoCore/VectoCore/OutputData/XML/AttributeMappings.cs index 6228900cc45804344e55c1721a3a232eb1eb08ba..36749e3c867d21221351eb683b82b9e11316c447 100644 --- a/VectoCore/VectoCore/OutputData/XML/AttributeMappings.cs +++ b/VectoCore/VectoCore/OutputData/XML/AttributeMappings.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Resources; using TUGraz.VectoCore.InputData.Reader; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs index 8a9a167e63c2f7ef351fd487486fb8f89db34243..f940f7acec828e8a4787108e1b0dba82d60f4974 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLCustomerReport.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs index 1ddd0d5df61b949d7356a2732a157792fcd6e6e7..65d3a0821cdbf6ba4c82b6014dea707ca390c833 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationReport.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs index ff0de725730524b7b94b9ebfa6e8ff8d23a1776e..87fb34848e02e6e620f8fc6ae3f8f5afe2c7bb26 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs b/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs index c1cdce193139ab2da84f6623e9ba4febc77ff4af..4bba607d2ac88beb1ca31c34664a1eb1dc2699fb 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLEngineeringWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCore/OutputData/XML/XMLFullReport.cs b/VectoCore/VectoCore/OutputData/XML/XMLFullReport.cs index 57c01d7cbcbc920d98bb2684eeb0fe55bbf9e036..7a3d19ac895970230f4d5f64f8f870ce202ff173 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLFullReport.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLFullReport.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCore/Properties/AssemblyInfo.cs b/VectoCore/VectoCore/Properties/AssemblyInfo.cs index 5c4f8ce0c12b679a02dde93652359d9714090be8..9259a018bfaa2e3c796d28758d4578386a44b894 100644 --- a/VectoCore/VectoCore/Properties/AssemblyInfo.cs +++ b/VectoCore/VectoCore/Properties/AssemblyInfo.cs @@ -1,53 +1,53 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("VectoCore")] -[assembly: AssemblyDescription("Core Library for VECTO Simulations")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("European Union")] -[assembly: AssemblyProduct("VectoCore")] -[assembly: AssemblyCopyright("Copyright © 2012 - 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("b843f4c2-660b-4a3e-a336-c1f9c20aa993")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPI")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoEngineeringAPI")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VECTO")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPITest")] -[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("VectoCore")] +[assembly: AssemblyDescription("Core Library for VECTO Simulations")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("European Union")] +[assembly: AssemblyProduct("VectoCore")] +[assembly: AssemblyCopyright("Copyright © 2012 - 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("b843f4c2-660b-4a3e-a336-c1f9c20aa993")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPI")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoEngineeringAPI")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VECTO")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoCoreTest")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoAPITest")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("VectoXML")] [assembly: System.Runtime.CompilerServices.InternalsVisibleTo("XMLTest")] \ No newline at end of file diff --git a/VectoCore/VectoCore/Properties/Version.cs b/VectoCore/VectoCore/Properties/Version.cs index 8f45722eb566a8c720985b81bd908e9e18edb6c4..679216b163dc275ac0da280e860e390485490108 100644 --- a/VectoCore/VectoCore/Properties/Version.cs +++ b/VectoCore/VectoCore/Properties/Version.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Reflection; [assembly: AssemblyVersion("3.1.2.810")] [assembly: AssemblyFileVersion("3.1.2.810")] diff --git a/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs b/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs index 2b83816cf8ea0d0cd52af4fec2f8675a05f73d49..fa886546ede615f5ed61708611dfd46be7310816 100644 --- a/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs +++ b/VectoCore/VectoCore/Utils/DataTableExtensionMethods.cs @@ -1,7 +1,7 @@ /* * This file is part of VECTO. * -* Copyright © 2012-2016 European Union +* Copyright © 2012-2017 European Union * * Developed by Graz University of Technology, * Institute of Internal Combustion Engines and Thermodynamics, diff --git a/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs b/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs index c65611bf27f2fa1fd9354e245c16cdebd285728f..bb694435cf2429fcf263ad0c487ff808d9340921 100644 --- a/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs +++ b/VectoCore/VectoCore/Utils/DateTimeFallbackDeserializer.cs @@ -1,66 +1,66 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace TUGraz.VectoCore.Utils -{ - /// <summary> - /// Accepts following date formats: - /// * German: d.M.yyyy HH:mm:ss - /// * English: M/d/yyyy HH:mm:ss tt - /// * ISO8601: yyyy-MM-DDTHH:mm:ssZ - /// * Local culture format (based on current localization of the user) - /// Output is in ISO8601 format. - /// </summary> - public class DateTimeFallbackDeserializer : IsoDateTimeConverter - { - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - DateTime dateTime; - if (reader.TokenType == JsonToken.Date) { - return reader.Value; - } - if (DateTime.TryParseExact((string)reader.Value, new[] { "d.M.yyyy HH:mm:ss", "M/d/yyyy HH:mm:ss tt" }, - CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) { - return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); - } - - if (DateTime.TryParse((string)reader.Value, out dateTime)) { - return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); - } - return base.ReadJson(reader, objectType, existingValue, serializer); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace TUGraz.VectoCore.Utils +{ + /// <summary> + /// Accepts following date formats: + /// * German: d.M.yyyy HH:mm:ss + /// * English: M/d/yyyy HH:mm:ss tt + /// * ISO8601: yyyy-MM-DDTHH:mm:ssZ + /// * Local culture format (based on current localization of the user) + /// Output is in ISO8601 format. + /// </summary> + public class DateTimeFallbackDeserializer : IsoDateTimeConverter + { + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + DateTime dateTime; + if (reader.TokenType == JsonToken.Date) { + return reader.Value; + } + if (DateTime.TryParseExact((string)reader.Value, new[] { "d.M.yyyy HH:mm:ss", "M/d/yyyy HH:mm:ss tt" }, + CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime)) { + return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); + } + + if (DateTime.TryParse((string)reader.Value, out dateTime)) { + return DateTime.SpecifyKind(dateTime, DateTimeKind.Utc); + } + return base.ReadJson(reader, objectType, existingValue, serializer); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/DebugData.cs b/VectoCore/VectoCore/Utils/DebugData.cs index f54e6196d4e22dcf81cdcbcb3f0c88d6c7ec8622..f8e5f87c4cc209b09a0f7329b646bf3e76ab339f 100644 --- a/VectoCore/VectoCore/Utils/DebugData.cs +++ b/VectoCore/VectoCore/Utils/DebugData.cs @@ -1,63 +1,63 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.Diagnostics; - -namespace TUGraz.VectoCore.Utils -{ - public class DebugData - { - internal readonly List<dynamic> Data; - - public DebugData() - { -#if DEBUG - Data = new List<dynamic>(); -#endif - } - - [Conditional("DEBUG")] - public void Add(dynamic value) - { - Data.Add(value); - } - - public override string ToString() - { -#if DEBUG - return string.Join("\n", Data); -#else - return "-"; - #endif - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.Diagnostics; + +namespace TUGraz.VectoCore.Utils +{ + public class DebugData + { + internal readonly List<dynamic> Data; + + public DebugData() + { +#if DEBUG + Data = new List<dynamic>(); +#endif + } + + [Conditional("DEBUG")] + public void Add(dynamic value) + { + Data.Add(value); + } + + public override string ToString() + { +#if DEBUG + return string.Join("\n", Data); +#else + return "-"; + #endif + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/DelaunayMap.cs b/VectoCore/VectoCore/Utils/DelaunayMap.cs index 45f763af4c6e8c0ce7fd328ef1ac467ee4a1872b..57a7739e6136db7e0ccba3d683fc4c3f74c18bd6 100644 --- a/VectoCore/VectoCore/Utils/DelaunayMap.cs +++ b/VectoCore/VectoCore/Utils/DelaunayMap.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs b/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs index f32c59dd055e47b1d818a8ae187cbc47bafddbdd..ee73506a49ca8a096a4bca1b419ce64d58789526 100644 --- a/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs +++ b/VectoCore/VectoCore/Utils/DictionaryExtensionMethods.cs @@ -1,53 +1,53 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Utils -{ - internal static class DictionaryExtensionMethods - { - public static object GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) - { - TValue value; - return dictionary.TryGetValue(key, out value) ? (object)value : DBNull.Value; - } - - public static TValue GetValueOrZero<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) - where TValue : SIBase<TValue> - { - TValue value; - return dictionary.TryGetValue(key, out value) ? value : 0.SI<TValue>(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Utils +{ + internal static class DictionaryExtensionMethods + { + public static object GetValueOrNull<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) + { + TValue value; + return dictionary.TryGetValue(key, out value) ? (object)value : DBNull.Value; + } + + public static TValue GetValueOrZero<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) + where TValue : SIBase<TValue> + { + TValue value; + return dictionary.TryGetValue(key, out value) ? value : 0.SI<TValue>(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/Formulas.cs b/VectoCore/VectoCore/Utils/Formulas.cs index c8085d74a3c714804bbc2d72e8cf0b3c5b2c9f5b..1f68f8f0f71a075ea4f36ad34ca11f2a2e63c57c 100644 --- a/VectoCore/VectoCore/Utils/Formulas.cs +++ b/VectoCore/VectoCore/Utils/Formulas.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Utils diff --git a/VectoCore/VectoCore/Utils/IterationStatistics.cs b/VectoCore/VectoCore/Utils/IterationStatistics.cs index b43f49fdd11789980976ea778b6917fa9232020d..01ec52f39638da54656d97cc44243b300c79516e 100644 --- a/VectoCore/VectoCore/Utils/IterationStatistics.cs +++ b/VectoCore/VectoCore/Utils/IterationStatistics.cs @@ -1,167 +1,167 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Data; -using System.Diagnostics; -using System.IO; -using System.Runtime.CompilerServices; -using System.Threading; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Utils -{ - public static class IterationStatistics - { - private static readonly ThreadLocal<List<DataEntry>> DataLocal = - new ThreadLocal<List<DataEntry>>(() => new List<DataEntry>()); - - public static List<DataEntry> Data - { - get { return DataLocal.Value; } - } - - private static readonly ThreadLocal<Stopwatch> TimerLocal = new ThreadLocal<Stopwatch>(Stopwatch.StartNew); - - private static Stopwatch Timer - { - get { return TimerLocal.Value; } - } - - private static readonly ThreadLocal<Dictionary<string, Dictionary<string, double>>> CurrentLocal = - new ThreadLocal<Dictionary<string, Dictionary<string, double>>>( - () => new Dictionary<string, Dictionary<string, double>>()); - - private static Dictionary<string, Dictionary<string, double>> Current - { - get { return CurrentLocal.Value; } - set { CurrentLocal.Value = value; } - } - - [Conditional("TRACE")] - public static void Increment<T>(T o, string key, double? value = null) - { - var t = typeof(T).Name; - - if (!Current.ContainsKey(t)) - Current[t] = new Dictionary<string, double>(); - - if (Current[t].ContainsKey(key)) - if (value.HasValue) - Current[t][key] += value.Value; - else - Current[t][key]++; - - else { - if (value.HasValue) - Current[t][key] = value.Value; - else - Current[t][key] = 1; - } - } - - public static void StartIteration() - { - Timer.Restart(); - } - - [Conditional("TRACE"), MethodImpl(MethodImplOptions.Synchronized)] - public static void FinishIteration(Second absTime) - { - Timer.Stop(); - Data.Add(new DataEntry(absTime, Timer.Elapsed, Current)); - Current = new Dictionary<string, Dictionary<string, double>>(); - } - - [Conditional("TRACE")] - public static void FinishSimulation(string runName) - { - var table = new DataTable(); - table.Columns.Add("Distance", typeof(double)); - table.Columns.Add("Time", typeof(double)); - table.Columns.Add("StepDuration", typeof(double)); - table.Columns.Add("StepIterationCount", typeof(double)); - table.Columns.Add("NumDriverRequests", typeof(double)); - table.Columns.Add("NumAccelActions", typeof(double)); - table.Columns.Add("NumBrakeActions", typeof(double)); - table.Columns.Add("NumCoastActions", typeof(double)); - table.Columns.Add("NumRollActions", typeof(double)); - table.Columns.Add("SearchOPIterations", typeof(double)); - table.Columns.Add("SearchBrakeIterations", typeof(double)); - table.Columns.Add("NumGearboxRequests", typeof(double)); - table.Columns.Add("NumEngineRequests", typeof(double)); - - foreach (var entry in Data) { - var row = table.NewRow(); - row["StepDuration"] = entry.Duration.TotalMilliseconds; - - if (entry.Values.ContainsKey("DistanceRun")) { - row["Distance"] = entry.Values["DistanceRun"].GetValueOrNull("Distance"); - row["Time"] = entry.Values["DistanceRun"].GetValueOrNull("Time"); - row["StepIterationCount"] = entry.Values["DistanceRun"].GetValueOrNull("Iterations"); - } - if (entry.Values.ContainsKey("Driver")) { - row["NumDriverRequests"] = entry.Values["Driver"].GetValueOrNull("Requests"); - row["NumAccelActions"] = entry.Values["Driver"].GetValueOrNull("Accelerate"); - row["NumBrakeActions"] = entry.Values["Driver"].GetValueOrNull("Brake"); - row["NumCoastActions"] = entry.Values["Driver"].GetValueOrNull("Coast"); - row["NumRollActions"] = entry.Values["Driver"].GetValueOrNull("Roll"); - row["SearchOPIterations"] = entry.Values["Driver"].GetValueOrNull("SearchOperatingPoint"); - row["SearchBrakeIterations"] = entry.Values["Driver"].GetValueOrNull("SearchBrakingPower"); - } - if (entry.Values.ContainsKey("Gearbox")) { - row["NumGearboxRequests"] = entry.Values["Gearbox"].GetValueOrNull("Requests"); - } - if (entry.Values.ContainsKey("CombustionEngine")) { - row["NumEngineRequests"] = entry.Values["CombustionEngine"].GetValueOrNull("Requests"); - } - table.Rows.Add(row); - } - var writer = new StreamWriter("statistics_" + runName + ".csv"); - VectoCSVFile.Write(writer, table); - } - - public sealed class DataEntry - { - public readonly TimeSpan Duration; - public readonly Second Time; - public readonly Dictionary<string, Dictionary<string, double>> Values; - - public DataEntry(Second time, TimeSpan duration, Dictionary<string, Dictionary<string, double>> values) - { - Time = time; - Duration = duration; - Values = values; - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Data; +using System.Diagnostics; +using System.IO; +using System.Runtime.CompilerServices; +using System.Threading; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Utils +{ + public static class IterationStatistics + { + private static readonly ThreadLocal<List<DataEntry>> DataLocal = + new ThreadLocal<List<DataEntry>>(() => new List<DataEntry>()); + + public static List<DataEntry> Data + { + get { return DataLocal.Value; } + } + + private static readonly ThreadLocal<Stopwatch> TimerLocal = new ThreadLocal<Stopwatch>(Stopwatch.StartNew); + + private static Stopwatch Timer + { + get { return TimerLocal.Value; } + } + + private static readonly ThreadLocal<Dictionary<string, Dictionary<string, double>>> CurrentLocal = + new ThreadLocal<Dictionary<string, Dictionary<string, double>>>( + () => new Dictionary<string, Dictionary<string, double>>()); + + private static Dictionary<string, Dictionary<string, double>> Current + { + get { return CurrentLocal.Value; } + set { CurrentLocal.Value = value; } + } + + [Conditional("TRACE")] + public static void Increment<T>(T o, string key, double? value = null) + { + var t = typeof(T).Name; + + if (!Current.ContainsKey(t)) + Current[t] = new Dictionary<string, double>(); + + if (Current[t].ContainsKey(key)) + if (value.HasValue) + Current[t][key] += value.Value; + else + Current[t][key]++; + + else { + if (value.HasValue) + Current[t][key] = value.Value; + else + Current[t][key] = 1; + } + } + + public static void StartIteration() + { + Timer.Restart(); + } + + [Conditional("TRACE"), MethodImpl(MethodImplOptions.Synchronized)] + public static void FinishIteration(Second absTime) + { + Timer.Stop(); + Data.Add(new DataEntry(absTime, Timer.Elapsed, Current)); + Current = new Dictionary<string, Dictionary<string, double>>(); + } + + [Conditional("TRACE")] + public static void FinishSimulation(string runName) + { + var table = new DataTable(); + table.Columns.Add("Distance", typeof(double)); + table.Columns.Add("Time", typeof(double)); + table.Columns.Add("StepDuration", typeof(double)); + table.Columns.Add("StepIterationCount", typeof(double)); + table.Columns.Add("NumDriverRequests", typeof(double)); + table.Columns.Add("NumAccelActions", typeof(double)); + table.Columns.Add("NumBrakeActions", typeof(double)); + table.Columns.Add("NumCoastActions", typeof(double)); + table.Columns.Add("NumRollActions", typeof(double)); + table.Columns.Add("SearchOPIterations", typeof(double)); + table.Columns.Add("SearchBrakeIterations", typeof(double)); + table.Columns.Add("NumGearboxRequests", typeof(double)); + table.Columns.Add("NumEngineRequests", typeof(double)); + + foreach (var entry in Data) { + var row = table.NewRow(); + row["StepDuration"] = entry.Duration.TotalMilliseconds; + + if (entry.Values.ContainsKey("DistanceRun")) { + row["Distance"] = entry.Values["DistanceRun"].GetValueOrNull("Distance"); + row["Time"] = entry.Values["DistanceRun"].GetValueOrNull("Time"); + row["StepIterationCount"] = entry.Values["DistanceRun"].GetValueOrNull("Iterations"); + } + if (entry.Values.ContainsKey("Driver")) { + row["NumDriverRequests"] = entry.Values["Driver"].GetValueOrNull("Requests"); + row["NumAccelActions"] = entry.Values["Driver"].GetValueOrNull("Accelerate"); + row["NumBrakeActions"] = entry.Values["Driver"].GetValueOrNull("Brake"); + row["NumCoastActions"] = entry.Values["Driver"].GetValueOrNull("Coast"); + row["NumRollActions"] = entry.Values["Driver"].GetValueOrNull("Roll"); + row["SearchOPIterations"] = entry.Values["Driver"].GetValueOrNull("SearchOperatingPoint"); + row["SearchBrakeIterations"] = entry.Values["Driver"].GetValueOrNull("SearchBrakingPower"); + } + if (entry.Values.ContainsKey("Gearbox")) { + row["NumGearboxRequests"] = entry.Values["Gearbox"].GetValueOrNull("Requests"); + } + if (entry.Values.ContainsKey("CombustionEngine")) { + row["NumEngineRequests"] = entry.Values["CombustionEngine"].GetValueOrNull("Requests"); + } + table.Rows.Add(row); + } + var writer = new StreamWriter("statistics_" + runName + ".csv"); + VectoCSVFile.Write(writer, table); + } + + public sealed class DataEntry + { + public readonly TimeSpan Duration; + public readonly Second Time; + public readonly Dictionary<string, Dictionary<string, double>> Values; + + public DataEntry(Second time, TimeSpan duration, Dictionary<string, Dictionary<string, double>> values) + { + Time = time; + Duration = duration; + Values = values; + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/Physics.cs b/VectoCore/VectoCore/Utils/Physics.cs index 2bb5897943dfca6ff612d00630a04814ffa8296e..a7fcce2342d0c1d9468d76b4667cd00008a5db2e 100644 --- a/VectoCore/VectoCore/Utils/Physics.cs +++ b/VectoCore/VectoCore/Utils/Physics.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Utils diff --git a/VectoCore/VectoCore/Utils/ProviderExtensions.cs b/VectoCore/VectoCore/Utils/ProviderExtensions.cs index a2c6ea46e649db663d65c29b460b6cbe772f7816..482a839bb7a1ff0f8be16f72cb7c277ecc33b87c 100644 --- a/VectoCore/VectoCore/Utils/ProviderExtensions.cs +++ b/VectoCore/VectoCore/Utils/ProviderExtensions.cs @@ -1,131 +1,131 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; - -namespace TUGraz.VectoCore.Utils -{ - public static class ProviderExtensions - { - public static void AddAuxiliaries(this CombustionEngine engine, VehicleContainer container, - VectoRunData data) - { - // aux --> engine - if (data.AdvancedAux != null && data.AdvancedAux.AuxiliaryAssembly == AuxiliaryModel.Advanced) { - engine.Connect(PowertrainBuilder.CreateAdvancedAuxiliaries(data, container).Port()); - } else { - if (data.Aux != null) { - engine.Connect(PowertrainBuilder.CreateAuxiliaries(data, container).Port()); - } - } - } - - public static IDriver AddComponent(this IDrivingCycleInProvider prev, IDriver next) - { - prev.InPort().Connect(next.OutPort()); - return next; - } - - public static IVehicle AddComponent(this IDriverDemandInProvider prev, IVehicle next) - { - prev.InPort().Connect(next.OutPort()); - return next; - } - - public static IWheels AddComponent(this IFvInProvider prev, IWheels next) - { - prev.InPort().Connect(next.OutPort()); - return next; - } - - public static IPowerTrainComponent AddComponent(this ITnInProvider prev, IPowerTrainComponent next) - { - prev.InPort().Connect(next.OutPort()); - return next; - } - - public static IPowerTrainComponent AddComponent(this IPowerTrainComponent prev, IPowerTrainComponent next) - { - if (next == null) { - return prev; - } - - prev.InPort().Connect(next.OutPort()); - return next; - } - - public static CombustionEngine AddComponent(this IPowerTrainComponent prev, CombustionEngine next, - IIdleController idleController = null) - { - prev.InPort().Connect(next.OutPort()); - - if (idleController == null) { - idleController = next.IdleController; - } - - var clutch = prev as IClutch; - if (clutch != null) { - clutch.IdleController = idleController; - } - var atGbx = prev as ATGearbox; - if (atGbx != null) { - atGbx.IdleController = idleController; - } - - return next; - } - - public static IPowerTrainComponent AddComponent(this IPowerTrainComponent prev, IGearbox gearbox, RetarderData data, - IVehicleContainer container) - { - switch (data.Type) { - case RetarderType.TransmissionOutputRetarder: - return prev.AddComponent(new Retarder(container, data.LossMap, data.Ratio)).AddComponent(gearbox); - case RetarderType.TransmissionInputRetarder: - return prev.AddComponent(gearbox).AddComponent(new Retarder(container, data.LossMap, data.Ratio)); - case RetarderType.None: - return prev.AddComponent(new DummyRetarder(container)).AddComponent(gearbox); - case RetarderType.LossesIncludedInTransmission: - return prev.AddComponent(new DummyRetarder(container)).AddComponent(gearbox); - default: - throw new ArgumentOutOfRangeException(data.Type.ToString()); - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; + +namespace TUGraz.VectoCore.Utils +{ + public static class ProviderExtensions + { + public static void AddAuxiliaries(this CombustionEngine engine, VehicleContainer container, + VectoRunData data) + { + // aux --> engine + if (data.AdvancedAux != null && data.AdvancedAux.AuxiliaryAssembly == AuxiliaryModel.Advanced) { + engine.Connect(PowertrainBuilder.CreateAdvancedAuxiliaries(data, container).Port()); + } else { + if (data.Aux != null) { + engine.Connect(PowertrainBuilder.CreateAuxiliaries(data, container).Port()); + } + } + } + + public static IDriver AddComponent(this IDrivingCycleInProvider prev, IDriver next) + { + prev.InPort().Connect(next.OutPort()); + return next; + } + + public static IVehicle AddComponent(this IDriverDemandInProvider prev, IVehicle next) + { + prev.InPort().Connect(next.OutPort()); + return next; + } + + public static IWheels AddComponent(this IFvInProvider prev, IWheels next) + { + prev.InPort().Connect(next.OutPort()); + return next; + } + + public static IPowerTrainComponent AddComponent(this ITnInProvider prev, IPowerTrainComponent next) + { + prev.InPort().Connect(next.OutPort()); + return next; + } + + public static IPowerTrainComponent AddComponent(this IPowerTrainComponent prev, IPowerTrainComponent next) + { + if (next == null) { + return prev; + } + + prev.InPort().Connect(next.OutPort()); + return next; + } + + public static CombustionEngine AddComponent(this IPowerTrainComponent prev, CombustionEngine next, + IIdleController idleController = null) + { + prev.InPort().Connect(next.OutPort()); + + if (idleController == null) { + idleController = next.IdleController; + } + + var clutch = prev as IClutch; + if (clutch != null) { + clutch.IdleController = idleController; + } + var atGbx = prev as ATGearbox; + if (atGbx != null) { + atGbx.IdleController = idleController; + } + + return next; + } + + public static IPowerTrainComponent AddComponent(this IPowerTrainComponent prev, IGearbox gearbox, RetarderData data, + IVehicleContainer container) + { + switch (data.Type) { + case RetarderType.TransmissionOutputRetarder: + return prev.AddComponent(new Retarder(container, data.LossMap, data.Ratio)).AddComponent(gearbox); + case RetarderType.TransmissionInputRetarder: + return prev.AddComponent(gearbox).AddComponent(new Retarder(container, data.LossMap, data.Ratio)); + case RetarderType.None: + return prev.AddComponent(new DummyRetarder(container)).AddComponent(gearbox); + case RetarderType.LossesIncludedInTransmission: + return prev.AddComponent(new DummyRetarder(container)).AddComponent(gearbox); + default: + throw new ArgumentOutOfRangeException(data.Type.ToString()); + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/RessourceHelper.cs b/VectoCore/VectoCore/Utils/RessourceHelper.cs index 757bcdc36f180d74765be70fba6f7f39745d5b0e..93f200613416e46fc6a89d81aec0b0f4dbcdcf25 100644 --- a/VectoCore/VectoCore/Utils/RessourceHelper.cs +++ b/VectoCore/VectoCore/Utils/RessourceHelper.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Reflection; diff --git a/VectoCore/VectoCore/Utils/SearchAlgorithm.cs b/VectoCore/VectoCore/Utils/SearchAlgorithm.cs index 726206fb215c2b0a98b46155a882b5a1ec13da32..5b001a40783e26dc7beb1a341be2f2a1110bb8be 100644 --- a/VectoCore/VectoCore/Utils/SearchAlgorithm.cs +++ b/VectoCore/VectoCore/Utils/SearchAlgorithm.cs @@ -1,295 +1,295 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Data; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; - -namespace TUGraz.VectoCore.Utils -{ - public static class SearchAlgorithm - { - /// <summary> - /// Applies a numerical search over the evaluateFunction until the criterion reaches approximately 0. - /// <code> - /// SearchAlgorithm.Search(firstAcceleration, firstDelta, secondAccelerationInterval, - /// getYValue: result => ((ResponseDryRun)result).Delta, - /// evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), - /// criterion: result => ((ResponseDryRun)result).Delta); - /// </code> - /// </summary> - public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, - Func<object, double> criterion) where T : SIBase<T> - { - var iterationCount = 0; - return Search(x, y, interval, getYValue, evaluateFunction, criterion, null, ref iterationCount); - } - - /// <summary> - /// Applies a numerical search over the evaluateFunction until the criterion reaches approximately 0. - /// <code> - /// SearchAlgorithm.Search(firstAcceleration, firstDelta, secondAccelerationInterval, - /// getYValue: result => ((ResponseDryRun)result).Delta, - /// evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), - /// criterion: result => ((ResponseDryRun)result).Delta); - /// abortCriterion: result => true/false - /// </code> - /// </summary> - public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, - Func<object, double> criterion, Func<object, int, bool> abortCriterion) where T : SIBase<T> - { - var iterationCount = 0; - return Search(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount); - } - - /// <summary> - /// Applies a numerical search over the evaluateFunction until the criterion reaches approximately 0. - /// <code> - /// SearchAlgorithm.Search(firstAcceleration, firstDelta, secondAccelerationInterval, - /// getYValue: result => ((ResponseDryRun)result).Delta, - /// evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), - /// criterion: result => ((ResponseDryRun)result).Delta); - /// abortCriterion: result => true/false - /// </code> - /// </summary> - public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, - Func<object, double> criterion, Func<object, int, bool> abortCriterion, ref int iterationCount) where T : SIBase<T> - { - T result; - try { - result = InterpolateSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, - ref iterationCount); - } catch (VectoException ex) { - var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); - log.Debug("Falling back to LineSearch. InterpolationSearch failed: " + ex.Message); - result = LineSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount); - } - return result; - } - - /// <summary> - /// Line Search Algorithm. - /// Phase 1: Linear Bracketing: Search iterative for the area of interest (with fixed step size). - /// Phase 2: Binary Sectioning: Binary search in the area of interest. - /// </summary> - private static T LineSearch<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, - Func<object, double> criterion, Func<object, int, bool> abortCriterion, ref int iterationCount) where T : SIBase<T> - { - var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); - - var intervalFactor = 1.0; - var origY = y; - var debug = new DebugData(); - debug.Add(new { x = x.Value(), y = y.Value() }); - log.Debug("Log Disabled during LineSearch."); - LogManager.DisableLogging(); - try { - for (var count = 1; count < 100; count++, iterationCount++) { - if (origY.Sign() != y.Sign()) { - intervalFactor = 0.5; - } - - interval *= intervalFactor; - x += interval * -y.Sign(); - var result = evaluateFunction(x); - y = getYValue(result); - debug.Add(new { x = x.Value(), y = y.Value(), delta = criterion(result), result }); - if (criterion(result).IsEqual(0, Constants.SimulationSettings.LineSearchTolerance / 2)) { - LogManager.EnableLogging(); - log.Debug("LineSearch found an operating point after {0} function calls.", count); - //iterationCount += count; - LogManager.DisableLogging(); - AppendDebug(debug); - return x; - } - if (abortCriterion != null && abortCriterion(result, iterationCount)) { - LogManager.EnableLogging(); - log.Debug("LineSearch aborted due to abortCriterion: {0}", result); - LogManager.DisableLogging(); - throw new VectoSearchAbortedException("LineSearch"); - } - } - } finally { - LogManager.EnableLogging(); - } - - //iterationCount += 100; - log.Debug("LineSearch could not find an operating point."); - log.Error("Exceeded max iterations when searching for operating point!"); - log.Error("debug: {0}", debug); - - WriteSearch(debug, "LineSearch.csv"); - throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); - } - - [Conditional("TRACE")] - private static void AppendDebug(DebugData debug) - { - var xmin = debug.Data.Min(d => d.x); - var xmax = debug.Data.Max(d => d.x); - var ymin = debug.Data.Min(d => d.y); - var ymax = debug.Data.Max(d => d.y); - - var rand = new Random().Next(); - using ( - var f = - new StreamWriter(File.Open("LineSearch-" + Thread.CurrentThread.ManagedThreadId + "-statistics.csv", - FileMode.Append))) { - foreach (var d in debug.Data) { - f.WriteLine(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}", - rand, - (d.x - xmin) / (xmax - xmin), - (d.y - ymin) / (ymax - ymin), - d.x / Math.Max(Math.Abs(xmax), Math.Abs(xmin)), - d.y / Math.Max(Math.Abs(ymax), Math.Abs(ymin)), - d.x, d.y)); - } - } - } - - /// <summary> - /// Interpolating Search algorithm. - /// Calculates linear equation of 2 points and jumps directly to root-point. - /// </summary> - private static T InterpolateSearch<T>(T x1SI, SI y1SI, T intervalSI, Func<object, SI> getYValue, - Func<T, object> evaluateFunction, Func<object, double> criterion, Func<object, int, bool> abortCriterion, - ref int iterationCount) where T : SIBase<T> - { - var x1 = x1SI.Value(); - var interval = intervalSI.Value(); - var y1 = y1SI.Value(); - - var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); - var debug = new DebugData(); - debug.Add(new { x = x1, y = y1 }); - log.Debug("Log Disabled during InterpolateSearch."); - LogManager.DisableLogging(); - - try { - var x2 = x1 + interval; - var result = evaluateFunction(x2.SI<T>()); - if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) { - LogManager.EnableLogging(); - log.Debug("InterpolateSearch found an operating point after 1 function call."); - AppendDebug(debug); - LogManager.DisableLogging(); - iterationCount++; - return x2.SI<T>(); - } - - for (var count = 2; count < 30; count++, iterationCount++) { - var y2 = getYValue(result).Value(); - debug.Add(new { x = x2, y = y2, delta = criterion(result), result }); - - var k = (y2 - y1) / (x2 - x1); - var d = y2 - k * x2; - x1 = x2; - x2 = -d / k; - if (double.IsInfinity(x2) || double.IsNaN(x2)) { - debug.Add(new { x = x2, y = getYValue(result).Value(), delta = criterion(result), result }); - LogManager.EnableLogging(); - log.Debug("InterpolateSearch could not get more exact. Aborting after {0} function calls.", count); - LogManager.DisableLogging(); - AppendDebug(debug); - //iterationCount += count; - - //return x1.SI<T>(); - throw new VectoSearchAbortedException("InterpolateLinearSearch"); - } - - result = evaluateFunction(x2.SI<T>()); - if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) { - debug.Add(new { x = x2, y = getYValue(result).Value(), delta = criterion(result), result }); - LogManager.EnableLogging(); - log.Debug("InterpolateSearch found an operating point after {0} function calls.", count); - LogManager.DisableLogging(); - AppendDebug(debug); - return x2.SI<T>(); - } - if (abortCriterion != null && abortCriterion(result, iterationCount)) { - LogManager.EnableLogging(); - log.Debug("LineSearch aborted due to abortCriterion: {0}", result); - LogManager.DisableLogging(); - throw new VectoSearchAbortedException("InterpolateLinearSearch"); - } - y1 = y2; - } - } finally { - LogManager.EnableLogging(); - } - - log.Debug("InterpolateSearch could not find an operating point."); -#if DEBUG - log.Error("InterpolateSearch exceeded max iterations when searching for operating point!"); - log.Error("debug: {0}", debug); -#endif - WriteSearch(debug, "InterpolateSearch.csv"); - throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); - } - - [Conditional("TRACE")] - private static void WriteSearch(DebugData debug, string filename) - { - var table = new DataTable(); - table.Columns.Add("x", typeof(double)); - table.Columns.Add("y", typeof(double)); - table.Columns.Add("delta", typeof(double)); - table.Columns.Add("AuxPower", typeof(double)); - table.Columns.Add("engineSpeed", typeof(double)); - table.Columns.Add("enginePower", typeof(double)); - - foreach (var entry in debug.Data.Skip(1)) { - var response = entry.result as ResponseDryRun; - if (response == null) { - continue; - } - var row = table.NewRow(); - row["x"] = entry.x.Value(); - row["y"] = entry.y.Value(); - row["delta"] = entry.delta; - row["AuxPower"] = response.AuxiliariesPowerDemand == null ? -1 : response.AuxiliariesPowerDemand.Value(); - row["engineSpeed"] = response.EngineSpeed == null ? -1 : response.EngineSpeed.Value(); - row["enginePower"] = response.EnginePowerRequest == null ? -1 : response.EnginePowerRequest.Value(); - - table.Rows.Add(row); - } - VectoCSVFile.Write(filename, table); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Data; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; + +namespace TUGraz.VectoCore.Utils +{ + public static class SearchAlgorithm + { + /// <summary> + /// Applies a numerical search over the evaluateFunction until the criterion reaches approximately 0. + /// <code> + /// SearchAlgorithm.Search(firstAcceleration, firstDelta, secondAccelerationInterval, + /// getYValue: result => ((ResponseDryRun)result).Delta, + /// evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), + /// criterion: result => ((ResponseDryRun)result).Delta); + /// </code> + /// </summary> + public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, + Func<object, double> criterion) where T : SIBase<T> + { + var iterationCount = 0; + return Search(x, y, interval, getYValue, evaluateFunction, criterion, null, ref iterationCount); + } + + /// <summary> + /// Applies a numerical search over the evaluateFunction until the criterion reaches approximately 0. + /// <code> + /// SearchAlgorithm.Search(firstAcceleration, firstDelta, secondAccelerationInterval, + /// getYValue: result => ((ResponseDryRun)result).Delta, + /// evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), + /// criterion: result => ((ResponseDryRun)result).Delta); + /// abortCriterion: result => true/false + /// </code> + /// </summary> + public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, + Func<object, double> criterion, Func<object, int, bool> abortCriterion) where T : SIBase<T> + { + var iterationCount = 0; + return Search(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount); + } + + /// <summary> + /// Applies a numerical search over the evaluateFunction until the criterion reaches approximately 0. + /// <code> + /// SearchAlgorithm.Search(firstAcceleration, firstDelta, secondAccelerationInterval, + /// getYValue: result => ((ResponseDryRun)result).Delta, + /// evaluateFunction: x => NextComponent.Request(absTime, dt, x, gradient, true), + /// criterion: result => ((ResponseDryRun)result).Delta); + /// abortCriterion: result => true/false + /// </code> + /// </summary> + public static T Search<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, + Func<object, double> criterion, Func<object, int, bool> abortCriterion, ref int iterationCount) where T : SIBase<T> + { + T result; + try { + result = InterpolateSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, + ref iterationCount); + } catch (VectoException ex) { + var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); + log.Debug("Falling back to LineSearch. InterpolationSearch failed: " + ex.Message); + result = LineSearch(x, y, interval, getYValue, evaluateFunction, criterion, abortCriterion, ref iterationCount); + } + return result; + } + + /// <summary> + /// Line Search Algorithm. + /// Phase 1: Linear Bracketing: Search iterative for the area of interest (with fixed step size). + /// Phase 2: Binary Sectioning: Binary search in the area of interest. + /// </summary> + private static T LineSearch<T>(T x, SI y, T interval, Func<object, SI> getYValue, Func<T, object> evaluateFunction, + Func<object, double> criterion, Func<object, int, bool> abortCriterion, ref int iterationCount) where T : SIBase<T> + { + var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); + + var intervalFactor = 1.0; + var origY = y; + var debug = new DebugData(); + debug.Add(new { x = x.Value(), y = y.Value() }); + log.Debug("Log Disabled during LineSearch."); + LogManager.DisableLogging(); + try { + for (var count = 1; count < 100; count++, iterationCount++) { + if (origY.Sign() != y.Sign()) { + intervalFactor = 0.5; + } + + interval *= intervalFactor; + x += interval * -y.Sign(); + var result = evaluateFunction(x); + y = getYValue(result); + debug.Add(new { x = x.Value(), y = y.Value(), delta = criterion(result), result }); + if (criterion(result).IsEqual(0, Constants.SimulationSettings.LineSearchTolerance / 2)) { + LogManager.EnableLogging(); + log.Debug("LineSearch found an operating point after {0} function calls.", count); + //iterationCount += count; + LogManager.DisableLogging(); + AppendDebug(debug); + return x; + } + if (abortCriterion != null && abortCriterion(result, iterationCount)) { + LogManager.EnableLogging(); + log.Debug("LineSearch aborted due to abortCriterion: {0}", result); + LogManager.DisableLogging(); + throw new VectoSearchAbortedException("LineSearch"); + } + } + } finally { + LogManager.EnableLogging(); + } + + //iterationCount += 100; + log.Debug("LineSearch could not find an operating point."); + log.Error("Exceeded max iterations when searching for operating point!"); + log.Error("debug: {0}", debug); + + WriteSearch(debug, "LineSearch.csv"); + throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); + } + + [Conditional("TRACE")] + private static void AppendDebug(DebugData debug) + { + var xmin = debug.Data.Min(d => d.x); + var xmax = debug.Data.Max(d => d.x); + var ymin = debug.Data.Min(d => d.y); + var ymax = debug.Data.Max(d => d.y); + + var rand = new Random().Next(); + using ( + var f = + new StreamWriter(File.Open("LineSearch-" + Thread.CurrentThread.ManagedThreadId + "-statistics.csv", + FileMode.Append))) { + foreach (var d in debug.Data) { + f.WriteLine(string.Format("{0}, {1}, {2}, {3}, {4}, {5}, {6}", + rand, + (d.x - xmin) / (xmax - xmin), + (d.y - ymin) / (ymax - ymin), + d.x / Math.Max(Math.Abs(xmax), Math.Abs(xmin)), + d.y / Math.Max(Math.Abs(ymax), Math.Abs(ymin)), + d.x, d.y)); + } + } + } + + /// <summary> + /// Interpolating Search algorithm. + /// Calculates linear equation of 2 points and jumps directly to root-point. + /// </summary> + private static T InterpolateSearch<T>(T x1SI, SI y1SI, T intervalSI, Func<object, SI> getYValue, + Func<T, object> evaluateFunction, Func<object, double> criterion, Func<object, int, bool> abortCriterion, + ref int iterationCount) where T : SIBase<T> + { + var x1 = x1SI.Value(); + var interval = intervalSI.Value(); + var y1 = y1SI.Value(); + + var log = LogManager.GetLogger(typeof(SearchAlgorithm).FullName); + var debug = new DebugData(); + debug.Add(new { x = x1, y = y1 }); + log.Debug("Log Disabled during InterpolateSearch."); + LogManager.DisableLogging(); + + try { + var x2 = x1 + interval; + var result = evaluateFunction(x2.SI<T>()); + if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) { + LogManager.EnableLogging(); + log.Debug("InterpolateSearch found an operating point after 1 function call."); + AppendDebug(debug); + LogManager.DisableLogging(); + iterationCount++; + return x2.SI<T>(); + } + + for (var count = 2; count < 30; count++, iterationCount++) { + var y2 = getYValue(result).Value(); + debug.Add(new { x = x2, y = y2, delta = criterion(result), result }); + + var k = (y2 - y1) / (x2 - x1); + var d = y2 - k * x2; + x1 = x2; + x2 = -d / k; + if (double.IsInfinity(x2) || double.IsNaN(x2)) { + debug.Add(new { x = x2, y = getYValue(result).Value(), delta = criterion(result), result }); + LogManager.EnableLogging(); + log.Debug("InterpolateSearch could not get more exact. Aborting after {0} function calls.", count); + LogManager.DisableLogging(); + AppendDebug(debug); + //iterationCount += count; + + //return x1.SI<T>(); + throw new VectoSearchAbortedException("InterpolateLinearSearch"); + } + + result = evaluateFunction(x2.SI<T>()); + if (criterion(result).IsEqual(0, Constants.SimulationSettings.InterpolateSearchTolerance)) { + debug.Add(new { x = x2, y = getYValue(result).Value(), delta = criterion(result), result }); + LogManager.EnableLogging(); + log.Debug("InterpolateSearch found an operating point after {0} function calls.", count); + LogManager.DisableLogging(); + AppendDebug(debug); + return x2.SI<T>(); + } + if (abortCriterion != null && abortCriterion(result, iterationCount)) { + LogManager.EnableLogging(); + log.Debug("LineSearch aborted due to abortCriterion: {0}", result); + LogManager.DisableLogging(); + throw new VectoSearchAbortedException("InterpolateLinearSearch"); + } + y1 = y2; + } + } finally { + LogManager.EnableLogging(); + } + + log.Debug("InterpolateSearch could not find an operating point."); +#if DEBUG + log.Error("InterpolateSearch exceeded max iterations when searching for operating point!"); + log.Error("debug: {0}", debug); +#endif + WriteSearch(debug, "InterpolateSearch.csv"); + throw new VectoSearchFailedException("Failed to find operating point! points: {0}", debug); + } + + [Conditional("TRACE")] + private static void WriteSearch(DebugData debug, string filename) + { + var table = new DataTable(); + table.Columns.Add("x", typeof(double)); + table.Columns.Add("y", typeof(double)); + table.Columns.Add("delta", typeof(double)); + table.Columns.Add("AuxPower", typeof(double)); + table.Columns.Add("engineSpeed", typeof(double)); + table.Columns.Add("enginePower", typeof(double)); + + foreach (var entry in debug.Data.Skip(1)) { + var response = entry.result as ResponseDryRun; + if (response == null) { + continue; + } + var row = table.NewRow(); + row["x"] = entry.x.Value(); + row["y"] = entry.y.Value(); + row["delta"] = entry.delta; + row["AuxPower"] = response.AuxiliariesPowerDemand == null ? -1 : response.AuxiliariesPowerDemand.Value(); + row["engineSpeed"] = response.EngineSpeed == null ? -1 : response.EngineSpeed.Value(); + row["enginePower"] = response.EnginePowerRequest == null ? -1 : response.EnginePowerRequest.Value(); + + table.Rows.Add(row); + } + VectoCSVFile.Write(filename, table); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Utils/SwitchExtension.cs b/VectoCore/VectoCore/Utils/SwitchExtension.cs index 9d8be316dd109043e185ff0bf7de825b9484580b..d4582b9456c7da2811271496d879c25ae67f7871 100644 --- a/VectoCore/VectoCore/Utils/SwitchExtension.cs +++ b/VectoCore/VectoCore/Utils/SwitchExtension.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Diagnostics; diff --git a/VectoCore/VectoCore/Utils/VectoCSVFile.cs b/VectoCore/VectoCore/Utils/VectoCSVFile.cs index ac9d2bedf28120c57923c91ac20ab20bb6294098..f7c9b8274338b8dc89fb258dcf034756e476cfc1 100644 --- a/VectoCore/VectoCore/Utils/VectoCSVFile.cs +++ b/VectoCore/VectoCore/Utils/VectoCSVFile.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualBasic.FileIO; using System; using System.Data; diff --git a/VectoCore/VectoCore/Utils/XPathHelper.cs b/VectoCore/VectoCore/Utils/XPathHelper.cs index 1db87fd3a39f9db1321a8d18f95f621853393f83..a84f809d40b22964b35a9aad847969e3c370e6eb 100644 --- a/VectoCore/VectoCore/Utils/XPathHelper.cs +++ b/VectoCore/VectoCore/Utils/XPathHelper.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using System.Xml; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCore/Utils/XmlResourceResolver.cs b/VectoCore/VectoCore/Utils/XmlResourceResolver.cs index f6dc90bc7060c70e80e93fac73963e172420dc9a..a045a73c78d216d0dccbdd31efac7146745c2657 100644 --- a/VectoCore/VectoCore/Utils/XmlResourceResolver.cs +++ b/VectoCore/VectoCore/Utils/XmlResourceResolver.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using System.Xml; diff --git a/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs b/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs index 8d41f094b662da891c1ab8738950fc51a7dad529..7255209338c43f2cd066f45d750ae0e151ce406b 100644 --- a/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs +++ b/VectoCore/VectoCoreTest/Dummy/EngineFLDTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Diagnostics; using System.IO; diff --git a/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs b/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs index 037c1972adbffcb04f414e3e1264a35586a979ea..a5996cb9c45ce3c60f309677ef5a4cf0a61e1a53 100644 --- a/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs +++ b/VectoCore/VectoCoreTest/Exceptions/ExceptionTests.cs @@ -1,61 +1,61 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Exceptions; - -// ReSharper disable ObjectCreationAsStatement - -namespace TUGraz.VectoCore.Tests.Exceptions -{ - [TestClass] - public class ExceptionTests - { - [TestMethod] - public void Test_VectoExceptions() - { - new CSVReadException("Test"); - new CSVReadException("Test", new Exception("Inner")); - new InvalidFileFormatException("Test"); - new CSVReadException("Test", new Exception("Inner")); - new UnsupportedFileVersionException("Test"); - new UnsupportedFileVersionException("Test", new Exception("Inner")); - new InvalidFileFormatException("Test"); - new InvalidFileFormatException("Test", new Exception("Inner")); - new VectoException("Test"); - new VectoException("Test", new Exception("Inner")); - - new VectoSimulationException("Test"); - new VectoSimulationException("Test", new Exception("Inner")); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Exceptions; + +// ReSharper disable ObjectCreationAsStatement + +namespace TUGraz.VectoCore.Tests.Exceptions +{ + [TestClass] + public class ExceptionTests + { + [TestMethod] + public void Test_VectoExceptions() + { + new CSVReadException("Test"); + new CSVReadException("Test", new Exception("Inner")); + new InvalidFileFormatException("Test"); + new CSVReadException("Test", new Exception("Inner")); + new UnsupportedFileVersionException("Test"); + new UnsupportedFileVersionException("Test", new Exception("Inner")); + new InvalidFileFormatException("Test"); + new InvalidFileFormatException("Test", new Exception("Inner")); + new VectoException("Test"); + new VectoException("Test", new Exception("Inner")); + + new VectoSimulationException("Test"); + new VectoSimulationException("Test", new Exception("Inner")); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/FileIO/JsonTest.cs b/VectoCore/VectoCoreTest/FileIO/JsonTest.cs index 83813343c9baf36d1e991ef8b27bd08fd8d1ffe2..25bd9dda532352fcec1dd26b0776a82f9fb0d67c 100644 --- a/VectoCore/VectoCoreTest/FileIO/JsonTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/JsonTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs b/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs index 1a36cd2d9467cede9f580508a1d195601e325661..58b6bb1a7441e26a75dcb3278aa4f9e72965eba7 100644 --- a/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/SimulationDataReaderTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using System.IO; using System.Linq; diff --git a/VectoCore/VectoCoreTest/FileIO/VectoCSVFileTest.cs b/VectoCore/VectoCoreTest/FileIO/VectoCSVFileTest.cs index c23c4e77f87dbe127d5cba55541815814737c37e..a9e53ba4f8c28cb2b37c7ee3e041b04b4ad076a5 100644 --- a/VectoCore/VectoCoreTest/FileIO/VectoCSVFileTest.cs +++ b/VectoCore/VectoCoreTest/FileIO/VectoCSVFileTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Data; using System.IO; using System.Linq; diff --git a/VectoCore/VectoCoreTest/GraphProgram.cs b/VectoCore/VectoCoreTest/GraphProgram.cs index 238b3eb3baa97ab703c0481eab1aaa3b4bc745cf..eed0a2d54a58e29665d4e20c00d86e065b95d636 100644 --- a/VectoCore/VectoCoreTest/GraphProgram.cs +++ b/VectoCore/VectoCoreTest/GraphProgram.cs @@ -1,38 +1,38 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -namespace TUGraz.VectoCore.Tests -{ - public class GraphProgram - { - - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +namespace TUGraz.VectoCore.Tests +{ + public class GraphProgram + { + + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs index c7299426edf3156ebd3345f92ec378a9e72c0e28..c2d47be8df92f088be214388ff5ff26e58528bfe 100644 --- a/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/ATPowerTrain.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AAuxTests.cs b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AAuxTests.cs index 62875b004dce482f2ad03969a75d8fe3893b3d02..1f6e36d899598d955bf56f0a411c46702315339c 100644 --- a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AAuxTests.cs +++ b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AAuxTests.cs @@ -1,302 +1,302 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries -{ - [TestFixture] - public class DriverStrategyTestCoachAux - { - [TestFixtureSetUp] - public void Init() - { - //LogManager.DisableLogging(); -#if TRACE - GraphWriter.Enable(); -#else - GraphWriter.Disable(); -#endif - GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; - - GraphWriter.Yfields = new[] { - ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, - ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap - }; - GraphWriter.Series1Label = "Vecto 3"; - GraphWriter.Series2Label = "Vecto 2.0_aux"; - } - - private static string GetSlopeString(double slope) - { - var slopeStr = slope > 0 - ? Math.Abs(slope).ToString("uphill_#") - : slope < 0 - ? Math.Abs(slope).ToString("downhill_#") - : "level"; - return slopeStr; - } - - [Category("ComparisonAAUX"), - TestCase(0, 20, -5), TestCase(0, 20, 0), - TestCase(0, 40, 25), TestCase(0, 40, 20), TestCase(0, 40, 15), - TestCase(0, 40, 10), TestCase(0, 40, 5), TestCase(0, 40, 1), - TestCase(0, 40, 0), TestCase(0, 40, -3), - TestCase(0, 40, -1), TestCase(0, 40, -5), TestCase(0, 40, -10), - TestCase(0, 40, -15), TestCase(0, 40, -20), TestCase(0, 40, -25), - TestCase(0, 60, 25), TestCase(0, 60, 20), TestCase(0, 60, 15), - TestCase(0, 60, 10), TestCase(0, 60, 5), TestCase(0, 60, 1), - TestCase(0, 60, 0), TestCase(0, 60, -3), - TestCase(0, 60, -1), TestCase(0, 60, -5), TestCase(0, 60, -10), - TestCase(0, 60, -15), TestCase(0, 60, -20), TestCase(0, 60, -25), - TestCase(0, 85, 25), TestCase(0, 85, 20), TestCase(0, 85, 15), - TestCase(0, 85, 10), TestCase(0, 85, 5), TestCase(0, 85, 1), - TestCase(0, 85, 0), TestCase(0, 85, -3), TestCase(0, 85, 2), - TestCase(0, 85, -1), TestCase(0, 85, -5), TestCase(0, 85, -10), - TestCase(0, 85, -15), TestCase(0, 85, -20), TestCase(0, 85, -25), - TestCase(20, 40, 25), TestCase(20, 40, 20), TestCase(20, 40, 15), - TestCase(20, 40, 10), TestCase(20, 40, 5), TestCase(20, 40, 1), - TestCase(20, 40, 0), - TestCase(20, 40, -1), TestCase(20, 40, -5), TestCase(20, 40, -10), - TestCase(20, 40, -15), TestCase(20, 40, -20), TestCase(20, 40, -25), - TestCase(20, 60, 25), TestCase(20, 60, 20), TestCase(20, 60, 15), - TestCase(20, 60, 10), TestCase(20, 60, 5), TestCase(20, 60, 1), - TestCase(20, 60, 0), - TestCase(20, 60, -1), TestCase(20, 60, -5), TestCase(20, 60, -10), - TestCase(20, 60, -15), TestCase(20, 60, -20), TestCase(20, 60, -25), - TestCase(20, 85, 25), TestCase(20, 85, 20), TestCase(20, 85, 15), - TestCase(20, 85, 10), TestCase(20, 85, 5), TestCase(20, 85, 1), - TestCase(20, 85, 0), - TestCase(20, 85, -1), TestCase(20, 85, -5), TestCase(20, 85, -10), - TestCase(20, 85, -15), TestCase(20, 85, -20), TestCase(20, 85, -25), - TestCase(20, 22, 5), - ] - public void Coach_Accelerate_AAux(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = GetSlopeString(slope); - var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - Coach_BusAuxiliaries(cycle, modFileName, - string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Accelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr)); - } - - [Category("ComparisonAAUX"), - TestCase(40, 0, 20), TestCase(40, 0, 15), - TestCase(40, 0, 10), TestCase(40, 0, 5), TestCase(40, 0, 1), - TestCase(40, 0, 0), - TestCase(40, 0, -1), TestCase(40, 0, -5), TestCase(40, 0, -10), - TestCase(40, 0, -15), TestCase(40, 0, -20), TestCase(40, 0, -25), - TestCase(60, 0, 20), TestCase(60, 0, 15), - TestCase(60, 0, 10), TestCase(60, 0, 5), TestCase(60, 0, 1), - TestCase(60, 0, 0), - TestCase(60, 0, -1), TestCase(60, 0, -5), TestCase(60, 0, -10), - TestCase(60, 0, -15), TestCase(60, 0, -20), TestCase(60, 0, -25), - TestCase(85, 0, 25), TestCase(85, 0, 20), TestCase(85, 0, 15), - TestCase(85, 0, 10), TestCase(85, 0, 5), TestCase(85, 0, 1), - TestCase(85, 0, 0), - TestCase(85, 0, -1), TestCase(85, 0, -5), TestCase(85, 0, -10), - TestCase(85, 0, -15), TestCase(85, 0, -20), TestCase(85, 0, -25), - TestCase(80, 0, 3), TestCase(80, 0, 5), TestCase(80, 0, 15), - TestCase(22, 20, -5), - ] - public void Coach_Decelerate_AAux(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = GetSlopeString(slope); - var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - Coach_BusAuxiliaries(cycle, modFileName, - string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Decelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr)); - } - - [Category("ComparisonAAUX"), - TestCase(40, 0, 25), - TestCase(60, 0, 25), - TestCase(80, 0, 25)] - public void Coach_Decelerate_AAux_Low(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = GetSlopeString(slope); - var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - Coach_BusAuxiliaries(cycle, modFileName, - string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Decelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr), - false); - } - - [Category("ComparisonAAUX"), - TestCase(10, 10, 20), TestCase(10, 10, 15), - TestCase(10, 10, 10), TestCase(10, 10, 5), TestCase(10, 10, 1), - TestCase(10, 10, 0), - TestCase(10, 10, -1), TestCase(10, 10, -5), TestCase(10, 10, -10), - TestCase(10, 10, -15), TestCase(10, 10, -20), TestCase(10, 10, -25), - TestCase(20, 20, 25), TestCase(20, 20, 20), TestCase(20, 20, 15), - TestCase(20, 20, 10), TestCase(20, 20, 5), TestCase(20, 20, 1), - TestCase(20, 20, 0), - TestCase(20, 20, -1), TestCase(20, 20, -5), TestCase(20, 20, -10), - TestCase(20, 20, -15), TestCase(20, 20, -20), TestCase(20, 20, -25), - TestCase(30, 30, 25), TestCase(30, 30, 20), TestCase(30, 30, 15), - TestCase(30, 30, 10), TestCase(30, 30, 5), TestCase(30, 30, 1), - TestCase(30, 30, 0), - TestCase(30, 30, -1), TestCase(30, 30, -5), TestCase(30, 30, -10), - TestCase(30, 30, -15), TestCase(30, 30, -20), TestCase(30, 30, -25), - TestCase(40, 40, 20), TestCase(40, 40, 15), - TestCase(40, 40, 10), TestCase(40, 40, 5), TestCase(40, 40, 1), - TestCase(40, 40, 0), - TestCase(40, 40, -1), TestCase(40, 40, -5), TestCase(40, 40, -10), - TestCase(40, 40, -15), TestCase(40, 40, -20), TestCase(40, 40, -25), - TestCase(50, 50, 25), TestCase(50, 50, 20), TestCase(50, 50, 15), - TestCase(50, 50, 10), TestCase(50, 50, 5), TestCase(50, 50, 1), - TestCase(50, 50, 0), - TestCase(50, 50, -1), TestCase(50, 50, -5), TestCase(50, 50, -10), - TestCase(50, 50, -15), TestCase(50, 50, -20), TestCase(50, 50, -25), - TestCase(60, 60, 20), TestCase(60, 60, 15), - TestCase(60, 60, 10), TestCase(60, 60, 5), TestCase(60, 60, 1), - TestCase(60, 60, 0), - TestCase(60, 60, -1), TestCase(60, 60, -5), TestCase(60, 60, -10), - TestCase(60, 60, -15), TestCase(60, 60, -20), TestCase(60, 60, -25), - TestCase(80, 80, 20), TestCase(80, 80, 15), - TestCase(80, 80, 10), TestCase(80, 80, 5), TestCase(80, 80, 1), - TestCase(80, 80, 0), - TestCase(80, 80, -1), TestCase(80, 80, -5), TestCase(80, 80, -10), - TestCase(80, 80, -15), TestCase(80, 80, -20), TestCase(80, 80, -25), - TestCase(85, 85, 25), TestCase(85, 85, 20), TestCase(85, 85, 15), - TestCase(85, 85, 10), TestCase(85, 85, 5), TestCase(85, 85, 1), - TestCase(85, 85, 0), - TestCase(85, 85, -1), TestCase(85, 85, -5), TestCase(85, 85, -10), - TestCase(85, 85, -15), TestCase(85, 85, -20), TestCase(85, 85, -25), - ] - public void Coach_Drive_AAux(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = GetSlopeString(slope); - var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - Coach_BusAuxiliaries(cycle, modFileName, - string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Drive_{0}_{1}_{2}.vmod", v1, v2, slopeStr)); - } - - [Category("ComparisonAAUX"), - TestCase(10, 10, 25), - TestCase(40, 40, 25), - TestCase(60, 60, 25), - TestCase(80, 80, 25), - ] - public void Coach_Drive_AAux_Low(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = GetSlopeString(slope); - var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - Coach_BusAuxiliaries(cycle, modFileName, - string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Drive_{0}_{1}_{2}.vmod", v1, v2, slopeStr), - false); - } - - [Category("ComparisonAAUX"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, - "Coach_AAux_Drive_80_slope_inc.vmod", "24t Coach_AAux_Cycle_Drive_80_Increasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_80_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, - "Coach_AAux_Drive_50_slope_inc.vmod", "24t Coach_AAux_Cycle_Drive_50_Increasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_50_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, - "Coach_AAux_Drive_30_slope_inc.vmod", "24t Coach_AAux_Cycle_Drive_30_Increasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_30_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, - "Coach_AAux_Drive_80_slope_dec.vmod", "24t Coach_AAux_Cycle_Drive_80_Decreasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_80_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, - "Coach_AAux_Drive_50_slope_dec.vmod", "24t Coach_AAux_Cycle_Drive_50_Decreasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_50_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, - "Coach_AAux_Drive_30_slope_dec.vmod", "24t Coach_AAux_Cycle_Drive_30_Decreasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_30_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, - "Coach_AAux_Drive_80_slope_dec-inc.vmod", "24t Coach_AAux_Cycle_Drive_80_Dec_Increasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_80_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, - "Coach_AAux_Drive_50_slope_dec-inc.vmod", "24t Coach_AAux_Cycle_Drive_50_Dec_Increasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_50_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, - "Coach_AAux_Drive_30_slope_dec-inc.vmod", "24t Coach_AAux_Cycle_Drive_30_Dec_Increasing_Slope.vmod", - TestName = "CoachBusAux CycleDrive_30_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, - "Coach_AAux_DecelerateWhileBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_DecelerateWhileBrake_80_0_level.vmod", - TestName = "CoachBusAux CycleDecelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, - "Coach_AAux_AccelerateWhileBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_AccelerateWhileBrake_80_0_level.vmod", - TestName = "CoachBusAux CycleAccelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, - "Coach_AAux_AccelerateAtBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_AccelerateAtBrake_80_0_level.vmod", - TestName = "CoachBusAux CycleAccelerateAtBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, - "Coach_AAux_AccelerateBeforeBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_AccelerateBeforeBrake_80_0_level.vmod", - TestName = "CoachBusAux CycleAccelerateBeforeBrake_80_0_level" - ), - TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, - "Coach_AAux_Drive_stop_85_stop_85_level.vmod", "24t Coach_AAux_Cycle_Drive_stop_85_stop_85_level.vmod", - TestName = "CoachBusAux CycleDrive_stop_85_stop_85_level"), - ] - public void Coach_AAux_Special(string cycleData, string modFileName, string compareFileName) - { - Coach_BusAuxiliaries(cycleData, modFileName, compareFileName); - } - - private void Coach_BusAuxiliaries(string cycleData, string modFileName, string compareFileName, - bool highEnginePower = true) - { - var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); - var run = CoachAdvancedAuxPowertrain.CreateEngineeringRun(cycle, modFileName, highEnginePower: highEnginePower); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFileName, @"..\..\TestData\Integration\BusAuxiliaries\Vecto2.0\" + compareFileName); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries +{ + [TestFixture] + public class DriverStrategyTestCoachAux + { + [TestFixtureSetUp] + public void Init() + { + //LogManager.DisableLogging(); +#if TRACE + GraphWriter.Enable(); +#else + GraphWriter.Disable(); +#endif + GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; + + GraphWriter.Yfields = new[] { + ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, + ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap + }; + GraphWriter.Series1Label = "Vecto 3"; + GraphWriter.Series2Label = "Vecto 2.0_aux"; + } + + private static string GetSlopeString(double slope) + { + var slopeStr = slope > 0 + ? Math.Abs(slope).ToString("uphill_#") + : slope < 0 + ? Math.Abs(slope).ToString("downhill_#") + : "level"; + return slopeStr; + } + + [Category("ComparisonAAUX"), + TestCase(0, 20, -5), TestCase(0, 20, 0), + TestCase(0, 40, 25), TestCase(0, 40, 20), TestCase(0, 40, 15), + TestCase(0, 40, 10), TestCase(0, 40, 5), TestCase(0, 40, 1), + TestCase(0, 40, 0), TestCase(0, 40, -3), + TestCase(0, 40, -1), TestCase(0, 40, -5), TestCase(0, 40, -10), + TestCase(0, 40, -15), TestCase(0, 40, -20), TestCase(0, 40, -25), + TestCase(0, 60, 25), TestCase(0, 60, 20), TestCase(0, 60, 15), + TestCase(0, 60, 10), TestCase(0, 60, 5), TestCase(0, 60, 1), + TestCase(0, 60, 0), TestCase(0, 60, -3), + TestCase(0, 60, -1), TestCase(0, 60, -5), TestCase(0, 60, -10), + TestCase(0, 60, -15), TestCase(0, 60, -20), TestCase(0, 60, -25), + TestCase(0, 85, 25), TestCase(0, 85, 20), TestCase(0, 85, 15), + TestCase(0, 85, 10), TestCase(0, 85, 5), TestCase(0, 85, 1), + TestCase(0, 85, 0), TestCase(0, 85, -3), TestCase(0, 85, 2), + TestCase(0, 85, -1), TestCase(0, 85, -5), TestCase(0, 85, -10), + TestCase(0, 85, -15), TestCase(0, 85, -20), TestCase(0, 85, -25), + TestCase(20, 40, 25), TestCase(20, 40, 20), TestCase(20, 40, 15), + TestCase(20, 40, 10), TestCase(20, 40, 5), TestCase(20, 40, 1), + TestCase(20, 40, 0), + TestCase(20, 40, -1), TestCase(20, 40, -5), TestCase(20, 40, -10), + TestCase(20, 40, -15), TestCase(20, 40, -20), TestCase(20, 40, -25), + TestCase(20, 60, 25), TestCase(20, 60, 20), TestCase(20, 60, 15), + TestCase(20, 60, 10), TestCase(20, 60, 5), TestCase(20, 60, 1), + TestCase(20, 60, 0), + TestCase(20, 60, -1), TestCase(20, 60, -5), TestCase(20, 60, -10), + TestCase(20, 60, -15), TestCase(20, 60, -20), TestCase(20, 60, -25), + TestCase(20, 85, 25), TestCase(20, 85, 20), TestCase(20, 85, 15), + TestCase(20, 85, 10), TestCase(20, 85, 5), TestCase(20, 85, 1), + TestCase(20, 85, 0), + TestCase(20, 85, -1), TestCase(20, 85, -5), TestCase(20, 85, -10), + TestCase(20, 85, -15), TestCase(20, 85, -20), TestCase(20, 85, -25), + TestCase(20, 22, 5), + ] + public void Coach_Accelerate_AAux(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = GetSlopeString(slope); + var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + Coach_BusAuxiliaries(cycle, modFileName, + string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Accelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr)); + } + + [Category("ComparisonAAUX"), + TestCase(40, 0, 20), TestCase(40, 0, 15), + TestCase(40, 0, 10), TestCase(40, 0, 5), TestCase(40, 0, 1), + TestCase(40, 0, 0), + TestCase(40, 0, -1), TestCase(40, 0, -5), TestCase(40, 0, -10), + TestCase(40, 0, -15), TestCase(40, 0, -20), TestCase(40, 0, -25), + TestCase(60, 0, 20), TestCase(60, 0, 15), + TestCase(60, 0, 10), TestCase(60, 0, 5), TestCase(60, 0, 1), + TestCase(60, 0, 0), + TestCase(60, 0, -1), TestCase(60, 0, -5), TestCase(60, 0, -10), + TestCase(60, 0, -15), TestCase(60, 0, -20), TestCase(60, 0, -25), + TestCase(85, 0, 25), TestCase(85, 0, 20), TestCase(85, 0, 15), + TestCase(85, 0, 10), TestCase(85, 0, 5), TestCase(85, 0, 1), + TestCase(85, 0, 0), + TestCase(85, 0, -1), TestCase(85, 0, -5), TestCase(85, 0, -10), + TestCase(85, 0, -15), TestCase(85, 0, -20), TestCase(85, 0, -25), + TestCase(80, 0, 3), TestCase(80, 0, 5), TestCase(80, 0, 15), + TestCase(22, 20, -5), + ] + public void Coach_Decelerate_AAux(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = GetSlopeString(slope); + var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + Coach_BusAuxiliaries(cycle, modFileName, + string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Decelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr)); + } + + [Category("ComparisonAAUX"), + TestCase(40, 0, 25), + TestCase(60, 0, 25), + TestCase(80, 0, 25)] + public void Coach_Decelerate_AAux_Low(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = GetSlopeString(slope); + var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + Coach_BusAuxiliaries(cycle, modFileName, + string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Decelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr), + false); + } + + [Category("ComparisonAAUX"), + TestCase(10, 10, 20), TestCase(10, 10, 15), + TestCase(10, 10, 10), TestCase(10, 10, 5), TestCase(10, 10, 1), + TestCase(10, 10, 0), + TestCase(10, 10, -1), TestCase(10, 10, -5), TestCase(10, 10, -10), + TestCase(10, 10, -15), TestCase(10, 10, -20), TestCase(10, 10, -25), + TestCase(20, 20, 25), TestCase(20, 20, 20), TestCase(20, 20, 15), + TestCase(20, 20, 10), TestCase(20, 20, 5), TestCase(20, 20, 1), + TestCase(20, 20, 0), + TestCase(20, 20, -1), TestCase(20, 20, -5), TestCase(20, 20, -10), + TestCase(20, 20, -15), TestCase(20, 20, -20), TestCase(20, 20, -25), + TestCase(30, 30, 25), TestCase(30, 30, 20), TestCase(30, 30, 15), + TestCase(30, 30, 10), TestCase(30, 30, 5), TestCase(30, 30, 1), + TestCase(30, 30, 0), + TestCase(30, 30, -1), TestCase(30, 30, -5), TestCase(30, 30, -10), + TestCase(30, 30, -15), TestCase(30, 30, -20), TestCase(30, 30, -25), + TestCase(40, 40, 20), TestCase(40, 40, 15), + TestCase(40, 40, 10), TestCase(40, 40, 5), TestCase(40, 40, 1), + TestCase(40, 40, 0), + TestCase(40, 40, -1), TestCase(40, 40, -5), TestCase(40, 40, -10), + TestCase(40, 40, -15), TestCase(40, 40, -20), TestCase(40, 40, -25), + TestCase(50, 50, 25), TestCase(50, 50, 20), TestCase(50, 50, 15), + TestCase(50, 50, 10), TestCase(50, 50, 5), TestCase(50, 50, 1), + TestCase(50, 50, 0), + TestCase(50, 50, -1), TestCase(50, 50, -5), TestCase(50, 50, -10), + TestCase(50, 50, -15), TestCase(50, 50, -20), TestCase(50, 50, -25), + TestCase(60, 60, 20), TestCase(60, 60, 15), + TestCase(60, 60, 10), TestCase(60, 60, 5), TestCase(60, 60, 1), + TestCase(60, 60, 0), + TestCase(60, 60, -1), TestCase(60, 60, -5), TestCase(60, 60, -10), + TestCase(60, 60, -15), TestCase(60, 60, -20), TestCase(60, 60, -25), + TestCase(80, 80, 20), TestCase(80, 80, 15), + TestCase(80, 80, 10), TestCase(80, 80, 5), TestCase(80, 80, 1), + TestCase(80, 80, 0), + TestCase(80, 80, -1), TestCase(80, 80, -5), TestCase(80, 80, -10), + TestCase(80, 80, -15), TestCase(80, 80, -20), TestCase(80, 80, -25), + TestCase(85, 85, 25), TestCase(85, 85, 20), TestCase(85, 85, 15), + TestCase(85, 85, 10), TestCase(85, 85, 5), TestCase(85, 85, 1), + TestCase(85, 85, 0), + TestCase(85, 85, -1), TestCase(85, 85, -5), TestCase(85, 85, -10), + TestCase(85, 85, -15), TestCase(85, 85, -20), TestCase(85, 85, -25), + ] + public void Coach_Drive_AAux(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = GetSlopeString(slope); + var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + Coach_BusAuxiliaries(cycle, modFileName, + string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Drive_{0}_{1}_{2}.vmod", v1, v2, slopeStr)); + } + + [Category("ComparisonAAUX"), + TestCase(10, 10, 25), + TestCase(40, 40, 25), + TestCase(60, 60, 25), + TestCase(80, 80, 25), + ] + public void Coach_Drive_AAux_Low(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = GetSlopeString(slope); + var modFileName = string.Format(CultureInfo.InvariantCulture, @"CoachAAUX_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + Coach_BusAuxiliaries(cycle, modFileName, + string.Format(CultureInfo.InvariantCulture, "24t Coach_AAux_Cycle_Drive_{0}_{1}_{2}.vmod", v1, v2, slopeStr), + false); + } + + [Category("ComparisonAAUX"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, + "Coach_AAux_Drive_80_slope_inc.vmod", "24t Coach_AAux_Cycle_Drive_80_Increasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_80_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, + "Coach_AAux_Drive_50_slope_inc.vmod", "24t Coach_AAux_Cycle_Drive_50_Increasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_50_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, + "Coach_AAux_Drive_30_slope_inc.vmod", "24t Coach_AAux_Cycle_Drive_30_Increasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_30_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, + "Coach_AAux_Drive_80_slope_dec.vmod", "24t Coach_AAux_Cycle_Drive_80_Decreasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_80_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, + "Coach_AAux_Drive_50_slope_dec.vmod", "24t Coach_AAux_Cycle_Drive_50_Decreasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_50_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, + "Coach_AAux_Drive_30_slope_dec.vmod", "24t Coach_AAux_Cycle_Drive_30_Decreasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_30_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, + "Coach_AAux_Drive_80_slope_dec-inc.vmod", "24t Coach_AAux_Cycle_Drive_80_Dec_Increasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_80_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, + "Coach_AAux_Drive_50_slope_dec-inc.vmod", "24t Coach_AAux_Cycle_Drive_50_Dec_Increasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_50_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, + "Coach_AAux_Drive_30_slope_dec-inc.vmod", "24t Coach_AAux_Cycle_Drive_30_Dec_Increasing_Slope.vmod", + TestName = "CoachBusAux CycleDrive_30_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, + "Coach_AAux_DecelerateWhileBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_DecelerateWhileBrake_80_0_level.vmod", + TestName = "CoachBusAux CycleDecelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, + "Coach_AAux_AccelerateWhileBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_AccelerateWhileBrake_80_0_level.vmod", + TestName = "CoachBusAux CycleAccelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, + "Coach_AAux_AccelerateAtBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_AccelerateAtBrake_80_0_level.vmod", + TestName = "CoachBusAux CycleAccelerateAtBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, + "Coach_AAux_AccelerateBeforeBrake_80_0_level.vmod", "24t Coach_AAux_Cycle_AccelerateBeforeBrake_80_0_level.vmod", + TestName = "CoachBusAux CycleAccelerateBeforeBrake_80_0_level" + ), + TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, + "Coach_AAux_Drive_stop_85_stop_85_level.vmod", "24t Coach_AAux_Cycle_Drive_stop_85_stop_85_level.vmod", + TestName = "CoachBusAux CycleDrive_stop_85_stop_85_level"), + ] + public void Coach_AAux_Special(string cycleData, string modFileName, string compareFileName) + { + Coach_BusAuxiliaries(cycleData, modFileName, compareFileName); + } + + private void Coach_BusAuxiliaries(string cycleData, string modFileName, string compareFileName, + bool highEnginePower = true) + { + var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); + var run = CoachAdvancedAuxPowertrain.CreateEngineeringRun(cycle, modFileName, highEnginePower: highEnginePower); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFileName, @"..\..\TestData\Integration\BusAuxiliaries\Vecto2.0\" + compareFileName); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs index 9c18eb85f09fb3b1e2dcaa55d6076af76ad654c9..af5f1461361079a9bc557f04da855a25131ea474 100644 --- a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs +++ b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/AuxDemandTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using NUnit.Framework; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs index 14e434a22f90395d6bbae951056d6eea70c7b4d4..12ccde3babfbb096441ccb5e501eae223a727cdc 100644 --- a/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs +++ b/VectoCore/VectoCoreTest/Integration/BusAuxiliaries/BusAdapterTest.cs @@ -1,172 +1,172 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Data; -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Tests.Utils; -using TUGraz.VectoCore.Utils; -using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; - -namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries -{ - [TestFixture] - public class BusAdapterTest - { - [Test] - [TestCase(12000, 1256, 148, 148, 6086.9321)] - [TestCase(12000, 1256, -48, -148, 6086.9321)] - [TestCase(12000, 1256, 48, -148, 6086.9321)] - [TestCase(12000, 800, 148, 148, 6377.0923)] - [TestCase(12000, 800, -48, -148, 6377.0923)] - [TestCase(12000, 800, 48, -148, 6377.0923)] - public void TestNoSmartAuxDuringDrive(double vehicleWeight, double engineSpeedRpm, double driveLinePower, - double internalPower, double expectedPowerDemand) - { - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); - - driver.DriverBehavior = DrivingBehavior.Driving; - - var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); - var engineSpeed = engineSpeedRpm.RPMtoRad(); - busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); - - var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, - (internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed); - - Assert.AreEqual(expectedPowerDemand, (torque * engineSpeed).Value(), 1e-2); - } - - [Test] - [TestCase(12000, 1256, 148, 148, 6086.9321)] - [TestCase(12000, 1256, -28, -27, 6086.9321)] - [TestCase(12000, 1256, -28, -29, 6086.9321)] - [TestCase(12000, 1256, -128, -28, 6086.9321)] - [TestCase(12000, 1256, 28, -28, 6086.9321)] - [TestCase(12000, 800, 148, 148, 6377.0923)] - [TestCase(12000, 800, -14, -13, 6377.0923)] - [TestCase(12000, 800, -14, -15, 6377.0923)] - [TestCase(12000, 800, -35, -14, 6377.0923)] - [TestCase(12000, 800, 35, -14, 6377.0923)] - public void TestNoSmartAuxDuringCoasting(double vehicleWeight, double engineSpeedRpm, double driveLinePower, - double internalPower, double expectedPowerDemand) - { - // this test is to make sure that the aux power-demand does not jump between average and smart power demand - // when searching for the operating point for coasting (i.e. power demand (internal Power) is close to the motoring curve, - // intependent of power demand of power train) - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); - - driver.DriverBehavior = DrivingBehavior.Coasting; - - var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); - var engineSpeed = engineSpeedRpm.RPMtoRad(); - busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); - - var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, - (internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed); - - Assert.AreEqual(expectedPowerDemand, (torque * engineSpeed).Value(), 1e-2); - } - - [Test] - [TestCase(12000, 1256, -48, -148, 8954.1396)] - [TestCase(12000, 1256, 48, -148, 8954.1396)] - [TestCase(12000, 800, -48, -148, 8281.5088)] - [TestCase(12000, 800, 48, -148, 8281.5088)] - public void TestSmartAuxDuringBrake(double vehicleWeight, double engineSpeedRpm, double driveLinePower, - double internalPower, double expectedPowerDemand) - { - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); - - driver.DriverBehavior = DrivingBehavior.Braking; - - var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); - var engineSpeed = engineSpeedRpm.RPMtoRad(); - busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); - - var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, - (internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed); - - Assert.AreEqual(expectedPowerDemand, (torque * engineSpeed).Value(), 1e-3); - } - - [Test, - TestCase(19000)] - public void AuxDemandContinuityTest(double vehicleWeight) - { - MockDriver driver; - var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); - - driver.DriverBehavior = DrivingBehavior.Driving; - - //var engineSpeedRpm = 1375.1014; - - var table = new DataTable(); - table.Columns.Add("engineSpeed", typeof(double)); - table.Columns.Add("auxPowerDemand", typeof(double)); - - for (var engineSpeedRpm = 1370.0; engineSpeedRpm < 1380; engineSpeedRpm += 1e-3) { - var driveLinePower = 2200.0; - var internalPower = driveLinePower + 43; - - var engineDrivelinePower = driveLinePower.SI<Watt>(); - var engineSpeed = engineSpeedRpm.RPMtoRad(); - busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); - - var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, - (internalPower).SI<Watt>() / engineSpeed, engineSpeed); - - var row = table.NewRow(); - row["engineSpeed"] = engineSpeed.Value() / Constants.RPMToRad; - row["auxPowerDemand"] = (torque * engineSpeed).Value(); - table.Rows.Add(row); - } - var pt1 = new Point((double)(table.Rows[0]["engineSpeed"]), (double)(table.Rows[0]["auxPowerDemand"])); - var pt2 = new Point((double)(table.Rows[table.Rows.Count - 1]["engineSpeed"]), - (double)(table.Rows[table.Rows.Count - 1]["auxPowerDemand"])); - var edge = new Edge(pt1, pt2); - var slope = edge.SlopeXY; - var offset = edge.OffsetXY; - foreach (DataRow row in table.Rows) { - var expected = (double)row["engineSpeed"] * slope + offset; - Assert.AreEqual(expected, (double)row["auxPowerDemand"], 0.1); - } - - //VectoCSVFile.Write("auxPowerDemand_EngineSpeed.csv", table); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Data; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Tests.Utils; +using TUGraz.VectoCore.Utils; +using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; + +namespace TUGraz.VectoCore.Tests.Integration.BusAuxiliaries +{ + [TestFixture] + public class BusAdapterTest + { + [Test] + [TestCase(12000, 1256, 148, 148, 6086.9321)] + [TestCase(12000, 1256, -48, -148, 6086.9321)] + [TestCase(12000, 1256, 48, -148, 6086.9321)] + [TestCase(12000, 800, 148, 148, 6377.0923)] + [TestCase(12000, 800, -48, -148, 6377.0923)] + [TestCase(12000, 800, 48, -148, 6377.0923)] + public void TestNoSmartAuxDuringDrive(double vehicleWeight, double engineSpeedRpm, double driveLinePower, + double internalPower, double expectedPowerDemand) + { + MockDriver driver; + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + + driver.DriverBehavior = DrivingBehavior.Driving; + + var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); + var engineSpeed = engineSpeedRpm.RPMtoRad(); + busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); + + var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, + (internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed); + + Assert.AreEqual(expectedPowerDemand, (torque * engineSpeed).Value(), 1e-2); + } + + [Test] + [TestCase(12000, 1256, 148, 148, 6086.9321)] + [TestCase(12000, 1256, -28, -27, 6086.9321)] + [TestCase(12000, 1256, -28, -29, 6086.9321)] + [TestCase(12000, 1256, -128, -28, 6086.9321)] + [TestCase(12000, 1256, 28, -28, 6086.9321)] + [TestCase(12000, 800, 148, 148, 6377.0923)] + [TestCase(12000, 800, -14, -13, 6377.0923)] + [TestCase(12000, 800, -14, -15, 6377.0923)] + [TestCase(12000, 800, -35, -14, 6377.0923)] + [TestCase(12000, 800, 35, -14, 6377.0923)] + public void TestNoSmartAuxDuringCoasting(double vehicleWeight, double engineSpeedRpm, double driveLinePower, + double internalPower, double expectedPowerDemand) + { + // this test is to make sure that the aux power-demand does not jump between average and smart power demand + // when searching for the operating point for coasting (i.e. power demand (internal Power) is close to the motoring curve, + // intependent of power demand of power train) + MockDriver driver; + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + + driver.DriverBehavior = DrivingBehavior.Coasting; + + var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); + var engineSpeed = engineSpeedRpm.RPMtoRad(); + busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); + + var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, + (internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed); + + Assert.AreEqual(expectedPowerDemand, (torque * engineSpeed).Value(), 1e-2); + } + + [Test] + [TestCase(12000, 1256, -48, -148, 8954.1396)] + [TestCase(12000, 1256, 48, -148, 8954.1396)] + [TestCase(12000, 800, -48, -148, 8281.5088)] + [TestCase(12000, 800, 48, -148, 8281.5088)] + public void TestSmartAuxDuringBrake(double vehicleWeight, double engineSpeedRpm, double driveLinePower, + double internalPower, double expectedPowerDemand) + { + MockDriver driver; + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + + driver.DriverBehavior = DrivingBehavior.Braking; + + var engineDrivelinePower = (driveLinePower * 1000).SI<Watt>(); + var engineSpeed = engineSpeedRpm.RPMtoRad(); + busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); + + var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, + (internalPower * 1000).SI<Watt>() / engineSpeed, engineSpeed); + + Assert.AreEqual(expectedPowerDemand, (torque * engineSpeed).Value(), 1e-3); + } + + [Test, + TestCase(19000)] + public void AuxDemandContinuityTest(double vehicleWeight) + { + MockDriver driver; + var busAux = AuxDemandTest.CreateBusAuxAdapterForTesting(vehicleWeight, out driver); + + driver.DriverBehavior = DrivingBehavior.Driving; + + //var engineSpeedRpm = 1375.1014; + + var table = new DataTable(); + table.Columns.Add("engineSpeed", typeof(double)); + table.Columns.Add("auxPowerDemand", typeof(double)); + + for (var engineSpeedRpm = 1370.0; engineSpeedRpm < 1380; engineSpeedRpm += 1e-3) { + var driveLinePower = 2200.0; + var internalPower = driveLinePower + 43; + + var engineDrivelinePower = driveLinePower.SI<Watt>(); + var engineSpeed = engineSpeedRpm.RPMtoRad(); + busAux.Initialize(engineDrivelinePower / engineSpeed, engineSpeed); + + var torque = busAux.TorqueDemand(0.SI<Second>(), 1.SI<Second>(), engineDrivelinePower / engineSpeed, + (internalPower).SI<Watt>() / engineSpeed, engineSpeed); + + var row = table.NewRow(); + row["engineSpeed"] = engineSpeed.Value() / Constants.RPMToRad; + row["auxPowerDemand"] = (torque * engineSpeed).Value(); + table.Rows.Add(row); + } + var pt1 = new Point((double)(table.Rows[0]["engineSpeed"]), (double)(table.Rows[0]["auxPowerDemand"])); + var pt2 = new Point((double)(table.Rows[table.Rows.Count - 1]["engineSpeed"]), + (double)(table.Rows[table.Rows.Count - 1]["auxPowerDemand"])); + var edge = new Edge(pt1, pt2); + var slope = edge.SlopeXY; + var offset = edge.OffsetXY; + foreach (DataRow row in table.Rows) { + var expected = (double)row["engineSpeed"] * slope + offset; + Assert.AreEqual(expected, (double)row["auxPowerDemand"], 0.1); + } + + //VectoCSVFile.Write("auxPowerDemand_EngineSpeed.csv", table); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs index c33dbba6e980c7b1bca35ffefc664530eae625a5..76c72e3126610af2c795687b0da884c49b3db583 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachAdvancedAuxPowertrain.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs index abb2aae21bc49f0c232a192fbdd2a4af576426b0..6cd925541c89a17dc27b2294757601f6319de202 100644 --- a/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/CoachPowerTrain.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCoreTest/Integration/DriverStrategy/SimpleCycles.cs b/VectoCore/VectoCoreTest/Integration/DriverStrategy/SimpleCycles.cs index 57621b4ef9f8a87d7afaa9063df32fcc55b53e29..a3e21fd14d2e89e2edb669e3e2ed8a1906af50de 100644 --- a/VectoCore/VectoCoreTest/Integration/DriverStrategy/SimpleCycles.cs +++ b/VectoCore/VectoCoreTest/Integration/DriverStrategy/SimpleCycles.cs @@ -1,642 +1,642 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using NUnit.Framework; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.OutputData.FileIO; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy -{ - [TestFixture] - public class SimpleCycles - { - [TestFixtureSetUp] - public void Init() - { - //LogManager.DisableLogging(); -#if TRACE - GraphWriter.Enable(); -#else - GraphWriter.Disable(); -#endif - GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; - - GraphWriter.Yfields = new[] { - ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, - ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap - }; - GraphWriter.Series1Label = "Vecto 3"; - GraphWriter.Series2Label = "Vecto 2.2"; - } - - private static string GetSlopeString(double slope) - { - var slopeStr = slope > 0 - ? Math.Abs(slope).ToString("uphill_#") - : slope < 0 - ? Math.Abs(slope).ToString("downhill_#") - : "level"; - return slopeStr; - } - - [TestCase, Category("ComparisonV2")] - public void TestGraph() - { - var imgV3 = @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v3.vmod"; - var imgv22 = - @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v22.vmod"; - - GraphWriter.Write(imgV3, imgv22); - } - - [TestCase, Category("ComparisonV2")] - public void TestSingleGraph() - { - var imgV3 = @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v3.vmod"; - - GraphWriter.Write(imgV3); - } - - [Category("ComparisonV2"), - TestCase(0, 20, -5), - TestCase(0, 20, 0), - TestCase(0, 85, -15), - TestCase(0, 85, -25), - TestCase(0, 85, -5), - TestCase(0, 85, 0), - TestCase(0, 85, 1), - TestCase(0, 85, 10), - TestCase(0, 85, 2), - TestCase(0, 85, 25), - TestCase(0, 85, 5), - TestCase(20, 22, 5), - TestCase(20, 60, -15), - TestCase(20, 60, -25), - TestCase(20, 60, -5), - TestCase(20, 60, 0), - TestCase(20, 60, 15), - TestCase(20, 60, 25), - TestCase(20, 60, 5), - ] - public void Truck_Accelerate(double v1, double v2, double slope) - { - Assert.IsTrue(v2 > v1); - var cycle = string.Format(CultureInfo.InvariantCulture, - "0, {0}, {1}, {2}\n100, {3}, {4}, 0\n1000, {3}, {4}, {5}", v1, - slope, v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Truck_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Accelerate_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Test, - TestCase(20, 60, 25), - ] - public void Truck_Accelerate_MT(double v1, double v2, double slope) - { - Assert.IsTrue(v2 > v1); - var cycle = string.Format(CultureInfo.InvariantCulture, - "0, {0}, {1}, {2}\n100, {3}, {4}, 0\n1000, {3}, {4}, {5}", v1, - slope, v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Truck_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Accelerate_MT_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope)), gbxType: GearboxType.MT); - } - - [Category("ComparisonV2"), - TestCase(22, 20, -5), - TestCase(45, 0, -5), - TestCase(45, 0, 0), - TestCase(45, 0, 5), - TestCase(60, 20, -15), - TestCase(60, 20, -25), - TestCase(60, 20, -5), - TestCase(60, 20, 0), - TestCase(60, 20, 15), - TestCase(60, 20, 5), - TestCase(80, 0, -15), - TestCase(80, 0, -25), - TestCase(80, 0, -5), - TestCase(80, 0, 0), - //TestCase(80, 0, 18), - TestCase(80, 0, 15), - TestCase(80, 0, 3), - TestCase(80, 0, 5), - ] - public void Truck_Decelerate(double v1, double v2, double slope) - { - Assert.IsTrue(v2 < v1); - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Truck_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Decelerate_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("ComparisonV2"), - TestCase(10, 10, -15), - TestCase(10, 10, -25), - TestCase(10, 10, -5), - TestCase(10, 10, 0), - TestCase(10, 10, 15), - TestCase(10, 10, 25), - TestCase(10, 10, 5), - TestCase(20, 20, -15), - TestCase(30, 30, -15), - TestCase(50, 50, -15), - TestCase(80, 80, -15), - TestCase(80, 80, -5), - TestCase(80, 80, 0), - TestCase(80, 80, 15), - TestCase(80, 80, 5), - ] - public void Truck_Drive(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Truck_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Drive_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("ComparisonV2"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_80_Increasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_80_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_50_Increasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_50_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_30_Increasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_30_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_80_Decreasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_80_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_50_Decreasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_50_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_30_Decreasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_30_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_80_Dec_Increasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_80_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_50_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, - "40t_Long_Haul_Truck_Cycle_Drive_30_Dec_Increasing_Slope.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDrive_30_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, - "40t_Long_Haul_Truck_Cycle_DecelerateWhileBrake_80_0_level.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleDecelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, - "40t_Long_Haul_Truck_Cycle_AccelerateWhileBrake_80_0_level.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleAccelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, - "40t_Long_Haul_Truck_Cycle_AccelerateAtBrake_80_0_level.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleAccelerateAtBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, - "40t_Long_Haul_Truck_Cycle_AccelerateBeforeBrake_80_0_level.vmod", GearboxType.AMT, - TestName = "TruckSpecial CycleAccelerateBeforeBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, - "24t Truck_Cycle_Drive_stop_85_stop_85_level.vmod", - GearboxType.AMT, TestName = "TruckSpecial CycleDrive_stop_85_stop_85_level"), - TestCase(SimpleDrivingCycles.CycleDrive_SlopeChangeBeforeStop, - "Truck_DriverStrategy_SlopeChangeBeforeStop.vmod", - GearboxType.AMT, TestName = "TruckSpecial CycleDrive_SlopeChangeBeforeStop"), - TestCase(SimpleDrivingCycles.CycleDriver_FrequentSlopChange, "Truck_DriverStrategy_SlopeChangeBeforeStop.vmod", - GearboxType.AMT, TestName = "TruckSpecial CycleDriver_FrequentSlopChange"), - ] - public void Truck_Special(string cycleData, string modFileName, GearboxType gbxType = GearboxType.AMT) - { - var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); - var run = Truck40tPowerTrain.CreateEngineeringRun(cycle, modFileName, gbxType: gbxType); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFileName, - @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck\" + modFileName); - } - - [Category("ComparisonV2"), - TestCase(0, 40, -1), - TestCase(0, 40, -3), - TestCase(0, 40, -5), - TestCase(0, 60, -1), - TestCase(0, 60, -3), - TestCase(0, 60, -5), - TestCase(0, 85, -1), - TestCase(0, 85, -3), - TestCase(0, 85, -5), - ] - public void Truck_Accelerate_Overspeed(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = slope > 0 ? "uhpill" : slope < 0 ? "downhill" : "level"; - string modFileName = string.Format(CultureInfo.InvariantCulture, - "40t_Long_Haul_Truck_Cycle_Accelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); - var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFileName, true); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFileName, - @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck_Overspeed\" + modFileName); - } - - [Category("ComparisonV2"), - TestCase(0, 20, -5), - TestCase(0, 20, 0), - TestCase(0, 85, -15), - TestCase(0, 85, -25), - TestCase(0, 85, -5), - TestCase(0, 85, 0), - TestCase(0, 85, 1), - TestCase(0, 85, 10), - TestCase(0, 85, 2), - //TestCase(0, 85, 25), - TestCase(0, 85, 5), - TestCase(20, 22, 5), - TestCase(20, 60, -15), - TestCase(20, 60, -25), - TestCase(20, 60, -5), - TestCase(20, 60, 0), - TestCase(20, 60, 15), - TestCase(20, 60, 25), - TestCase(20, 60, 5), - ] - public void Coach_Accelerate(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Coach_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Accelerate_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("ComparisonV2"), - TestCase(22, 20, -5), - TestCase(45, 0, -5), - TestCase(45, 0, 0), - TestCase(45, 0, 5), - TestCase(60, 20, -15), - TestCase(60, 20, -25), - TestCase(60, 20, -5), - TestCase(60, 20, 0), - TestCase(60, 20, 15), - TestCase(60, 20, 5), - TestCase(80, 0, -15), - TestCase(80, 0, -25), - TestCase(80, 0, -5), - TestCase(80, 0, 0), - TestCase(80, 0, 20), - TestCase(80, 0, 15), - TestCase(80, 0, 3), - TestCase(80, 0, 5), - ] - public void Coach_Decelerate(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Coach_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Decelerate_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("ComparisonV2"), - TestCase(10, 10, -15), - TestCase(10, 10, -25), - TestCase(10, 10, -5), - TestCase(10, 10, 0), - TestCase(10, 10, 15), - TestCase(10, 10, 5), - TestCase(20, 20, -15), - TestCase(30, 30, -15), - TestCase(50, 50, -15), - TestCase(80, 80, -15), - TestCase(80, 80, -5), - TestCase(80, 80, 0), - TestCase(80, 80, 15), - TestCase(80, 80, 5), - ] - public void Coach_Drive(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Coach(cycle, string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Drive_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope)), true); - } - - [Category("ComparisonV2"), - TestCase(10, 10, 25) - ] - public void Coach_Drive_low(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - Coach(cycle, string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Drive_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope)), false); - } - - [Category("ComparisonV2"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, - "24t Coach_Cycle_Drive_80_Increasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_80_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, - "24t Coach_Cycle_Drive_50_Increasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_50_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, - "24t Coach_Cycle_Drive_30_Increasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_30_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, - "24t Coach_Cycle_Drive_80_Decreasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_80_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, - "24t Coach_Cycle_Drive_50_Decreasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_50_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, - "24t Coach_Cycle_Drive_30_Decreasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_30_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, - "24t Coach_Cycle_Drive_80_Dec_Increasing_Slope.vmod", - TestName = "CoachSpecial CycleDrive_80_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, - "24t Coach_Cycle_Drive_50_Dec_Increasing_Slope.vmod", - TestName = "CoachSpecial CycleDrive_50_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, - "24t Coach_Cycle_Drive_30_Dec_Increasing_Slope.vmod", - TestName = "CoachSpecialCycleDrive_30_Dec_Increasing_Slope "), - TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, - "24t Coach_Cycle_DecelerateWhileBrake_80_0_level.vmod", - TestName = "CoachSpecial CycleDecelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, - "24t Coach_Cycle_AccelerateWhileBrake_80_0_level.vmod", - TestName = "CoachSpecial CycleAccelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, - "24t Coach_Cycle_AccelerateAtBrake_80_0_level.vmod", - TestName = "CoachSpecial CycleAccelerateAtBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, - "24t Coach_Cycle_AccelerateBeforeBrake_80_0_level.vmod", - TestName = "CoachSpecial CycleAccelerateBeforeBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, - "24t Coach_Cycle_Drive_stop_85_stop_85_level.vmod", - TestName = "CoachSpecial CycleDrive_stop_85_stop_85_level"), - TestCase(SimpleDrivingCycles.CycleDrive_SlopeChangeBeforeStop, - "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", - TestName = "CoachSpecial CycleDrive_SlopeChangeBeforeStop"), - TestCase(SimpleDrivingCycles.CycleDriver_FrequentSlopChange, - "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", - TestName = "CoachSpecial CycleDriver_FrequentSlopChange"), - ] - public void Coach_Special(string cycleData, string modFileName) - { - Coach(cycleData, modFileName, true); - } - - private void Coach(string cycleData, string modFileName, bool highEnginePower) - { - var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); - var run = CoachPowerTrain.CreateEngineeringRun(cycle, modFileName, highEnginePower: highEnginePower); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFileName, @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach\" + modFileName); - } - - [Category("ComparisonV2"), - TestCase(0, 40, -1), - TestCase(0, 40, -3), - TestCase(0, 40, -5), - TestCase(0, 60, -1), - TestCase(0, 60, -3), - TestCase(0, 60, -5), - TestCase(0, 85, -1), - TestCase(0, 85, -3), - TestCase(0, 85, -5), - ] - public void Coach_Accelerate_Overspeed(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - var slopeStr = slope > 0 ? "uhpill" : slope < 0 ? "downhill" : "level"; - string modFileName = string.Format(CultureInfo.InvariantCulture, - "24t Coach_Cycle_Accelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr); - - var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); - var run = CoachPowerTrain.CreateEngineeringRun(cycleData, modFileName, true); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFileName, - @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach_Overspeed\" + modFileName); - } - - // #################################################### - - [Category("AT Gearbox"), - TestCase(0, 20, -5), - TestCase(0, 20, 0), - TestCase(0, 85, -15), - TestCase(0, 85, -25), - TestCase(0, 85, -5), - TestCase(0, 85, 0), - TestCase(0, 85, 1), - TestCase(0, 85, 10), - TestCase(0, 85, 2), - //TestCase(0, 85, 25), - TestCase(0, 85, 5), - TestCase(20, 22, 5), - TestCase(20, 60, -15), - TestCase(20, 60, -25), - TestCase(20, 60, -5), - TestCase(20, 60, 0), - TestCase(20, 60, 15), - //TestCase(20, 60, 25), - TestCase(20, 60, 5), - ] - public void AT_Gearbox_Accelerate(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, - "0, {0}, {1}, {2}\n100, {3}, {4}, {5}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - AT_Gearbox_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "AT-Gbx Accelerate_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("AT Gearbox"), - TestCase(22, 20, -5), - TestCase(45, 0, -5), - TestCase(45, 0, 0), - TestCase(45, 0, 5), - TestCase(60, 20, -15), - TestCase(60, 20, -25), - TestCase(60, 20, -5), - TestCase(60, 20, 0), - //TestCase(60, 20, 15), - TestCase(60, 20, 5), - TestCase(80, 0, -15), - TestCase(80, 0, -25), - TestCase(80, 0, -5), - TestCase(80, 0, 0), - //TestCase(80, 0, 20), - //TestCase(80, 0, 15), - TestCase(80, 0, 3), - TestCase(80, 0, 5), - ] - public void AT_Gearbox_Decelerate(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - AT_Gearbox_Special(cycle, - string.Format(CultureInfo.InvariantCulture, "AT-Gbx Decelerate_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("AT Gearbox"), - TestCase(10, 10, -15), - TestCase(10, 10, -25), - TestCase(10, 10, -5), - TestCase(10, 10, 0), - TestCase(10, 10, 15), - TestCase(10, 10, 25), - TestCase(10, 10, 5), - TestCase(20, 20, -15), - TestCase(30, 30, -15), - TestCase(50, 50, -15), - TestCase(80, 80, -15), - TestCase(80, 80, -5), - TestCase(80, 80, 0), - //TestCase(80, 80, 15), - TestCase(80, 80, 5), - ] - public void AT_Gearbox_Drive(double v1, double v2, double slope) - { - var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, - v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); - - AT_Gearbox_Special(cycle, string.Format(CultureInfo.InvariantCulture, "AT-Gbx Drive_{0}_{1}_{2}.vmod", - v1, v2, GetSlopeString(slope))); - } - - [Category("AT Gearbox"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, - "AT-Gbx Drive_80_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_80_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, - "AT-Gbx Drive_50_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_50_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, - "AT-Gbx Drive_30_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_30_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, - "AT-Gbx Drive_80_Decreasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_80_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, - "AT-Gbx Drive_50_Decreasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_50_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, - "AT-Gbx Drive_30_Decreasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_30_Decreasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, - "AT-Gbx Drive_80_Dec_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_80_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, - "AT-Gbx Drive_50_Dec_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_50_Dec_Increasing_Slope"), - TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, - "AT-Gbx Drive_30_Dec_Increasing_Slope.vmod", TestName = "AT-GearboxCycleDrive_30_Dec_Increasing_Slope "), - TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, - "AT-Gbx DecelerateWhileBrake_80_0_level.vmod", - TestName = "AT-Gearbox CycleDecelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, - "AT-Gbx AccelerateWhileBrake_80_0_level.vmod", - TestName = "AT-Gearbox CycleAccelerateWhileBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, - "AT-Gbx AccelerateAtBrake_80_0_level.vmod", TestName = "AT-Gearbox CycleAccelerateAtBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, - "AT-Gbx AccelerateBeforeBrake_80_0_level.vmod", - TestName = "AT-Gearbox CycleAccelerateBeforeBrake_80_0_level"), - TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, "AT-Gbx Drive_stop_85_stop_85_level.vmod", - TestName = "AT-Gearbox CycleDrive_stop_85_stop_85_level"), - TestCase(SimpleDrivingCycles.CycleDrive_SlopeChangeBeforeStop, - "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", - TestName = "AT-Gearbox CycleDrive_SlopeChangeBeforeStop"), - TestCase(SimpleDrivingCycles.CycleDriver_FrequentSlopChange, - "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", - TestName = "AT-Gearbox CycleDriver_FrequentSlopChange"), - ] - public void AT_Gearbox_Special(string cycleData, string modFileName) - { - var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); - var run = ATPowerTrain.CreateEngineeringRun(cycle, GearboxType.ATSerial, modFileName); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - //GraphWriter.Write(modFileName, @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach\" + modFileName); - } - - //[TestCase()] - //public void HugoTest() - //{ - // //var source = @"E:\QUAM\Workspace\Projekt HUGO\Jobs generated\Tractor_4x4_vehicle-class-8_EURO6_2018_CO.xml"; - // var source = @"E:\QUAM\Workspace\Projekt HUGO\Jobs generated\Rigid Truck_4x2_vehicle-class-4_EURO1_LH.xml"; - // //@"E:\QUAM\Workspace\Projekt HUGO\Jobs generated\Rigid Truck_4x2_vehicle-class-4_EURO1_LH.xml"; - // var writer = new FileOutputWriter(source); - // var apiRun = VectoEngineeringApi.VectoInstance(source, writer); - // try { - // apiRun.RunSimulation(); - // var status = apiRun.GetProgress(); - // foreach (var progressEntry in status) { - // if (!progressEntry.Value.Success) { - // Console.WriteLine("error executing run {0} in job {1}: error: {2}", progressEntry.Key, source, - // progressEntry.Value.Error.Message); - // Console.WriteLine(progressEntry.Value.Error.StackTrace); - // } - // } - // Assert.IsFalse(apiRun.GetProgress().Any(x => !x.Value.Success)); - // } catch (Exception e) { - // Console.WriteLine("Simulation failed: " + e.Message); - // } - //} - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using NUnit.Framework; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.OutputData.FileIO; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Integration.DriverStrategy +{ + [TestFixture] + public class SimpleCycles + { + [TestFixtureSetUp] + public void Init() + { + //LogManager.DisableLogging(); +#if TRACE + GraphWriter.Enable(); +#else + GraphWriter.Disable(); +#endif + GraphWriter.Xfields = new[] { ModalResultField.time, ModalResultField.dist }; + + GraphWriter.Yfields = new[] { + ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, + ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap + }; + GraphWriter.Series1Label = "Vecto 3"; + GraphWriter.Series2Label = "Vecto 2.2"; + } + + private static string GetSlopeString(double slope) + { + var slopeStr = slope > 0 + ? Math.Abs(slope).ToString("uphill_#") + : slope < 0 + ? Math.Abs(slope).ToString("downhill_#") + : "level"; + return slopeStr; + } + + [TestCase, Category("ComparisonV2")] + public void TestGraph() + { + var imgV3 = @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v3.vmod"; + var imgv22 = + @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v22.vmod"; + + GraphWriter.Write(imgV3, imgv22); + } + + [TestCase, Category("ComparisonV2")] + public void TestSingleGraph() + { + var imgV3 = @"TestData\Results\Integration\40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope_v3.vmod"; + + GraphWriter.Write(imgV3); + } + + [Category("ComparisonV2"), + TestCase(0, 20, -5), + TestCase(0, 20, 0), + TestCase(0, 85, -15), + TestCase(0, 85, -25), + TestCase(0, 85, -5), + TestCase(0, 85, 0), + TestCase(0, 85, 1), + TestCase(0, 85, 10), + TestCase(0, 85, 2), + TestCase(0, 85, 25), + TestCase(0, 85, 5), + TestCase(20, 22, 5), + TestCase(20, 60, -15), + TestCase(20, 60, -25), + TestCase(20, 60, -5), + TestCase(20, 60, 0), + TestCase(20, 60, 15), + TestCase(20, 60, 25), + TestCase(20, 60, 5), + ] + public void Truck_Accelerate(double v1, double v2, double slope) + { + Assert.IsTrue(v2 > v1); + var cycle = string.Format(CultureInfo.InvariantCulture, + "0, {0}, {1}, {2}\n100, {3}, {4}, 0\n1000, {3}, {4}, {5}", v1, + slope, v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Truck_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Accelerate_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Test, + TestCase(20, 60, 25), + ] + public void Truck_Accelerate_MT(double v1, double v2, double slope) + { + Assert.IsTrue(v2 > v1); + var cycle = string.Format(CultureInfo.InvariantCulture, + "0, {0}, {1}, {2}\n100, {3}, {4}, 0\n1000, {3}, {4}, {5}", v1, + slope, v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Truck_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Accelerate_MT_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope)), gbxType: GearboxType.MT); + } + + [Category("ComparisonV2"), + TestCase(22, 20, -5), + TestCase(45, 0, -5), + TestCase(45, 0, 0), + TestCase(45, 0, 5), + TestCase(60, 20, -15), + TestCase(60, 20, -25), + TestCase(60, 20, -5), + TestCase(60, 20, 0), + TestCase(60, 20, 15), + TestCase(60, 20, 5), + TestCase(80, 0, -15), + TestCase(80, 0, -25), + TestCase(80, 0, -5), + TestCase(80, 0, 0), + //TestCase(80, 0, 18), + TestCase(80, 0, 15), + TestCase(80, 0, 3), + TestCase(80, 0, 5), + ] + public void Truck_Decelerate(double v1, double v2, double slope) + { + Assert.IsTrue(v2 < v1); + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Truck_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Decelerate_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("ComparisonV2"), + TestCase(10, 10, -15), + TestCase(10, 10, -25), + TestCase(10, 10, -5), + TestCase(10, 10, 0), + TestCase(10, 10, 15), + TestCase(10, 10, 25), + TestCase(10, 10, 5), + TestCase(20, 20, -15), + TestCase(30, 30, -15), + TestCase(50, 50, -15), + TestCase(80, 80, -15), + TestCase(80, 80, -5), + TestCase(80, 80, 0), + TestCase(80, 80, 15), + TestCase(80, 80, 5), + ] + public void Truck_Drive(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Truck_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "40t_Long_Haul_Truck_Cycle_Drive_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("ComparisonV2"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_80_Increasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_80_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_50_Increasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_50_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_30_Increasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_30_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_80_Decreasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_80_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_50_Decreasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_50_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_30_Decreasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_30_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_80_Dec_Increasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_80_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_50_Dec_Increasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_50_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, + "40t_Long_Haul_Truck_Cycle_Drive_30_Dec_Increasing_Slope.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDrive_30_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, + "40t_Long_Haul_Truck_Cycle_DecelerateWhileBrake_80_0_level.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleDecelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, + "40t_Long_Haul_Truck_Cycle_AccelerateWhileBrake_80_0_level.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleAccelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, + "40t_Long_Haul_Truck_Cycle_AccelerateAtBrake_80_0_level.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleAccelerateAtBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, + "40t_Long_Haul_Truck_Cycle_AccelerateBeforeBrake_80_0_level.vmod", GearboxType.AMT, + TestName = "TruckSpecial CycleAccelerateBeforeBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, + "24t Truck_Cycle_Drive_stop_85_stop_85_level.vmod", + GearboxType.AMT, TestName = "TruckSpecial CycleDrive_stop_85_stop_85_level"), + TestCase(SimpleDrivingCycles.CycleDrive_SlopeChangeBeforeStop, + "Truck_DriverStrategy_SlopeChangeBeforeStop.vmod", + GearboxType.AMT, TestName = "TruckSpecial CycleDrive_SlopeChangeBeforeStop"), + TestCase(SimpleDrivingCycles.CycleDriver_FrequentSlopChange, "Truck_DriverStrategy_SlopeChangeBeforeStop.vmod", + GearboxType.AMT, TestName = "TruckSpecial CycleDriver_FrequentSlopChange"), + ] + public void Truck_Special(string cycleData, string modFileName, GearboxType gbxType = GearboxType.AMT) + { + var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); + var run = Truck40tPowerTrain.CreateEngineeringRun(cycle, modFileName, gbxType: gbxType); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFileName, + @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck\" + modFileName); + } + + [Category("ComparisonV2"), + TestCase(0, 40, -1), + TestCase(0, 40, -3), + TestCase(0, 40, -5), + TestCase(0, 60, -1), + TestCase(0, 60, -3), + TestCase(0, 60, -5), + TestCase(0, 85, -1), + TestCase(0, 85, -3), + TestCase(0, 85, -5), + ] + public void Truck_Accelerate_Overspeed(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = slope > 0 ? "uhpill" : slope < 0 ? "downhill" : "level"; + string modFileName = string.Format(CultureInfo.InvariantCulture, + "40t_Long_Haul_Truck_Cycle_Accelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); + var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFileName, true); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFileName, + @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\40t Truck_Overspeed\" + modFileName); + } + + [Category("ComparisonV2"), + TestCase(0, 20, -5), + TestCase(0, 20, 0), + TestCase(0, 85, -15), + TestCase(0, 85, -25), + TestCase(0, 85, -5), + TestCase(0, 85, 0), + TestCase(0, 85, 1), + TestCase(0, 85, 10), + TestCase(0, 85, 2), + //TestCase(0, 85, 25), + TestCase(0, 85, 5), + TestCase(20, 22, 5), + TestCase(20, 60, -15), + TestCase(20, 60, -25), + TestCase(20, 60, -5), + TestCase(20, 60, 0), + TestCase(20, 60, 15), + TestCase(20, 60, 25), + TestCase(20, 60, 5), + ] + public void Coach_Accelerate(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Coach_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Accelerate_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("ComparisonV2"), + TestCase(22, 20, -5), + TestCase(45, 0, -5), + TestCase(45, 0, 0), + TestCase(45, 0, 5), + TestCase(60, 20, -15), + TestCase(60, 20, -25), + TestCase(60, 20, -5), + TestCase(60, 20, 0), + TestCase(60, 20, 15), + TestCase(60, 20, 5), + TestCase(80, 0, -15), + TestCase(80, 0, -25), + TestCase(80, 0, -5), + TestCase(80, 0, 0), + TestCase(80, 0, 20), + TestCase(80, 0, 15), + TestCase(80, 0, 3), + TestCase(80, 0, 5), + ] + public void Coach_Decelerate(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Coach_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Decelerate_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("ComparisonV2"), + TestCase(10, 10, -15), + TestCase(10, 10, -25), + TestCase(10, 10, -5), + TestCase(10, 10, 0), + TestCase(10, 10, 15), + TestCase(10, 10, 5), + TestCase(20, 20, -15), + TestCase(30, 30, -15), + TestCase(50, 50, -15), + TestCase(80, 80, -15), + TestCase(80, 80, -5), + TestCase(80, 80, 0), + TestCase(80, 80, 15), + TestCase(80, 80, 5), + ] + public void Coach_Drive(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Coach(cycle, string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Drive_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope)), true); + } + + [Category("ComparisonV2"), + TestCase(10, 10, 25) + ] + public void Coach_Drive_low(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + Coach(cycle, string.Format(CultureInfo.InvariantCulture, "24t Coach_Cycle_Drive_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope)), false); + } + + [Category("ComparisonV2"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, + "24t Coach_Cycle_Drive_80_Increasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_80_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, + "24t Coach_Cycle_Drive_50_Increasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_50_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, + "24t Coach_Cycle_Drive_30_Increasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_30_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, + "24t Coach_Cycle_Drive_80_Decreasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_80_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, + "24t Coach_Cycle_Drive_50_Decreasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_50_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, + "24t Coach_Cycle_Drive_30_Decreasing_Slope.vmod", TestName = "CoachSpecial CycleDrive_30_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, + "24t Coach_Cycle_Drive_80_Dec_Increasing_Slope.vmod", + TestName = "CoachSpecial CycleDrive_80_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, + "24t Coach_Cycle_Drive_50_Dec_Increasing_Slope.vmod", + TestName = "CoachSpecial CycleDrive_50_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, + "24t Coach_Cycle_Drive_30_Dec_Increasing_Slope.vmod", + TestName = "CoachSpecialCycleDrive_30_Dec_Increasing_Slope "), + TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, + "24t Coach_Cycle_DecelerateWhileBrake_80_0_level.vmod", + TestName = "CoachSpecial CycleDecelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, + "24t Coach_Cycle_AccelerateWhileBrake_80_0_level.vmod", + TestName = "CoachSpecial CycleAccelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, + "24t Coach_Cycle_AccelerateAtBrake_80_0_level.vmod", + TestName = "CoachSpecial CycleAccelerateAtBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, + "24t Coach_Cycle_AccelerateBeforeBrake_80_0_level.vmod", + TestName = "CoachSpecial CycleAccelerateBeforeBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, + "24t Coach_Cycle_Drive_stop_85_stop_85_level.vmod", + TestName = "CoachSpecial CycleDrive_stop_85_stop_85_level"), + TestCase(SimpleDrivingCycles.CycleDrive_SlopeChangeBeforeStop, + "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", + TestName = "CoachSpecial CycleDrive_SlopeChangeBeforeStop"), + TestCase(SimpleDrivingCycles.CycleDriver_FrequentSlopChange, + "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", + TestName = "CoachSpecial CycleDriver_FrequentSlopChange"), + ] + public void Coach_Special(string cycleData, string modFileName) + { + Coach(cycleData, modFileName, true); + } + + private void Coach(string cycleData, string modFileName, bool highEnginePower) + { + var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); + var run = CoachPowerTrain.CreateEngineeringRun(cycle, modFileName, highEnginePower: highEnginePower); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFileName, @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach\" + modFileName); + } + + [Category("ComparisonV2"), + TestCase(0, 40, -1), + TestCase(0, 40, -3), + TestCase(0, 40, -5), + TestCase(0, 60, -1), + TestCase(0, 60, -3), + TestCase(0, 60, -5), + TestCase(0, 85, -1), + TestCase(0, 85, -3), + TestCase(0, 85, -5), + ] + public void Coach_Accelerate_Overspeed(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + var slopeStr = slope > 0 ? "uhpill" : slope < 0 ? "downhill" : "level"; + string modFileName = string.Format(CultureInfo.InvariantCulture, + "24t Coach_Cycle_Accelerate_{0}_{1}_{2}.vmod", v1, v2, slopeStr); + + var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); + var run = CoachPowerTrain.CreateEngineeringRun(cycleData, modFileName, true); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFileName, + @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach_Overspeed\" + modFileName); + } + + // #################################################### + + [Category("AT Gearbox"), + TestCase(0, 20, -5), + TestCase(0, 20, 0), + TestCase(0, 85, -15), + TestCase(0, 85, -25), + TestCase(0, 85, -5), + TestCase(0, 85, 0), + TestCase(0, 85, 1), + TestCase(0, 85, 10), + TestCase(0, 85, 2), + //TestCase(0, 85, 25), + TestCase(0, 85, 5), + TestCase(20, 22, 5), + TestCase(20, 60, -15), + TestCase(20, 60, -25), + TestCase(20, 60, -5), + TestCase(20, 60, 0), + TestCase(20, 60, 15), + //TestCase(20, 60, 25), + TestCase(20, 60, 5), + ] + public void AT_Gearbox_Accelerate(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, + "0, {0}, {1}, {2}\n100, {3}, {4}, {5}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + AT_Gearbox_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "AT-Gbx Accelerate_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("AT Gearbox"), + TestCase(22, 20, -5), + TestCase(45, 0, -5), + TestCase(45, 0, 0), + TestCase(45, 0, 5), + TestCase(60, 20, -15), + TestCase(60, 20, -25), + TestCase(60, 20, -5), + TestCase(60, 20, 0), + //TestCase(60, 20, 15), + TestCase(60, 20, 5), + TestCase(80, 0, -15), + TestCase(80, 0, -25), + TestCase(80, 0, -5), + TestCase(80, 0, 0), + //TestCase(80, 0, 20), + //TestCase(80, 0, 15), + TestCase(80, 0, 3), + TestCase(80, 0, 5), + ] + public void AT_Gearbox_Decelerate(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + AT_Gearbox_Special(cycle, + string.Format(CultureInfo.InvariantCulture, "AT-Gbx Decelerate_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("AT Gearbox"), + TestCase(10, 10, -15), + TestCase(10, 10, -25), + TestCase(10, 10, -5), + TestCase(10, 10, 0), + TestCase(10, 10, 15), + TestCase(10, 10, 25), + TestCase(10, 10, 5), + TestCase(20, 20, -15), + TestCase(30, 30, -15), + TestCase(50, 50, -15), + TestCase(80, 80, -15), + TestCase(80, 80, -5), + TestCase(80, 80, 0), + //TestCase(80, 80, 15), + TestCase(80, 80, 5), + ] + public void AT_Gearbox_Drive(double v1, double v2, double slope) + { + var cycle = string.Format(CultureInfo.InvariantCulture, "0, {0}, {1}, {2}\n1000, {3}, {4}, {5}", v1, slope, + v1.IsEqual(0) ? 2 : 0, v2, slope, v2.IsEqual(0) ? 2 : 0); + + AT_Gearbox_Special(cycle, string.Format(CultureInfo.InvariantCulture, "AT-Gbx Drive_{0}_{1}_{2}.vmod", + v1, v2, GetSlopeString(slope))); + } + + [Category("AT Gearbox"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Increasing_Slope, + "AT-Gbx Drive_80_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_80_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Increasing_Slope, + "AT-Gbx Drive_50_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_50_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Increasing_Slope, + "AT-Gbx Drive_30_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_30_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Decreasing_Slope, + "AT-Gbx Drive_80_Decreasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_80_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Decreasing_Slope, + "AT-Gbx Drive_50_Decreasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_50_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Decreasing_Slope, + "AT-Gbx Drive_30_Decreasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_30_Decreasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_80_Dec_Increasing_Slope, + "AT-Gbx Drive_80_Dec_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_80_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_50_Dec_Increasing_Slope, + "AT-Gbx Drive_50_Dec_Increasing_Slope.vmod", TestName = "AT-Gearbox CycleDrive_50_Dec_Increasing_Slope"), + TestCase(SimpleDrivingCycles.CycleDrive_30_Dec_Increasing_Slope, + "AT-Gbx Drive_30_Dec_Increasing_Slope.vmod", TestName = "AT-GearboxCycleDrive_30_Dec_Increasing_Slope "), + TestCase(SimpleDrivingCycles.CycleDecelerateWhileBrake_80_0_level, + "AT-Gbx DecelerateWhileBrake_80_0_level.vmod", + TestName = "AT-Gearbox CycleDecelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateWhileBrake_80_0_level, + "AT-Gbx AccelerateWhileBrake_80_0_level.vmod", + TestName = "AT-Gearbox CycleAccelerateWhileBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateAtBrake_80_0_level, + "AT-Gbx AccelerateAtBrake_80_0_level.vmod", TestName = "AT-Gearbox CycleAccelerateAtBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleAccelerateBeforeBrake_80_0_level, + "AT-Gbx AccelerateBeforeBrake_80_0_level.vmod", + TestName = "AT-Gearbox CycleAccelerateBeforeBrake_80_0_level"), + TestCase(SimpleDrivingCycles.CycleDrive_stop_85_stop_85_level, "AT-Gbx Drive_stop_85_stop_85_level.vmod", + TestName = "AT-Gearbox CycleDrive_stop_85_stop_85_level"), + TestCase(SimpleDrivingCycles.CycleDrive_SlopeChangeBeforeStop, + "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", + TestName = "AT-Gearbox CycleDrive_SlopeChangeBeforeStop"), + TestCase(SimpleDrivingCycles.CycleDriver_FrequentSlopChange, + "24t Coach_DriverStrategy_SlopeChangeBeforeStop.vmod", + TestName = "AT-Gearbox CycleDriver_FrequentSlopChange"), + ] + public void AT_Gearbox_Special(string cycleData, string modFileName) + { + var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); + var run = ATPowerTrain.CreateEngineeringRun(cycle, GearboxType.ATSerial, modFileName); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + //GraphWriter.Write(modFileName, @"..\..\TestData\Integration\DriverStrategy\Vecto2.2\Coach\" + modFileName); + } + + //[TestCase()] + //public void HugoTest() + //{ + // //var source = @"E:\QUAM\Workspace\Projekt HUGO\Jobs generated\Tractor_4x4_vehicle-class-8_EURO6_2018_CO.xml"; + // var source = @"E:\QUAM\Workspace\Projekt HUGO\Jobs generated\Rigid Truck_4x2_vehicle-class-4_EURO1_LH.xml"; + // //@"E:\QUAM\Workspace\Projekt HUGO\Jobs generated\Rigid Truck_4x2_vehicle-class-4_EURO1_LH.xml"; + // var writer = new FileOutputWriter(source); + // var apiRun = VectoEngineeringApi.VectoInstance(source, writer); + // try { + // apiRun.RunSimulation(); + // var status = apiRun.GetProgress(); + // foreach (var progressEntry in status) { + // if (!progressEntry.Value.Success) { + // Console.WriteLine("error executing run {0} in job {1}: error: {2}", progressEntry.Key, source, + // progressEntry.Value.Error.Message); + // Console.WriteLine(progressEntry.Value.Error.StackTrace); + // } + // } + // Assert.IsFalse(apiRun.GetProgress().Any(x => !x.Value.Success)); + // } catch (Exception e) { + // Console.WriteLine("Simulation failed: " + e.Message); + // } + //} + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs b/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs index 02d38767c068b1c07fd535a9f16891e75b9ffeb1..f6313adfe31c5e9be65de30a72925080476a6cfe 100644 --- a/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs +++ b/VectoCore/VectoCoreTest/Integration/EngineOnlyCycle/EngineOnlyCycleTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Linq; using NUnit.Framework; diff --git a/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs b/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs index 3e6fd32088f3bbce83f865e26737aa2fce8c3c89..6c9246226a5ba9520e5729e62a10583df2316a04 100644 --- a/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs +++ b/VectoCore/VectoCoreTest/Integration/FuelTypesTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using NUnit.Framework; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.InputData.FileIO.JSON; diff --git a/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs b/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs index 1a771b921a33fd19465f13d96291185d7a29982c..023e422781c149971c0e53b213dc1a15d2d9b0a4 100644 --- a/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs +++ b/VectoCore/VectoCoreTest/Integration/FullCycleDeclarationTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Data; using System.IO; using System.Linq; diff --git a/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs b/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs index 1a6f778fe1ae0a05c91133922fac0b80ea8b631f..a5d306c3ea13a357ed4fa864a9c8d1fe0afe7897 100644 --- a/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs +++ b/VectoCore/VectoCoreTest/Integration/ShiftStrategy/ShiftStrategyTest.cs @@ -1,97 +1,97 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Globalization; -using NUnit.Framework; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Integration.ShiftStrategy -{ - [TestFixture] - public class ShiftStrategyTest - { - [TestFixtureSetUp] - public void DisableLogging() - { - //LogManager.DisableLogging(); -#if TRACE - GraphWriter.Enable(); -#else - GraphWriter.Disable(); -#endif - - GraphWriter.Xfields = new[] { ModalResultField.dist }; - - GraphWriter.Yfields = new[] { - ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, - ModalResultField.P_eng_out, /*ModalResultField.T_eng_fcmap, */ ModalResultField.FCMap, - }; - GraphWriter.PlotDrivingMode = true; - GraphWriter.Series1Label = "Vecto 3"; - } - - [Test, - TestCase(75, 42.5, 4.5), - TestCase(75, 42.5, 3.5), - TestCase(75, 42.5, 2.1), - TestCase(65, 42.5, 2.3), - ] - public void Truck_Shifting_Test(double v1, double v2, double slope) - { - Assert.IsTrue(v1 > v2); - - var cycle = new[] { - // <s>,<v>,<grad>,<stop> - string.Format(CultureInfo.InvariantCulture, " 0, {0}, {2}, 0", v1, v2, slope), - string.Format(CultureInfo.InvariantCulture, "1000, {1}, {2}, 0", v1, v2, slope), - string.Format(CultureInfo.InvariantCulture, "1100, {1}, 0, 0", v1, v2, slope) - }; - System.IO.Directory.CreateDirectory(string.Format(@"Shiftt_{0}_{1}", v1, v2, slope)); - var slopePrefix = ""; - if (!slope.IsEqual(0)) { - slopePrefix = slope > 0 ? "uh_" : "dh_"; - } - var modFile = string.Format(@"Truck_Shift_{0}_{1}_{3}{2:0.0}.vmod", v1, v2, Math.Abs(slope), - slopePrefix); - var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); - var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFile, gbxType: GearboxType.MT); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - - GraphWriter.Write(modFile); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Globalization; +using NUnit.Framework; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Integration.ShiftStrategy +{ + [TestFixture] + public class ShiftStrategyTest + { + [TestFixtureSetUp] + public void DisableLogging() + { + //LogManager.DisableLogging(); +#if TRACE + GraphWriter.Enable(); +#else + GraphWriter.Disable(); +#endif + + GraphWriter.Xfields = new[] { ModalResultField.dist }; + + GraphWriter.Yfields = new[] { + ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, + ModalResultField.P_eng_out, /*ModalResultField.T_eng_fcmap, */ ModalResultField.FCMap, + }; + GraphWriter.PlotDrivingMode = true; + GraphWriter.Series1Label = "Vecto 3"; + } + + [Test, + TestCase(75, 42.5, 4.5), + TestCase(75, 42.5, 3.5), + TestCase(75, 42.5, 2.1), + TestCase(65, 42.5, 2.3), + ] + public void Truck_Shifting_Test(double v1, double v2, double slope) + { + Assert.IsTrue(v1 > v2); + + var cycle = new[] { + // <s>,<v>,<grad>,<stop> + string.Format(CultureInfo.InvariantCulture, " 0, {0}, {2}, 0", v1, v2, slope), + string.Format(CultureInfo.InvariantCulture, "1000, {1}, {2}, 0", v1, v2, slope), + string.Format(CultureInfo.InvariantCulture, "1100, {1}, 0, 0", v1, v2, slope) + }; + System.IO.Directory.CreateDirectory(string.Format(@"Shiftt_{0}_{1}", v1, v2, slope)); + var slopePrefix = ""; + if (!slope.IsEqual(0)) { + slopePrefix = slope > 0 ? "uh_" : "dh_"; + } + var modFile = string.Format(@"Truck_Shift_{0}_{1}_{3}{2:0.0}.vmod", v1, v2, Math.Abs(slope), + slopePrefix); + var cycleData = SimpleDrivingCycles.CreateCycleData(cycle); + var run = Truck40tPowerTrain.CreateEngineeringRun(cycleData, modFile, gbxType: GearboxType.MT); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + + GraphWriter.Write(modFile); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/SimpleDrivingCycles.cs b/VectoCore/VectoCoreTest/Integration/SimpleDrivingCycles.cs index 145eb9cc26a81fae50a1947ae33853de301ffbb1..373eab6f47fe26bbc61270c71c59cc50f5f9fd5b 100644 --- a/VectoCore/VectoCoreTest/Integration/SimpleDrivingCycles.cs +++ b/VectoCore/VectoCoreTest/Integration/SimpleDrivingCycles.cs @@ -1,289 +1,289 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Diagnostics.CodeAnalysis; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Tests.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Integration -{ - [SuppressMessage("ReSharper", "InconsistentNaming")] - public class SimpleDrivingCycles - { - public static DrivingCycleData CreateCycleData(string[] entries) - { - var cycleData = InputDataHelper.InputDataAsStream("<s>,<v>,<grad>,<stop>", entries); - return DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false); - } - - public static DrivingCycleData CreateCycleData(string entries) - { - var cycleData = InputDataHelper.InputDataAsStream("<s>,<v>,<grad>,<stop>", entries.Split('\n')); - return DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false); - } - - #region Misc - - public const string CycleDrive_80_Increasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 100, 80, 0.25, 0 - 200, 80, 0.5, 0 - 300, 80, 0.75, 0 - 400, 80, 1, 0 - 500, 80, 1.25, 0 - 600, 80, 1.5, 0 - 700, 80, 1.75, 0 - 800, 80, 2, 0 - 900, 80, 2.25, 0 - 1000, 80, 2.5, 0 - 1100, 80, 0, 0"; - - public const string CycleDrive_50_Increasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 50, 0, 0 - 100, 50, 0.25, 0 - 200, 50, 0.5, 0 - 300, 50, 0.75, 0 - 400, 50, 1, 0 - 500, 50, 1.25, 0 - 600, 50, 1.5, 0 - 700, 50, 1.75, 0 - 800, 50, 2, 0 - 900, 50, 2.25, 0 - 1000, 50, 2.5, 0 - 1100, 50, 0, 0"; - - public const string CycleDrive_30_Increasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 30, 0, 0 - 100, 30, 0.25, 0 - 200, 30, 0.5, 0 - 300, 30, 0.75, 0 - 400, 30, 1, 0 - 500, 30, 1.25, 0 - 600, 30, 1.5, 0 - 700, 30, 1.75, 0 - 800, 30, 2, 0 - 900, 30, 2.25, 0 - 1000, 30, 2.5, 0 - 1100, 30, 0, 0"; - - public const string CycleDrive_80_Decreasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 100, 80, -0.25, 0 - 200, 80, -0.5, 0 - 300, 80, -0.75, 0 - 400, 80, -1, 0 - 500, 80, -1.25, 0 - 600, 80, -1.5, 0 - 700, 80, -1.75, 0 - 800, 80, -2, 0 - 900, 80, -2.25, 0 - 1000, 80, -2.5, 0 - 1100, 80, 0, 0"; - - public const string CycleDrive_50_Decreasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 50, 0, 0 - 100, 50, -0.25, 0 - 200, 50, -0.5, 0 - 300, 50, -0.75, 0 - 400, 50, -1, 0 - 500, 50, -1.25, 0 - 600, 50, -1.5, 0 - 700, 50, -1.75, 0 - 800, 50, -2, 0 - 900, 50, -2.25, 0 - 1000, 50, -2.5, 0 - 1100, 50, 0, 0 "; - - public const string CycleDrive_30_Decreasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 30, 0, 0 - 100, 30, -0.25, 0 - 200, 30, -0.5, 0 - 300, 30, -0.75, 0 - 400, 30, -1, 0 - 500, 30, -1.25, 0 - 600, 30, -1.5, 0 - 700, 30, -1.75, 0 - 800, 30, -2, 0 - 900, 30, -2.25, 0 - 1000, 30, -2.5, 0 - 1100, 30, 0, 0 "; - - public const string CycleDrive_80_Dec_Increasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 100, 80, -0.25, 0 - 200, 80, -0.5, 0 - 300, 80, -0.75, 0 - 400, 80, -1, 0 - 500, 80, -1.25, 0 - 600, 80, -1.5, 0 - 700, 80, -1.75, 0 - 800, 80, -2, 0 - 900, 80, -2.25, 0 - 1000, 80, -2.5, 0 - 1100, 80, 0, 0 - 1200, 80, 0, 0 - 1300, 80, 0.25, 0 - 1400, 80, 0.5, 0 - 1500, 80, 0.75, 0 - 1600, 80, 1, 0 - 1700, 80, 1.25, 0 - 1800, 80, 1.5, 0 - 1900, 80, 1.75, 0 - 2000, 80, 2, 0 - 2100, 80, 2.25, 0 - 2200, 80, 2.5, 0 - 2300, 80, 0, 0 "; - - public const string CycleDrive_50_Dec_Increasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 50, 0, 0 - 50, 50, -0.25, 0 - 100, 50, -0.5, 0 - 150, 50, -0.75, 0 - 200, 50, -1, 0 - 250, 50, -1.25, 0 - 300, 50, -1.5, 0 - 350, 50, -1.75, 0 - 400, 50, -2, 0 - 450, 50, -2.25, 0 - 500, 50, -2.5, 0 - 550, 50, 0, 0 - 600, 50, 0, 0 - 650, 50, 0.25, 0 - 700, 50, 0.5, 0 - 750, 50, 0.75, 0 - 800, 50, 1, 0 - 850, 50, 1.25, 0 - 900, 50, 1.5, 0 - 950, 50, 1.75, 0 - 1000, 50, 2, 0 - 1050, 50, 2.25, 0 - 1100, 50, 2.5, 0 - 1150, 50, 5, 0 - 1200, 50, 0, 0 "; - - public const string CycleDrive_30_Dec_Increasing_Slope = - // <s>,<v>,<grad>,<stop> - @" 0, 30, 0, 0 - 50, 30, -0.25, 0 - 100, 30, -0.5, 0 - 150, 30, -0.75, 0 - 200, 30, -1, 0 - 250, 30, -1.25, 0 - 300, 30, -1.5, 0 - 350, 30, -1.75, 0 - 400, 30, -2, 0 - 450, 30, -2.25, 0 - 500, 30, -2.5, 0 - 550, 30, 0, 0 - 600, 30, 0, 0 - 650, 30, 0.25, 0 - 700, 30, 0.5, 0 - 750, 30, 0.75, 0 - 800, 30, 1, 0 - 850, 30, 1.25, 0 - 900, 30, 1.5, 0 - 950, 30, 1.75, 0 - 1000, 30, 2, 0 - 1050, 30, 2.25, 0 - 1100, 30, 2.5, 0 - 1150, 30, 0, 0"; - - public const string CycleDecelerateWhileBrake_80_0_level = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 990, 65, 0, 0 - 1000, 0, 0, 2"; - - public const string CycleAccelerateWhileBrake_80_0_level = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 800, 90, 0, 0 - 950, 80, 0, 0 - 1000, 0, 0, 2"; - - public const string CycleAccelerateAtBrake_80_0_level = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 505, 90, 0, 0 - 650, 80, 0, 0 - 1000, 0, 0, 2"; - - public const string CycleAccelerateBeforeBrake_80_0_level = - // <s>,<v>,<grad>,<stop> - @" 0, 80, 0, 0 - 450, 90, 0, 0 - 650, 80, 0, 0 - 1000, 0, 0, 2"; - - public const string CycleDrive_stop_85_stop_85_level = - // <s>,<v>,<grad>,<stop> - @" 0, 0, 0, 2 - 1000, 85, 0, 0 - 2000, 0, 0, 2 - 3000, 85, 0, 0"; - - public const string CycleDrive_SlopeChangeBeforeStop = - // <s>,<v>,<grad>,<stop> - @" 0, 60, -1.4, 0 - 298, 60, -1.7, 0 - 300, 0, -1.7, 4"; - - public const string CycleDriver_FrequentSlopChange = - // <s>,<v>,<grad>,<stop> - @" 0, 60, 0, 0 - 10, 60, -6, 0 - 100, 55, -6, 0 - 300, 55, -6, 0"; - - #endregion - - public static DrivingCycleData ReadDeclarationCycle(string missionType) - { - var cycleData = - RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." + missionType + - Constants.FileExtensions.CycleFile); - var cycle = DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false); - return cycle; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Diagnostics.CodeAnalysis; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Tests.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Integration +{ + [SuppressMessage("ReSharper", "InconsistentNaming")] + public class SimpleDrivingCycles + { + public static DrivingCycleData CreateCycleData(string[] entries) + { + var cycleData = InputDataHelper.InputDataAsStream("<s>,<v>,<grad>,<stop>", entries); + return DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false); + } + + public static DrivingCycleData CreateCycleData(string entries) + { + var cycleData = InputDataHelper.InputDataAsStream("<s>,<v>,<grad>,<stop>", entries.Split('\n')); + return DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false); + } + + #region Misc + + public const string CycleDrive_80_Increasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 100, 80, 0.25, 0 + 200, 80, 0.5, 0 + 300, 80, 0.75, 0 + 400, 80, 1, 0 + 500, 80, 1.25, 0 + 600, 80, 1.5, 0 + 700, 80, 1.75, 0 + 800, 80, 2, 0 + 900, 80, 2.25, 0 + 1000, 80, 2.5, 0 + 1100, 80, 0, 0"; + + public const string CycleDrive_50_Increasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 50, 0, 0 + 100, 50, 0.25, 0 + 200, 50, 0.5, 0 + 300, 50, 0.75, 0 + 400, 50, 1, 0 + 500, 50, 1.25, 0 + 600, 50, 1.5, 0 + 700, 50, 1.75, 0 + 800, 50, 2, 0 + 900, 50, 2.25, 0 + 1000, 50, 2.5, 0 + 1100, 50, 0, 0"; + + public const string CycleDrive_30_Increasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 30, 0, 0 + 100, 30, 0.25, 0 + 200, 30, 0.5, 0 + 300, 30, 0.75, 0 + 400, 30, 1, 0 + 500, 30, 1.25, 0 + 600, 30, 1.5, 0 + 700, 30, 1.75, 0 + 800, 30, 2, 0 + 900, 30, 2.25, 0 + 1000, 30, 2.5, 0 + 1100, 30, 0, 0"; + + public const string CycleDrive_80_Decreasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 100, 80, -0.25, 0 + 200, 80, -0.5, 0 + 300, 80, -0.75, 0 + 400, 80, -1, 0 + 500, 80, -1.25, 0 + 600, 80, -1.5, 0 + 700, 80, -1.75, 0 + 800, 80, -2, 0 + 900, 80, -2.25, 0 + 1000, 80, -2.5, 0 + 1100, 80, 0, 0"; + + public const string CycleDrive_50_Decreasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 50, 0, 0 + 100, 50, -0.25, 0 + 200, 50, -0.5, 0 + 300, 50, -0.75, 0 + 400, 50, -1, 0 + 500, 50, -1.25, 0 + 600, 50, -1.5, 0 + 700, 50, -1.75, 0 + 800, 50, -2, 0 + 900, 50, -2.25, 0 + 1000, 50, -2.5, 0 + 1100, 50, 0, 0 "; + + public const string CycleDrive_30_Decreasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 30, 0, 0 + 100, 30, -0.25, 0 + 200, 30, -0.5, 0 + 300, 30, -0.75, 0 + 400, 30, -1, 0 + 500, 30, -1.25, 0 + 600, 30, -1.5, 0 + 700, 30, -1.75, 0 + 800, 30, -2, 0 + 900, 30, -2.25, 0 + 1000, 30, -2.5, 0 + 1100, 30, 0, 0 "; + + public const string CycleDrive_80_Dec_Increasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 100, 80, -0.25, 0 + 200, 80, -0.5, 0 + 300, 80, -0.75, 0 + 400, 80, -1, 0 + 500, 80, -1.25, 0 + 600, 80, -1.5, 0 + 700, 80, -1.75, 0 + 800, 80, -2, 0 + 900, 80, -2.25, 0 + 1000, 80, -2.5, 0 + 1100, 80, 0, 0 + 1200, 80, 0, 0 + 1300, 80, 0.25, 0 + 1400, 80, 0.5, 0 + 1500, 80, 0.75, 0 + 1600, 80, 1, 0 + 1700, 80, 1.25, 0 + 1800, 80, 1.5, 0 + 1900, 80, 1.75, 0 + 2000, 80, 2, 0 + 2100, 80, 2.25, 0 + 2200, 80, 2.5, 0 + 2300, 80, 0, 0 "; + + public const string CycleDrive_50_Dec_Increasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 50, 0, 0 + 50, 50, -0.25, 0 + 100, 50, -0.5, 0 + 150, 50, -0.75, 0 + 200, 50, -1, 0 + 250, 50, -1.25, 0 + 300, 50, -1.5, 0 + 350, 50, -1.75, 0 + 400, 50, -2, 0 + 450, 50, -2.25, 0 + 500, 50, -2.5, 0 + 550, 50, 0, 0 + 600, 50, 0, 0 + 650, 50, 0.25, 0 + 700, 50, 0.5, 0 + 750, 50, 0.75, 0 + 800, 50, 1, 0 + 850, 50, 1.25, 0 + 900, 50, 1.5, 0 + 950, 50, 1.75, 0 + 1000, 50, 2, 0 + 1050, 50, 2.25, 0 + 1100, 50, 2.5, 0 + 1150, 50, 5, 0 + 1200, 50, 0, 0 "; + + public const string CycleDrive_30_Dec_Increasing_Slope = + // <s>,<v>,<grad>,<stop> + @" 0, 30, 0, 0 + 50, 30, -0.25, 0 + 100, 30, -0.5, 0 + 150, 30, -0.75, 0 + 200, 30, -1, 0 + 250, 30, -1.25, 0 + 300, 30, -1.5, 0 + 350, 30, -1.75, 0 + 400, 30, -2, 0 + 450, 30, -2.25, 0 + 500, 30, -2.5, 0 + 550, 30, 0, 0 + 600, 30, 0, 0 + 650, 30, 0.25, 0 + 700, 30, 0.5, 0 + 750, 30, 0.75, 0 + 800, 30, 1, 0 + 850, 30, 1.25, 0 + 900, 30, 1.5, 0 + 950, 30, 1.75, 0 + 1000, 30, 2, 0 + 1050, 30, 2.25, 0 + 1100, 30, 2.5, 0 + 1150, 30, 0, 0"; + + public const string CycleDecelerateWhileBrake_80_0_level = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 990, 65, 0, 0 + 1000, 0, 0, 2"; + + public const string CycleAccelerateWhileBrake_80_0_level = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 800, 90, 0, 0 + 950, 80, 0, 0 + 1000, 0, 0, 2"; + + public const string CycleAccelerateAtBrake_80_0_level = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 505, 90, 0, 0 + 650, 80, 0, 0 + 1000, 0, 0, 2"; + + public const string CycleAccelerateBeforeBrake_80_0_level = + // <s>,<v>,<grad>,<stop> + @" 0, 80, 0, 0 + 450, 90, 0, 0 + 650, 80, 0, 0 + 1000, 0, 0, 2"; + + public const string CycleDrive_stop_85_stop_85_level = + // <s>,<v>,<grad>,<stop> + @" 0, 0, 0, 2 + 1000, 85, 0, 0 + 2000, 0, 0, 2 + 3000, 85, 0, 0"; + + public const string CycleDrive_SlopeChangeBeforeStop = + // <s>,<v>,<grad>,<stop> + @" 0, 60, -1.4, 0 + 298, 60, -1.7, 0 + 300, 0, -1.7, 4"; + + public const string CycleDriver_FrequentSlopChange = + // <s>,<v>,<grad>,<stop> + @" 0, 60, 0, 0 + 10, 60, -6, 0 + 100, 55, -6, 0 + 300, 55, -6, 0"; + + #endregion + + public static DrivingCycleData ReadDeclarationCycle(string missionType) + { + var cycleData = + RessourceHelper.ReadStream(DeclarationData.DeclarationDataResourcePrefix + ".MissionCycles." + missionType + + Constants.FileExtensions.CycleFile); + var cycle = DrivingCycleDataReader.ReadFromStream(cycleData, CycleType.DistanceBased, "", false); + return cycle; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs index 02a975cb56c53f8e0748d767be4fad16b0e9ccd0..a07878d29c25c5fed065c21b26ccfb9eab0108c5 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/FullPowertrain.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs index 03ce3ed327057b3ad399a0dd65de9f20eb7847bf..fff3f7d93b238c83a36577876a5727bad032b0fd 100644 --- a/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs +++ b/VectoCore/VectoCoreTest/Integration/SimulationRuns/MinimalPowertrain.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs b/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs index a67f0adef45c6775ecdd75854a3dc915cbc7bd45..f1191b9578a4c9904b762065ecc3c0a119a47f59 100644 --- a/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs +++ b/VectoCore/VectoCoreTest/Integration/TestVehicleIdlingSpeed.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Xml; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/VectoCore/VectoCoreTest/Integration/TorqueLimitsTest.cs b/VectoCore/VectoCoreTest/Integration/TorqueLimitsTest.cs index e3322d7fcd00ac82276d21d6f2cf69edb6b1b2f0..b48ca55f2411ad6ff81ce60b2963588cf4b0ffad 100644 --- a/VectoCore/VectoCoreTest/Integration/TorqueLimitsTest.cs +++ b/VectoCore/VectoCoreTest/Integration/TorqueLimitsTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using NUnit.Framework; diff --git a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs index e1b97d52788e51c570ef7364a8f42a1766be8c17..a3248672a7d7cef1fe7bee76f688dfb2941a88df 100644 --- a/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs +++ b/VectoCore/VectoCoreTest/Integration/Truck40tPowerTrain.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs index 24e3fbf0ecb46c2c0556a3a1940d8ef9234baaab..586dbfe8d0d5aa9618c6a471918be72f99af9eda 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/AirdragDefaultValuesTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationAdapterTestHelper.cs b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationAdapterTestHelper.cs index 8eba8dc4e78b6ac767a624a2a8b11c2320f33e3b..2f0b67c64b1b2699c76ea60b0a7af2379c1a6273 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationAdapterTestHelper.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationAdapterTestHelper.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class2.cs b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class2.cs index a2a5dbaf25d7fa7c558c3fc18c97cb08a62cba1b..46a595b612fa110680a87a9dad37bc022de5cc38 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class2.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class2.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using NUnit.Framework; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class5.cs b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class5.cs index 9a25dade0b779f87b7ab47770722c992f8bac1f2..35c66be08f8e4f6ca483567c9b35f907eb6c4d39 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class5.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class5.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using NUnit.Framework; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class9.cs b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class9.cs index f27827de8a1102d07a91b04d55f484de8ac40ce9..e4fb26bf92fbb81e19c590130aa08f53da66d334 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class9.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DataAdapter/DeclarationDataAdapterTest_Class9.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Linq; using NUnit.Framework; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index 76df184bc60ebc1f4b11b850f151849dfad047b9..8647201ea834cd3b2053723081bbfbaa3df38f7c 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using NUnit.Framework; using System; using System.IO; diff --git a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs index 1686fe09d4467ae9610160df0941d4196950dcce..06f1dab82704d9366afac338afb9b3e5d27f2922 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/ShiftPolygonTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.IO; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs index 74d2bd10cfb0ac784149156810fcdf4528cc3e66..8d73537a0b633d77c197010cf02d8adf3575159e 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/AuxTests.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs index 5c61430a62ce97e9655982ddace47fd7f31e4459..6419b916a7b296947e1ac506293932e4896c4089 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/DrivingCycleTests.cs @@ -1,392 +1,392 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.IO; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using NUnit.Framework; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.Tests.Utils; -using TUGraz.VectoCore.Utils; -using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestFixture] - public class DrivingCycleTests - { - [TestCase()] - public void TestEngineOnly() - { - var dataWriter = new MockModalDataContainer(); - var container = new VehicleContainer(ExecutionMode.Engineering, dataWriter); - - var cycleData = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\Coach Engine Only.vdri", CycleType.EngineOnly, - false); - var cycle = new PowertrainDrivingCycle(container, cycleData); - - var outPort = new MockTnOutPort(); - var inPort = cycle.InPort(); - var cycleOut = cycle.OutPort(); - - inPort.Connect(outPort); - - var absTime = 0.SI<Second>(); - var dt = 1.SI<Second>(); - - var response = cycleOut.Request(absTime, dt); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - var time = absTime + dt / 2; - var simulationInterval = dt; - container.CommitSimulationStep(time, simulationInterval); - - Assert.AreEqual(absTime, outPort.AbsTime); - Assert.AreEqual(dt, outPort.Dt); - Assert.AreEqual(600.RPMtoRad(), outPort.AngularVelocity); - Assert.AreEqual(0.SI<NewtonMeter>(), outPort.Torque); - } - - [TestCase()] - public void TestEngineOnlyWithTimestamps() - { - var container = new VehicleContainer(ExecutionMode.Engineering); - - var cycleData = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\Coach Engine Only Paux_var-dt.vdri", - CycleType.EngineOnly, false); - var cycle = new PowertrainDrivingCycle(container, cycleData); - - var outPort = new MockTnOutPort(); - var inPort = cycle.InPort(); - - inPort.Connect(outPort); - - var absTime = 0.SI<Second>(); - var dt = 5.SI<Second>(); - - var response = cycle.OutPort().Request(absTime, dt); - var timeFail = (response as ResponseFailTimeInterval); - Assert.IsInstanceOfType(response, typeof(ResponseFailTimeInterval)); - // ReSharper disable once PossibleNullReferenceException - Assert.AreEqual(0.25.SI<Second>(), timeFail.DeltaT); - - dt = timeFail.DeltaT; - - response = cycle.OutPort().Request(absTime, dt); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - container.CommitSimulationStep(absTime, dt); - - Assert.AreEqual(absTime, outPort.AbsTime); - Assert.AreEqual(dt, outPort.Dt); - Assert.AreEqual(600.RPMtoRad(), outPort.AngularVelocity); - Assert.AreEqual(0.SI<NewtonMeter>(), outPort.Torque); - - // ======================== - absTime += dt; - dt = 1.SI<Second>(); - - response = cycle.OutPort().Request(absTime, dt); - Assert.IsInstanceOfType(response, typeof(ResponseFailTimeInterval)); - - dt = ((ResponseFailTimeInterval)response).DeltaT; - Assert.AreEqual(0.5.SI<Second>(), dt); - - for (var i = 0; i < 100; i++) { - response = cycle.OutPort().Request(absTime, dt); - response.Switch() - .Case<ResponseFailTimeInterval>(r => dt = r.DeltaT) - .Case<ResponseSuccess>(r => { - container.CommitSimulationStep(absTime, dt); - Assert.AreEqual(absTime, outPort.AbsTime); - Assert.AreEqual(dt, outPort.Dt); - - if (absTime < 5) { - Assert.AreEqual(600.RPMtoRad(), outPort.AngularVelocity); - AssertHelper.AreRelativeEqual(0.SI<NewtonMeter>(), outPort.Torque, toleranceFactor: 1e-3); - } else if (absTime.IsBetween(12.75, 13.25) || absTime.IsBetween(14, 15)) { - Assert.IsTrue(outPort.AngularVelocity > 600.RPMtoRad()); - Assert.IsTrue(outPort.Torque < 0); - } else { - Assert.IsTrue(outPort.AngularVelocity > 600.RPMtoRad()); - Assert.IsTrue(outPort.Torque > 0); - } - - absTime += dt; - dt = 1.SI<Second>(); - }) - .Default(r => { throw new UnexpectedResponseException("Got an unexpected response", r); }); - } - } - - [ - // declaration mode - distance based - TestCase("<s>,<v>,<grad>,<stop>", CycleType.DistanceBased), - TestCase("<s>,<<v>,>grad>,<stop>", CycleType.DistanceBased), - - // engineering mode - distance based - TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>", CycleType.DistanceBased), - TestCase("<s>,<v>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>", CycleType.DistanceBased), - TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<Aux_ELE>,<Aux_SP>", CycleType.DistanceBased), - TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>", CycleType.DistanceBased), - TestCase("<s>,<v>,<stop>,<Padd>", CycleType.DistanceBased), - TestCase("s,v,stop,Padd", CycleType.DistanceBased), - TestCase("s,v,stop", CycleType.DistanceBased), - - // engineering mode - time based - // mk 2016-03-01: plain time based cycle does not exist anymore. replaced by measuredspeed, measuredspeed gear, engineonly and pwheel - - // engine only - TestCase("<t>,<n>,<Me>,<Padd>", CycleType.EngineOnly), - TestCase("<t>,<n>,<Me>", CycleType.EngineOnly), - TestCase("<t>,<n>,<Me>,<Pe>,<Padd>", CycleType.EngineOnly), - TestCase("<t>,<n>,<Pe>,<Padd>", CycleType.EngineOnly), - TestCase("<t>,<n>,<Pe>", CycleType.EngineOnly), - TestCase("<Me>,<n>,<Padd>,<t>", CycleType.EngineOnly), - TestCase("t,n,Me,Padd", CycleType.EngineOnly), - - // p_wheel - TestCase("<t>,<Pwheel>,<gear>,<n>,<Padd>", CycleType.PWheel), - TestCase("<gear>,<t>,<n>,<Padd>,<Pwheel>", CycleType.PWheel), - TestCase("<t>,<Pwheel>,<gear>,<n>", CycleType.PWheel), - TestCase("t,Pwheel,gear,n,Padd", CycleType.PWheel), - TestCase("Pwheel,t,gear,n,Padd", CycleType.PWheel), - - // measured speed - TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>", CycleType.MeasuredSpeed), - TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>", CycleType.MeasuredSpeed), - TestCase("<t>,<v>,<grad>,<Padd>", CycleType.MeasuredSpeed), - TestCase("<t>,<v>,<grad>,<Padd>,<Aux_ALT>,<Aux_ES>", CycleType.MeasuredSpeed), - TestCase("<t>,<v>,<grad>", CycleType.MeasuredSpeed), - TestCase("<t>,<Padd>,<grad>,<v>", CycleType.MeasuredSpeed), - TestCase("t,v,grad,Padd", CycleType.MeasuredSpeed), - TestCase("t,v,grad", CycleType.MeasuredSpeed), - - // measured speed with gear - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>", - CycleType.MeasuredSpeedGear), - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>", CycleType.MeasuredSpeedGear), - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<Aux_HVAC>,<Aux_HP>", CycleType.MeasuredSpeedGear), - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>", CycleType.MeasuredSpeedGear), - TestCase("<t>,<v>,<grad>,<n>,<gear>", CycleType.MeasuredSpeedGear), - TestCase("<n>,<Padd>,<gear>,<v>,<grad>,<t>", CycleType.MeasuredSpeedGear), - TestCase("t,v,grad,Padd,n,gear", CycleType.MeasuredSpeedGear), - ] - public void DrivingCycle_AutoDetect(string cycle, CycleType type) - { - TestCycleDetect(cycle, type); - } - - [ - // wrong cycles - TestCase("v,grad,Padd,n,gear", CycleType.MeasuredSpeedGear), - TestCase("<t>,<grad>", CycleType.MeasuredSpeed), - TestCase("<t>,<Pwheel>,<n>,<Padd>", CycleType.PWheel), - TestCase("<t>,<Pwheel>,<Pwheel>,<n>,<Padd>", CycleType.PWheel), - TestCase("<t>,<n>,<torque>,<>,<Padd>", CycleType.EngineOnly), - TestCase("x,y,z", CycleType.EngineOnly), - TestCase("x", CycleType.EngineOnly), - TestCase("", CycleType.MeasuredSpeed), - TestCase("<t>,<v>,<gear>,<Pwheel>,<s>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>", - CycleType.MeasuredSpeedGear),] - public void DrivingCycle_AutoDetect_Exception(string cycle, CycleType type) - { - AssertHelper.Exception<VectoException>(() => TestCycleDetect(cycle, type)); - } - - [ - // declaration mode - distance based - TestCase("<s>,<v>,<grad>,<stop>\n1,1,1,0", CycleType.DistanceBased, 2), - TestCase("<s>,<v>,<grad>,<stop>\n1,0,1,1", CycleType.DistanceBased, 3), - TestCase("<s>,<<v>,>grad>,<stop>\n1,1,1,0", CycleType.DistanceBased, 2), - - // engineering mode - distance based - TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1,1,1", - CycleType.DistanceBased, 2), - TestCase("<s>,<v>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>\n1,1,0,1,1,1,1,1", - CycleType.DistanceBased, 2), - TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1", CycleType.DistanceBased, 2), - TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>\n1,1,1,0,1,1,1", CycleType.DistanceBased, 2), - TestCase("<s>,<v>,<stop>,<Padd>\n1,1,0,1", CycleType.DistanceBased, 2), - TestCase("s,v,stop,Padd\n1,1,0,1", CycleType.DistanceBased, 2), - TestCase("s,v,stop\n1,1,0", CycleType.DistanceBased, 2), - - // engineering mode - time based - // mk 2016-03-01: plain time based cycle does not exist anymore. replaced by measuredspeed, measuredspeed gear, engineonly and pwheel - - // engine only - TestCase("<t>,<n>,<Me>,<Padd>\n1,1,1,1", CycleType.EngineOnly, 1), - TestCase("<t>,<n>,<Me>\n1,1,1", CycleType.EngineOnly, 1), - TestCase("<t>,<n>,<Me>,<Pe>,<Padd>\n1,1,1,1,1", CycleType.EngineOnly, 1), - TestCase("<t>,<n>,<Pe>,<Padd>\n1,1,1,1", CycleType.EngineOnly, 1), - TestCase("<t>,<n>,<Pe>\n1,1,1", CycleType.EngineOnly, 1), - TestCase("<Me>,<n>,<Padd>,<t>\n1,1,1,1", CycleType.EngineOnly, 1), - TestCase("t,n,Me,Padd\n1,1,1,1", CycleType.EngineOnly, 1), - - // p_wheel - TestCase("<t>,<Pwheel>,<gear>,<n>,<Padd>\n1,1,1,1,1", CycleType.PWheel, 1), - TestCase("<gear>,<t>,<n>,<Padd>,<Pwheel>\n1,1,1,1,1", CycleType.PWheel, 1), - TestCase("<t>,<Pwheel>,<gear>,<n>\n1,1,1,1", CycleType.PWheel, 1), - TestCase("t,Pwheel,gear,n,Padd\n1,1,1,1,1", CycleType.PWheel, 1), - TestCase("Pwheel,t,gear,n,Padd\n1,1,1,1,1", CycleType.PWheel, 1), - - // measured speed - TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,1,1,1,1,1", - CycleType.MeasuredSpeed, 1), - TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_ALT>,<Aux_ES>\n1,1,1,1,1,1,1,1", - CycleType.MeasuredSpeed, 1), - TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>\n1,1,1,1,1,1", CycleType.MeasuredSpeed, 1), - TestCase("<t>,<v>,<grad>,<Padd>\n1,1,1,1", CycleType.MeasuredSpeed, 1), - TestCase("<t>,<v>,<grad>,<Padd>,<Aux_ALT>,<Aux_ES>\n1,1,1,1,1,1", CycleType.MeasuredSpeed, 1), - TestCase("<t>,<v>,<grad>\n1,1,1", CycleType.MeasuredSpeed, 1), - TestCase("<t>,<Padd>,<grad>,<v>\n1,1,1,1", CycleType.MeasuredSpeed, 1), - TestCase("t,v,grad,Padd\n1,1,1,1", CycleType.MeasuredSpeed, 1), - TestCase("t,v,grad\n1,1,1", CycleType.MeasuredSpeed, 1), - - // measured speed with gear - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>\n1,1,1,1,1,1,1,1,1,1", - CycleType.MeasuredSpeedGear, 1), - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>\n1,1,1,1,1,1,1,1", - CycleType.MeasuredSpeedGear, 1), - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<Aux_HVAC>,<Aux_HP>\n1,1,1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), - TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>\n1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), - TestCase("<t>,<v>,<grad>,<n>,<gear>\n1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), - TestCase("<n>,<Padd>,<gear>,<v>,<grad>,<t>\n1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), - TestCase("t,v,grad,Padd,n,gear\n1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), - ] - public void DrivingCycle_Read(string cycle, CycleType type, int entryCount) - { - TestCycleRead(cycle, type, entryCount); - } - - - [ - // wrong cycles - TestCase("<s>,<v>,<grad>,<stop>\n1,1,1,1", CycleType.DistanceBased), - TestCase("v,grad,Padd,n,gear\n1,1,1,1,1", CycleType.MeasuredSpeedGear), - TestCase("<t>,<grad>\n1,1,1,1,1,1,1,1,1", CycleType.MeasuredSpeed), - TestCase("<t>,<Pwheel>,<n>,<Padd>\n1,1,1,1,1,1,1,1,1", CycleType.PWheel), - TestCase("<t>,<Pwheel>,<Pwheel>,<n>,<Padd>\n1,1,1,1,1,1,1,1,1", CycleType.PWheel), - TestCase("<t>,<n>,<torque>,<>,<Padd>\n1,1,1,1,1,1,1,1,1", CycleType.EngineOnly), - TestCase("x,y,z\n1,1,1,1,1,1,1,1,1", CycleType.EngineOnly), - TestCase("x\n1,1,1,1,1,1,1,1,1", CycleType.EngineOnly), - TestCase("\n1,1,1,1,1,1,1,1,1", CycleType.MeasuredSpeed), - TestCase( - "<t>,<v>,<gear>,<Pwheel>,<s>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>\n1,1,1,1,1,1,1,1,1", - CycleType.MeasuredSpeedGear), - ] - public void DrivingCycle_Read_Exception(string cycle, CycleType type) - { - AssertHelper.Exception<VectoException>(() => TestCycleRead(cycle, type)); - } - - [TestCase(@"TestData\Cycles\Coach.vdri", CycleType.DistanceBased), - TestCase(@"TestData\Cycles\Engine Only1.vdri", CycleType.EngineOnly), - TestCase(@"TestData\Pwheel\RD_#1_Pwheel_AuxStd.vdri", CycleType.PWheel), - TestCase(@"TestData\MeasuredSpeed\MeasuredSpeedVairAux.vdri", CycleType.MeasuredSpeed), - TestCase(@"TestData\MeasuredSpeed\MeasuredSpeed_Gear_Rural_VairAux.vdri", - CycleType.MeasuredSpeedGear), - ] - public void DrivingCycle_Detect_File(string filename, CycleType type) - { - TestCycleDetect(File.ReadAllText(filename), type); - } - - [TestCase(@"TestData\Cycles\Coach.vdri", CycleType.DistanceBased, 6116), - TestCase(@"TestData\Cycles\Engine Only1.vdri", CycleType.EngineOnly, 696), - TestCase(@"TestData\Pwheel\RD_#1_Pwheel_AuxStd.vdri", CycleType.PWheel, 3917), - TestCase(@"TestData\MeasuredSpeed\MeasuredSpeedVairAux.vdri", CycleType.MeasuredSpeed, 1300), - TestCase(@"TestData\MeasuredSpeed\MeasuredSpeed_Gear_Rural_VairAux.vdri", - CycleType.MeasuredSpeedGear, 1300), - ] - public void DrivingCycle_Read_File(string filename, CycleType type, int entryCount) - { - TestCycleRead(File.ReadAllText(filename), type, entryCount); - } - - [ - TestCase("t, Engine Speed, PTO Torque\n1,2,3", CycleType.PTO), - TestCase("t, engine speed, PTO Torque\n1,2,3", CycleType.PTO), - TestCase("t, Engine Speed, pto torque\n1,2,3", CycleType.PTO), - TestCase("t, engine speed, pto torque\n1,2,3", CycleType.PTO), - TestCase("T, ENGINE SPEED, PTO TORQUE\n1,2,3", CycleType.PTO), - TestCase("<Me>,<n>,<Padd>,<t>\n1,1,1,1", CycleType.EngineOnly), - TestCase("t,n,Me,Padd\n1,1,1,1", CycleType.EngineOnly), - TestCase("<s>,<v>,<Grad>,<STOP>\n1,0,1,1", CycleType.DistanceBased), - TestCase("<s>,<V>,<grad>,<stop>,<PADD>,<vAir_res>,<vAir_Beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1,1,1", - CycleType.DistanceBased), - TestCase("<S>,<v>,<stop>,<pAdd>,<Vair_res>,<vair_BETA>,<Aux_ELE>,<Aux_SP>\n1,1,0,1,1,1,1,1", - CycleType.DistanceBased) - ] - public void DrivingCycleDetect_CaseInsensitive(string cycle, CycleType type) - { - TestCycleDetect(cycle, type); - } - - [ - TestCase("t, Engine Speed, PTO Torque\n1,2,3", CycleType.PTO, 1), - TestCase("t, engine speed, PTO Torque\n1,2,3", CycleType.PTO, 1), - TestCase("t, Engine Speed, pto torque\n1,2,3", CycleType.PTO, 1), - TestCase("t, engine speed, pto torque\n1,2,3", CycleType.PTO, 1), - TestCase("T, ENGINE SPEED, PTO TORQUE\n1,2,3", CycleType.PTO, 1), - TestCase("<Me>,<n>,<Padd>,<t>\n1,1,1,1", CycleType.EngineOnly, 1), - TestCase("t,n,Me,Padd\n1,1,1,1", CycleType.EngineOnly, 1), - TestCase("<s>,<v>,<Grad>,<STOP>\n1,0,1,1", CycleType.DistanceBased, 3), - TestCase("<s>,<V>,<grad>,<stop>,<PADD>,<vAir_res>,<vAir_Beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1,1,1", - CycleType.DistanceBased, 2), - TestCase("<S>,<v>,<stop>,<pAdd>,<Vair_res>,<vair_BETA>,<Aux_ELE>,<Aux_SP>\n1,1,0,1,1,1,1,1", - CycleType.DistanceBased, 2) - ] - public void DrivingCycleRead_CaseInsensitive(string cycle, CycleType type, int entryCount) - { - TestCycleRead(cycle, type, entryCount); - } - - private static void TestCycleDetect(string inputData, CycleType cycleType) - { - var cycleTypeCalc = DrivingCycleDataReader.DetectCycleType(VectoCSVFile.ReadStream(inputData.ToStream())); - Assert.AreEqual(cycleType, cycleTypeCalc); - } - - private static void TestCycleRead(string inputData, CycleType cycleType, int entryCount = 1) - { - var drivingCycle = DrivingCycleDataReader.ReadFromStream(inputData.ToStream(), cycleType, "", false); - Assert.AreEqual(cycleType, drivingCycle.CycleType); - Assert.AreEqual(entryCount, drivingCycle.Entries.Count, "Driving Cycle Entry count."); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NUnit.Framework; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Utils; +using TUGraz.VectoCore.Utils; +using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestFixture] + public class DrivingCycleTests + { + [TestCase()] + public void TestEngineOnly() + { + var dataWriter = new MockModalDataContainer(); + var container = new VehicleContainer(ExecutionMode.Engineering, dataWriter); + + var cycleData = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\Coach Engine Only.vdri", CycleType.EngineOnly, + false); + var cycle = new PowertrainDrivingCycle(container, cycleData); + + var outPort = new MockTnOutPort(); + var inPort = cycle.InPort(); + var cycleOut = cycle.OutPort(); + + inPort.Connect(outPort); + + var absTime = 0.SI<Second>(); + var dt = 1.SI<Second>(); + + var response = cycleOut.Request(absTime, dt); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + var time = absTime + dt / 2; + var simulationInterval = dt; + container.CommitSimulationStep(time, simulationInterval); + + Assert.AreEqual(absTime, outPort.AbsTime); + Assert.AreEqual(dt, outPort.Dt); + Assert.AreEqual(600.RPMtoRad(), outPort.AngularVelocity); + Assert.AreEqual(0.SI<NewtonMeter>(), outPort.Torque); + } + + [TestCase()] + public void TestEngineOnlyWithTimestamps() + { + var container = new VehicleContainer(ExecutionMode.Engineering); + + var cycleData = DrivingCycleDataReader.ReadFromFile(@"TestData\Cycles\Coach Engine Only Paux_var-dt.vdri", + CycleType.EngineOnly, false); + var cycle = new PowertrainDrivingCycle(container, cycleData); + + var outPort = new MockTnOutPort(); + var inPort = cycle.InPort(); + + inPort.Connect(outPort); + + var absTime = 0.SI<Second>(); + var dt = 5.SI<Second>(); + + var response = cycle.OutPort().Request(absTime, dt); + var timeFail = (response as ResponseFailTimeInterval); + Assert.IsInstanceOfType(response, typeof(ResponseFailTimeInterval)); + // ReSharper disable once PossibleNullReferenceException + Assert.AreEqual(0.25.SI<Second>(), timeFail.DeltaT); + + dt = timeFail.DeltaT; + + response = cycle.OutPort().Request(absTime, dt); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + container.CommitSimulationStep(absTime, dt); + + Assert.AreEqual(absTime, outPort.AbsTime); + Assert.AreEqual(dt, outPort.Dt); + Assert.AreEqual(600.RPMtoRad(), outPort.AngularVelocity); + Assert.AreEqual(0.SI<NewtonMeter>(), outPort.Torque); + + // ======================== + absTime += dt; + dt = 1.SI<Second>(); + + response = cycle.OutPort().Request(absTime, dt); + Assert.IsInstanceOfType(response, typeof(ResponseFailTimeInterval)); + + dt = ((ResponseFailTimeInterval)response).DeltaT; + Assert.AreEqual(0.5.SI<Second>(), dt); + + for (var i = 0; i < 100; i++) { + response = cycle.OutPort().Request(absTime, dt); + response.Switch() + .Case<ResponseFailTimeInterval>(r => dt = r.DeltaT) + .Case<ResponseSuccess>(r => { + container.CommitSimulationStep(absTime, dt); + Assert.AreEqual(absTime, outPort.AbsTime); + Assert.AreEqual(dt, outPort.Dt); + + if (absTime < 5) { + Assert.AreEqual(600.RPMtoRad(), outPort.AngularVelocity); + AssertHelper.AreRelativeEqual(0.SI<NewtonMeter>(), outPort.Torque, toleranceFactor: 1e-3); + } else if (absTime.IsBetween(12.75, 13.25) || absTime.IsBetween(14, 15)) { + Assert.IsTrue(outPort.AngularVelocity > 600.RPMtoRad()); + Assert.IsTrue(outPort.Torque < 0); + } else { + Assert.IsTrue(outPort.AngularVelocity > 600.RPMtoRad()); + Assert.IsTrue(outPort.Torque > 0); + } + + absTime += dt; + dt = 1.SI<Second>(); + }) + .Default(r => { throw new UnexpectedResponseException("Got an unexpected response", r); }); + } + } + + [ + // declaration mode - distance based + TestCase("<s>,<v>,<grad>,<stop>", CycleType.DistanceBased), + TestCase("<s>,<<v>,>grad>,<stop>", CycleType.DistanceBased), + + // engineering mode - distance based + TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>", CycleType.DistanceBased), + TestCase("<s>,<v>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>", CycleType.DistanceBased), + TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<Aux_ELE>,<Aux_SP>", CycleType.DistanceBased), + TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>", CycleType.DistanceBased), + TestCase("<s>,<v>,<stop>,<Padd>", CycleType.DistanceBased), + TestCase("s,v,stop,Padd", CycleType.DistanceBased), + TestCase("s,v,stop", CycleType.DistanceBased), + + // engineering mode - time based + // mk 2016-03-01: plain time based cycle does not exist anymore. replaced by measuredspeed, measuredspeed gear, engineonly and pwheel + + // engine only + TestCase("<t>,<n>,<Me>,<Padd>", CycleType.EngineOnly), + TestCase("<t>,<n>,<Me>", CycleType.EngineOnly), + TestCase("<t>,<n>,<Me>,<Pe>,<Padd>", CycleType.EngineOnly), + TestCase("<t>,<n>,<Pe>,<Padd>", CycleType.EngineOnly), + TestCase("<t>,<n>,<Pe>", CycleType.EngineOnly), + TestCase("<Me>,<n>,<Padd>,<t>", CycleType.EngineOnly), + TestCase("t,n,Me,Padd", CycleType.EngineOnly), + + // p_wheel + TestCase("<t>,<Pwheel>,<gear>,<n>,<Padd>", CycleType.PWheel), + TestCase("<gear>,<t>,<n>,<Padd>,<Pwheel>", CycleType.PWheel), + TestCase("<t>,<Pwheel>,<gear>,<n>", CycleType.PWheel), + TestCase("t,Pwheel,gear,n,Padd", CycleType.PWheel), + TestCase("Pwheel,t,gear,n,Padd", CycleType.PWheel), + + // measured speed + TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>", CycleType.MeasuredSpeed), + TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>", CycleType.MeasuredSpeed), + TestCase("<t>,<v>,<grad>,<Padd>", CycleType.MeasuredSpeed), + TestCase("<t>,<v>,<grad>,<Padd>,<Aux_ALT>,<Aux_ES>", CycleType.MeasuredSpeed), + TestCase("<t>,<v>,<grad>", CycleType.MeasuredSpeed), + TestCase("<t>,<Padd>,<grad>,<v>", CycleType.MeasuredSpeed), + TestCase("t,v,grad,Padd", CycleType.MeasuredSpeed), + TestCase("t,v,grad", CycleType.MeasuredSpeed), + + // measured speed with gear + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>", + CycleType.MeasuredSpeedGear), + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>", CycleType.MeasuredSpeedGear), + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<Aux_HVAC>,<Aux_HP>", CycleType.MeasuredSpeedGear), + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>", CycleType.MeasuredSpeedGear), + TestCase("<t>,<v>,<grad>,<n>,<gear>", CycleType.MeasuredSpeedGear), + TestCase("<n>,<Padd>,<gear>,<v>,<grad>,<t>", CycleType.MeasuredSpeedGear), + TestCase("t,v,grad,Padd,n,gear", CycleType.MeasuredSpeedGear), + ] + public void DrivingCycle_AutoDetect(string cycle, CycleType type) + { + TestCycleDetect(cycle, type); + } + + [ + // wrong cycles + TestCase("v,grad,Padd,n,gear", CycleType.MeasuredSpeedGear), + TestCase("<t>,<grad>", CycleType.MeasuredSpeed), + TestCase("<t>,<Pwheel>,<n>,<Padd>", CycleType.PWheel), + TestCase("<t>,<Pwheel>,<Pwheel>,<n>,<Padd>", CycleType.PWheel), + TestCase("<t>,<n>,<torque>,<>,<Padd>", CycleType.EngineOnly), + TestCase("x,y,z", CycleType.EngineOnly), + TestCase("x", CycleType.EngineOnly), + TestCase("", CycleType.MeasuredSpeed), + TestCase("<t>,<v>,<gear>,<Pwheel>,<s>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>", + CycleType.MeasuredSpeedGear),] + public void DrivingCycle_AutoDetect_Exception(string cycle, CycleType type) + { + AssertHelper.Exception<VectoException>(() => TestCycleDetect(cycle, type)); + } + + [ + // declaration mode - distance based + TestCase("<s>,<v>,<grad>,<stop>\n1,1,1,0", CycleType.DistanceBased, 2), + TestCase("<s>,<v>,<grad>,<stop>\n1,0,1,1", CycleType.DistanceBased, 3), + TestCase("<s>,<<v>,>grad>,<stop>\n1,1,1,0", CycleType.DistanceBased, 2), + + // engineering mode - distance based + TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1,1,1", + CycleType.DistanceBased, 2), + TestCase("<s>,<v>,<stop>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>\n1,1,0,1,1,1,1,1", + CycleType.DistanceBased, 2), + TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1", CycleType.DistanceBased, 2), + TestCase("<s>,<v>,<grad>,<stop>,<Padd>,<vair_res>,<vair_beta>\n1,1,1,0,1,1,1", CycleType.DistanceBased, 2), + TestCase("<s>,<v>,<stop>,<Padd>\n1,1,0,1", CycleType.DistanceBased, 2), + TestCase("s,v,stop,Padd\n1,1,0,1", CycleType.DistanceBased, 2), + TestCase("s,v,stop\n1,1,0", CycleType.DistanceBased, 2), + + // engineering mode - time based + // mk 2016-03-01: plain time based cycle does not exist anymore. replaced by measuredspeed, measuredspeed gear, engineonly and pwheel + + // engine only + TestCase("<t>,<n>,<Me>,<Padd>\n1,1,1,1", CycleType.EngineOnly, 1), + TestCase("<t>,<n>,<Me>\n1,1,1", CycleType.EngineOnly, 1), + TestCase("<t>,<n>,<Me>,<Pe>,<Padd>\n1,1,1,1,1", CycleType.EngineOnly, 1), + TestCase("<t>,<n>,<Pe>,<Padd>\n1,1,1,1", CycleType.EngineOnly, 1), + TestCase("<t>,<n>,<Pe>\n1,1,1", CycleType.EngineOnly, 1), + TestCase("<Me>,<n>,<Padd>,<t>\n1,1,1,1", CycleType.EngineOnly, 1), + TestCase("t,n,Me,Padd\n1,1,1,1", CycleType.EngineOnly, 1), + + // p_wheel + TestCase("<t>,<Pwheel>,<gear>,<n>,<Padd>\n1,1,1,1,1", CycleType.PWheel, 1), + TestCase("<gear>,<t>,<n>,<Padd>,<Pwheel>\n1,1,1,1,1", CycleType.PWheel, 1), + TestCase("<t>,<Pwheel>,<gear>,<n>\n1,1,1,1", CycleType.PWheel, 1), + TestCase("t,Pwheel,gear,n,Padd\n1,1,1,1,1", CycleType.PWheel, 1), + TestCase("Pwheel,t,gear,n,Padd\n1,1,1,1,1", CycleType.PWheel, 1), + + // measured speed + TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,1,1,1,1,1", + CycleType.MeasuredSpeed, 1), + TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>,<Aux_ALT>,<Aux_ES>\n1,1,1,1,1,1,1,1", + CycleType.MeasuredSpeed, 1), + TestCase("<t>,<v>,<grad>,<Padd>,<vair_res>,<vair_beta>\n1,1,1,1,1,1", CycleType.MeasuredSpeed, 1), + TestCase("<t>,<v>,<grad>,<Padd>\n1,1,1,1", CycleType.MeasuredSpeed, 1), + TestCase("<t>,<v>,<grad>,<Padd>,<Aux_ALT>,<Aux_ES>\n1,1,1,1,1,1", CycleType.MeasuredSpeed, 1), + TestCase("<t>,<v>,<grad>\n1,1,1", CycleType.MeasuredSpeed, 1), + TestCase("<t>,<Padd>,<grad>,<v>\n1,1,1,1", CycleType.MeasuredSpeed, 1), + TestCase("t,v,grad,Padd\n1,1,1,1", CycleType.MeasuredSpeed, 1), + TestCase("t,v,grad\n1,1,1", CycleType.MeasuredSpeed, 1), + + // measured speed with gear + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>\n1,1,1,1,1,1,1,1,1,1", + CycleType.MeasuredSpeedGear, 1), + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>\n1,1,1,1,1,1,1,1", + CycleType.MeasuredSpeedGear, 1), + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>,<Aux_HVAC>,<Aux_HP>\n1,1,1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), + TestCase("<t>,<v>,<grad>,<Padd>,<n>,<gear>\n1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), + TestCase("<t>,<v>,<grad>,<n>,<gear>\n1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), + TestCase("<n>,<Padd>,<gear>,<v>,<grad>,<t>\n1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), + TestCase("t,v,grad,Padd,n,gear\n1,1,1,1,1,1", CycleType.MeasuredSpeedGear, 1), + ] + public void DrivingCycle_Read(string cycle, CycleType type, int entryCount) + { + TestCycleRead(cycle, type, entryCount); + } + + + [ + // wrong cycles + TestCase("<s>,<v>,<grad>,<stop>\n1,1,1,1", CycleType.DistanceBased), + TestCase("v,grad,Padd,n,gear\n1,1,1,1,1", CycleType.MeasuredSpeedGear), + TestCase("<t>,<grad>\n1,1,1,1,1,1,1,1,1", CycleType.MeasuredSpeed), + TestCase("<t>,<Pwheel>,<n>,<Padd>\n1,1,1,1,1,1,1,1,1", CycleType.PWheel), + TestCase("<t>,<Pwheel>,<Pwheel>,<n>,<Padd>\n1,1,1,1,1,1,1,1,1", CycleType.PWheel), + TestCase("<t>,<n>,<torque>,<>,<Padd>\n1,1,1,1,1,1,1,1,1", CycleType.EngineOnly), + TestCase("x,y,z\n1,1,1,1,1,1,1,1,1", CycleType.EngineOnly), + TestCase("x\n1,1,1,1,1,1,1,1,1", CycleType.EngineOnly), + TestCase("\n1,1,1,1,1,1,1,1,1", CycleType.MeasuredSpeed), + TestCase( + "<t>,<v>,<gear>,<Pwheel>,<s>,<grad>,<Padd>,<n>,<gear>,<vair_res>,<vair_beta>,<Aux_HVAC>,<Aux_HP>\n1,1,1,1,1,1,1,1,1", + CycleType.MeasuredSpeedGear), + ] + public void DrivingCycle_Read_Exception(string cycle, CycleType type) + { + AssertHelper.Exception<VectoException>(() => TestCycleRead(cycle, type)); + } + + [TestCase(@"TestData\Cycles\Coach.vdri", CycleType.DistanceBased), + TestCase(@"TestData\Cycles\Engine Only1.vdri", CycleType.EngineOnly), + TestCase(@"TestData\Pwheel\RD_#1_Pwheel_AuxStd.vdri", CycleType.PWheel), + TestCase(@"TestData\MeasuredSpeed\MeasuredSpeedVairAux.vdri", CycleType.MeasuredSpeed), + TestCase(@"TestData\MeasuredSpeed\MeasuredSpeed_Gear_Rural_VairAux.vdri", + CycleType.MeasuredSpeedGear), + ] + public void DrivingCycle_Detect_File(string filename, CycleType type) + { + TestCycleDetect(File.ReadAllText(filename), type); + } + + [TestCase(@"TestData\Cycles\Coach.vdri", CycleType.DistanceBased, 6116), + TestCase(@"TestData\Cycles\Engine Only1.vdri", CycleType.EngineOnly, 696), + TestCase(@"TestData\Pwheel\RD_#1_Pwheel_AuxStd.vdri", CycleType.PWheel, 3917), + TestCase(@"TestData\MeasuredSpeed\MeasuredSpeedVairAux.vdri", CycleType.MeasuredSpeed, 1300), + TestCase(@"TestData\MeasuredSpeed\MeasuredSpeed_Gear_Rural_VairAux.vdri", + CycleType.MeasuredSpeedGear, 1300), + ] + public void DrivingCycle_Read_File(string filename, CycleType type, int entryCount) + { + TestCycleRead(File.ReadAllText(filename), type, entryCount); + } + + [ + TestCase("t, Engine Speed, PTO Torque\n1,2,3", CycleType.PTO), + TestCase("t, engine speed, PTO Torque\n1,2,3", CycleType.PTO), + TestCase("t, Engine Speed, pto torque\n1,2,3", CycleType.PTO), + TestCase("t, engine speed, pto torque\n1,2,3", CycleType.PTO), + TestCase("T, ENGINE SPEED, PTO TORQUE\n1,2,3", CycleType.PTO), + TestCase("<Me>,<n>,<Padd>,<t>\n1,1,1,1", CycleType.EngineOnly), + TestCase("t,n,Me,Padd\n1,1,1,1", CycleType.EngineOnly), + TestCase("<s>,<v>,<Grad>,<STOP>\n1,0,1,1", CycleType.DistanceBased), + TestCase("<s>,<V>,<grad>,<stop>,<PADD>,<vAir_res>,<vAir_Beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1,1,1", + CycleType.DistanceBased), + TestCase("<S>,<v>,<stop>,<pAdd>,<Vair_res>,<vair_BETA>,<Aux_ELE>,<Aux_SP>\n1,1,0,1,1,1,1,1", + CycleType.DistanceBased) + ] + public void DrivingCycleDetect_CaseInsensitive(string cycle, CycleType type) + { + TestCycleDetect(cycle, type); + } + + [ + TestCase("t, Engine Speed, PTO Torque\n1,2,3", CycleType.PTO, 1), + TestCase("t, engine speed, PTO Torque\n1,2,3", CycleType.PTO, 1), + TestCase("t, Engine Speed, pto torque\n1,2,3", CycleType.PTO, 1), + TestCase("t, engine speed, pto torque\n1,2,3", CycleType.PTO, 1), + TestCase("T, ENGINE SPEED, PTO TORQUE\n1,2,3", CycleType.PTO, 1), + TestCase("<Me>,<n>,<Padd>,<t>\n1,1,1,1", CycleType.EngineOnly, 1), + TestCase("t,n,Me,Padd\n1,1,1,1", CycleType.EngineOnly, 1), + TestCase("<s>,<v>,<Grad>,<STOP>\n1,0,1,1", CycleType.DistanceBased, 3), + TestCase("<s>,<V>,<grad>,<stop>,<PADD>,<vAir_res>,<vAir_Beta>,<Aux_ELE>,<Aux_SP>\n1,1,1,0,1,1,1,1,1", + CycleType.DistanceBased, 2), + TestCase("<S>,<v>,<stop>,<pAdd>,<Vair_res>,<vair_BETA>,<Aux_ELE>,<Aux_SP>\n1,1,0,1,1,1,1,1", + CycleType.DistanceBased, 2) + ] + public void DrivingCycleRead_CaseInsensitive(string cycle, CycleType type, int entryCount) + { + TestCycleRead(cycle, type, entryCount); + } + + private static void TestCycleDetect(string inputData, CycleType cycleType) + { + var cycleTypeCalc = DrivingCycleDataReader.DetectCycleType(VectoCSVFile.ReadStream(inputData.ToStream())); + Assert.AreEqual(cycleType, cycleTypeCalc); + } + + private static void TestCycleRead(string inputData, CycleType cycleType, int entryCount = 1) + { + var drivingCycle = DrivingCycleDataReader.ReadFromStream(inputData.ToStream(), cycleType, "", false); + Assert.AreEqual(cycleType, drivingCycle.CycleType); + Assert.AreEqual(entryCount, drivingCycle.Entries.Count, "Driving Cycle Entry count."); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs index 33e34a4352349c24469013c8bb3bf6e0c8ca23d2..7f29f6e73e9d6c4311e14d4f61464388ac2229d4 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/FactoryTest.cs @@ -1,123 +1,123 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.FileIO.JSON; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.OutputData.FileIO; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestClass] - public class FactoryTest - { - public const string DeclarationJobFile = @"Testdata\Jobs\12t Delivery Truck.vecto"; - - public const string EngineeringJobFile = @"Testdata\Jobs\24t Coach.vecto"; - - [TestMethod] - public void CreateDeclarationSimulationRun() - { - var fileWriter = new FileOutputWriter(DeclarationJobFile); - - var inputData = JSONInputDataFactory.ReadJsonJob(DeclarationJobFile); - var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, fileWriter); - - //factory.DataReader.SetJobFile(DeclarationJobFile); - - var run = factory.SimulationRuns().First(); - var vehicleContainer = (VehicleContainer)run.GetContainer(); - - Assert.AreEqual(11, vehicleContainer.SimulationComponents().Count); - - Assert.IsInstanceOfType(vehicleContainer.Gearbox, typeof(Gearbox), "gearbox not installed"); - Assert.IsInstanceOfType(vehicleContainer.Engine, typeof(CombustionEngine), "engine not installed"); - Assert.IsInstanceOfType(vehicleContainer.Vehicle, typeof(Vehicle), "vehicle not installed"); - - var gearbox = vehicleContainer.Gearbox as Gearbox; - Assert.IsNotNull(gearbox); - - // -- shiftpolygon downshift - - // no downshift curve in first gear! - Assert.AreEqual(660.RPMtoRad().Value(), gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[0].AngularSpeed.Value(), - 0.0001); - Assert.AreEqual(-163.9, gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[0].Torque.Value(), 0.0001); - - Assert.AreEqual(660.RPMtoRad().Value(), gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[1].AngularSpeed.Value(), - 0.0001); - Assert.AreEqual(257.9742, gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[1].Torque.Value(), 0.1); - - Assert.AreEqual(1679.9982.RPMtoRad().Value(), - gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[2].AngularSpeed.Value(), - 0.1); - Assert.AreEqual(988.9, gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[2].Torque.Value(), 0.0001); - - // -- shiftpolygon upshift - - Assert.AreEqual(1889.66433.RPMtoRad().Value(), - gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[0].AngularSpeed.Value(), - 0.1); - Assert.AreEqual(-163.9, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[0].Torque.Value(), 0.0001); - - Assert.AreEqual(1889.66433.RPMtoRad().Value(), - gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[1].AngularSpeed.Value(), - 0.1); - Assert.AreEqual(245.3663, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[1].Torque.Value(), 0.1); - - Assert.AreEqual(5793.0409.RPMtoRad().Value(), gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[2].AngularSpeed.Value(), - 0.1); - Assert.AreEqual(988.9, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[2].Torque.Value(), 0.1); - } - - [TestMethod] - public void CreateEngineeringSimulationRun() - { - var fileWriter = new FileOutputWriter(EngineeringJobFile); - - var inputData = JSONInputDataFactory.ReadJsonJob(EngineeringJobFile); - var factory = new SimulatorFactory(ExecutionMode.Engineering, inputData, fileWriter); - - var run = factory.SimulationRuns().First(); - - var vehicleContainer = (VehicleContainer)run.GetContainer(); - Assert.AreEqual(12, vehicleContainer.SimulationComponents().Count); - - Assert.IsInstanceOfType(vehicleContainer.Gearbox, typeof(Gearbox), "gearbox not installed"); - Assert.IsInstanceOfType(vehicleContainer.Engine, typeof(CombustionEngine), "engine not installed"); - Assert.IsInstanceOfType(vehicleContainer.Vehicle, typeof(Vehicle), "vehicle not installed"); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.OutputData.FileIO; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestClass] + public class FactoryTest + { + public const string DeclarationJobFile = @"Testdata\Jobs\12t Delivery Truck.vecto"; + + public const string EngineeringJobFile = @"Testdata\Jobs\24t Coach.vecto"; + + [TestMethod] + public void CreateDeclarationSimulationRun() + { + var fileWriter = new FileOutputWriter(DeclarationJobFile); + + var inputData = JSONInputDataFactory.ReadJsonJob(DeclarationJobFile); + var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, fileWriter); + + //factory.DataReader.SetJobFile(DeclarationJobFile); + + var run = factory.SimulationRuns().First(); + var vehicleContainer = (VehicleContainer)run.GetContainer(); + + Assert.AreEqual(11, vehicleContainer.SimulationComponents().Count); + + Assert.IsInstanceOfType(vehicleContainer.Gearbox, typeof(Gearbox), "gearbox not installed"); + Assert.IsInstanceOfType(vehicleContainer.Engine, typeof(CombustionEngine), "engine not installed"); + Assert.IsInstanceOfType(vehicleContainer.Vehicle, typeof(Vehicle), "vehicle not installed"); + + var gearbox = vehicleContainer.Gearbox as Gearbox; + Assert.IsNotNull(gearbox); + + // -- shiftpolygon downshift + + // no downshift curve in first gear! + Assert.AreEqual(660.RPMtoRad().Value(), gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[0].AngularSpeed.Value(), + 0.0001); + Assert.AreEqual(-163.9, gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[0].Torque.Value(), 0.0001); + + Assert.AreEqual(660.RPMtoRad().Value(), gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[1].AngularSpeed.Value(), + 0.0001); + Assert.AreEqual(257.9742, gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[1].Torque.Value(), 0.1); + + Assert.AreEqual(1679.9982.RPMtoRad().Value(), + gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[2].AngularSpeed.Value(), + 0.1); + Assert.AreEqual(988.9, gearbox.ModelData.Gears[2].ShiftPolygon.Downshift[2].Torque.Value(), 0.0001); + + // -- shiftpolygon upshift + + Assert.AreEqual(1889.66433.RPMtoRad().Value(), + gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[0].AngularSpeed.Value(), + 0.1); + Assert.AreEqual(-163.9, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[0].Torque.Value(), 0.0001); + + Assert.AreEqual(1889.66433.RPMtoRad().Value(), + gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[1].AngularSpeed.Value(), + 0.1); + Assert.AreEqual(245.3663, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[1].Torque.Value(), 0.1); + + Assert.AreEqual(5793.0409.RPMtoRad().Value(), gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[2].AngularSpeed.Value(), + 0.1); + Assert.AreEqual(988.9, gearbox.ModelData.Gears[1].ShiftPolygon.Upshift[2].Torque.Value(), 0.1); + } + + [TestMethod] + public void CreateEngineeringSimulationRun() + { + var fileWriter = new FileOutputWriter(EngineeringJobFile); + + var inputData = JSONInputDataFactory.ReadJsonJob(EngineeringJobFile); + var factory = new SimulatorFactory(ExecutionMode.Engineering, inputData, fileWriter); + + var run = factory.SimulationRuns().First(); + + var vehicleContainer = (VehicleContainer)run.GetContainer(); + Assert.AreEqual(12, vehicleContainer.SimulationComponents().Count); + + Assert.IsInstanceOfType(vehicleContainer.Gearbox, typeof(Gearbox), "gearbox not installed"); + Assert.IsInstanceOfType(vehicleContainer.Engine, typeof(CombustionEngine), "engine not installed"); + Assert.IsInstanceOfType(vehicleContainer.Vehicle, typeof(Vehicle), "vehicle not installed"); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/GearboxInertiaTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/GearboxInertiaTest.cs index 788e273961ba4757510e9bcde95f52b0ac0587e0..133658952cf04eb037a35579bd305ae52bb02c4c 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/GearboxInertiaTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/GearboxInertiaTest.cs @@ -1,55 +1,55 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Tests.Integration; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestFixture] - public class GearboxInertiaTest - { - [Test] - public void RunWithGearboxInertia() - { - var cycleData = "0, 0, 0, 2\n" + - "1000, 80, 0, 0"; - - var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); - var run = CoachPowerTrain.CreateEngineeringRun(cycle, "RunWithGearboxInertia.vmod", - gearBoxInertia: 0.12.SI<KilogramSquareMeter>()); - - run.Run(); - Assert.IsTrue(run.FinishedWithoutErrors); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Tests.Integration; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestFixture] + public class GearboxInertiaTest + { + [Test] + public void RunWithGearboxInertia() + { + var cycleData = "0, 0, 0, 2\n" + + "1000, 80, 0, 0"; + + var cycle = SimpleDrivingCycles.CreateCycleData(cycleData); + var run = CoachPowerTrain.CreateEngineeringRun(cycle, "RunWithGearboxInertia.vmod", + gearBoxInertia: 0.12.SI<KilogramSquareMeter>()); + + run.Run(); + Assert.IsTrue(run.FinishedWithoutErrors); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/GetSectionTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/GetSectionTest.cs index 38c2d56e0ff053cfeb7d909506c3246b0dfdefbb..dc63c248cc99fd8edc2f7942788a7482f99f7601 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/GetSectionTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/GetSectionTest.cs @@ -1,95 +1,95 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestFixture] - public class GetSectionTests - { - public class Entry - { - public readonly PerSecond EngineSpeed; - public NewtonMeter Torque; - - public Entry(PerSecond engineSpeed, NewtonMeter torque) - { - EngineSpeed = engineSpeed; - Torque = torque; - } - } - - [Test] - public void TestGetSection() - { - var entries = new List<Entry>(); - for (var i = 0; i < 10; i++) { - entries.Add(new Entry(i.RPMtoRad(), i.SI<NewtonMeter>())); - } - var entryArr = entries.ToArray(); - - foreach (var val in new[] { -1, 0, 1, 5, 8, 9, 10 }) { - var sw = Stopwatch.StartNew(); - var s = entries.GetSection(e => val > e.EngineSpeed); - sw.Stop(); - //Console.WriteLine("Iterator: " + sw.Elapsed); - - sw.Restart(); - var s1 = entryArr.GetSection(e => val > e.EngineSpeed); - sw.Stop(); - //Console.WriteLine("Array: " + sw.Elapsed); - - Assert.AreSame(s.Item1, s1.Item1); - Assert.AreSame(s.Item2, s1.Item2); - } - - foreach (var val in new[] { -1, 0, 1, 5, 8, 9, 10 }) { - var sw = Stopwatch.StartNew(); - var s = entries.GetSection(e => val < e.EngineSpeed); - sw.Stop(); - //Console.WriteLine("Iterator: " + sw.Elapsed); - - sw.Restart(); - var s1 = entryArr.GetSection(e => val < e.EngineSpeed); - sw.Stop(); - //Console.WriteLine("Array: " + sw.Elapsed); - - Assert.AreSame(s.Item1, s1.Item1); - Assert.AreSame(s.Item2, s1.Item2); - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestFixture] + public class GetSectionTests + { + public class Entry + { + public readonly PerSecond EngineSpeed; + public NewtonMeter Torque; + + public Entry(PerSecond engineSpeed, NewtonMeter torque) + { + EngineSpeed = engineSpeed; + Torque = torque; + } + } + + [Test] + public void TestGetSection() + { + var entries = new List<Entry>(); + for (var i = 0; i < 10; i++) { + entries.Add(new Entry(i.RPMtoRad(), i.SI<NewtonMeter>())); + } + var entryArr = entries.ToArray(); + + foreach (var val in new[] { -1, 0, 1, 5, 8, 9, 10 }) { + var sw = Stopwatch.StartNew(); + var s = entries.GetSection(e => val > e.EngineSpeed); + sw.Stop(); + //Console.WriteLine("Iterator: " + sw.Elapsed); + + sw.Restart(); + var s1 = entryArr.GetSection(e => val > e.EngineSpeed); + sw.Stop(); + //Console.WriteLine("Array: " + sw.Elapsed); + + Assert.AreSame(s.Item1, s1.Item1); + Assert.AreSame(s.Item2, s1.Item2); + } + + foreach (var val in new[] { -1, 0, 1, 5, 8, 9, 10 }) { + var sw = Stopwatch.StartNew(); + var s = entries.GetSection(e => val < e.EngineSpeed); + sw.Stop(); + //Console.WriteLine("Iterator: " + sw.Elapsed); + + sw.Restart(); + var s1 = entryArr.GetSection(e => val < e.EngineSpeed); + sw.Stop(); + //Console.WriteLine("Array: " + sw.Elapsed); + + Assert.AreSame(s.Item1, s1.Item1); + Assert.AreSame(s.Item2, s1.Item2); + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs index 0c9283be9ecaa633ffcd1954fa1d8087cdac0a9b..17e5101ae737e34ded3f5a0ca61d95270887762d 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LACDecisionFactorTest.cs @@ -1,65 +1,65 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestClass] - public class LACDecisionFactorTest - { - [TestMethod] - public void LAC_DF_Test() - { - for (var vVehicle = 0.SI<MeterPerSecond>(); - vVehicle < 100.KMPHtoMeterPerSecond(); - vVehicle += 1.KMPHtoMeterPerSecond()) { - for (var vTarget = vVehicle; vTarget > 0; vTarget -= 1.KMPHtoMeterPerSecond()) { - var df_coast = new LACDecisionFactor().Lookup(vTarget, vVehicle - vTarget); - if (vTarget < 48.KMPHtoMeterPerSecond()) { - AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); - } - - if (vVehicle - vTarget > 11) { - AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); - } - - if (vTarget > 52.KMPHtoMeterPerSecond() && vVehicle - vTarget < 9.KMPHtoMeterPerSecond()) { - AssertHelper.AreRelativeEqual(df_coast, 1.0, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); - } - } - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestClass] + public class LACDecisionFactorTest + { + [TestMethod] + public void LAC_DF_Test() + { + for (var vVehicle = 0.SI<MeterPerSecond>(); + vVehicle < 100.KMPHtoMeterPerSecond(); + vVehicle += 1.KMPHtoMeterPerSecond()) { + for (var vTarget = vVehicle; vTarget > 0; vTarget -= 1.KMPHtoMeterPerSecond()) { + var df_coast = new LACDecisionFactor().Lookup(vTarget, vVehicle - vTarget); + if (vTarget < 48.KMPHtoMeterPerSecond()) { + AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); + } + + if (vVehicle - vTarget > 11) { + AssertHelper.AreRelativeEqual(df_coast, 2.5, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); + } + + if (vTarget > 52.KMPHtoMeterPerSecond() && vVehicle - vTarget < 9.KMPHtoMeterPerSecond()) { + AssertHelper.AreRelativeEqual(df_coast, 1.0, string.Format("vVehicle: {0}, vTarget: {1}", vVehicle, vTarget)); + } + } + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs index 6de65c4b90644e8bff2b18378bc118e2f9f06f1e..623d6a5241968ada84a5b51e226012f073cc930b 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/LossMapRangeValidationTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs index e0b70749528b1d5896d71a27f15bd9bd4d0ac2e9..e3a0d787ceae63f165f705cd5d223d93344bdd1e 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/MeasuredSpeedModeTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/MockSumWriter.cs b/VectoCore/VectoCoreTest/Models/Simulation/MockSumWriter.cs index d871960e182cd5bc2286490be8959b348b2b2cc7..4944c5deaa9dffbf14b0f1eab27150c82cf558a0 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/MockSumWriter.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/MockSumWriter.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.OutputData; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/PTOIdleLossTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/PTOIdleLossTest.cs index 9ba9231b9f15ce9d7878abf4b9f3dc75346d48e4..480fdac4abb22fd0d9be445f9579d0c1b8f7a4fd 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/PTOIdleLossTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/PTOIdleLossTest.cs @@ -1,103 +1,103 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using NUnit.Framework; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Tests.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestFixture] - public class PTOIdleLossTest - { - [TestCase] - public void PTOLossMapCaseSensitiveTest() - { - var data = new[] { - "0, 0", - "10, 100" - }; - var tbl = VectoCSVFile.ReadStream(InputDataHelper.InputDataAsStream("pto torque, engine speed", data)); - - var pto = PTOIdleLossMapReader.Create(tbl); - - var loss = pto.GetTorqueLoss(100.RPMtoRad()); - Assert.AreEqual(10, loss.Value()); - } - - - [TestCase] - public void PTOIdleLosses_FixPoints() - { - var entryList = new List<PTOLossMap.Entry>(); - for (var i = 0; i < 2000; i += 200) { - entryList.Add(new PTOLossMap.Entry { - EngineSpeed = i.RPMtoRad(), - PTOTorque = (Math.Sqrt(i) / 10).SI<NewtonMeter>() - }); - } - var pto = new PTOLossMap(entryList.ToArray()); - - foreach (var entry in entryList) { - Assert.AreEqual(entry.PTOTorque, pto.GetTorqueLoss(entry.EngineSpeed)); - } - } - - [TestCase] - public void PTOIdleLosses_Interpolate() - { - var entryList = new List<PTOLossMap.Entry>(); - for (var i = 0; i < 2000; i += 200) { - entryList.Add(new PTOLossMap.Entry { - EngineSpeed = i.RPMtoRad(), - PTOTorque = (Math.Sqrt(i) / 10).SI<NewtonMeter>() - }); - } - var pto = new PTOLossMap(entryList.ToArray()); - - for (var i = 1; i < entryList.Count; i++) { - var v1 = entryList[i - 1]; - var v2 = entryList[i]; - - for (var f = v1.EngineSpeed; f < v2.EngineSpeed; f += 10.RPMtoRad()) { - AssertHelper.AreRelativeEqual( - VectoMath.Interpolate(v1.EngineSpeed, v2.EngineSpeed, v1.PTOTorque, v2.PTOTorque, f), - pto.GetTorqueLoss(f)); - } - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using NUnit.Framework; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Tests.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestFixture] + public class PTOIdleLossTest + { + [TestCase] + public void PTOLossMapCaseSensitiveTest() + { + var data = new[] { + "0, 0", + "10, 100" + }; + var tbl = VectoCSVFile.ReadStream(InputDataHelper.InputDataAsStream("pto torque, engine speed", data)); + + var pto = PTOIdleLossMapReader.Create(tbl); + + var loss = pto.GetTorqueLoss(100.RPMtoRad()); + Assert.AreEqual(10, loss.Value()); + } + + + [TestCase] + public void PTOIdleLosses_FixPoints() + { + var entryList = new List<PTOLossMap.Entry>(); + for (var i = 0; i < 2000; i += 200) { + entryList.Add(new PTOLossMap.Entry { + EngineSpeed = i.RPMtoRad(), + PTOTorque = (Math.Sqrt(i) / 10).SI<NewtonMeter>() + }); + } + var pto = new PTOLossMap(entryList.ToArray()); + + foreach (var entry in entryList) { + Assert.AreEqual(entry.PTOTorque, pto.GetTorqueLoss(entry.EngineSpeed)); + } + } + + [TestCase] + public void PTOIdleLosses_Interpolate() + { + var entryList = new List<PTOLossMap.Entry>(); + for (var i = 0; i < 2000; i += 200) { + entryList.Add(new PTOLossMap.Entry { + EngineSpeed = i.RPMtoRad(), + PTOTorque = (Math.Sqrt(i) / 10).SI<NewtonMeter>() + }); + } + var pto = new PTOLossMap(entryList.ToArray()); + + for (var i = 1; i < entryList.Count; i++) { + var v1 = entryList[i - 1]; + var v2 = entryList[i]; + + for (var f = v1.EngineSpeed; f < v2.EngineSpeed; f += 10.RPMtoRad()) { + AssertHelper.AreRelativeEqual( + VectoMath.Interpolate(v1.EngineSpeed, v2.EngineSpeed, v1.PTOTorque, v2.PTOTorque, f), + pto.GetTorqueLoss(f)); + } + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs b/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs index 90f5b457760e77277d33a501c8f405fdfe8840b9..f825193969f98b5165ebac3f03d4068d45310a1e 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/PowerTrainBuilderTest.cs @@ -1,117 +1,117 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Linq; -using NUnit.Framework; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.InputData; -using TUGraz.VectoCore.InputData.FileIO.JSON; -using TUGraz.VectoCore.InputData.Reader.Impl; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.Tests.Utils; -using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestFixture] - public class PowerTrainBuilderTest - { - public const string JobFile = @"TestData\Jobs\24t Coach.vecto"; - public const string JobFileNoAngular = @"TestData\Jobs\24t CoachNoAng.vecto"; - public const string JobFileAngEfficiency = @"TestData\Jobs\24t Coach_Ang_Efficiency.vecto"; - - public const string JobFileDecl = @"TestData\Jobs\40t_Long_Haul_Truck.vecto"; - public const string JobFileDeclNoAngular = @"TestData\Jobs\40t_Long_Haul_Truck_NoAng.vecto"; - public const string JobFileDeclAngEfficiency = @"TestData\Jobs\40t_Long_Haul_Truck with AngleEfficiency.vecto"; - - [TestCase(JobFile, 12), - TestCase(JobFileNoAngular, 11), - TestCase(JobFileAngEfficiency, 12)] - public void BuildFullPowerTrain_Engineering(string inputFile, int componentCount) - { - var dataProvider = JSONInputDataFactory.ReadJsonJob(inputFile); - var engineeringProvider = dataProvider as IEngineeringInputDataProvider; - if (engineeringProvider == null) { - throw new VectoException("Failed to cast to Engineering InputDataProvider"); - } - var reader = new EngineeringModeVectoRunDataFactory(engineeringProvider); - var runData = reader.NextRun().First(); - - var writer = new MockModalDataContainer(); - var builder = new PowertrainBuilder(writer); - - var powerTrain = builder.Build(runData); - - Assert.IsInstanceOfType(powerTrain, typeof(IVehicleContainer)); - Assert.AreEqual(componentCount, powerTrain.SimulationComponents().Count); - - Assert.IsInstanceOfType(powerTrain.Engine, typeof(CombustionEngine)); - Assert.IsInstanceOfType(powerTrain.Gearbox, typeof(Gearbox)); - Assert.IsInstanceOfType(powerTrain.Cycle, typeof(ISimulationOutPort)); - Assert.IsInstanceOfType(powerTrain.Vehicle, typeof(Vehicle)); - } - - [TestCase(JobFileDeclNoAngular, 11, false), - TestCase(JobFileDecl, 12, false), - TestCase(JobFileDeclAngEfficiency, 11, true)] - public void BuildFullPowerTrain_Declaration(string inputFile, int componentCount, bool shouldFail) - { - var dataProvider = JSONInputDataFactory.ReadJsonJob(inputFile); - var provider = dataProvider as IDeclarationInputDataProvider; - if (provider == null) { - throw new VectoException("Failed to cast to Declaration InputDataProvider"); - } - var reader = new DeclarationModeVectoRunDataFactory(provider, null); - - if (!shouldFail) { - var runData = reader.NextRun().First(); - - var writer = new MockModalDataContainer(); - var builder = new PowertrainBuilder(writer); - - var powerTrain = builder.Build(runData); - - Assert.IsInstanceOfType(powerTrain, typeof(IVehicleContainer)); - Assert.AreEqual(componentCount, powerTrain.SimulationComponents().Count); - - Assert.IsInstanceOfType(powerTrain.Engine, typeof(CombustionEngine)); - Assert.IsInstanceOfType(powerTrain.Gearbox, typeof(Gearbox)); - Assert.IsInstanceOfType(powerTrain.Cycle, typeof(ISimulationOutPort)); - Assert.IsInstanceOfType(powerTrain.Vehicle, typeof(Vehicle)); - } else { - AssertHelper.Exception<VectoException>(() => { reader.NextRun().ToList(); }); - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Linq; +using NUnit.Framework; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.InputData; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.InputData.Reader.Impl; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Utils; +using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestFixture] + public class PowerTrainBuilderTest + { + public const string JobFile = @"TestData\Jobs\24t Coach.vecto"; + public const string JobFileNoAngular = @"TestData\Jobs\24t CoachNoAng.vecto"; + public const string JobFileAngEfficiency = @"TestData\Jobs\24t Coach_Ang_Efficiency.vecto"; + + public const string JobFileDecl = @"TestData\Jobs\40t_Long_Haul_Truck.vecto"; + public const string JobFileDeclNoAngular = @"TestData\Jobs\40t_Long_Haul_Truck_NoAng.vecto"; + public const string JobFileDeclAngEfficiency = @"TestData\Jobs\40t_Long_Haul_Truck with AngleEfficiency.vecto"; + + [TestCase(JobFile, 12), + TestCase(JobFileNoAngular, 11), + TestCase(JobFileAngEfficiency, 12)] + public void BuildFullPowerTrain_Engineering(string inputFile, int componentCount) + { + var dataProvider = JSONInputDataFactory.ReadJsonJob(inputFile); + var engineeringProvider = dataProvider as IEngineeringInputDataProvider; + if (engineeringProvider == null) { + throw new VectoException("Failed to cast to Engineering InputDataProvider"); + } + var reader = new EngineeringModeVectoRunDataFactory(engineeringProvider); + var runData = reader.NextRun().First(); + + var writer = new MockModalDataContainer(); + var builder = new PowertrainBuilder(writer); + + var powerTrain = builder.Build(runData); + + Assert.IsInstanceOfType(powerTrain, typeof(IVehicleContainer)); + Assert.AreEqual(componentCount, powerTrain.SimulationComponents().Count); + + Assert.IsInstanceOfType(powerTrain.Engine, typeof(CombustionEngine)); + Assert.IsInstanceOfType(powerTrain.Gearbox, typeof(Gearbox)); + Assert.IsInstanceOfType(powerTrain.Cycle, typeof(ISimulationOutPort)); + Assert.IsInstanceOfType(powerTrain.Vehicle, typeof(Vehicle)); + } + + [TestCase(JobFileDeclNoAngular, 11, false), + TestCase(JobFileDecl, 12, false), + TestCase(JobFileDeclAngEfficiency, 11, true)] + public void BuildFullPowerTrain_Declaration(string inputFile, int componentCount, bool shouldFail) + { + var dataProvider = JSONInputDataFactory.ReadJsonJob(inputFile); + var provider = dataProvider as IDeclarationInputDataProvider; + if (provider == null) { + throw new VectoException("Failed to cast to Declaration InputDataProvider"); + } + var reader = new DeclarationModeVectoRunDataFactory(provider, null); + + if (!shouldFail) { + var runData = reader.NextRun().First(); + + var writer = new MockModalDataContainer(); + var builder = new PowertrainBuilder(writer); + + var powerTrain = builder.Build(runData); + + Assert.IsInstanceOfType(powerTrain, typeof(IVehicleContainer)); + Assert.AreEqual(componentCount, powerTrain.SimulationComponents().Count); + + Assert.IsInstanceOfType(powerTrain.Engine, typeof(CombustionEngine)); + Assert.IsInstanceOfType(powerTrain.Gearbox, typeof(Gearbox)); + Assert.IsInstanceOfType(powerTrain.Cycle, typeof(ISimulationOutPort)); + Assert.IsInstanceOfType(powerTrain.Vehicle, typeof(Vehicle)); + } else { + AssertHelper.Exception<VectoException>(() => { reader.NextRun().ToList(); }); + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs index 49658a7215a0932f69479429ed12a8312c0ca307..2467116af3c24bf893d8cb08daadc902671ddac9 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Text; using System.Data; diff --git a/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs index 98e683de89efbbaea66c7563856b7abd60805b20..04d9856d6d7751b2e5e320aa3c7ed7f6b791548b 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/SimulationTests.cs @@ -1,143 +1,143 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.FileIO.JSON; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.OutputData; -using TUGraz.VectoCore.OutputData.FileIO; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.Simulation -{ - [TestClass] - public class SimulationTests - { - private const string EngineOnlyJob = @"TestData\Jobs\EngineOnlyJob.vecto"; - - [TestMethod] - public void TestSimulationEngineOnly() - { - var resultFileName = "TestEngineOnly-result.vmod"; - var job = CreateRun(resultFileName); - - var container = job.GetContainer(); - - Assert.AreEqual(560.RPMtoRad(), container.EngineSpeed); - } - - [TestMethod] - public void TestEngineOnly_JobRun() - { - var actual = @"TestData\Jobs\EngineOnlyJob_Coach Engine Only short.vmod"; - var expected = @"TestData\Results\EngineOnlyCycles\EngineOnlyJob_Coach Engine Only short.vmod"; - - var job = CreateRun(actual); - job.Run(); - - Assert.IsTrue(job.FinishedWithoutErrors); - - ResultFileHelper.TestModFile(expected, actual); - } - - [TestMethod] - public void TestEngineOnly_SimulatorRun() - { - var actual = @"TestData\Jobs\EngineOnlyJob_Coach Engine Only short.vmod"; - var expected = @"TestData\Results\EngineOnlyCycles\EngineOnlyJob_Coach Engine Only short.vmod"; - - var run = CreateRun(actual); - - var jobContainer = new JobContainer(new MockSumWriter()); - jobContainer.AddRun(run); - jobContainer.Execute(); - jobContainer.WaitFinished(); - - foreach (var r in jobContainer.Runs) { - Assert.IsTrue(r.Run.FinishedWithoutErrors, string.Format("{0}", r.ExecException)); - } - - ResultFileHelper.TestModFile(expected, actual); - } - - public IVectoRun CreateRun(string resultFileName) - { - var fileWriter = new FileOutputWriter(resultFileName); - var sumWriter = new SummaryDataContainer(fileWriter); - - var inputData = JSONInputDataFactory.ReadJsonJob(EngineOnlyJob); - var factory = new SimulatorFactory(ExecutionMode.Engineering, inputData, fileWriter) { - SumData = sumWriter - }; - - return factory.SimulationRuns().First(); - } - - [TestMethod] - public void Test_VectoJob() - { - var jobFile = @"TestData\Jobs\24t Coach EngineOnly.vecto"; - var fileWriter = new FileOutputWriter(jobFile); - var sumWriter = new SummaryDataContainer(fileWriter); - var jobContainer = new JobContainer(sumWriter); - - var inputData = JSONInputDataFactory.ReadJsonJob(jobFile); - var runsFactory = new SimulatorFactory(ExecutionMode.Engineering, inputData, fileWriter); - - jobContainer.AddRuns(runsFactory); - jobContainer.Execute(); - - jobContainer.WaitFinished(); - - foreach (var run in jobContainer.Runs) { - Assert.IsTrue(run.Run.FinishedWithoutErrors, string.Format("{0}", run.ExecException)); - } - - ResultFileHelper.TestSumFile(@"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly.vsum", - @"TestData\Jobs\24t Coach EngineOnly.vsum"); - - ResultFileHelper.TestModFiles(new[] { - @"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly_Engine Only1.vmod", - @"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly_Engine Only2.vmod", - @"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly_Engine Only3.vmod" - }, new[] { - @"TestData\Jobs\24t Coach EngineOnly_Engine Only1.vmod", - @"TestData\Jobs\24t Coach EngineOnly_Engine Only2.vmod", - @"TestData\Jobs\24t Coach EngineOnly_Engine Only3.vmod" - }) - ; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.OutputData; +using TUGraz.VectoCore.OutputData.FileIO; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.Simulation +{ + [TestClass] + public class SimulationTests + { + private const string EngineOnlyJob = @"TestData\Jobs\EngineOnlyJob.vecto"; + + [TestMethod] + public void TestSimulationEngineOnly() + { + var resultFileName = "TestEngineOnly-result.vmod"; + var job = CreateRun(resultFileName); + + var container = job.GetContainer(); + + Assert.AreEqual(560.RPMtoRad(), container.EngineSpeed); + } + + [TestMethod] + public void TestEngineOnly_JobRun() + { + var actual = @"TestData\Jobs\EngineOnlyJob_Coach Engine Only short.vmod"; + var expected = @"TestData\Results\EngineOnlyCycles\EngineOnlyJob_Coach Engine Only short.vmod"; + + var job = CreateRun(actual); + job.Run(); + + Assert.IsTrue(job.FinishedWithoutErrors); + + ResultFileHelper.TestModFile(expected, actual); + } + + [TestMethod] + public void TestEngineOnly_SimulatorRun() + { + var actual = @"TestData\Jobs\EngineOnlyJob_Coach Engine Only short.vmod"; + var expected = @"TestData\Results\EngineOnlyCycles\EngineOnlyJob_Coach Engine Only short.vmod"; + + var run = CreateRun(actual); + + var jobContainer = new JobContainer(new MockSumWriter()); + jobContainer.AddRun(run); + jobContainer.Execute(); + jobContainer.WaitFinished(); + + foreach (var r in jobContainer.Runs) { + Assert.IsTrue(r.Run.FinishedWithoutErrors, string.Format("{0}", r.ExecException)); + } + + ResultFileHelper.TestModFile(expected, actual); + } + + public IVectoRun CreateRun(string resultFileName) + { + var fileWriter = new FileOutputWriter(resultFileName); + var sumWriter = new SummaryDataContainer(fileWriter); + + var inputData = JSONInputDataFactory.ReadJsonJob(EngineOnlyJob); + var factory = new SimulatorFactory(ExecutionMode.Engineering, inputData, fileWriter) { + SumData = sumWriter + }; + + return factory.SimulationRuns().First(); + } + + [TestMethod] + public void Test_VectoJob() + { + var jobFile = @"TestData\Jobs\24t Coach EngineOnly.vecto"; + var fileWriter = new FileOutputWriter(jobFile); + var sumWriter = new SummaryDataContainer(fileWriter); + var jobContainer = new JobContainer(sumWriter); + + var inputData = JSONInputDataFactory.ReadJsonJob(jobFile); + var runsFactory = new SimulatorFactory(ExecutionMode.Engineering, inputData, fileWriter); + + jobContainer.AddRuns(runsFactory); + jobContainer.Execute(); + + jobContainer.WaitFinished(); + + foreach (var run in jobContainer.Runs) { + Assert.IsTrue(run.Run.FinishedWithoutErrors, string.Format("{0}", run.ExecException)); + } + + ResultFileHelper.TestSumFile(@"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly.vsum", + @"TestData\Jobs\24t Coach EngineOnly.vsum"); + + ResultFileHelper.TestModFiles(new[] { + @"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly_Engine Only1.vmod", + @"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly_Engine Only2.vmod", + @"TestData\Results\EngineOnlyCycles\24t Coach EngineOnly_Engine Only3.vmod" + }, new[] { + @"TestData\Jobs\24t Coach EngineOnly_Engine Only1.vmod", + @"TestData\Jobs\24t Coach EngineOnly_Engine Only2.vmod", + @"TestData\Jobs\24t Coach EngineOnly_Engine Only3.vmod" + }) + ; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs index 20f41fac1a02d44c71dcfbc530b5cd4904224bc9..8773ffb680e5b05f6544482a6293b6f369f4639d 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/VechicleContainerTests.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCore.Models.Simulation.Impl; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs index aaade21392b192c192eb1d38d48ed4722171d5d2..f0c12bd791d2c05813804a0ec23572c6f94fed24 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/ATGearboxTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using NUnit.Framework; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs index 3b4b2092a1bee769394db5233e2412278ed248f1..71e1458bfaff0dddb93f6e0a340ab13f95d00289 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/ClutchTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Data; using NUnit.Framework; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs index 65ab64ad067719c175fd7e7389094d94867be236..cef987e2b8cf9c2e5d7eb0cb65559359d44176e9 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/CombustionEngineTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Data; using System.Diagnostics; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs index 34505febccb80167fe473c54c217625176a71900..275c94e069756dfec1201747e08916cb1aa48222 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DistanceBasedDrivingCycleTest.cs @@ -1,234 +1,234 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.Tests.Integration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponent -{ - [TestClass] - public class DistanceBasedDrivingCycleTest - { - public const string ShortCycle = @"TestData\Cycles\Coach_24t_xshort.vdri"; - - public const double Tolerance = 0.0001; - - - [TestMethod] - public void TestLimitRequst() - { - var data = new string[] { - // <s>,<v>,<grad>,<stop> - " 0, 20, 0, 0", - " 1, 20, -0.1, 0", - " 2, 20, -0.3, 0", - " 10, 40, -0.3, 0", - " 19, 40, -0.2, 0", - " 20, 30, -0.1, 0" - }; - var cycleData = SimpleDrivingCycles.CreateCycleData(data); - var container = new VehicleContainer(ExecutionMode.Engineering); - var cycle = new DistanceBasedDrivingCycle(container, cycleData); - - var gbx = new MockGearbox(container); - - var driver = new MockDriver(container); - cycle.InPort().Connect(driver.OutPort()); - - cycle.OutPort().Initialize(); - - // just in test mock driver - driver.VehicleStopped = false; - - var absTime = 0.SI<Second>(); - - // a request up to 10m succeeds, no speed change for the next 10m - - var response = cycle.OutPort().Request(absTime, 0.3.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - response = cycle.OutPort().Request(absTime, 1.3.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - response = cycle.OutPort().Request(absTime, 2.7.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - response = cycle.OutPort().Request(absTime, 3.5.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - // a request with 12m exceeds the speed change at 10m -> maxDistance == 10m - - response = cycle.OutPort().Request(absTime, 12.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); - Assert.AreEqual(10, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); - - response = cycle.OutPort().Request(absTime, 10.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - // drive 10m - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - // - - - - - - - - - // request with 8m succeeds - - response = cycle.OutPort().Request(absTime, 8.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - // - - - - - - - - - // request with 3m more -> distance exceeded. maxDistance == 2m (approach next speed change, we are within 5m radius) - - response = cycle.OutPort().Request(absTime, 3.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); - Assert.AreEqual(2, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); - - // - - - - - - - - - // request with 1m (18 -> 19m) => response exceeded, drive up to next sample point (at least 5m) - response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); - Assert.AreEqual(Constants.SimulationSettings.BrakeNextTargetDistance.Value(), - ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value(), 1e-6); - - // next request with 5m, as suggested => distance exceeded. maxDistance == 2m (next speed change).... - response = cycle.OutPort().Request(absTime, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance); - Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); - Assert.AreEqual(2, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); - - // ok - response = cycle.OutPort().Request(absTime, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - } - - [TestMethod] - public void TestDistanceRequest() - { - var cycleData = DrivingCycleDataReader.ReadFromFile(ShortCycle, CycleType.DistanceBased, false); - - var container = new VehicleContainer(ExecutionMode.Engineering); - var cycle = new DistanceBasedDrivingCycle(container, cycleData); - - var gbx = new MockGearbox(container); - - var driver = new MockDriver(container); - cycle.InPort().Connect(driver.OutPort()); - - cycle.OutPort().Initialize(); - - // just in test mock driver - driver.VehicleStopped = false; - - var startDistance = container.CycleStartDistance.Value(); - var absTime = 0.SI<Second>(); - - // waiting time of 40 seconds is split up to 3 steps: 0.5, 39, 0.5 - var response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); - Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); - Assert.AreEqual(0.5, driver.LastRequest.dt.Value(), Tolerance); - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); - Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); - Assert.AreEqual(39, driver.LastRequest.dt.Value(), Tolerance); - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); - Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); - Assert.AreEqual(0.5, driver.LastRequest.dt.Value(), Tolerance); - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); - Assert.AreEqual(0.0284160694958265, driver.LastRequest.Gradient.Value(), 1E-12); - Assert.AreEqual(1 + startDistance, cycle.CurrentState.Distance.Value(), Tolerance); - - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); - - Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); - - Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); - Assert.AreEqual(0.0284160694958265, driver.LastRequest.Gradient.Value(), 1E-12); - Assert.AreEqual(2 + startDistance, cycle.CurrentState.Distance.Value(), Tolerance); - - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - - - var exceeded = (ResponseDrivingCycleDistanceExceeded)cycle.OutPort().Request(absTime, 1000.SI<Meter>()); - Assert.AreEqual(811, exceeded.MaxDistance.Value(), Tolerance); - - AssertHelper.Exception<VectoSimulationException>(() => { - container.CommitSimulationStep(absTime, exceeded.SimulationInterval); - absTime += exceeded.SimulationInterval; - }, "Previous request did not succeed!"); - - response = cycle.OutPort().Request(absTime, exceeded.MaxDistance); - - Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); - Assert.AreEqual(0.020140043264606885, driver.LastRequest.Gradient.Value(), 1E-12); - Assert.AreEqual(813 + startDistance, cycle.CurrentState.Distance.Value(), Tolerance); - - - container.CommitSimulationStep(absTime, response.SimulationInterval); - absTime += response.SimulationInterval; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Integration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponent +{ + [TestClass] + public class DistanceBasedDrivingCycleTest + { + public const string ShortCycle = @"TestData\Cycles\Coach_24t_xshort.vdri"; + + public const double Tolerance = 0.0001; + + + [TestMethod] + public void TestLimitRequst() + { + var data = new string[] { + // <s>,<v>,<grad>,<stop> + " 0, 20, 0, 0", + " 1, 20, -0.1, 0", + " 2, 20, -0.3, 0", + " 10, 40, -0.3, 0", + " 19, 40, -0.2, 0", + " 20, 30, -0.1, 0" + }; + var cycleData = SimpleDrivingCycles.CreateCycleData(data); + var container = new VehicleContainer(ExecutionMode.Engineering); + var cycle = new DistanceBasedDrivingCycle(container, cycleData); + + var gbx = new MockGearbox(container); + + var driver = new MockDriver(container); + cycle.InPort().Connect(driver.OutPort()); + + cycle.OutPort().Initialize(); + + // just in test mock driver + driver.VehicleStopped = false; + + var absTime = 0.SI<Second>(); + + // a request up to 10m succeeds, no speed change for the next 10m + + var response = cycle.OutPort().Request(absTime, 0.3.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + response = cycle.OutPort().Request(absTime, 1.3.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + response = cycle.OutPort().Request(absTime, 2.7.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + response = cycle.OutPort().Request(absTime, 3.5.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + // a request with 12m exceeds the speed change at 10m -> maxDistance == 10m + + response = cycle.OutPort().Request(absTime, 12.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.AreEqual(10, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); + + response = cycle.OutPort().Request(absTime, 10.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + // drive 10m + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + // - - - - - - - - + // request with 8m succeeds + + response = cycle.OutPort().Request(absTime, 8.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + // - - - - - - - - + // request with 3m more -> distance exceeded. maxDistance == 2m (approach next speed change, we are within 5m radius) + + response = cycle.OutPort().Request(absTime, 3.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.AreEqual(2, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); + + // - - - - - - - - + // request with 1m (18 -> 19m) => response exceeded, drive up to next sample point (at least 5m) + response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.AreEqual(Constants.SimulationSettings.BrakeNextTargetDistance.Value(), + ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value(), 1e-6); + + // next request with 5m, as suggested => distance exceeded. maxDistance == 2m (next speed change).... + response = cycle.OutPort().Request(absTime, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance); + Assert.IsInstanceOfType(response, typeof(ResponseDrivingCycleDistanceExceeded)); + Assert.AreEqual(2, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance.Value()); + + // ok + response = cycle.OutPort().Request(absTime, ((ResponseDrivingCycleDistanceExceeded)response).MaxDistance); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + } + + [TestMethod] + public void TestDistanceRequest() + { + var cycleData = DrivingCycleDataReader.ReadFromFile(ShortCycle, CycleType.DistanceBased, false); + + var container = new VehicleContainer(ExecutionMode.Engineering); + var cycle = new DistanceBasedDrivingCycle(container, cycleData); + + var gbx = new MockGearbox(container); + + var driver = new MockDriver(container); + cycle.InPort().Connect(driver.OutPort()); + + cycle.OutPort().Initialize(); + + // just in test mock driver + driver.VehicleStopped = false; + + var startDistance = container.CycleStartDistance.Value(); + var absTime = 0.SI<Second>(); + + // waiting time of 40 seconds is split up to 3 steps: 0.5, 39, 0.5 + var response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); + Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); + Assert.AreEqual(0.5, driver.LastRequest.dt.Value(), Tolerance); + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); + Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); + Assert.AreEqual(39, driver.LastRequest.dt.Value(), Tolerance); + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + Assert.AreEqual(0, driver.LastRequest.TargetVelocity.Value(), Tolerance); + Assert.AreEqual(0.028416069495827, driver.LastRequest.Gradient.Value(), 1E-12); + Assert.AreEqual(0.5, driver.LastRequest.dt.Value(), Tolerance); + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); + Assert.AreEqual(0.0284160694958265, driver.LastRequest.Gradient.Value(), 1E-12); + Assert.AreEqual(1 + startDistance, cycle.CurrentState.Distance.Value(), Tolerance); + + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + response = cycle.OutPort().Request(absTime, 1.SI<Meter>()); + + Assert.IsInstanceOfType(response, typeof(ResponseSuccess)); + + Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); + Assert.AreEqual(0.0284160694958265, driver.LastRequest.Gradient.Value(), 1E-12); + Assert.AreEqual(2 + startDistance, cycle.CurrentState.Distance.Value(), Tolerance); + + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + + + var exceeded = (ResponseDrivingCycleDistanceExceeded)cycle.OutPort().Request(absTime, 1000.SI<Meter>()); + Assert.AreEqual(811, exceeded.MaxDistance.Value(), Tolerance); + + AssertHelper.Exception<VectoSimulationException>(() => { + container.CommitSimulationStep(absTime, exceeded.SimulationInterval); + absTime += exceeded.SimulationInterval; + }, "Previous request did not succeed!"); + + response = cycle.OutPort().Request(absTime, exceeded.MaxDistance); + + Assert.AreEqual(5.SI<MeterPerSecond>().Value(), driver.LastRequest.TargetVelocity.Value(), Tolerance); + Assert.AreEqual(0.020140043264606885, driver.LastRequest.Gradient.Value(), 1E-12); + Assert.AreEqual(813 + startDistance, cycle.CurrentState.Distance.Value(), Tolerance); + + + container.CommitSimulationStep(absTime, response.SimulationInterval); + absTime += response.SimulationInterval; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs index 60d9b5bc012b6229f57164e643908365b6036763..a58614f247d3c5b538d34dff9bc34496d4794ce6 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/DriverTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs index 411bb226c85a47ad0a6ed3bd2d9d7e7ee0e3bbd3..543f36218a2ffb9b5c934d08e83f3c58a5971532 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxPowertrainTest.cs @@ -1,129 +1,129 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Tests.Integration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponent -{ - [TestClass] - public class GearboxPowertrainTest - { - [TestMethod] - public void Gearbox_Initialize_Empty() - { - var cycle = SimpleDrivingCycles.CreateCycleData(new[] { - // <s>, <v>, <grad>, <stop> - " 0, 0, 2.95016969027809, 1", - "1000, 60, 2.95016969027809, 0", - }); - var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(), - 0.SI<Kilogram>()); - var retVal = container.Cycle.Initialize(); - Assert.AreEqual(4u, container.Gear); - Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); - - AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); - - var absTime = 0.SI<Second>(); - var ds = 1.SI<Meter>(); - - retVal = container.Cycle.Request(absTime, ds); - container.CommitSimulationStep(absTime, retVal.SimulationInterval); - absTime += retVal.SimulationInterval; - - AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); - - container.Cycle.Request(absTime, ds); - container.CommitSimulationStep(absTime, retVal.SimulationInterval); - Assert.AreEqual(4u, container.Gear); - AssertHelper.AreRelativeEqual(65.6890, container.EngineSpeed); - } - - [TestMethod] - public void Gearbox_Initialize_RefLoad() - { - var cycle = SimpleDrivingCycles.CreateCycleData(new[] { - // <s>, <v>, <grad>, <stop> - " 0, 0, 2.95016969027809, 1", - " 1000, 60, 2.95016969027809, 0", - }); - var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(), - 19300.SI<Kilogram>()); - var retVal = container.Cycle.Initialize(); - Assert.AreEqual(4u, container.Gear); - Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); - - AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); - - var absTime = 0.SI<Second>(); - var ds = 1.SI<Meter>(); - - retVal = container.Cycle.Request(absTime, ds); - container.CommitSimulationStep(absTime, retVal.SimulationInterval); - absTime += retVal.SimulationInterval; - - AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); - - container.Cycle.Request(absTime, ds); - container.CommitSimulationStep(absTime, retVal.SimulationInterval); - - AssertHelper.AreRelativeEqual(87.3192, container.EngineSpeed); - } - - [TestMethod] - public void Gearbox_Initialize_85_RefLoad() - { - var cycle = SimpleDrivingCycles.CreateCycleData(new[] { - // <s>,<v>,<grad>,<stop> - " 0, 85, 2.95016969027809, 0", - " 100, 85, 2.95016969027809, 0", - }); - var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(), - 19300.SI<Kilogram>()); - var retVal = container.Cycle.Initialize(); - Assert.AreEqual(12u, container.Gear); - Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); - - AssertHelper.AreRelativeEqual(1195.996.RPMtoRad(), container.EngineSpeed, toleranceFactor: 1e-3); - - var absTime = 0.SI<Second>(); - var ds = 1.SI<Meter>(); - - retVal = container.Cycle.Request(absTime, ds); - container.CommitSimulationStep(absTime, retVal.SimulationInterval); - absTime += retVal.SimulationInterval; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Tests.Integration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponent +{ + [TestClass] + public class GearboxPowertrainTest + { + [TestMethod] + public void Gearbox_Initialize_Empty() + { + var cycle = SimpleDrivingCycles.CreateCycleData(new[] { + // <s>, <v>, <grad>, <stop> + " 0, 0, 2.95016969027809, 1", + "1000, 60, 2.95016969027809, 0", + }); + var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(), + 0.SI<Kilogram>()); + var retVal = container.Cycle.Initialize(); + Assert.AreEqual(4u, container.Gear); + Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + + AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); + + var absTime = 0.SI<Second>(); + var ds = 1.SI<Meter>(); + + retVal = container.Cycle.Request(absTime, ds); + container.CommitSimulationStep(absTime, retVal.SimulationInterval); + absTime += retVal.SimulationInterval; + + AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); + + container.Cycle.Request(absTime, ds); + container.CommitSimulationStep(absTime, retVal.SimulationInterval); + Assert.AreEqual(4u, container.Gear); + AssertHelper.AreRelativeEqual(65.6890, container.EngineSpeed); + } + + [TestMethod] + public void Gearbox_Initialize_RefLoad() + { + var cycle = SimpleDrivingCycles.CreateCycleData(new[] { + // <s>, <v>, <grad>, <stop> + " 0, 0, 2.95016969027809, 1", + " 1000, 60, 2.95016969027809, 0", + }); + var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(), + 19300.SI<Kilogram>()); + var retVal = container.Cycle.Initialize(); + Assert.AreEqual(4u, container.Gear); + Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + + AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); + + var absTime = 0.SI<Second>(); + var ds = 1.SI<Meter>(); + + retVal = container.Cycle.Request(absTime, ds); + container.CommitSimulationStep(absTime, retVal.SimulationInterval); + absTime += retVal.SimulationInterval; + + AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed); + + container.Cycle.Request(absTime, ds); + container.CommitSimulationStep(absTime, retVal.SimulationInterval); + + AssertHelper.AreRelativeEqual(87.3192, container.EngineSpeed); + } + + [TestMethod] + public void Gearbox_Initialize_85_RefLoad() + { + var cycle = SimpleDrivingCycles.CreateCycleData(new[] { + // <s>,<v>,<grad>,<stop> + " 0, 85, 2.95016969027809, 0", + " 100, 85, 2.95016969027809, 0", + }); + var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(), + 19300.SI<Kilogram>()); + var retVal = container.Cycle.Initialize(); + Assert.AreEqual(12u, container.Gear); + Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess)); + + AssertHelper.AreRelativeEqual(1195.996.RPMtoRad(), container.EngineSpeed, toleranceFactor: 1e-3); + + var absTime = 0.SI<Second>(); + var ds = 1.SI<Meter>(); + + retVal = container.Cycle.Request(absTime, ds); + container.CommitSimulationStep(absTime, retVal.SimulationInterval); + absTime += retVal.SimulationInterval; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs index 1998a142a4104387dc3f78e2564199f5c3727c0e..e051d3be7415703b4a7266fcdfea6d3440f29640 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxShiftLossesTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Globalization; using NUnit.Framework; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs index 7343808a0915dfdff667ea7fd844ceefe5ebd461..61276d6a2f5b0f75e2d6b91ec677ccb8c2588e3a 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/GearboxTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Linq; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs index 1d047c70736e7eaa0f1162aedd8e1a30cae33005..09ebd216387078b6090e5734e5cfe4eb66c97945 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/RetarderTest.cs @@ -1,183 +1,183 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.Tests.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponent -{ - [TestClass] - public class RetarderTest - { - private const string RetarderLossMapFile = @"TestData\Components\Retarder.vrlm"; - private const double Delta = 0.0001; - - [TestMethod] - public void RetarderBasicTest() - { - var vehicle = new VehicleContainer(ExecutionMode.Declaration); - var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); - var retarder = new Retarder(vehicle, retarderData, 1.0); - - var nextRequest = new MockTnOutPort(); - - retarder.InPort().Connect(nextRequest); - var outPort = retarder.OutPort(); - - var absTime = 0.SI<Second>(); - var dt = 0.SI<Second>(); - - // -------- - outPort.Initialize(0.SI<NewtonMeter>(), 10.RPMtoRad()); - outPort.Request(absTime, dt, 0.SI<NewtonMeter>(), 10.RPMtoRad()); - - Assert.AreEqual(10.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - Assert.AreEqual(10.002, nextRequest.Torque.Value(), Delta); - - // -------- - outPort.Initialize(100.SI<NewtonMeter>(), 1000.RPMtoRad()); - outPort.Request(absTime, dt, 100.SI<NewtonMeter>(), 1000.RPMtoRad()); - - Assert.AreEqual(1000.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - Assert.AreEqual(112, nextRequest.Torque.Value(), Delta); - - // -------- - outPort.Initialize(50.SI<NewtonMeter>(), 650.RPMtoRad()); - outPort.Request(absTime, dt, 50.SI<NewtonMeter>(), 1550.RPMtoRad()); - retarder.CommitSimulationStep(new MockModalDataContainer()); - Assert.AreEqual(1550.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - - // (650+1550)/2 = 1100 => 12.42Nm - Assert.AreEqual(50 + 12.42, nextRequest.Torque.Value(), Delta); - - //VECTO-307: added an additional request after a commit - outPort.Request(absTime, dt, 50.SI<NewtonMeter>(), 450.RPMtoRad()); - Assert.AreEqual(450.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - // avg: (1550+450)/2 = 1000 rpm => 12Nm - Assert.AreEqual(50 + 12, nextRequest.Torque.Value(), Delta); - } - - [TestMethod] - public void RetarderRatioTest() - { - var vehicle = new VehicleContainer(ExecutionMode.Engineering); - var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); - var retarder = new Retarder(vehicle, retarderData, 2.0); - - var nextRequest = new MockTnOutPort(); - - retarder.InPort().Connect(nextRequest); - var outPort = retarder.OutPort(); - - var absTime = 0.SI<Second>(); - var dt = 0.SI<Second>(); - - // -------- - outPort.Initialize(0.SI<NewtonMeter>(), 10.RPMtoRad()); - outPort.Request(absTime, dt, 0.SI<NewtonMeter>(), 10.RPMtoRad()); - - Assert.AreEqual(10.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - Assert.AreEqual(5.002, nextRequest.Torque.Value(), Delta); - - // -------- - outPort.Initialize(100.SI<NewtonMeter>(), 1000.RPMtoRad()); - outPort.Request(absTime, dt, 100.SI<NewtonMeter>(), 1000.RPMtoRad()); - - Assert.AreEqual(1000.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - Assert.AreEqual(109, nextRequest.Torque.Value(), Delta); - - // -------- - outPort.Initialize(50.SI<NewtonMeter>(), 1550.RPMtoRad()); - outPort.Request(absTime, dt, 50.SI<NewtonMeter>(), 1550.RPMtoRad()); - - Assert.AreEqual(1550.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - Assert.AreEqual(50 + 13.89, nextRequest.Torque.Value(), Delta); // extrapolated - } - - [TestMethod] - public void RetarderDeclarationTest() - { - var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); - var declVehicle = new VehicleContainer(ExecutionMode.Declaration); - var retarder = new Retarder(declVehicle, retarderData, 2.0); - var nextRequest = new MockTnOutPort(); - - retarder.InPort().Connect(nextRequest); - var outPort = retarder.OutPort(); - - outPort.Initialize(50.SI<NewtonMeter>(), 2550.RPMtoRad()); - outPort.Request(0.SI<Second>(), 0.SI<Second>(), 50.SI<NewtonMeter>(), 2550.RPMtoRad()); - AssertHelper.Exception<VectoException>(() => retarder.CommitSimulationStep(new MockModalDataContainer()), - "Retarder LossMap data was extrapolated in Declaration mode: range for loss map is not sufficient: n:2550 (min:0, max:2300), ratio:2"); - } - - [TestMethod] - public void RetarderDataSorting() - { - var retarderEntries = new[] { - "100,10.02", - "0,10", - "200,10.08", - "500,10.5", - "300,10.18", - "400,10.32", - }; - var retarderTbl = - VectoCSVFile.ReadStream(InputDataHelper.InputDataAsStream("Retarder Speed [rpm],Loss Torque [Nm]", - retarderEntries)); - var vehicle = new VehicleContainer(ExecutionMode.Engineering); - var retarderData = RetarderLossMapReader.Create(retarderTbl); - var retarder = new Retarder(vehicle, retarderData, 2.0); - - var nextRequest = new MockTnOutPort(); - - retarder.InPort().Connect(nextRequest); - var outPort = retarder.OutPort(); - - var absTime = 0.SI<Second>(); - var dt = 0.SI<Second>(); - - // -------- - outPort.Initialize(100.SI<NewtonMeter>(), 125.RPMtoRad()); - outPort.Request(absTime, dt, 100.SI<NewtonMeter>(), 125.RPMtoRad()); - - Assert.AreEqual(125.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); - Assert.AreEqual(100 + 5.065, nextRequest.Torque.Value(), Delta); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponent +{ + [TestClass] + public class RetarderTest + { + private const string RetarderLossMapFile = @"TestData\Components\Retarder.vrlm"; + private const double Delta = 0.0001; + + [TestMethod] + public void RetarderBasicTest() + { + var vehicle = new VehicleContainer(ExecutionMode.Declaration); + var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); + var retarder = new Retarder(vehicle, retarderData, 1.0); + + var nextRequest = new MockTnOutPort(); + + retarder.InPort().Connect(nextRequest); + var outPort = retarder.OutPort(); + + var absTime = 0.SI<Second>(); + var dt = 0.SI<Second>(); + + // -------- + outPort.Initialize(0.SI<NewtonMeter>(), 10.RPMtoRad()); + outPort.Request(absTime, dt, 0.SI<NewtonMeter>(), 10.RPMtoRad()); + + Assert.AreEqual(10.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + Assert.AreEqual(10.002, nextRequest.Torque.Value(), Delta); + + // -------- + outPort.Initialize(100.SI<NewtonMeter>(), 1000.RPMtoRad()); + outPort.Request(absTime, dt, 100.SI<NewtonMeter>(), 1000.RPMtoRad()); + + Assert.AreEqual(1000.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + Assert.AreEqual(112, nextRequest.Torque.Value(), Delta); + + // -------- + outPort.Initialize(50.SI<NewtonMeter>(), 650.RPMtoRad()); + outPort.Request(absTime, dt, 50.SI<NewtonMeter>(), 1550.RPMtoRad()); + retarder.CommitSimulationStep(new MockModalDataContainer()); + Assert.AreEqual(1550.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + + // (650+1550)/2 = 1100 => 12.42Nm + Assert.AreEqual(50 + 12.42, nextRequest.Torque.Value(), Delta); + + //VECTO-307: added an additional request after a commit + outPort.Request(absTime, dt, 50.SI<NewtonMeter>(), 450.RPMtoRad()); + Assert.AreEqual(450.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + // avg: (1550+450)/2 = 1000 rpm => 12Nm + Assert.AreEqual(50 + 12, nextRequest.Torque.Value(), Delta); + } + + [TestMethod] + public void RetarderRatioTest() + { + var vehicle = new VehicleContainer(ExecutionMode.Engineering); + var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); + var retarder = new Retarder(vehicle, retarderData, 2.0); + + var nextRequest = new MockTnOutPort(); + + retarder.InPort().Connect(nextRequest); + var outPort = retarder.OutPort(); + + var absTime = 0.SI<Second>(); + var dt = 0.SI<Second>(); + + // -------- + outPort.Initialize(0.SI<NewtonMeter>(), 10.RPMtoRad()); + outPort.Request(absTime, dt, 0.SI<NewtonMeter>(), 10.RPMtoRad()); + + Assert.AreEqual(10.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + Assert.AreEqual(5.002, nextRequest.Torque.Value(), Delta); + + // -------- + outPort.Initialize(100.SI<NewtonMeter>(), 1000.RPMtoRad()); + outPort.Request(absTime, dt, 100.SI<NewtonMeter>(), 1000.RPMtoRad()); + + Assert.AreEqual(1000.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + Assert.AreEqual(109, nextRequest.Torque.Value(), Delta); + + // -------- + outPort.Initialize(50.SI<NewtonMeter>(), 1550.RPMtoRad()); + outPort.Request(absTime, dt, 50.SI<NewtonMeter>(), 1550.RPMtoRad()); + + Assert.AreEqual(1550.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + Assert.AreEqual(50 + 13.89, nextRequest.Torque.Value(), Delta); // extrapolated + } + + [TestMethod] + public void RetarderDeclarationTest() + { + var retarderData = RetarderLossMapReader.ReadFromFile(RetarderLossMapFile); + var declVehicle = new VehicleContainer(ExecutionMode.Declaration); + var retarder = new Retarder(declVehicle, retarderData, 2.0); + var nextRequest = new MockTnOutPort(); + + retarder.InPort().Connect(nextRequest); + var outPort = retarder.OutPort(); + + outPort.Initialize(50.SI<NewtonMeter>(), 2550.RPMtoRad()); + outPort.Request(0.SI<Second>(), 0.SI<Second>(), 50.SI<NewtonMeter>(), 2550.RPMtoRad()); + AssertHelper.Exception<VectoException>(() => retarder.CommitSimulationStep(new MockModalDataContainer()), + "Retarder LossMap data was extrapolated in Declaration mode: range for loss map is not sufficient: n:2550 (min:0, max:2300), ratio:2"); + } + + [TestMethod] + public void RetarderDataSorting() + { + var retarderEntries = new[] { + "100,10.02", + "0,10", + "200,10.08", + "500,10.5", + "300,10.18", + "400,10.32", + }; + var retarderTbl = + VectoCSVFile.ReadStream(InputDataHelper.InputDataAsStream("Retarder Speed [rpm],Loss Torque [Nm]", + retarderEntries)); + var vehicle = new VehicleContainer(ExecutionMode.Engineering); + var retarderData = RetarderLossMapReader.Create(retarderTbl); + var retarder = new Retarder(vehicle, retarderData, 2.0); + + var nextRequest = new MockTnOutPort(); + + retarder.InPort().Connect(nextRequest); + var outPort = retarder.OutPort(); + + var absTime = 0.SI<Second>(); + var dt = 0.SI<Second>(); + + // -------- + outPort.Initialize(100.SI<NewtonMeter>(), 125.RPMtoRad()); + outPort.Request(absTime, dt, 100.SI<NewtonMeter>(), 125.RPMtoRad()); + + Assert.AreEqual(125.RPMtoRad().Value(), nextRequest.AngularVelocity.Value(), Delta); + Assert.AreEqual(100 + 5.065, nextRequest.Torque.Value(), Delta); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs index 8b54bfe1e262d94260ad10ce44e40c0d94e61e1e..66833a07c6b6d3676976098f0b35478d338a3981 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/VehicleTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.IO; using NUnit.Framework; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs index af3797b5d982b5441c5ad57f94a43fbc6dd1ccde..e4340dac4d236b7bee94adb2281fa22d10729243 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponent/WheelsTest.cs @@ -1,75 +1,75 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.Models.SimulationComponent.Impl; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponent -{ - [TestClass] - public class WheelsTest - { - private const string VehicleDataFile = @"TestData\Components\24t Coach.vveh"; - - [TestMethod] - public void WheelsRequestTest() - { - var container = new VehicleContainer(ExecutionMode.Engineering); - //var reader = new EngineeringModeSimulationDataReader(); - var vehicleData = MockSimulationDataFactory.CreateVehicleDataFromFile(VehicleDataFile); - - IWheels wheels = new Wheels(container, vehicleData.DynamicTyreRadius, vehicleData.WheelsInertia); - var mockPort = new MockTnOutPort(); - - wheels.InPort().Connect(mockPort); - - var requestPort = wheels.OutPort(); - - var absTime = 0.SI<Second>(); - var dt = 1.SI<Second>(); - - var force = 5000.SI<Newton>(); - var velocity = 20.SI<MeterPerSecond>(); - - requestPort.Initialize(force, velocity); - - var retVal = requestPort.Request(absTime, dt, force, velocity); - - Assert.AreEqual(2600.0, mockPort.Torque.Value(), 0.0001); - Assert.AreEqual(38.4615384615, mockPort.AngularVelocity.Value(), 0.0001); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponent +{ + [TestClass] + public class WheelsTest + { + private const string VehicleDataFile = @"TestData\Components\24t Coach.vveh"; + + [TestMethod] + public void WheelsRequestTest() + { + var container = new VehicleContainer(ExecutionMode.Engineering); + //var reader = new EngineeringModeSimulationDataReader(); + var vehicleData = MockSimulationDataFactory.CreateVehicleDataFromFile(VehicleDataFile); + + IWheels wheels = new Wheels(container, vehicleData.DynamicTyreRadius, vehicleData.WheelsInertia); + var mockPort = new MockTnOutPort(); + + wheels.InPort().Connect(mockPort); + + var requestPort = wheels.OutPort(); + + var absTime = 0.SI<Second>(); + var dt = 1.SI<Second>(); + + var force = 5000.SI<Newton>(); + var velocity = 20.SI<MeterPerSecond>(); + + requestPort.Initialize(force, velocity); + + var retVal = requestPort.Request(absTime, dt, force, velocity); + + Assert.AreEqual(2600.0, mockPort.Torque.Value(), 0.0001); + Assert.AreEqual(38.4615384615, mockPort.AngularVelocity.Value(), 0.0001); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs index c04bc986b6ea80afbd29ae53ed6ce2250d23828c..24e952c97dbe42bda92ae443ab2fa33ddf1ad1e1 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AccelerationCurveTest.cs @@ -1,154 +1,154 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.InputData.Reader.ComponentData; -using TUGraz.VectoCore.Models.SimulationComponent.Data; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData -{ - [TestClass] - public class AccelerationCurveTest - { - public const double Tolerance = 0.0001; - public AccelerationCurveData Data; - - public void EqualAcceleration(double velocity, double acceleration, double deceleration) - { - var entry = Data.Lookup(velocity.KMPHtoMeterPerSecond()); - Assert.AreEqual(entry.Acceleration.Value(), acceleration, Tolerance); - Assert.AreEqual(entry.Deceleration.Value(), deceleration, Tolerance); - } - - [TestMethod] - public void AccelerationTest() - { - Data = AccelerationCurveReader.ReadFromFile(@"TestData\Components\Coach.vacc"); - - // FIXED POINTS - EqualAcceleration(0, 1.01570922360353, -0.231742702878269); - EqualAcceleration(5, 1.38546581120225, -0.45346198022574); - EqualAcceleration(10, 1.34993329755465, -0.565404125020508); - EqualAcceleration(15, 1.29026714002479, -0.703434814668512); - EqualAcceleration(20, 1.16369598822194, -0.677703399378421); - EqualAcceleration(25, 1.04024417156355, -0.63631961226452); - EqualAcceleration(30, 0.910278494884728, -0.548894523516266); - EqualAcceleration(35, 0.785875078338323, -0.453995336940216); - EqualAcceleration(40, 0.69560012996407, -0.385460695652016); - EqualAcceleration(45, 0.648984223443223, -0.349181329186105); - EqualAcceleration(50, 0.594249623931624, -0.309125096967231); - EqualAcceleration(55, 0.559156929181929, -0.296716093796643); - EqualAcceleration(60, 0.541508805860806, -0.270229542673924); - EqualAcceleration(65, 0.539582904761905, -0.256408113084341); - EqualAcceleration(70, 0.539103523809524, -0.217808535739946); - EqualAcceleration(75, 0.529581598997494, -0.18609307386602); - EqualAcceleration(80, 0.496418462064251, -0.142683384645006); - EqualAcceleration(85, 0.453932619248656, -0.117950211164234); - EqualAcceleration(90, 0.397824554210839, -0.102997621205622); - EqualAcceleration(95, 0.33969661577071, -0.102997621205622); - EqualAcceleration(100, 0.289428370365158, -0.102997621205622); - EqualAcceleration(105, 0.256471472751248, -0.102997621205622); - EqualAcceleration(110, 0.24, -0.102997621205622); - EqualAcceleration(115, 0.22, -0.102997621205622); - EqualAcceleration(120, 0.2, -0.102997621205622); - - // INTERPOLATED POINTS - EqualAcceleration(0, 1.015709224, -0.231742703); - EqualAcceleration(2.5, 1.200587517, -0.342602342); - EqualAcceleration(7.5, 1.367699554, -0.509433053); - EqualAcceleration(12.5, 1.320100219, -0.63441947); - EqualAcceleration(17.5, 1.226981564, -0.690569107); - EqualAcceleration(22.5, 1.10197008, -0.657011506); - EqualAcceleration(27.5, 0.975261333, -0.592607068); - EqualAcceleration(32.5, 0.848076787, -0.50144493); - EqualAcceleration(37.5, 0.740737604, -0.419728016); - EqualAcceleration(42.5, 0.672292177, -0.367321012); - EqualAcceleration(47.5, 0.621616924, -0.329153213); - EqualAcceleration(52.5, 0.576703277, -0.302920595); - EqualAcceleration(57.5, 0.550332868, -0.283472818); - EqualAcceleration(62.5, 0.540545855, -0.263318828); - EqualAcceleration(67.5, 0.539343214, -0.237108324); - EqualAcceleration(72.5, 0.534342561, -0.201950805); - EqualAcceleration(77.5, 0.513000031, -0.164388229); - EqualAcceleration(82.5, 0.475175541, -0.130316798); - EqualAcceleration(87.5, 0.425878587, -0.110473916); - EqualAcceleration(92.5, 0.368760585, -0.102997621); - EqualAcceleration(97.5, 0.314562493, -0.102997621); - EqualAcceleration(102.5, 0.272949922, -0.102997621); - EqualAcceleration(107.5, 0.248235736, -0.102997621); - EqualAcceleration(112.5, 0.23, -0.102997621); - EqualAcceleration(117.5, 0.21, -0.102997621); - - // EXTRAPOLATE - EqualAcceleration(130, 0.16, -0.103); - } - - [TestMethod] - public void ComputeAccelerationDistanceTest() - { - Data = AccelerationCurveReader.ReadFromFile(@"TestData\Components\Truck.vacc"); - - // in this part the deceleration is constant - - var result = Data.ComputeAccelerationDistance(25.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); - Assert.AreEqual(24.11265432099, result.Value(), Tolerance); - - result = Data.ComputeAccelerationDistance(25.KMPHtoMeterPerSecond(), 15.KMPHtoMeterPerSecond()); - Assert.AreEqual(15.43209876543, result.Value(), Tolerance); - - result = Data.ComputeAccelerationDistance(50.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); - Assert.AreEqual(96.45061728395, result.Value(), Tolerance); - - result = Data.ComputeAccelerationDistance(50.KMPHtoMeterPerSecond(), 15.KMPHtoMeterPerSecond()); - Assert.AreEqual(87.77006172840, result.Value(), Tolerance); - - result = Data.ComputeAccelerationDistance(100.KMPHtoMeterPerSecond(), 60.KMPHtoMeterPerSecond()); - Assert.AreEqual(493.82716049383, result.Value(), Tolerance); - - // decelerate in the non-constant part only - - result = Data.ComputeAccelerationDistance(60.KMPHtoMeterPerSecond(), 50.KMPHtoMeterPerSecond()); - Assert.AreEqual(59.44491148, result.Value(), Tolerance); - - result = Data.ComputeAccelerationDistance(59.KMPHtoMeterPerSecond(), 55.KMPHtoMeterPerSecond()); - Assert.AreEqual(27.33155090, result.Value(), Tolerance); - - // decelerate across multiple areas of acceleration curve - - result = Data.ComputeAccelerationDistance(60.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); - Assert.AreEqual(59.44491148 + 96.45061728395, result.Value(), Tolerance); - - result = Data.ComputeAccelerationDistance(100.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); - Assert.AreEqual(59.44491148 + 96.45061728395 + 493.82716049383, result.Value(), Tolerance); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.InputData.Reader.ComponentData; +using TUGraz.VectoCore.Models.SimulationComponent.Data; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData +{ + [TestClass] + public class AccelerationCurveTest + { + public const double Tolerance = 0.0001; + public AccelerationCurveData Data; + + public void EqualAcceleration(double velocity, double acceleration, double deceleration) + { + var entry = Data.Lookup(velocity.KMPHtoMeterPerSecond()); + Assert.AreEqual(entry.Acceleration.Value(), acceleration, Tolerance); + Assert.AreEqual(entry.Deceleration.Value(), deceleration, Tolerance); + } + + [TestMethod] + public void AccelerationTest() + { + Data = AccelerationCurveReader.ReadFromFile(@"TestData\Components\Coach.vacc"); + + // FIXED POINTS + EqualAcceleration(0, 1.01570922360353, -0.231742702878269); + EqualAcceleration(5, 1.38546581120225, -0.45346198022574); + EqualAcceleration(10, 1.34993329755465, -0.565404125020508); + EqualAcceleration(15, 1.29026714002479, -0.703434814668512); + EqualAcceleration(20, 1.16369598822194, -0.677703399378421); + EqualAcceleration(25, 1.04024417156355, -0.63631961226452); + EqualAcceleration(30, 0.910278494884728, -0.548894523516266); + EqualAcceleration(35, 0.785875078338323, -0.453995336940216); + EqualAcceleration(40, 0.69560012996407, -0.385460695652016); + EqualAcceleration(45, 0.648984223443223, -0.349181329186105); + EqualAcceleration(50, 0.594249623931624, -0.309125096967231); + EqualAcceleration(55, 0.559156929181929, -0.296716093796643); + EqualAcceleration(60, 0.541508805860806, -0.270229542673924); + EqualAcceleration(65, 0.539582904761905, -0.256408113084341); + EqualAcceleration(70, 0.539103523809524, -0.217808535739946); + EqualAcceleration(75, 0.529581598997494, -0.18609307386602); + EqualAcceleration(80, 0.496418462064251, -0.142683384645006); + EqualAcceleration(85, 0.453932619248656, -0.117950211164234); + EqualAcceleration(90, 0.397824554210839, -0.102997621205622); + EqualAcceleration(95, 0.33969661577071, -0.102997621205622); + EqualAcceleration(100, 0.289428370365158, -0.102997621205622); + EqualAcceleration(105, 0.256471472751248, -0.102997621205622); + EqualAcceleration(110, 0.24, -0.102997621205622); + EqualAcceleration(115, 0.22, -0.102997621205622); + EqualAcceleration(120, 0.2, -0.102997621205622); + + // INTERPOLATED POINTS + EqualAcceleration(0, 1.015709224, -0.231742703); + EqualAcceleration(2.5, 1.200587517, -0.342602342); + EqualAcceleration(7.5, 1.367699554, -0.509433053); + EqualAcceleration(12.5, 1.320100219, -0.63441947); + EqualAcceleration(17.5, 1.226981564, -0.690569107); + EqualAcceleration(22.5, 1.10197008, -0.657011506); + EqualAcceleration(27.5, 0.975261333, -0.592607068); + EqualAcceleration(32.5, 0.848076787, -0.50144493); + EqualAcceleration(37.5, 0.740737604, -0.419728016); + EqualAcceleration(42.5, 0.672292177, -0.367321012); + EqualAcceleration(47.5, 0.621616924, -0.329153213); + EqualAcceleration(52.5, 0.576703277, -0.302920595); + EqualAcceleration(57.5, 0.550332868, -0.283472818); + EqualAcceleration(62.5, 0.540545855, -0.263318828); + EqualAcceleration(67.5, 0.539343214, -0.237108324); + EqualAcceleration(72.5, 0.534342561, -0.201950805); + EqualAcceleration(77.5, 0.513000031, -0.164388229); + EqualAcceleration(82.5, 0.475175541, -0.130316798); + EqualAcceleration(87.5, 0.425878587, -0.110473916); + EqualAcceleration(92.5, 0.368760585, -0.102997621); + EqualAcceleration(97.5, 0.314562493, -0.102997621); + EqualAcceleration(102.5, 0.272949922, -0.102997621); + EqualAcceleration(107.5, 0.248235736, -0.102997621); + EqualAcceleration(112.5, 0.23, -0.102997621); + EqualAcceleration(117.5, 0.21, -0.102997621); + + // EXTRAPOLATE + EqualAcceleration(130, 0.16, -0.103); + } + + [TestMethod] + public void ComputeAccelerationDistanceTest() + { + Data = AccelerationCurveReader.ReadFromFile(@"TestData\Components\Truck.vacc"); + + // in this part the deceleration is constant + + var result = Data.ComputeAccelerationDistance(25.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); + Assert.AreEqual(24.11265432099, result.Value(), Tolerance); + + result = Data.ComputeAccelerationDistance(25.KMPHtoMeterPerSecond(), 15.KMPHtoMeterPerSecond()); + Assert.AreEqual(15.43209876543, result.Value(), Tolerance); + + result = Data.ComputeAccelerationDistance(50.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); + Assert.AreEqual(96.45061728395, result.Value(), Tolerance); + + result = Data.ComputeAccelerationDistance(50.KMPHtoMeterPerSecond(), 15.KMPHtoMeterPerSecond()); + Assert.AreEqual(87.77006172840, result.Value(), Tolerance); + + result = Data.ComputeAccelerationDistance(100.KMPHtoMeterPerSecond(), 60.KMPHtoMeterPerSecond()); + Assert.AreEqual(493.82716049383, result.Value(), Tolerance); + + // decelerate in the non-constant part only + + result = Data.ComputeAccelerationDistance(60.KMPHtoMeterPerSecond(), 50.KMPHtoMeterPerSecond()); + Assert.AreEqual(59.44491148, result.Value(), Tolerance); + + result = Data.ComputeAccelerationDistance(59.KMPHtoMeterPerSecond(), 55.KMPHtoMeterPerSecond()); + Assert.AreEqual(27.33155090, result.Value(), Tolerance); + + // decelerate across multiple areas of acceleration curve + + result = Data.ComputeAccelerationDistance(60.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); + Assert.AreEqual(59.44491148 + 96.45061728395, result.Value(), Tolerance); + + result = Data.ComputeAccelerationDistance(100.KMPHtoMeterPerSecond(), 0.KMPHtoMeterPerSecond()); + Assert.AreEqual(59.44491148 + 96.45061728395 + 493.82716049383, result.Value(), Tolerance); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs index a4ddb31543411a64d7eb8da5ff525ee3f2f80108..b778a343a834bd9ad37fcf92dbb60a34563e2cc1 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/AuxiliaryTypeHelperTest.cs @@ -1,67 +1,67 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.Declaration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData -{ - [TestClass] - public class AuxiliaryTypeHelperTest - { - [TestMethod] - public void TestParseAuxiliaryType() - { - Assert.AreEqual(AuxiliaryType.Fan, AuxiliaryTypeHelper.Parse("Fan")); - Assert.AreEqual(AuxiliaryType.SteeringPump, AuxiliaryTypeHelper.Parse("Steering pump")); - Assert.AreEqual(AuxiliaryType.ElectricSystem, AuxiliaryTypeHelper.Parse("Electric System")); - Assert.AreEqual(AuxiliaryType.HVAC, AuxiliaryTypeHelper.Parse("HVAC")); - Assert.AreEqual(AuxiliaryType.PneumaticSystem, AuxiliaryTypeHelper.Parse("Pneumatic System")); - } - - [TestMethod] - public void TestToString() - { - Assert.AreEqual(Constants.Auxiliaries.Names.Fan, AuxiliaryTypeHelper.ToString(AuxiliaryType.Fan)); - Assert.AreEqual(Constants.Auxiliaries.Names.SteeringPump, AuxiliaryTypeHelper.ToString(AuxiliaryType.SteeringPump)); - Assert.AreEqual(Constants.Auxiliaries.Names.HeatingVentilationAirCondition, - AuxiliaryTypeHelper.ToString(AuxiliaryType.HVAC)); - Assert.AreEqual(Constants.Auxiliaries.Names.PneumaticSystem, - AuxiliaryTypeHelper.ToString(AuxiliaryType.PneumaticSystem)); - Assert.AreEqual(Constants.Auxiliaries.Names.ElectricSystem, - AuxiliaryTypeHelper.ToString(AuxiliaryType.ElectricSystem)); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.Models.Declaration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData +{ + [TestClass] + public class AuxiliaryTypeHelperTest + { + [TestMethod] + public void TestParseAuxiliaryType() + { + Assert.AreEqual(AuxiliaryType.Fan, AuxiliaryTypeHelper.Parse("Fan")); + Assert.AreEqual(AuxiliaryType.SteeringPump, AuxiliaryTypeHelper.Parse("Steering pump")); + Assert.AreEqual(AuxiliaryType.ElectricSystem, AuxiliaryTypeHelper.Parse("Electric System")); + Assert.AreEqual(AuxiliaryType.HVAC, AuxiliaryTypeHelper.Parse("HVAC")); + Assert.AreEqual(AuxiliaryType.PneumaticSystem, AuxiliaryTypeHelper.Parse("Pneumatic System")); + } + + [TestMethod] + public void TestToString() + { + Assert.AreEqual(Constants.Auxiliaries.Names.Fan, AuxiliaryTypeHelper.ToString(AuxiliaryType.Fan)); + Assert.AreEqual(Constants.Auxiliaries.Names.SteeringPump, AuxiliaryTypeHelper.ToString(AuxiliaryType.SteeringPump)); + Assert.AreEqual(Constants.Auxiliaries.Names.HeatingVentilationAirCondition, + AuxiliaryTypeHelper.ToString(AuxiliaryType.HVAC)); + Assert.AreEqual(Constants.Auxiliaries.Names.PneumaticSystem, + AuxiliaryTypeHelper.ToString(AuxiliaryType.PneumaticSystem)); + Assert.AreEqual(Constants.Auxiliaries.Names.ElectricSystem, + AuxiliaryTypeHelper.ToString(AuxiliaryType.ElectricSystem)); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs index 894dfe71f6e959d891515fef56a1a5f52bf3be74..56728eeb8cfc5036574f150197f2f8d86284dc82 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/DistanceCycleDataTest.cs @@ -1,138 +1,138 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.Reader; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.Tests.Integration; -using TUGraz.VectoCore.Tests.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData -{ - [TestClass] - public class DistanceCycleDataTest - { -// public readonly string CycleFile = @"TestData\Cycles\"; - private const string ResourceNamespace = "TUGraz.VectoCore.Resources.Declaration."; - - - [TestMethod] - public void FilterRedundantEntries() - { - var data = new[] { - " 0, 20, 0, 0", - " 1, 20, 0, 0", - " 2, 20, 0, 0", - " 3, 20, 0, 0", - " 4, 20, 0, 0", - " 5, 20, 1, 0", - " 6, 20, 1, 0", - " 6, 20, 1, 0", - " 8, 20, 1, 0", - " 9, 20, 1, 0", - }; - - var cycleData = SimpleDrivingCycles.CreateCycleData(data); - Assert.AreEqual(3, cycleData.Entries.Count); - - Assert.AreEqual(0, cycleData.Entries[0].Distance.Value()); - Assert.AreEqual(5, cycleData.Entries[1].Distance.Value()); - Assert.AreEqual(9, cycleData.Entries[2].Distance.Value()); - } - - [TestMethod] - public void HandleStopTimes() - { - var data = new[] { - " 0, 20, 0, 0", - " 1, 20, 0, 0", - " 2, 20, 0, 0", - " 3, 20, 0, 0", - " 4, 20, 0, 0", - " 5, 0, 0, 5", - " 6, 20, 0, 0", - " 6, 20, 0, 0", - " 8, 20, 0, 0", - " 9, 20, 0, 0", - }; - - var cycleData = SimpleDrivingCycles.CreateCycleData(data); - Assert.AreEqual(4, cycleData.Entries.Count); - - Assert.AreEqual(0, cycleData.Entries[0].Distance.Value()); - Assert.AreEqual(5, cycleData.Entries[1].Distance.Value()); - Assert.AreEqual(5, cycleData.Entries[2].Distance.Value()); - Assert.AreEqual(9, cycleData.Entries[3].Distance.Value()); - - Assert.AreEqual(5, cycleData.Entries[1].StoppingTime.Value()); - } - - [TestMethod] - public void StopTimeWhenVehicleSpeedIsNotZero() - { - var data = new[] { - " 0, 20, 0, 0", - "20, 20, 0, 5", - "90, 20, 0, 0" - }; - - AssertHelper.Exception<VectoException>(() => SimpleDrivingCycles.CreateCycleData(data)); - } - - [TestMethod] - public void DistanceNotStrictlyIncreasing() - { - var data = new[] { - " 0, 20, 0, 0", - "90, 20, 0, 0", - "80, 20, 0, 0" - }; - - AssertHelper.Exception<VectoException>(() => SimpleDrivingCycles.CreateCycleData(data)); - } - - [TestMethod] - public void CycleAltitudeTest() - { - var missionType = "LongHaul"; - var stream = - RessourceHelper.ReadStream(ResourceNamespace + "MissionCycles." + missionType + Constants.FileExtensions.CycleFile); - - var cycleData = DrivingCycleDataReader.ReadFromStream(stream, CycleType.DistanceBased, "", false); - foreach (var entry in cycleData.Entries) { - var tmp = entry.Altitude; - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.Reader; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Tests.Integration; +using TUGraz.VectoCore.Tests.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData +{ + [TestClass] + public class DistanceCycleDataTest + { +// public readonly string CycleFile = @"TestData\Cycles\"; + private const string ResourceNamespace = "TUGraz.VectoCore.Resources.Declaration."; + + + [TestMethod] + public void FilterRedundantEntries() + { + var data = new[] { + " 0, 20, 0, 0", + " 1, 20, 0, 0", + " 2, 20, 0, 0", + " 3, 20, 0, 0", + " 4, 20, 0, 0", + " 5, 20, 1, 0", + " 6, 20, 1, 0", + " 6, 20, 1, 0", + " 8, 20, 1, 0", + " 9, 20, 1, 0", + }; + + var cycleData = SimpleDrivingCycles.CreateCycleData(data); + Assert.AreEqual(3, cycleData.Entries.Count); + + Assert.AreEqual(0, cycleData.Entries[0].Distance.Value()); + Assert.AreEqual(5, cycleData.Entries[1].Distance.Value()); + Assert.AreEqual(9, cycleData.Entries[2].Distance.Value()); + } + + [TestMethod] + public void HandleStopTimes() + { + var data = new[] { + " 0, 20, 0, 0", + " 1, 20, 0, 0", + " 2, 20, 0, 0", + " 3, 20, 0, 0", + " 4, 20, 0, 0", + " 5, 0, 0, 5", + " 6, 20, 0, 0", + " 6, 20, 0, 0", + " 8, 20, 0, 0", + " 9, 20, 0, 0", + }; + + var cycleData = SimpleDrivingCycles.CreateCycleData(data); + Assert.AreEqual(4, cycleData.Entries.Count); + + Assert.AreEqual(0, cycleData.Entries[0].Distance.Value()); + Assert.AreEqual(5, cycleData.Entries[1].Distance.Value()); + Assert.AreEqual(5, cycleData.Entries[2].Distance.Value()); + Assert.AreEqual(9, cycleData.Entries[3].Distance.Value()); + + Assert.AreEqual(5, cycleData.Entries[1].StoppingTime.Value()); + } + + [TestMethod] + public void StopTimeWhenVehicleSpeedIsNotZero() + { + var data = new[] { + " 0, 20, 0, 0", + "20, 20, 0, 5", + "90, 20, 0, 0" + }; + + AssertHelper.Exception<VectoException>(() => SimpleDrivingCycles.CreateCycleData(data)); + } + + [TestMethod] + public void DistanceNotStrictlyIncreasing() + { + var data = new[] { + " 0, 20, 0, 0", + "90, 20, 0, 0", + "80, 20, 0, 0" + }; + + AssertHelper.Exception<VectoException>(() => SimpleDrivingCycles.CreateCycleData(data)); + } + + [TestMethod] + public void CycleAltitudeTest() + { + var missionType = "LongHaul"; + var stream = + RessourceHelper.ReadStream(ResourceNamespace + "MissionCycles." + missionType + Constants.FileExtensions.CycleFile); + + var cycleData = DrivingCycleDataReader.ReadFromStream(stream, CycleType.DistanceBased, "", false); + foreach (var entry in cycleData.Entries) { + var tmp = entry.Altitude; + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs index fc7427d407122e083bdffc46b40528ea31905514..bc4b51c6a9b40d7c26decd6bb24e01b9c9fc82e8 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FuelConsumptionMapTest.cs @@ -1,73 +1,73 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData -{ - [TestClass] - public class FuelConsumptionMapTest - { - private const double Tolerance = 0.0001; - - [TestMethod] - public void TestFuelConsumption_FixedPoints() - { - var map = FuelConsumptionMapReader.ReadFromFile(@"TestData\Components\24t Coach.vmap"); - var lines = File.ReadAllLines(@"TestData\Components\24t Coach.vmap").Skip(1).ToArray(); - AssertMapValuesEqual(lines, map); - } - - [TestMethod] - public void TestFuelConsumption_InterpolatedPoints() - { - var map = FuelConsumptionMapReader.ReadFromFile(@"TestData\Components\24t Coach.vmap"); - var lines = File.ReadAllLines(@"TestData\Components\24t CoachInterpolated.vmap").Skip(1).ToArray(); - AssertMapValuesEqual(lines, map); - } - - private static void AssertMapValuesEqual(IReadOnlyList<string> lines, FuelConsumptionMap map) - { - for (var i = 1; i < lines.Count; i++) { - var entry = lines[i].Split(',').Select(x => double.Parse(x, CultureInfo.InvariantCulture)).ToArray(); - - Assert.AreEqual(entry[2].SI().Gramm.Per.Hour.ConvertTo().Kilo.Gramm.Per.Second.Value(), - map.GetFuelConsumption(entry[1].SI<NewtonMeter>(), entry[0].RPMtoRad(), true).Value.Value(), Tolerance); - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData +{ + [TestClass] + public class FuelConsumptionMapTest + { + private const double Tolerance = 0.0001; + + [TestMethod] + public void TestFuelConsumption_FixedPoints() + { + var map = FuelConsumptionMapReader.ReadFromFile(@"TestData\Components\24t Coach.vmap"); + var lines = File.ReadAllLines(@"TestData\Components\24t Coach.vmap").Skip(1).ToArray(); + AssertMapValuesEqual(lines, map); + } + + [TestMethod] + public void TestFuelConsumption_InterpolatedPoints() + { + var map = FuelConsumptionMapReader.ReadFromFile(@"TestData\Components\24t Coach.vmap"); + var lines = File.ReadAllLines(@"TestData\Components\24t CoachInterpolated.vmap").Skip(1).ToArray(); + AssertMapValuesEqual(lines, map); + } + + private static void AssertMapValuesEqual(IReadOnlyList<string> lines, FuelConsumptionMap map) + { + for (var i = 1; i < lines.Count; i++) { + var entry = lines[i].Split(',').Select(x => double.Parse(x, CultureInfo.InvariantCulture)).ToArray(); + + Assert.AreEqual(entry[2].SI().Gramm.Per.Hour.ConvertTo().Kilo.Gramm.Per.Second.Value(), + map.GetFuelConsumption(entry[1].SI<NewtonMeter>(), entry[0].RPMtoRad(), true).Value.Value(), Tolerance); + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs index a07591196884eaaa99f425e8077fef9511e3bc2c..886e71bdac7041a357de56e0149cfc666e3e1f4e 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/FullLoadCurveTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; using NLog; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs index 5968ff314ec4187d7532097ebf76d41a1a12e923..bc9e398818ad9e1fa539215521f9636aeb555861 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/GearboxDataTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Data; using NUnit.Framework; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/TorqueConverterDataTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/TorqueConverterDataTest.cs index e48a3a52f049b018fec16ec8c6413925b886c045..140b237fd199cd1d23da94a5335ad4158a41c746 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/TorqueConverterDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/TorqueConverterDataTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs index f35363407c47374493f73c8df38b800eca3f8830..745de816d1872d48d4046eaeac75fe1b63c095b3 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/ValidationTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs b/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs index ca2bffc5475e1cdee887279c60d1c1d94573e5dd..ceefbe92f2b0103450fec6a81f0737575482d001 100644 --- a/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/SimulationComponentData/VehicleDataTest.cs @@ -1,51 +1,51 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData -{ - [TestClass] - public class VehicleDataTest - { - private const string VehicleDataFile = @"TestData\Components\24t Coach.vveh"; - - [TestMethod] - public void ReadVehicleFileTest() - { - //IDataFileReader reader = new EngineeringModeSimulationDataReader(); - //var vehicleData = reader.ReadVehicleDataFile(VehicleDataFile); - //VehicleData.ReadFromFile(VehicleDataFile); - - //Assert.AreEqual(VehicleCategory.Coach, vehicleData.VehicleCategory); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace TUGraz.VectoCore.Tests.Models.SimulationComponentData +{ + [TestClass] + public class VehicleDataTest + { + private const string VehicleDataFile = @"TestData\Components\24t Coach.vveh"; + + [TestMethod] + public void ReadVehicleFileTest() + { + //IDataFileReader reader = new EngineeringModeSimulationDataReader(); + //var vehicleData = reader.ReadVehicleDataFile(VehicleDataFile); + //VehicleData.ReadFromFile(VehicleDataFile); + + //Assert.AreEqual(VehicleCategory.Coach, vehicleData.VehicleCategory); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Properties/AssemblyInfo.cs b/VectoCore/VectoCoreTest/Properties/AssemblyInfo.cs index 0464b43efe01cc4c33f29bb138efcb7cc3858923..6950179a87165cd2e78151b35d63350ed545f204 100644 --- a/VectoCore/VectoCoreTest/Properties/AssemblyInfo.cs +++ b/VectoCore/VectoCoreTest/Properties/AssemblyInfo.cs @@ -1,50 +1,50 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. - -[assembly: AssemblyTitle("VectoCoreTest")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("European Union")] -[assembly: AssemblyProduct("VectoCoreTest")] -[assembly: AssemblyCopyright("Copyright © 2012 - 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("292ab9c6-e15b-44b5-8145-e655e38b9ac3")] -[assembly: AssemblyVersion("1.0.0.0")] +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("VectoCoreTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("European Union")] +[assembly: AssemblyProduct("VectoCoreTest")] +[assembly: AssemblyCopyright("Copyright © 2012 - 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("292ab9c6-e15b-44b5-8145-e655e38b9ac3")] +[assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Properties/Settings.Designer.cs b/VectoCore/VectoCoreTest/Properties/Settings.Designer.cs index ce145014d385e7b7bf136d0095d40eb40b46fcfa..63f709bf3d3b8020d9da145b4e5e329d85f1143c 100644 --- a/VectoCore/VectoCoreTest/Properties/Settings.Designer.cs +++ b/VectoCore/VectoCoreTest/Properties/Settings.Designer.cs @@ -1,51 +1,51 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.CodeDom.Compiler; -using System.Configuration; -using System.Runtime.CompilerServices; - -namespace TUGraz.VectoCore.Tests.Properties { - - - [CompilerGenerated()] - [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] - internal sealed partial class Settings : ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.CodeDom.Compiler; +using System.Configuration; +using System.Runtime.CompilerServices; + +namespace TUGraz.VectoCore.Tests.Properties { + + + [CompilerGenerated()] + [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] + internal sealed partial class Settings : ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs b/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs index 9a452e7e369716fd1f6d6d0fa2d9033e489ad74d..b4e87905cb842b719dca06e4c1b9413a31ed741d 100644 --- a/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs +++ b/VectoCore/VectoCoreTest/Reports/ActualModalSimulationDataTest.cs @@ -1,69 +1,69 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using NUnit.Framework; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.InputData.FileIO.JSON; -using TUGraz.VectoCore.Models.Simulation.Impl; -using TUGraz.VectoCore.OutputData; -using TUGraz.VectoCore.OutputData.FileIO; -using TUGraz.VectoCore.Tests.Integration; -using TUGraz.VectoCore.Tests.Utils; - -namespace TUGraz.VectoCore.Tests.Reports -{ - [TestFixture] - public class ActualModalSimulationDataTest - { - [Test] - public void TestWriteActualModData() - { - const string jobFile = @"TestData\Integration\DeclarationMode\40t Truck\40t_Long_Haul_Truck.vecto"; - var fileWriter = new FileOutputWriter(jobFile); - var sumData = new SummaryDataContainer(fileWriter); - var jobContainer = new JobContainer(sumData); - - var inputData = JSONInputDataFactory.ReadJsonJob(jobFile); - var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, fileWriter); - factory.WriteModalResults = true; - factory.ActualModalData = true; - - jobContainer.AddRuns(factory); - jobContainer.Execute(); - //jobContainer.Runs[4].Run.Run(); - - jobContainer.WaitFinished(); - - Assert.IsTrue(jobContainer.AllCompleted); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using NUnit.Framework; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCore.Configuration; +using TUGraz.VectoCore.InputData.FileIO.JSON; +using TUGraz.VectoCore.Models.Simulation.Impl; +using TUGraz.VectoCore.OutputData; +using TUGraz.VectoCore.OutputData.FileIO; +using TUGraz.VectoCore.Tests.Integration; +using TUGraz.VectoCore.Tests.Utils; + +namespace TUGraz.VectoCore.Tests.Reports +{ + [TestFixture] + public class ActualModalSimulationDataTest + { + [Test] + public void TestWriteActualModData() + { + const string jobFile = @"TestData\Integration\DeclarationMode\40t Truck\40t_Long_Haul_Truck.vecto"; + var fileWriter = new FileOutputWriter(jobFile); + var sumData = new SummaryDataContainer(fileWriter); + var jobContainer = new JobContainer(sumData); + + var inputData = JSONInputDataFactory.ReadJsonJob(jobFile); + var factory = new SimulatorFactory(ExecutionMode.Declaration, inputData, fileWriter); + factory.WriteModalResults = true; + factory.ActualModalData = true; + + jobContainer.AddRuns(factory); + jobContainer.Execute(); + //jobContainer.Runs[4].Run.Run(); + + jobContainer.WaitFinished(); + + Assert.IsTrue(jobContainer.AllCompleted); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Reports/ModDataTest.cs b/VectoCore/VectoCoreTest/Reports/ModDataTest.cs index 5ec7258a03f662c6ecf3a7e5e8f97f0264942e8f..5ed3af872f8f3e5b03d2f8f18c1ea0d7d75a19d0 100644 --- a/VectoCore/VectoCoreTest/Reports/ModDataTest.cs +++ b/VectoCore/VectoCoreTest/Reports/ModDataTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs b/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs index 5a49f67a18eb6afe712b146d84461c077a66b89e..8a49735932b2f67c3b9ac6c74c076c0accd9ab69 100644 --- a/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs +++ b/VectoCore/VectoCoreTest/Reports/SumWriterTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCoreTest/Utils/AssertHelper.cs b/VectoCore/VectoCoreTest/Utils/AssertHelper.cs index 00fe1e4e84e6f713d9893f069c17a180d0e153fc..a73763d543e876fcdac519c6b80d3ab5d707faa4 100644 --- a/VectoCore/VectoCoreTest/Utils/AssertHelper.cs +++ b/VectoCore/VectoCoreTest/Utils/AssertHelper.cs @@ -1,110 +1,110 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.Diagnostics; -using System.Globalization; -using TUGraz.VectoCommon.Utils; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public static class AssertHelper - { - /// <summary> - /// Assert an expected Exception. - /// </summary> - [DebuggerHidden] - public static void Exception<T>(this Action func, string message = null) where T : Exception - { - try { - func(); - Assert.Fail("Expected Exception {0}, but no exception occured.", typeof(T)); - } catch (T ex) { - if (message != null) { - Assert.AreEqual(message, ex.Message); - } - } - } - - [DebuggerHidden] - public static void AreRelativeEqual(SI expected, SI actual, - double toleranceFactor = DoubleExtensionMethods.ToleranceFactor, string message = null) - { - Assert.IsTrue(actual.HasEqualUnit(expected), - string.Format("Wrong SI Units: expected: {0}, actual: {1}", expected.ToBasicUnits(), actual.ToBasicUnits())); - AreRelativeEqual(expected.Value(), actual.Value(), toleranceFactor: toleranceFactor, message: message); - } - - [DebuggerHidden] - public static void AreRelativeEqual(Scalar expected, Scalar actual, - double toleranceFactor = DoubleExtensionMethods.ToleranceFactor) - { - Assert.IsTrue(expected.HasEqualUnit(new SI()) && actual.HasEqualUnit(new SI()), "Units of Scalars must be empty."); - AreRelativeEqual(expected.Value(), actual.Value(), toleranceFactor: toleranceFactor); - } - - [DebuggerHidden] - public static void AreRelativeEqual(double? expected, SI actual, - double toleranceFactor = DoubleExtensionMethods.ToleranceFactor) - { - if (expected.HasValue) { - AreRelativeEqual(expected.Value, actual.Value(), toleranceFactor: toleranceFactor); - } else { - Assert.IsNull(actual, "Both Values have to be null or not null."); - } - } - - [DebuggerHidden] - public static void AreRelativeEqual(double? expected, double? actual, string message = null, - double toleranceFactor = DoubleExtensionMethods.ToleranceFactor) - { - if (!string.IsNullOrWhiteSpace(message)) { - message = "\n" + message; - } else { - message = ""; - } - - Assert.IsFalse(expected.HasValue ^ actual.HasValue, "Both Values have to be null or not null."); - - if (double.IsNaN(expected.Value)) { - Assert.IsTrue(double.IsNaN(actual.Value), - string.Format("Actual value is not NaN. Expected: {0}, Actual: {1}{2}", expected, actual, message)); - return; - } - - var ratio = expected == 0 ? Math.Abs(actual.Value) : Math.Abs(actual.Value / expected.Value - 1); - Assert.IsTrue(ratio < toleranceFactor, string.Format(CultureInfo.InvariantCulture, - "Given values are not equal. Expected: {0}, Actual: {1}, Difference: {3} (Tolerance Factor: {2}){4}", - expected, actual, toleranceFactor, expected - actual, message)); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Globalization; +using TUGraz.VectoCommon.Utils; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public static class AssertHelper + { + /// <summary> + /// Assert an expected Exception. + /// </summary> + [DebuggerHidden] + public static void Exception<T>(this Action func, string message = null) where T : Exception + { + try { + func(); + Assert.Fail("Expected Exception {0}, but no exception occured.", typeof(T)); + } catch (T ex) { + if (message != null) { + Assert.AreEqual(message, ex.Message); + } + } + } + + [DebuggerHidden] + public static void AreRelativeEqual(SI expected, SI actual, + double toleranceFactor = DoubleExtensionMethods.ToleranceFactor, string message = null) + { + Assert.IsTrue(actual.HasEqualUnit(expected), + string.Format("Wrong SI Units: expected: {0}, actual: {1}", expected.ToBasicUnits(), actual.ToBasicUnits())); + AreRelativeEqual(expected.Value(), actual.Value(), toleranceFactor: toleranceFactor, message: message); + } + + [DebuggerHidden] + public static void AreRelativeEqual(Scalar expected, Scalar actual, + double toleranceFactor = DoubleExtensionMethods.ToleranceFactor) + { + Assert.IsTrue(expected.HasEqualUnit(new SI()) && actual.HasEqualUnit(new SI()), "Units of Scalars must be empty."); + AreRelativeEqual(expected.Value(), actual.Value(), toleranceFactor: toleranceFactor); + } + + [DebuggerHidden] + public static void AreRelativeEqual(double? expected, SI actual, + double toleranceFactor = DoubleExtensionMethods.ToleranceFactor) + { + if (expected.HasValue) { + AreRelativeEqual(expected.Value, actual.Value(), toleranceFactor: toleranceFactor); + } else { + Assert.IsNull(actual, "Both Values have to be null or not null."); + } + } + + [DebuggerHidden] + public static void AreRelativeEqual(double? expected, double? actual, string message = null, + double toleranceFactor = DoubleExtensionMethods.ToleranceFactor) + { + if (!string.IsNullOrWhiteSpace(message)) { + message = "\n" + message; + } else { + message = ""; + } + + Assert.IsFalse(expected.HasValue ^ actual.HasValue, "Both Values have to be null or not null."); + + if (double.IsNaN(expected.Value)) { + Assert.IsTrue(double.IsNaN(actual.Value), + string.Format("Actual value is not NaN. Expected: {0}, Actual: {1}{2}", expected, actual, message)); + return; + } + + var ratio = expected == 0 ? Math.Abs(actual.Value) : Math.Abs(actual.Value / expected.Value - 1); + Assert.IsTrue(ratio < toleranceFactor, string.Format(CultureInfo.InvariantCulture, + "Given values are not equal. Expected: {0}, Actual: {1}, Difference: {3} (Tolerance Factor: {2}){4}", + expected, actual, toleranceFactor, expected - actual, message)); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs b/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs index 7d0732987fa4412c0583003741f596ce708c45c7..cb8199647242d0527f23598a7b6843903cae97c4 100644 --- a/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs +++ b/VectoCore/VectoCoreTest/Utils/DelauneyMapTest.cs @@ -1,213 +1,213 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using System.IO; -using System.Linq; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Utils -{ - [TestClass] - public class DelaunayMapTest - { - [TestMethod] - public void Test_Simple_DelaunayMap() - { - var map = new DelaunayMap("TEST"); - map.AddPoint(0, 0, 0); - map.AddPoint(1, 0, 0); - map.AddPoint(0, 1, 0); - - map.Triangulate(); - - var result = map.Interpolate(0.25, 0.25); - - AssertHelper.AreRelativeEqual(0, result); - } - - [TestMethod] - public void Test_DelaunayMapTriangle() - { - var map = new DelaunayMap("TEST"); - map.AddPoint(0, 0, 0); - map.AddPoint(1, 0, 1); - map.AddPoint(0, 1, 2); - - map.Triangulate(); - - // fixed points - AssertHelper.AreRelativeEqual(0, map.Interpolate(0, 0)); - AssertHelper.AreRelativeEqual(1, map.Interpolate(1, 0)); - AssertHelper.AreRelativeEqual(2, map.Interpolate(0, 1)); - - // interpolations - AssertHelper.AreRelativeEqual(0.5, map.Interpolate(0.5, 0)); - AssertHelper.AreRelativeEqual(1, map.Interpolate(0, 0.5)); - AssertHelper.AreRelativeEqual(1.5, map.Interpolate(0.5, 0.5)); - - AssertHelper.AreRelativeEqual(0.25, map.Interpolate(0.25, 0)); - AssertHelper.AreRelativeEqual(0.5, map.Interpolate(0, 0.25)); - AssertHelper.AreRelativeEqual(0.75, map.Interpolate(0.25, 0.25)); - - AssertHelper.AreRelativeEqual(0.75, map.Interpolate(0.75, 0)); - AssertHelper.AreRelativeEqual(1.5, map.Interpolate(0, 0.75)); - - // extrapolation (should fail) - Assert.IsNull(map.Interpolate(1, 1)); - Assert.IsNull(map.Interpolate(-1, -1)); - Assert.IsNull(map.Interpolate(1, -1)); - Assert.IsNull(map.Interpolate(-1, 1)); - } - - public void Test_DelaunayMapPlane() - { - var map = new DelaunayMap("TEST"); - map.AddPoint(0, 0, 0); - map.AddPoint(1, 0, 1); - map.AddPoint(0, 1, 2); - map.AddPoint(1, 1, 3); - - map.Triangulate(); - - // fixed points - AssertHelper.AreRelativeEqual(0, map.Interpolate(0, 0)); - AssertHelper.AreRelativeEqual(1, map.Interpolate(1, 0)); - AssertHelper.AreRelativeEqual(2, map.Interpolate(0, 1)); - AssertHelper.AreRelativeEqual(3, map.Interpolate(1, 1)); - - // interpolations - AssertHelper.AreRelativeEqual(0.5, map.Interpolate(0.5, 0)); - AssertHelper.AreRelativeEqual(1, map.Interpolate(0, 0.5)); - AssertHelper.AreRelativeEqual(2, map.Interpolate(1, 0.5)); - AssertHelper.AreRelativeEqual(2.5, map.Interpolate(0.5, 1)); - - AssertHelper.AreRelativeEqual(1.5, map.Interpolate(0.5, 0.5)); - - AssertHelper.AreRelativeEqual(0.75, map.Interpolate(0.25, 0.25)); - AssertHelper.AreRelativeEqual(2.25, map.Interpolate(0.75, 0.75)); - - AssertHelper.AreRelativeEqual(1.75, map.Interpolate(0.25, 0.75)); - AssertHelper.AreRelativeEqual(1.25, map.Interpolate(0.75, 0.25)); - - // extrapolation (should fail) - AssertHelper.Exception<VectoException>(() => map.Interpolate(1.5, 0.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(1.5, 1.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(0.5, 1.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(-0.5, 1.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(-0.5, 0.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(-1.5, -1.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(0.5, -0.5), "Interpolation failed."); - AssertHelper.Exception<VectoException>(() => map.Interpolate(-1.5, -0.5), "Interpolation failed."); - } - - [TestMethod] - public void Test_Delaunay_LessThan3Points() - { - AssertHelper.Exception<ArgumentException>(() => new DelaunayMap("TEST").Triangulate(), - "TEST: Triangulation needs at least 3 Points. Got 0 Points."); - - AssertHelper.Exception<ArgumentException>(() => { - var map1 = new DelaunayMap("TEST"); - map1.AddPoint(1, 0, 0); - map1.Triangulate(); - }, "TEST: Triangulation needs at least 3 Points. Got 1 Points."); - - AssertHelper.Exception<ArgumentException>(() => { - var map2 = new DelaunayMap("TEST"); - map2.AddPoint(1, 0, 0); - map2.AddPoint(0, 1, 0); - map2.Triangulate(); - }, "TEST: Triangulation needs at least 3 Points. Got 2 Points."); - - var map = new DelaunayMap("TEST"); - map.AddPoint(1, 0, 0); - map.AddPoint(0, 1, 0); - map.AddPoint(0, 0, 1); - map.Triangulate(); - } - - [TestMethod] - public void Test_Delaunay_DuplicatePoints() - { - var map = new DelaunayMap("TEST"); - map.AddPoint(0, 0, 0); - map.AddPoint(1, 0, 1); - map.AddPoint(1, 1, 3); - map.AddPoint(0, 1, 2); - map.AddPoint(1, 1, 5); - - AssertHelper.Exception<VectoException>(() => { map.Triangulate(); }, - "TEST: Input Data for Delaunay map contains duplicates! \n1 / 1"); - } - - [TestMethod] - public void Test_Delaunay_NormalOperation() - { - foreach (var factors in new[] { - Tuple.Create(1.0, 1.0), - Tuple.Create(1.0, 0.04), - Tuple.Create(1.0, 0.1), - Tuple.Create(1.0, 0.01), - Tuple.Create(1.0, 0.0001) - }) { - var xfactor = factors.Item1; - var yfactor = factors.Item2; - - var map = new DelaunayMap("TEST"); - var points = - File.ReadAllLines(@"TestData\Components\40t_Long_Haul_Truck.vmap") - .Skip(1) - .Select(s => { - var p = s.Split(',').ToDouble().ToList(); - return new Point(p[0] * xfactor, p[1] * yfactor, p[2]); - }) - .ToList(); - - points.ForEach(p => map.AddPoint(p.X, p.Y, p.Z)); - map.Triangulate(); - - // test fixed points - foreach (var p in points) { - AssertHelper.AreRelativeEqual(p.Z, map.Interpolate(p.X, p.Y)); - } - map.DrawGraph(); - - // test one arbitrary point in the middle - AssertHelper.AreRelativeEqual(37681, map.Interpolate(1500 * xfactor, 1300 * yfactor), - string.Format("{0}, {1}", xfactor, yfactor)); - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.IO; +using System.Linq; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Utils +{ + [TestClass] + public class DelaunayMapTest + { + [TestMethod] + public void Test_Simple_DelaunayMap() + { + var map = new DelaunayMap("TEST"); + map.AddPoint(0, 0, 0); + map.AddPoint(1, 0, 0); + map.AddPoint(0, 1, 0); + + map.Triangulate(); + + var result = map.Interpolate(0.25, 0.25); + + AssertHelper.AreRelativeEqual(0, result); + } + + [TestMethod] + public void Test_DelaunayMapTriangle() + { + var map = new DelaunayMap("TEST"); + map.AddPoint(0, 0, 0); + map.AddPoint(1, 0, 1); + map.AddPoint(0, 1, 2); + + map.Triangulate(); + + // fixed points + AssertHelper.AreRelativeEqual(0, map.Interpolate(0, 0)); + AssertHelper.AreRelativeEqual(1, map.Interpolate(1, 0)); + AssertHelper.AreRelativeEqual(2, map.Interpolate(0, 1)); + + // interpolations + AssertHelper.AreRelativeEqual(0.5, map.Interpolate(0.5, 0)); + AssertHelper.AreRelativeEqual(1, map.Interpolate(0, 0.5)); + AssertHelper.AreRelativeEqual(1.5, map.Interpolate(0.5, 0.5)); + + AssertHelper.AreRelativeEqual(0.25, map.Interpolate(0.25, 0)); + AssertHelper.AreRelativeEqual(0.5, map.Interpolate(0, 0.25)); + AssertHelper.AreRelativeEqual(0.75, map.Interpolate(0.25, 0.25)); + + AssertHelper.AreRelativeEqual(0.75, map.Interpolate(0.75, 0)); + AssertHelper.AreRelativeEqual(1.5, map.Interpolate(0, 0.75)); + + // extrapolation (should fail) + Assert.IsNull(map.Interpolate(1, 1)); + Assert.IsNull(map.Interpolate(-1, -1)); + Assert.IsNull(map.Interpolate(1, -1)); + Assert.IsNull(map.Interpolate(-1, 1)); + } + + public void Test_DelaunayMapPlane() + { + var map = new DelaunayMap("TEST"); + map.AddPoint(0, 0, 0); + map.AddPoint(1, 0, 1); + map.AddPoint(0, 1, 2); + map.AddPoint(1, 1, 3); + + map.Triangulate(); + + // fixed points + AssertHelper.AreRelativeEqual(0, map.Interpolate(0, 0)); + AssertHelper.AreRelativeEqual(1, map.Interpolate(1, 0)); + AssertHelper.AreRelativeEqual(2, map.Interpolate(0, 1)); + AssertHelper.AreRelativeEqual(3, map.Interpolate(1, 1)); + + // interpolations + AssertHelper.AreRelativeEqual(0.5, map.Interpolate(0.5, 0)); + AssertHelper.AreRelativeEqual(1, map.Interpolate(0, 0.5)); + AssertHelper.AreRelativeEqual(2, map.Interpolate(1, 0.5)); + AssertHelper.AreRelativeEqual(2.5, map.Interpolate(0.5, 1)); + + AssertHelper.AreRelativeEqual(1.5, map.Interpolate(0.5, 0.5)); + + AssertHelper.AreRelativeEqual(0.75, map.Interpolate(0.25, 0.25)); + AssertHelper.AreRelativeEqual(2.25, map.Interpolate(0.75, 0.75)); + + AssertHelper.AreRelativeEqual(1.75, map.Interpolate(0.25, 0.75)); + AssertHelper.AreRelativeEqual(1.25, map.Interpolate(0.75, 0.25)); + + // extrapolation (should fail) + AssertHelper.Exception<VectoException>(() => map.Interpolate(1.5, 0.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(1.5, 1.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(0.5, 1.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(-0.5, 1.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(-0.5, 0.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(-1.5, -1.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(0.5, -0.5), "Interpolation failed."); + AssertHelper.Exception<VectoException>(() => map.Interpolate(-1.5, -0.5), "Interpolation failed."); + } + + [TestMethod] + public void Test_Delaunay_LessThan3Points() + { + AssertHelper.Exception<ArgumentException>(() => new DelaunayMap("TEST").Triangulate(), + "TEST: Triangulation needs at least 3 Points. Got 0 Points."); + + AssertHelper.Exception<ArgumentException>(() => { + var map1 = new DelaunayMap("TEST"); + map1.AddPoint(1, 0, 0); + map1.Triangulate(); + }, "TEST: Triangulation needs at least 3 Points. Got 1 Points."); + + AssertHelper.Exception<ArgumentException>(() => { + var map2 = new DelaunayMap("TEST"); + map2.AddPoint(1, 0, 0); + map2.AddPoint(0, 1, 0); + map2.Triangulate(); + }, "TEST: Triangulation needs at least 3 Points. Got 2 Points."); + + var map = new DelaunayMap("TEST"); + map.AddPoint(1, 0, 0); + map.AddPoint(0, 1, 0); + map.AddPoint(0, 0, 1); + map.Triangulate(); + } + + [TestMethod] + public void Test_Delaunay_DuplicatePoints() + { + var map = new DelaunayMap("TEST"); + map.AddPoint(0, 0, 0); + map.AddPoint(1, 0, 1); + map.AddPoint(1, 1, 3); + map.AddPoint(0, 1, 2); + map.AddPoint(1, 1, 5); + + AssertHelper.Exception<VectoException>(() => { map.Triangulate(); }, + "TEST: Input Data for Delaunay map contains duplicates! \n1 / 1"); + } + + [TestMethod] + public void Test_Delaunay_NormalOperation() + { + foreach (var factors in new[] { + Tuple.Create(1.0, 1.0), + Tuple.Create(1.0, 0.04), + Tuple.Create(1.0, 0.1), + Tuple.Create(1.0, 0.01), + Tuple.Create(1.0, 0.0001) + }) { + var xfactor = factors.Item1; + var yfactor = factors.Item2; + + var map = new DelaunayMap("TEST"); + var points = + File.ReadAllLines(@"TestData\Components\40t_Long_Haul_Truck.vmap") + .Skip(1) + .Select(s => { + var p = s.Split(',').ToDouble().ToList(); + return new Point(p[0] * xfactor, p[1] * yfactor, p[2]); + }) + .ToList(); + + points.ForEach(p => map.AddPoint(p.X, p.Y, p.Z)); + map.Triangulate(); + + // test fixed points + foreach (var p in points) { + AssertHelper.AreRelativeEqual(p.Z, map.Interpolate(p.X, p.Y)); + } + map.DrawGraph(); + + // test one arbitrary point in the middle + AssertHelper.AreRelativeEqual(37681, map.Interpolate(1500 * xfactor, 1300 * yfactor), + string.Format("{0}, {1}", xfactor, yfactor)); + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs b/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs index 2258319d5ea7aa5069f88c49a62fbd95ee7144f0..fec0d4c63319ce7f1c06438b0a02dd93a1721aaa 100644 --- a/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs +++ b/VectoCore/VectoCoreTest/Utils/DoubleExtensionMethodTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCoreTest/Utils/GraphWriter.cs b/VectoCore/VectoCoreTest/Utils/GraphWriter.cs index fa610c1c2c1fa75adc6a90cdc4081f2cb156d7e5..f21d9664b85013652cbff02f978a7fcff267f1b8 100644 --- a/VectoCore/VectoCoreTest/Utils/GraphWriter.cs +++ b/VectoCore/VectoCoreTest/Utils/GraphWriter.cs @@ -1,444 +1,444 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Drawing; -using System.Linq; -using System.Windows.Forms.DataVisualization.Charting; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Utils; - -// ReSharper disable UnusedVariable - -namespace TUGraz.VectoCore.Tests.Utils -{ - public static class GraphWriter - { - private static bool _enabled = true; - - private static Size _diagramSize = new Size(2000, 440); - - private static readonly Font AxisLabelFont = new Font("Consolas", 10); - private static readonly Font AxisTitleFont = new Font("Verdana", 12); - private static readonly Font LegendFont = new Font("Verdana", 14); - - public static string Series2Label { get; set; } - - public static string Series1Label { get; set; } - - public static ModalResultField[] Yfields { get; set; } - - public static ModalResultField[] Xfields { get; set; } - - public static bool PlotDrivingMode = false; - - public static void Enable() - { - _enabled = true; - } - - public static void Disable() - { - _enabled = false; - } - - public static void Write(string fileNameV3, string fileNameV22 = null) - { - if (!_enabled) { - return; - } - - var modDataV3 = VectoCSVFile.Read(fileNameV3); - if (!File.Exists(fileNameV22)) { - LogManager.GetLogger(typeof(GraphWriter).FullName).Error("Modfile V2.2 not found: " + fileNameV22); - //Write(fileNameV3); - //return; - } - DataTable modDataV22 = null; - if (!string.IsNullOrWhiteSpace(fileNameV22) && File.Exists(fileNameV22)) - modDataV22 = VectoCSVFile.Read(fileNameV22); - - var titleHeight = (50 * 100.0f) / (_diagramSize.Height * Yfields.Length); - - foreach (var xfield in Xfields) { - var fileName = string.Format("{0}_{1}.png", Path.GetFileNameWithoutExtension(fileNameV3), - xfield.GetName()); - - var x = LoadData(modDataV3, xfield.GetName()); - var x2 = new[] { double.NegativeInfinity }; - if (fileNameV22 != null && modDataV22 != null) { - x2 = LoadData(modDataV22, xfield.GetName()); - } - var plotSize = new Size(_diagramSize.Width, _diagramSize.Height * Yfields.Length); - var maxX = (int)(Math.Ceiling(Math.Max(x.Max(), x2.Max()) * 1.01 / 10.0) * 10.0); - var minX = (int)(Math.Floor(Math.Max(x.Min(), x2.Min()) / 10.0) * 10.0); - var chart = new Chart { Size = plotSize }; - - for (var i = 0; i < Yfields.Length; i++) { - var yfield = Yfields[i]; - var y = LoadData(modDataV3, yfield.GetName()); - - var chartArea = AddChartArea(chart, yfield.ToString(), xfield.GetCaption(), maxX, minX, - yfield.GetCaption(), yfield == ModalResultField.Gear); - - var legend = CreateLegend(chart, yfield.ToString()); - - if (yfield == ModalResultField.v_act) { - var y3 = LoadData(modDataV3, ModalResultField.v_targ.GetName()); - var series3 = CreateSeries("v_target", legend, chartArea, chart, Color.Green, x, y3); - - var grad = LoadData(modDataV3, ModalResultField.grad.GetName()); - - chartArea.AxisY2.Enabled = AxisEnabled.True; - chartArea.AxisY2.Title = "gradient [%]"; - chartArea.AxisY2.TitleFont = AxisTitleFont; - chartArea.AxisY2.LabelStyle.Font = AxisLabelFont; - chartArea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.None; - chartArea.AxisY2.MinorGrid.Enabled = false; - chartArea.AxisY2.MajorGrid.Enabled = false; - var max = Math.Max(-Math.Round(grad.Min() * 2), Math.Round(grad.Max() * 2)); - //chartArea.AxisY2.si - //chartArea.AxisY2.Minimum = -max; - //chartArea.AxisY2.Maximum = max; - chartArea.AxisY2.RoundAxisValues(); - chartArea.AxisY2.Interval = Math.Round(max / 5); - - if (modDataV3.Columns.Contains("Alt")) { - var alt = LoadData(modDataV3, "Alt"); - var seriesAlt = CreateSeries("Altitude", legend, chartArea, chart, Color.Brown, x, alt); - seriesAlt.YAxisType = AxisType.Secondary; - } - var seriesGrad = CreateSeries("Gradient", legend, chartArea, chart, Color.Coral, x, grad); - seriesGrad.YAxisType = AxisType.Secondary; - } - if (PlotDrivingMode && yfield == Yfields.First()) { - if (modDataV3.Columns.Contains("Action")) { - var actionMapping = new Dictionary<string, double> { - { "Accelerate", 2 - 3 }, - { "Coast", 1 - 3 }, - { "Roll", 0 - 3 }, - { "Brake", -1 - 3 } - }; - var action = LoadDataMapped(modDataV3, "Action", actionMapping); - var seriesAction = CreateSeries("Driving Action", legend, chartArea, chart, Color.Magenta, x, action); - //seriesAction.YAxisType = AxisType.Secondary; - } - - if (modDataV3.Columns.Contains("DrivingMode")) { - var modeMapping = new Dictionary<string, double> { - { "DrivingModeDrive", -1 }, - { "DrivingModeBrake", -6 }, - }; - var mode = LoadDataMapped(modDataV3, "DrivingMode", modeMapping); - var seriesAction = CreateSeries("Driving Mode", legend, chartArea, chart, Color.Maroon, x, mode); - //seriesAction.YAxisType = AxisType; - } - } - - var series1 = CreateSeries(string.Format("{1} - {0}", yfield, Series1Label), legend, chartArea, chart, - Color.Blue, x, y); - - if (modDataV22 != null) { - var y2 = LoadData(modDataV22, TranslateFieldname(yfield)); - var series2 = CreateSeries(string.Format("{1} - {0}", yfield, Series2Label), legend, chartArea, chart, - Color.Red, x2, - y2); - } - - PositionChartArea(chartArea, titleHeight, i, Yfields.Length); - - if (i > 0) { - AlignChart(chart, yfield.ToString(), Yfields[0].ToString()); - } - } - - AddTitle(chart, Path.GetFileNameWithoutExtension(fileName), Yfields[0].ToString()); - - chart.Invalidate(); - chart.SaveImage(Path.Combine(Path.GetDirectoryName(fileNameV3) ?? "", fileName), ChartImageFormat.Png); - } - } - - private static string TranslateFieldname(ModalResultField modalResultField) - { - switch (modalResultField) { - case ModalResultField.n_eng_avg: - return "n"; - case ModalResultField.P_eng_out: - return "Pe_eng"; - case ModalResultField.T_eng_fcmap: - return "Tq_eng"; - case ModalResultField.P_aux: - return "Paux"; - //case ModalResultField.AA_TotalCycleFC_Grams: - // return "AA_TotalCycleFC_Grams []"; - default: - return modalResultField.GetName(); - } - } - - public static bool WriteDistanceSlice(string fileNameV3, string fileNameV22, double start, double end) - { - if (!_enabled) { - return true; - } - - var modDataV3Iput = VectoCSVFile.Read(fileNameV3); - //var modDataV3View = new DataView(modDataV3Iput) { - // RowFilter = string.Format(@"dist > {0} AND dist < {1}", start, end) - //}; - //var modDataV3 = modDataV3View.ToTable(); - var modDataV3Tmp = modDataV3Iput.AsEnumerable().Where(row => { - var s = row.ParseDouble("dist"); - return s >= start && s <= end; - }); - - if (!File.Exists(fileNameV22)) { - //LogManager.GetCurrentClassLogger().Error("Modfile V2.2 not found: " + fileNameV22); - //Write(fileNameV3); - //return; - } - DataTable modDataV22 = null; - if (fileNameV22 != null) { - var modDataV22Input = VectoCSVFile.Read(fileNameV22); - //var modDataV22View = new DataView(modDataV22Input) { - // RowFilter = string.Format(@"dist > {0} AND dist < {1}", start, end) - //}; - var modDataV22Tmp = modDataV22Input.AsEnumerable().Where(row => { - var s = row.ParseDouble("dist"); - return s >= start && s <= end; - }); - if (!(modDataV3Tmp.Any() || modDataV22Tmp.Any())) { - return false; - } - modDataV22 = modDataV22Tmp.CopyToDataTable(); - } else { - if (!modDataV3Tmp.Any()) { - return false; - } - } - var modDataV3 = modDataV3Tmp.CopyToDataTable(); - - //var xfields = new[] { ModalResultField.dist }; - var xfield = ModalResultField.dist; - var yfields = new[] { - ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, - ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap - }; - - var titleHeight = (50 * 100.0f) / (_diagramSize.Height * yfields.Length); - - //foreach (var xfield in xfields) { - var fileName = string.Format("{0}_{1}-{2:D3}_{3:D3}.png", Path.GetFileNameWithoutExtension(fileNameV3), - xfield.GetName(), (int)(start / 1000), (int)(end / 1000)); - - var x = LoadData(modDataV3, xfield.GetName()); - var x2 = new[] { double.NegativeInfinity }; - if (fileNameV22 != null && modDataV22 != null) { - x2 = LoadData(modDataV22, xfield.GetName()); - } - var plotSize = new Size(_diagramSize.Width, _diagramSize.Height * yfields.Length); - var maxX = (int)(Math.Ceiling(Math.Max(x.Max(), x2.Max()) * 1.01 / 10.0) * 10.0); - var minX = (int)(Math.Floor(Math.Max(x.Min(), x2.Min()) / 10.0) * 10.0); - var chart = new Chart { Size = plotSize }; - - for (var i = 0; i < yfields.Length; i++) { - var yfield = yfields[i]; - var y = LoadData(modDataV3, yfield.GetName()); - - var chartArea = AddChartArea(chart, yfield.ToString(), xfield.GetCaption(), maxX, minX, - yfield.GetCaption(), yfield == ModalResultField.Gear); - - var legend = CreateLegend(chart, yfield.ToString()); - - if (yfield == ModalResultField.v_act) { - var y3 = LoadData(modDataV3, ModalResultField.v_targ.GetName()); - var series3 = CreateSeries("v_target", legend, chartArea, chart, Color.Green, x, y3); - - var grad = LoadData(modDataV3, ModalResultField.grad.GetName()); - - chartArea.AxisY2.Enabled = AxisEnabled.True; - chartArea.AxisY2.Title = "gradient [%]"; - chartArea.AxisY2.TitleFont = AxisTitleFont; - chartArea.AxisY2.LabelStyle.Font = AxisLabelFont; - chartArea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.None; - chartArea.AxisY2.MinorGrid.Enabled = false; - chartArea.AxisY2.MajorGrid.Enabled = false; - var max = Math.Max(-Math.Round(grad.Min() * 2), Math.Round(grad.Max() * 2)); - //chartArea.AxisY2.si - chartArea.AxisY2.Minimum = -max; - chartArea.AxisY2.Maximum = max; - chartArea.AxisY2.RoundAxisValues(); - - var seriesGrad = CreateSeries("Gradient", legend, chartArea, chart, Color.Coral, x, grad); - seriesGrad.YAxisType = AxisType.Secondary; - } - - var series1 = CreateSeries(string.Format("Vecto 3 - {0}", yfield), legend, chartArea, chart, - Color.Blue, x, y); - - if (fileNameV22 != null) { - var y2 = LoadData(modDataV22, yfield.GetName()); - var series2 = CreateSeries(string.Format("Vecto 2.2 - {0}", yfield), legend, chartArea, chart, - Color.Red, x2, y2); - } - - PositionChartArea(chartArea, titleHeight, i, yfields.Length); - - if (i > 0) { - AlignChart(chart, yfield.ToString(), yfields[0].ToString()); - } - //} - - AddTitle(chart, Path.GetFileNameWithoutExtension(fileName), yfields[0].ToString()); - - chart.Invalidate(); - chart.SaveImage(fileName, ChartImageFormat.Png); - } - return true; - } - - private static void AddTitle(Chart chart, string titleText, string dockToChartArea) - { - var title = new Title { - Text = titleText, - DockedToChartArea = dockToChartArea, - IsDockedInsideChartArea = false, - Font = new Font("Verdana", 18, FontStyle.Bold) - }; - chart.Titles.Add(title); - } - - private static double[] LoadData(DataTable modDataV3, string field) - { - return modDataV3.Rows.Cast<DataRow>() - .Select(v => v.Field<string>(field).Length == 0 - ? double.NaN - : v.Field<string>(field).ToDouble()) - .ToArray(); - } - - private static double[] LoadDataMapped(DataTable modDataV3, string field, Dictionary<string, double> mapping) - { - return (from x in modDataV3.Rows.Cast<DataRow>() - let val = x.Field<string>(field) - select mapping.ContainsKey(val) ? mapping[val] : double.NaN).ToArray(); - } - - private static void AlignChart(Chart chart, string chartToAlign, string chartToAlignWith) - { - chart.ChartAreas[chartToAlign].AlignWithChartArea = chartToAlignWith; - chart.ChartAreas[chartToAlign].AlignmentOrientation = AreaAlignmentOrientations.Vertical; - chart.ChartAreas[chartToAlign].AlignmentStyle = AreaAlignmentStyles.All; - } - - private static void PositionChartArea(ChartArea chartArea, float titleHeight, int i, int numCharts) - { - chartArea.Position.Auto = false; - chartArea.Position.Width = 85; - chartArea.Position.Height = (100.0f - titleHeight) / numCharts; - chartArea.Position.X = 0; - chartArea.Position.Y = (i * (100.0f - titleHeight)) / numCharts + titleHeight; - } - - private static ChartArea AddChartArea(Chart chart, string name, string axisXTitle, int xMax, int xMin, - string axisYTitle, bool discreteValues) - { - var chartArea = new ChartArea { Name = name }; - chartArea.AxisX.MajorGrid.LineColor = Color.DarkGray; - chartArea.AxisY.MajorGrid.LineColor = Color.DarkGray; - chartArea.AxisX.LabelStyle.Font = AxisLabelFont; - chartArea.AxisY.LabelStyle.Font = AxisLabelFont; - - chartArea.AxisX.Interval = xMax / 20.0; - chartArea.AxisX.Maximum = xMax; - chartArea.AxisX.Minimum = xMin; - chartArea.AxisX.MinorGrid.Enabled = true; - chartArea.AxisX.MinorGrid.Interval = (xMax - xMin) / 100.0; - chartArea.AxisX.MinorGrid.LineColor = Color.LightGray; - chartArea.AxisX.Title = axisXTitle; - chartArea.AxisX.TitleFont = AxisTitleFont; - chartArea.AxisX.RoundAxisValues(); - chartArea.AxisX.MajorTickMark.Size = 2 * 100.0f / _diagramSize.Height; - - chartArea.AxisY.Title = axisYTitle; - chartArea.AxisY.TitleFont = AxisTitleFont; - chartArea.AxisY.RoundAxisValues(); - if (discreteValues) { - chartArea.AxisY.MajorGrid.Interval = 1; - chartArea.AxisY.MinorGrid.Enabled = false; - } else { - chartArea.AxisY.MinorGrid.Enabled = true; - } - chartArea.AxisY.MinorGrid.LineColor = Color.LightGray; - chartArea.AxisY.MajorTickMark.Size = 5 * 100.0f / _diagramSize.Width; - - chart.ChartAreas.Add(chartArea); - return chartArea; - } - - private static Legend CreateLegend(Chart chart, string dockToChartArea) - { - var legend = new Legend(dockToChartArea) { - Docking = Docking.Right, - IsDockedInsideChartArea = false, - DockedToChartArea = dockToChartArea, - Font = LegendFont, - }; - chart.Legends.Add(legend); - return legend; - } - - private static Series CreateSeries(String name, Legend legend, ChartArea chartArea, Chart chart, Color color, - IEnumerable<double> x, IEnumerable<double> y) - { - //ModalResultField yfield; - var series1 = new Series { - Name = name, - ChartType = SeriesChartType.Line, - Color = color, - BorderWidth = 2, - Legend = legend.Name, - IsVisibleInLegend = true, - ChartArea = chartArea.Name, - }; - - chart.Series.Add(series1); - chart.Series[series1.Name].Points.DataBindXY(x, y); - return series1; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Drawing; +using System.Linq; +using System.Windows.Forms.DataVisualization.Charting; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Utils; + +// ReSharper disable UnusedVariable + +namespace TUGraz.VectoCore.Tests.Utils +{ + public static class GraphWriter + { + private static bool _enabled = true; + + private static Size _diagramSize = new Size(2000, 440); + + private static readonly Font AxisLabelFont = new Font("Consolas", 10); + private static readonly Font AxisTitleFont = new Font("Verdana", 12); + private static readonly Font LegendFont = new Font("Verdana", 14); + + public static string Series2Label { get; set; } + + public static string Series1Label { get; set; } + + public static ModalResultField[] Yfields { get; set; } + + public static ModalResultField[] Xfields { get; set; } + + public static bool PlotDrivingMode = false; + + public static void Enable() + { + _enabled = true; + } + + public static void Disable() + { + _enabled = false; + } + + public static void Write(string fileNameV3, string fileNameV22 = null) + { + if (!_enabled) { + return; + } + + var modDataV3 = VectoCSVFile.Read(fileNameV3); + if (!File.Exists(fileNameV22)) { + LogManager.GetLogger(typeof(GraphWriter).FullName).Error("Modfile V2.2 not found: " + fileNameV22); + //Write(fileNameV3); + //return; + } + DataTable modDataV22 = null; + if (!string.IsNullOrWhiteSpace(fileNameV22) && File.Exists(fileNameV22)) + modDataV22 = VectoCSVFile.Read(fileNameV22); + + var titleHeight = (50 * 100.0f) / (_diagramSize.Height * Yfields.Length); + + foreach (var xfield in Xfields) { + var fileName = string.Format("{0}_{1}.png", Path.GetFileNameWithoutExtension(fileNameV3), + xfield.GetName()); + + var x = LoadData(modDataV3, xfield.GetName()); + var x2 = new[] { double.NegativeInfinity }; + if (fileNameV22 != null && modDataV22 != null) { + x2 = LoadData(modDataV22, xfield.GetName()); + } + var plotSize = new Size(_diagramSize.Width, _diagramSize.Height * Yfields.Length); + var maxX = (int)(Math.Ceiling(Math.Max(x.Max(), x2.Max()) * 1.01 / 10.0) * 10.0); + var minX = (int)(Math.Floor(Math.Max(x.Min(), x2.Min()) / 10.0) * 10.0); + var chart = new Chart { Size = plotSize }; + + for (var i = 0; i < Yfields.Length; i++) { + var yfield = Yfields[i]; + var y = LoadData(modDataV3, yfield.GetName()); + + var chartArea = AddChartArea(chart, yfield.ToString(), xfield.GetCaption(), maxX, minX, + yfield.GetCaption(), yfield == ModalResultField.Gear); + + var legend = CreateLegend(chart, yfield.ToString()); + + if (yfield == ModalResultField.v_act) { + var y3 = LoadData(modDataV3, ModalResultField.v_targ.GetName()); + var series3 = CreateSeries("v_target", legend, chartArea, chart, Color.Green, x, y3); + + var grad = LoadData(modDataV3, ModalResultField.grad.GetName()); + + chartArea.AxisY2.Enabled = AxisEnabled.True; + chartArea.AxisY2.Title = "gradient [%]"; + chartArea.AxisY2.TitleFont = AxisTitleFont; + chartArea.AxisY2.LabelStyle.Font = AxisLabelFont; + chartArea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.None; + chartArea.AxisY2.MinorGrid.Enabled = false; + chartArea.AxisY2.MajorGrid.Enabled = false; + var max = Math.Max(-Math.Round(grad.Min() * 2), Math.Round(grad.Max() * 2)); + //chartArea.AxisY2.si + //chartArea.AxisY2.Minimum = -max; + //chartArea.AxisY2.Maximum = max; + chartArea.AxisY2.RoundAxisValues(); + chartArea.AxisY2.Interval = Math.Round(max / 5); + + if (modDataV3.Columns.Contains("Alt")) { + var alt = LoadData(modDataV3, "Alt"); + var seriesAlt = CreateSeries("Altitude", legend, chartArea, chart, Color.Brown, x, alt); + seriesAlt.YAxisType = AxisType.Secondary; + } + var seriesGrad = CreateSeries("Gradient", legend, chartArea, chart, Color.Coral, x, grad); + seriesGrad.YAxisType = AxisType.Secondary; + } + if (PlotDrivingMode && yfield == Yfields.First()) { + if (modDataV3.Columns.Contains("Action")) { + var actionMapping = new Dictionary<string, double> { + { "Accelerate", 2 - 3 }, + { "Coast", 1 - 3 }, + { "Roll", 0 - 3 }, + { "Brake", -1 - 3 } + }; + var action = LoadDataMapped(modDataV3, "Action", actionMapping); + var seriesAction = CreateSeries("Driving Action", legend, chartArea, chart, Color.Magenta, x, action); + //seriesAction.YAxisType = AxisType.Secondary; + } + + if (modDataV3.Columns.Contains("DrivingMode")) { + var modeMapping = new Dictionary<string, double> { + { "DrivingModeDrive", -1 }, + { "DrivingModeBrake", -6 }, + }; + var mode = LoadDataMapped(modDataV3, "DrivingMode", modeMapping); + var seriesAction = CreateSeries("Driving Mode", legend, chartArea, chart, Color.Maroon, x, mode); + //seriesAction.YAxisType = AxisType; + } + } + + var series1 = CreateSeries(string.Format("{1} - {0}", yfield, Series1Label), legend, chartArea, chart, + Color.Blue, x, y); + + if (modDataV22 != null) { + var y2 = LoadData(modDataV22, TranslateFieldname(yfield)); + var series2 = CreateSeries(string.Format("{1} - {0}", yfield, Series2Label), legend, chartArea, chart, + Color.Red, x2, + y2); + } + + PositionChartArea(chartArea, titleHeight, i, Yfields.Length); + + if (i > 0) { + AlignChart(chart, yfield.ToString(), Yfields[0].ToString()); + } + } + + AddTitle(chart, Path.GetFileNameWithoutExtension(fileName), Yfields[0].ToString()); + + chart.Invalidate(); + chart.SaveImage(Path.Combine(Path.GetDirectoryName(fileNameV3) ?? "", fileName), ChartImageFormat.Png); + } + } + + private static string TranslateFieldname(ModalResultField modalResultField) + { + switch (modalResultField) { + case ModalResultField.n_eng_avg: + return "n"; + case ModalResultField.P_eng_out: + return "Pe_eng"; + case ModalResultField.T_eng_fcmap: + return "Tq_eng"; + case ModalResultField.P_aux: + return "Paux"; + //case ModalResultField.AA_TotalCycleFC_Grams: + // return "AA_TotalCycleFC_Grams []"; + default: + return modalResultField.GetName(); + } + } + + public static bool WriteDistanceSlice(string fileNameV3, string fileNameV22, double start, double end) + { + if (!_enabled) { + return true; + } + + var modDataV3Iput = VectoCSVFile.Read(fileNameV3); + //var modDataV3View = new DataView(modDataV3Iput) { + // RowFilter = string.Format(@"dist > {0} AND dist < {1}", start, end) + //}; + //var modDataV3 = modDataV3View.ToTable(); + var modDataV3Tmp = modDataV3Iput.AsEnumerable().Where(row => { + var s = row.ParseDouble("dist"); + return s >= start && s <= end; + }); + + if (!File.Exists(fileNameV22)) { + //LogManager.GetCurrentClassLogger().Error("Modfile V2.2 not found: " + fileNameV22); + //Write(fileNameV3); + //return; + } + DataTable modDataV22 = null; + if (fileNameV22 != null) { + var modDataV22Input = VectoCSVFile.Read(fileNameV22); + //var modDataV22View = new DataView(modDataV22Input) { + // RowFilter = string.Format(@"dist > {0} AND dist < {1}", start, end) + //}; + var modDataV22Tmp = modDataV22Input.AsEnumerable().Where(row => { + var s = row.ParseDouble("dist"); + return s >= start && s <= end; + }); + if (!(modDataV3Tmp.Any() || modDataV22Tmp.Any())) { + return false; + } + modDataV22 = modDataV22Tmp.CopyToDataTable(); + } else { + if (!modDataV3Tmp.Any()) { + return false; + } + } + var modDataV3 = modDataV3Tmp.CopyToDataTable(); + + //var xfields = new[] { ModalResultField.dist }; + var xfield = ModalResultField.dist; + var yfields = new[] { + ModalResultField.v_act, ModalResultField.acc, ModalResultField.n_eng_avg, ModalResultField.Gear, + ModalResultField.P_eng_out, ModalResultField.T_eng_fcmap, ModalResultField.FCMap + }; + + var titleHeight = (50 * 100.0f) / (_diagramSize.Height * yfields.Length); + + //foreach (var xfield in xfields) { + var fileName = string.Format("{0}_{1}-{2:D3}_{3:D3}.png", Path.GetFileNameWithoutExtension(fileNameV3), + xfield.GetName(), (int)(start / 1000), (int)(end / 1000)); + + var x = LoadData(modDataV3, xfield.GetName()); + var x2 = new[] { double.NegativeInfinity }; + if (fileNameV22 != null && modDataV22 != null) { + x2 = LoadData(modDataV22, xfield.GetName()); + } + var plotSize = new Size(_diagramSize.Width, _diagramSize.Height * yfields.Length); + var maxX = (int)(Math.Ceiling(Math.Max(x.Max(), x2.Max()) * 1.01 / 10.0) * 10.0); + var minX = (int)(Math.Floor(Math.Max(x.Min(), x2.Min()) / 10.0) * 10.0); + var chart = new Chart { Size = plotSize }; + + for (var i = 0; i < yfields.Length; i++) { + var yfield = yfields[i]; + var y = LoadData(modDataV3, yfield.GetName()); + + var chartArea = AddChartArea(chart, yfield.ToString(), xfield.GetCaption(), maxX, minX, + yfield.GetCaption(), yfield == ModalResultField.Gear); + + var legend = CreateLegend(chart, yfield.ToString()); + + if (yfield == ModalResultField.v_act) { + var y3 = LoadData(modDataV3, ModalResultField.v_targ.GetName()); + var series3 = CreateSeries("v_target", legend, chartArea, chart, Color.Green, x, y3); + + var grad = LoadData(modDataV3, ModalResultField.grad.GetName()); + + chartArea.AxisY2.Enabled = AxisEnabled.True; + chartArea.AxisY2.Title = "gradient [%]"; + chartArea.AxisY2.TitleFont = AxisTitleFont; + chartArea.AxisY2.LabelStyle.Font = AxisLabelFont; + chartArea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.None; + chartArea.AxisY2.MinorGrid.Enabled = false; + chartArea.AxisY2.MajorGrid.Enabled = false; + var max = Math.Max(-Math.Round(grad.Min() * 2), Math.Round(grad.Max() * 2)); + //chartArea.AxisY2.si + chartArea.AxisY2.Minimum = -max; + chartArea.AxisY2.Maximum = max; + chartArea.AxisY2.RoundAxisValues(); + + var seriesGrad = CreateSeries("Gradient", legend, chartArea, chart, Color.Coral, x, grad); + seriesGrad.YAxisType = AxisType.Secondary; + } + + var series1 = CreateSeries(string.Format("Vecto 3 - {0}", yfield), legend, chartArea, chart, + Color.Blue, x, y); + + if (fileNameV22 != null) { + var y2 = LoadData(modDataV22, yfield.GetName()); + var series2 = CreateSeries(string.Format("Vecto 2.2 - {0}", yfield), legend, chartArea, chart, + Color.Red, x2, y2); + } + + PositionChartArea(chartArea, titleHeight, i, yfields.Length); + + if (i > 0) { + AlignChart(chart, yfield.ToString(), yfields[0].ToString()); + } + //} + + AddTitle(chart, Path.GetFileNameWithoutExtension(fileName), yfields[0].ToString()); + + chart.Invalidate(); + chart.SaveImage(fileName, ChartImageFormat.Png); + } + return true; + } + + private static void AddTitle(Chart chart, string titleText, string dockToChartArea) + { + var title = new Title { + Text = titleText, + DockedToChartArea = dockToChartArea, + IsDockedInsideChartArea = false, + Font = new Font("Verdana", 18, FontStyle.Bold) + }; + chart.Titles.Add(title); + } + + private static double[] LoadData(DataTable modDataV3, string field) + { + return modDataV3.Rows.Cast<DataRow>() + .Select(v => v.Field<string>(field).Length == 0 + ? double.NaN + : v.Field<string>(field).ToDouble()) + .ToArray(); + } + + private static double[] LoadDataMapped(DataTable modDataV3, string field, Dictionary<string, double> mapping) + { + return (from x in modDataV3.Rows.Cast<DataRow>() + let val = x.Field<string>(field) + select mapping.ContainsKey(val) ? mapping[val] : double.NaN).ToArray(); + } + + private static void AlignChart(Chart chart, string chartToAlign, string chartToAlignWith) + { + chart.ChartAreas[chartToAlign].AlignWithChartArea = chartToAlignWith; + chart.ChartAreas[chartToAlign].AlignmentOrientation = AreaAlignmentOrientations.Vertical; + chart.ChartAreas[chartToAlign].AlignmentStyle = AreaAlignmentStyles.All; + } + + private static void PositionChartArea(ChartArea chartArea, float titleHeight, int i, int numCharts) + { + chartArea.Position.Auto = false; + chartArea.Position.Width = 85; + chartArea.Position.Height = (100.0f - titleHeight) / numCharts; + chartArea.Position.X = 0; + chartArea.Position.Y = (i * (100.0f - titleHeight)) / numCharts + titleHeight; + } + + private static ChartArea AddChartArea(Chart chart, string name, string axisXTitle, int xMax, int xMin, + string axisYTitle, bool discreteValues) + { + var chartArea = new ChartArea { Name = name }; + chartArea.AxisX.MajorGrid.LineColor = Color.DarkGray; + chartArea.AxisY.MajorGrid.LineColor = Color.DarkGray; + chartArea.AxisX.LabelStyle.Font = AxisLabelFont; + chartArea.AxisY.LabelStyle.Font = AxisLabelFont; + + chartArea.AxisX.Interval = xMax / 20.0; + chartArea.AxisX.Maximum = xMax; + chartArea.AxisX.Minimum = xMin; + chartArea.AxisX.MinorGrid.Enabled = true; + chartArea.AxisX.MinorGrid.Interval = (xMax - xMin) / 100.0; + chartArea.AxisX.MinorGrid.LineColor = Color.LightGray; + chartArea.AxisX.Title = axisXTitle; + chartArea.AxisX.TitleFont = AxisTitleFont; + chartArea.AxisX.RoundAxisValues(); + chartArea.AxisX.MajorTickMark.Size = 2 * 100.0f / _diagramSize.Height; + + chartArea.AxisY.Title = axisYTitle; + chartArea.AxisY.TitleFont = AxisTitleFont; + chartArea.AxisY.RoundAxisValues(); + if (discreteValues) { + chartArea.AxisY.MajorGrid.Interval = 1; + chartArea.AxisY.MinorGrid.Enabled = false; + } else { + chartArea.AxisY.MinorGrid.Enabled = true; + } + chartArea.AxisY.MinorGrid.LineColor = Color.LightGray; + chartArea.AxisY.MajorTickMark.Size = 5 * 100.0f / _diagramSize.Width; + + chart.ChartAreas.Add(chartArea); + return chartArea; + } + + private static Legend CreateLegend(Chart chart, string dockToChartArea) + { + var legend = new Legend(dockToChartArea) { + Docking = Docking.Right, + IsDockedInsideChartArea = false, + DockedToChartArea = dockToChartArea, + Font = LegendFont, + }; + chart.Legends.Add(legend); + return legend; + } + + private static Series CreateSeries(String name, Legend legend, ChartArea chartArea, Chart chart, Color color, + IEnumerable<double> x, IEnumerable<double> y) + { + //ModalResultField yfield; + var series1 = new Series { + Name = name, + ChartType = SeriesChartType.Line, + Color = color, + BorderWidth = 2, + Legend = legend.Name, + IsVisibleInLegend = true, + ChartArea = chartArea.Name, + }; + + chart.Series.Add(series1); + chart.Series[series1.Name].Points.DataBindXY(x, y); + return series1; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/InputDataHelper.cs b/VectoCore/VectoCoreTest/Utils/InputDataHelper.cs index dd02f481278d2e82647a908fea78ab609f5e37ed..17f6f39a52601e6ed58faa04d1fe8b965b5b9ed7 100644 --- a/VectoCore/VectoCoreTest/Utils/InputDataHelper.cs +++ b/VectoCore/VectoCoreTest/Utils/InputDataHelper.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; namespace TUGraz.VectoCore.Tests.Utils diff --git a/VectoCore/VectoCoreTest/Utils/MockAuxiliaryDemand.cs b/VectoCore/VectoCoreTest/Utils/MockAuxiliaryDemand.cs index 194c38bb1d6439ad625666ab0475a5095ef6a5f7..5727095d70e2a35e696b988d5f994f322a63b3c6 100644 --- a/VectoCore/VectoCoreTest/Utils/MockAuxiliaryDemand.cs +++ b/VectoCore/VectoCoreTest/Utils/MockAuxiliaryDemand.cs @@ -1,122 +1,122 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.Linq; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.Models.SimulationComponent.Data; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockDrivingCycle : VectoSimulationComponent, IDrivingCycleInfo - { - private readonly IEnumerator<DrivingCycleData.DrivingCycleEntry> _left; - private readonly IEnumerator<DrivingCycleData.DrivingCycleEntry> _right; - - public MockDrivingCycle(IVehicleContainer container, DrivingCycleData data) : base(container) - { - if (data != null) { - _left = data.Entries.GetEnumerator(); - _right = data.Entries.GetEnumerator(); - } else { - _left = Enumerable.Empty<DrivingCycleData.DrivingCycleEntry>().GetEnumerator(); - _right = Enumerable.Empty<DrivingCycleData.DrivingCycleEntry>().GetEnumerator(); - } - _left.MoveNext(); - _right.MoveNext(); - _right.MoveNext(); - } - - - public CycleData CycleData - { - get { - return new CycleData { - AbsTime = 0.SI<Second>(), - AbsDistance = 0.SI<Meter>(), - LeftSample = _left.Current, - RightSample = _right.Current - }; - } - } - - public bool PTOActive { get; set; } - - public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance) - { - return new DrivingCycleData.DrivingCycleEntry() { - RoadGradient = 0.SI<Radian>(), - Altitude = 0.SI<Meter>() - }; - } - - public Meter Altitude - { - get { return 0.SI<Meter>(); } - } - - protected override void DoWriteModalResults(IModalDataContainer container) - { - container[ModalResultField.dist] = 0.SI<Meter>(); - container[ModalResultField.v_targ] = 0.KMPHtoMeterPerSecond(); - container[ModalResultField.grad] = 0.SI<Scalar>(); - container[ModalResultField.altitude] = 0.SI<Meter>(); - } - - protected override void DoCommitSimulationStep() - { - _left.MoveNext(); - _right.MoveNext(); - } - - public Meter CycleStartDistance - { - get { return 0.SI<Meter>(); } - } - - public IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Meter lookaheadDistance) - { - return new List<DrivingCycleData.DrivingCycleEntry>(); - } - - public IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Second time) - { - return new List<DrivingCycleData.DrivingCycleEntry>(); - } - - public void FinishSimulation() {} - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.Linq; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockDrivingCycle : VectoSimulationComponent, IDrivingCycleInfo + { + private readonly IEnumerator<DrivingCycleData.DrivingCycleEntry> _left; + private readonly IEnumerator<DrivingCycleData.DrivingCycleEntry> _right; + + public MockDrivingCycle(IVehicleContainer container, DrivingCycleData data) : base(container) + { + if (data != null) { + _left = data.Entries.GetEnumerator(); + _right = data.Entries.GetEnumerator(); + } else { + _left = Enumerable.Empty<DrivingCycleData.DrivingCycleEntry>().GetEnumerator(); + _right = Enumerable.Empty<DrivingCycleData.DrivingCycleEntry>().GetEnumerator(); + } + _left.MoveNext(); + _right.MoveNext(); + _right.MoveNext(); + } + + + public CycleData CycleData + { + get { + return new CycleData { + AbsTime = 0.SI<Second>(), + AbsDistance = 0.SI<Meter>(), + LeftSample = _left.Current, + RightSample = _right.Current + }; + } + } + + public bool PTOActive { get; set; } + + public DrivingCycleData.DrivingCycleEntry CycleLookAhead(Meter distance) + { + return new DrivingCycleData.DrivingCycleEntry() { + RoadGradient = 0.SI<Radian>(), + Altitude = 0.SI<Meter>() + }; + } + + public Meter Altitude + { + get { return 0.SI<Meter>(); } + } + + protected override void DoWriteModalResults(IModalDataContainer container) + { + container[ModalResultField.dist] = 0.SI<Meter>(); + container[ModalResultField.v_targ] = 0.KMPHtoMeterPerSecond(); + container[ModalResultField.grad] = 0.SI<Scalar>(); + container[ModalResultField.altitude] = 0.SI<Meter>(); + } + + protected override void DoCommitSimulationStep() + { + _left.MoveNext(); + _right.MoveNext(); + } + + public Meter CycleStartDistance + { + get { return 0.SI<Meter>(); } + } + + public IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Meter lookaheadDistance) + { + return new List<DrivingCycleData.DrivingCycleEntry>(); + } + + public IReadOnlyList<DrivingCycleData.DrivingCycleEntry> LookAhead(Second time) + { + return new List<DrivingCycleData.DrivingCycleEntry>(); + } + + public void FinishSimulation() {} + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockBrakes.cs b/VectoCore/VectoCoreTest/Utils/MockBrakes.cs index 2a82559b868be1ecdb96c81b41ca157fcded1ccc..1ba2961a3277afbde91d63defcacb5f25d31eda4 100644 --- a/VectoCore/VectoCoreTest/Utils/MockBrakes.cs +++ b/VectoCore/VectoCoreTest/Utils/MockBrakes.cs @@ -1,52 +1,52 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockBrakes : VectoSimulationComponent, IBrakes - { - public MockBrakes(IVehicleContainer vehicle) : base(vehicle) - { - BrakePower = 0.SI<Watt>(); - } - - public Watt BrakePower { get; set; } - - protected override void DoWriteModalResults(IModalDataContainer container) {} - - protected override void DoCommitSimulationStep() {} - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockBrakes : VectoSimulationComponent, IBrakes + { + public MockBrakes(IVehicleContainer vehicle) : base(vehicle) + { + BrakePower = 0.SI<Watt>(); + } + + public Watt BrakePower { get; set; } + + protected override void DoWriteModalResults(IModalDataContainer container) {} + + protected override void DoCommitSimulationStep() {} + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockComponent.cs b/VectoCore/VectoCoreTest/Utils/MockComponent.cs index b38da2656ee967b7a903e6dcf569c3d2982d1339..950277b9f28d68ecd5648c81101c9e2376dd75fd 100644 --- a/VectoCore/VectoCoreTest/Utils/MockComponent.cs +++ b/VectoCore/VectoCoreTest/Utils/MockComponent.cs @@ -1,62 +1,62 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockComponent : VectoSimulationComponent, ITnOutPort - { - public MockComponent() : base(null) {} - protected override void DoWriteModalResults(IModalDataContainer container) {} - - protected override void DoCommitSimulationStep() {} - - public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) - { - if (dryRun) - return new ResponseDryRun(); - else - return new ResponseSuccess(); - } - - public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) - { - return new ResponseSuccess(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockComponent : VectoSimulationComponent, ITnOutPort + { + public MockComponent() : base(null) {} + protected override void DoWriteModalResults(IModalDataContainer container) {} + + protected override void DoCommitSimulationStep() {} + + public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + bool dryRun = false) + { + if (dryRun) + return new ResponseDryRun(); + else + return new ResponseSuccess(); + } + + public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) + { + return new ResponseSuccess(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockDriver.cs b/VectoCore/VectoCoreTest/Utils/MockDriver.cs index 90dcf0c21ca6277f2b62af26f77d4dd2aa97d33a..b561c9ea5333be82ee1e44cb4ab2167f8609ecb2 100644 --- a/VectoCore/VectoCoreTest/Utils/MockDriver.cs +++ b/VectoCore/VectoCoreTest/Utils/MockDriver.cs @@ -1,122 +1,122 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockDriver : VectoSimulationComponent, IDriver, IDrivingCycleOutPort, IDriverDemandInPort, IDriverInfo - { - private IDriverDemandOutPort _next; - - public RequestData LastRequest; - - public MockDriver(IVehicleContainer container) : base(container) - { - DriverBehavior = DrivingBehavior.Accelerating; - } - - protected override void DoWriteModalResults(IModalDataContainer container) {} - - protected override void DoCommitSimulationStep() {} - - public IDrivingCycleOutPort OutPort() - { - return this; - } - - public IDriverDemandInPort InPort() - { - return this; - } - - public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) - { - LastRequest = new RequestData { AbsTime = absTime, ds = ds, Gradient = gradient, TargetVelocity = targetVelocity }; - var acc = 0.SI<MeterPerSquareSecond>(); - var dt = 1.SI<Second>(); - return new ResponseSuccess { SimulationInterval = dt, SimulationDistance = ds, Source = this }; - } - - public IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient) - { - LastRequest = new RequestData { AbsTime = absTime, dt = dt, Gradient = gradient, TargetVelocity = targetVelocity }; - var acc = 0.SI<MeterPerSquareSecond>(); - return new ResponseSuccess { SimulationInterval = dt, Source = this }; - } - - public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient) - { - if (_next != null) { - return _next.Initialize(vehicleSpeed, roadGradient); - } - - return new ResponseSuccess { Source = this }; - } - - public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration) - { - if (_next != null) { - return _next.Initialize(vehicleSpeed, roadGradient, startAcceleration); - } - - return new ResponseSuccess { Source = this }; - } - - public void Connect(IDriverDemandOutPort other) - { - _next = other; - } - - public class RequestData - { - public Second AbsTime; - public Meter ds; - public Second dt; - public MeterPerSecond TargetVelocity; - public Radian Gradient; - } - - //public MeterPerSquareSecond DriverAcceleration { get; set; } - - public bool VehicleStopped { get; set; } - - public DrivingBehavior DriverBehavior { get; set; } - public MeterPerSquareSecond DriverAcceleration { get; set; } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockDriver : VectoSimulationComponent, IDriver, IDrivingCycleOutPort, IDriverDemandInPort, IDriverInfo + { + private IDriverDemandOutPort _next; + + public RequestData LastRequest; + + public MockDriver(IVehicleContainer container) : base(container) + { + DriverBehavior = DrivingBehavior.Accelerating; + } + + protected override void DoWriteModalResults(IModalDataContainer container) {} + + protected override void DoCommitSimulationStep() {} + + public IDrivingCycleOutPort OutPort() + { + return this; + } + + public IDriverDemandInPort InPort() + { + return this; + } + + public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) + { + LastRequest = new RequestData { AbsTime = absTime, ds = ds, Gradient = gradient, TargetVelocity = targetVelocity }; + var acc = 0.SI<MeterPerSquareSecond>(); + var dt = 1.SI<Second>(); + return new ResponseSuccess { SimulationInterval = dt, SimulationDistance = ds, Source = this }; + } + + public IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient) + { + LastRequest = new RequestData { AbsTime = absTime, dt = dt, Gradient = gradient, TargetVelocity = targetVelocity }; + var acc = 0.SI<MeterPerSquareSecond>(); + return new ResponseSuccess { SimulationInterval = dt, Source = this }; + } + + public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient) + { + if (_next != null) { + return _next.Initialize(vehicleSpeed, roadGradient); + } + + return new ResponseSuccess { Source = this }; + } + + public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration) + { + if (_next != null) { + return _next.Initialize(vehicleSpeed, roadGradient, startAcceleration); + } + + return new ResponseSuccess { Source = this }; + } + + public void Connect(IDriverDemandOutPort other) + { + _next = other; + } + + public class RequestData + { + public Second AbsTime; + public Meter ds; + public Second dt; + public MeterPerSecond TargetVelocity; + public Radian Gradient; + } + + //public MeterPerSquareSecond DriverAcceleration { get; set; } + + public bool VehicleStopped { get; set; } + + public DrivingBehavior DriverBehavior { get; set; } + public MeterPerSquareSecond DriverAcceleration { get; set; } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs b/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs index e158346b7aa93544171ed2d1a6136b588fa303d5..3c19b596cc5ffe76eec3bebb783733ad813737b8 100644 --- a/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs +++ b/VectoCore/VectoCoreTest/Utils/MockEngineDataProvider.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Data; using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; diff --git a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs index b3ca3392532ec7fe1a8ff07bf402b673762d2464..31da0c3cdf8c843d8280d5c594940427d3ce32fe 100644 --- a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs +++ b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCoreTest/Utils/MockIdleController.cs b/VectoCore/VectoCoreTest/Utils/MockIdleController.cs index 844a625e7ddb54016dc0b9d44baf4493dc6019c3..abe98fd929a70c3d663afcc008d199033d1c5c09 100644 --- a/VectoCore/VectoCoreTest/Utils/MockIdleController.cs +++ b/VectoCore/VectoCoreTest/Utils/MockIdleController.cs @@ -1,56 +1,56 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.SimulationComponent; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockIdleController : IIdleController - { - public ITnOutPort RequestPort { get; set; } - public void Reset() {} - - public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) - { - return new ResponseSuccess(); - } - - public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) - { - return new ResponseSuccess(); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.SimulationComponent; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockIdleController : IIdleController + { + public ITnOutPort RequestPort { get; set; } + public void Reset() {} + + public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) + { + return new ResponseSuccess(); + } + + public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + bool dryRun = false) + { + return new ResponseSuccess(); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockModalDataContainer.cs b/VectoCore/VectoCoreTest/Utils/MockModalDataContainer.cs index 727ca9fb00ed5b17bec79018241b8df2e4443bc1..47b2e9b7fa66234b79d9947f8cf65bb0004b99c3 100644 --- a/VectoCore/VectoCoreTest/Utils/MockModalDataContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockModalDataContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using System.Data; diff --git a/VectoCore/VectoCoreTest/Utils/MockPorts.cs b/VectoCore/VectoCoreTest/Utils/MockPorts.cs index 1ed1b863a9469c73bc10816b91fdbe1b983d8a15..294ed524b8d6c8c0fdabbbe0883c5b0ed9593a8f 100644 --- a/VectoCore/VectoCoreTest/Utils/MockPorts.cs +++ b/VectoCore/VectoCoreTest/Utils/MockPorts.cs @@ -1,196 +1,196 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.Simulation.DataBus; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockTnOutPort : ITnOutPort, IEngineInfo - { - protected static readonly LoggingObject Log = LogManager.GetLogger(typeof(MockTnOutPort).FullName); - - public Second AbsTime; - public Second Dt; - public NewtonMeter Torque; - public PerSecond AngularVelocity; - - public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - bool dryRun = false) - { - AbsTime = absTime; - Dt = dt; - Torque = outTorque; - AngularVelocity = outAngularVelocity; - Log.Debug("Request: absTime: {0}, dt: {1}, torque: {2}, angularVelocity: {3}", absTime, dt, outTorque, - outAngularVelocity); - - if (dryRun) { - return new ResponseDryRun { - Source = this, - GearboxPowerRequest = outTorque * outAngularVelocity, - EnginePowerRequest = outTorque * outAngularVelocity, - ClutchPowerRequest = outTorque * outAngularVelocity, - EngineSpeed = outAngularVelocity, - DynamicFullLoadPower = (outTorque + 2300.SI<NewtonMeter>()) * outAngularVelocity, - DeltaFullLoad = (outTorque - 2300.SI<NewtonMeter>()) * outAngularVelocity, - DeltaDragLoad = (outTorque - -100.SI<NewtonMeter>()) * outAngularVelocity - }; - } - - return new ResponseSuccess { - Source = this, - GearboxPowerRequest = outTorque * outAngularVelocity, - EnginePowerRequest = outTorque * outAngularVelocity, - ClutchPowerRequest = outTorque * outAngularVelocity, - EngineSpeed = outAngularVelocity, - }; - } - - public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) - { - return new ResponseSuccess { - Source = this, - EnginePowerRequest = outTorque * (outAngularVelocity ?? 0.SI<PerSecond>()), - ClutchPowerRequest = outTorque * (outAngularVelocity ?? 0.SI<PerSecond>()), - EngineSpeed = outAngularVelocity, - }; - } - - public void DoCommitSimulationStep() - { - AbsTime = null; - Dt = null; - Torque = null; - AngularVelocity = null; - } - - public PerSecond EngineSpeed - { - get { return AngularVelocity; } - } - - public NewtonMeter EngineTorque - { - get { return Torque; } - } - - public Watt EngineStationaryFullPower(PerSecond angularSpeed) - { - return 2300.SI<NewtonMeter>() * angularSpeed; - } - - public Watt EngineDragPower(PerSecond angularSpeed) - { - return -1000.SI<NewtonMeter>() * angularSpeed; - } - - public PerSecond EngineIdleSpeed - { - get { return 560.RPMtoRad(); } - } - - public PerSecond EngineRatedSpeed - { - // just a test value. not real. - get { return 1600.SI<PerSecond>(); } - } - - public PerSecond EngineN95hSpeed { get; set; } - public PerSecond EngineN80hSpeed { get; set; } - } - - public class MockDrivingCycleOutPort : LoggingObject, IDrivingCycleOutPort - { - public Second AbsTime; - public Meter Ds; - public Second Dt; - public MeterPerSecond Velocity; - public Radian Gradient; - - public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) - { - AbsTime = absTime; - Ds = ds; - Velocity = targetVelocity; - Gradient = gradient; - Log.Debug("Request: absTime: {0}, ds: {1}, velocity: {2}, gradient: {3}", absTime, ds, targetVelocity, gradient); - return new ResponseSuccess() { Source = this }; - } - - public IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient) - { - AbsTime = absTime; - Dt = dt; - Velocity = targetVelocity; - Gradient = gradient; - Log.Debug("Request: absTime: {0}, ds: {1}, velocity: {2}, gradient: {3}", absTime, dt, targetVelocity, gradient); - return new ResponseSuccess() { Source = this }; - } - - public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient) - { - throw new NotImplementedException(); - } - - public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration) - { - throw new NotImplementedException(); - } - } - - public class MockFvOutPort : LoggingObject, IFvOutPort - { - public Second AbsTime { get; set; } - public Second Dt { get; set; } - public Newton Force { get; set; } - public MeterPerSecond Velocity { get; set; } - - public IResponse Request(Second absTime, Second dt, Newton force, MeterPerSecond velocity, bool dryRun = false) - { - AbsTime = absTime; - Dt = dt; - Force = force; - Velocity = velocity; - Log.Debug("Request: abstime: {0}, dt: {1}, force: {2}, velocity: {3}", absTime, dt, force, velocity); - return new ResponseSuccess() { Source = this }; - } - - public IResponse Initialize(Newton vehicleForce, MeterPerSecond vehicleSpeed) - { - return new ResponseSuccess() { Source = this }; - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation.DataBus; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockTnOutPort : ITnOutPort, IEngineInfo + { + protected static readonly LoggingObject Log = LogManager.GetLogger(typeof(MockTnOutPort).FullName); + + public Second AbsTime; + public Second Dt; + public NewtonMeter Torque; + public PerSecond AngularVelocity; + + public IResponse Request(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, + bool dryRun = false) + { + AbsTime = absTime; + Dt = dt; + Torque = outTorque; + AngularVelocity = outAngularVelocity; + Log.Debug("Request: absTime: {0}, dt: {1}, torque: {2}, angularVelocity: {3}", absTime, dt, outTorque, + outAngularVelocity); + + if (dryRun) { + return new ResponseDryRun { + Source = this, + GearboxPowerRequest = outTorque * outAngularVelocity, + EnginePowerRequest = outTorque * outAngularVelocity, + ClutchPowerRequest = outTorque * outAngularVelocity, + EngineSpeed = outAngularVelocity, + DynamicFullLoadPower = (outTorque + 2300.SI<NewtonMeter>()) * outAngularVelocity, + DeltaFullLoad = (outTorque - 2300.SI<NewtonMeter>()) * outAngularVelocity, + DeltaDragLoad = (outTorque - -100.SI<NewtonMeter>()) * outAngularVelocity + }; + } + + return new ResponseSuccess { + Source = this, + GearboxPowerRequest = outTorque * outAngularVelocity, + EnginePowerRequest = outTorque * outAngularVelocity, + ClutchPowerRequest = outTorque * outAngularVelocity, + EngineSpeed = outAngularVelocity, + }; + } + + public IResponse Initialize(NewtonMeter outTorque, PerSecond outAngularVelocity) + { + return new ResponseSuccess { + Source = this, + EnginePowerRequest = outTorque * (outAngularVelocity ?? 0.SI<PerSecond>()), + ClutchPowerRequest = outTorque * (outAngularVelocity ?? 0.SI<PerSecond>()), + EngineSpeed = outAngularVelocity, + }; + } + + public void DoCommitSimulationStep() + { + AbsTime = null; + Dt = null; + Torque = null; + AngularVelocity = null; + } + + public PerSecond EngineSpeed + { + get { return AngularVelocity; } + } + + public NewtonMeter EngineTorque + { + get { return Torque; } + } + + public Watt EngineStationaryFullPower(PerSecond angularSpeed) + { + return 2300.SI<NewtonMeter>() * angularSpeed; + } + + public Watt EngineDragPower(PerSecond angularSpeed) + { + return -1000.SI<NewtonMeter>() * angularSpeed; + } + + public PerSecond EngineIdleSpeed + { + get { return 560.RPMtoRad(); } + } + + public PerSecond EngineRatedSpeed + { + // just a test value. not real. + get { return 1600.SI<PerSecond>(); } + } + + public PerSecond EngineN95hSpeed { get; set; } + public PerSecond EngineN80hSpeed { get; set; } + } + + public class MockDrivingCycleOutPort : LoggingObject, IDrivingCycleOutPort + { + public Second AbsTime; + public Meter Ds; + public Second Dt; + public MeterPerSecond Velocity; + public Radian Gradient; + + public IResponse Request(Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient) + { + AbsTime = absTime; + Ds = ds; + Velocity = targetVelocity; + Gradient = gradient; + Log.Debug("Request: absTime: {0}, ds: {1}, velocity: {2}, gradient: {3}", absTime, ds, targetVelocity, gradient); + return new ResponseSuccess() { Source = this }; + } + + public IResponse Request(Second absTime, Second dt, MeterPerSecond targetVelocity, Radian gradient) + { + AbsTime = absTime; + Dt = dt; + Velocity = targetVelocity; + Gradient = gradient; + Log.Debug("Request: absTime: {0}, ds: {1}, velocity: {2}, gradient: {3}", absTime, dt, targetVelocity, gradient); + return new ResponseSuccess() { Source = this }; + } + + public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient) + { + throw new NotImplementedException(); + } + + public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration) + { + throw new NotImplementedException(); + } + } + + public class MockFvOutPort : LoggingObject, IFvOutPort + { + public Second AbsTime { get; set; } + public Second Dt { get; set; } + public Newton Force { get; set; } + public MeterPerSecond Velocity { get; set; } + + public IResponse Request(Second absTime, Second dt, Newton force, MeterPerSecond velocity, bool dryRun = false) + { + AbsTime = absTime; + Dt = dt; + Force = force; + Velocity = velocity; + Log.Debug("Request: abstime: {0}, dt: {1}, force: {2}, velocity: {3}", absTime, dt, force, velocity); + return new ResponseSuccess() { Source = this }; + } + + public IResponse Initialize(Newton vehicleForce, MeterPerSecond vehicleSpeed) + { + return new ResponseSuccess() { Source = this }; + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockRunData.cs b/VectoCore/VectoCoreTest/Utils/MockRunData.cs index 9a7066e28a8c007a024c2bf8ea10d823c184eb2e..9cc3cb8fe7cfd52bb508fc7c04a52e7aae8ac91d 100644 --- a/VectoCore/VectoCoreTest/Utils/MockRunData.cs +++ b/VectoCore/VectoCoreTest/Utils/MockRunData.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; diff --git a/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs b/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs index a87fcbb94ba9e964e6835542d8ddc62569c2da51..0531a6625ca38aa9f5da975d5bcec5b9b2a2f68e 100644 --- a/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs +++ b/VectoCore/VectoCoreTest/Utils/MockSimulationDataFactory.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.InputData; diff --git a/VectoCore/VectoCoreTest/Utils/MockVehicle.cs b/VectoCore/VectoCoreTest/Utils/MockVehicle.cs index e63e6d32fd9530d7cc3b252c3cb3d849ced5a330..cfe15ec9802c650256af7e709f970f93a870b64b 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVehicle.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVehicle.cs @@ -1,147 +1,147 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using TUGraz.VectoCommon.Models; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Connector.Ports; -using TUGraz.VectoCore.Models.Connector.Ports.Impl; -using TUGraz.VectoCore.Models.Simulation; -using TUGraz.VectoCore.Models.Simulation.DataBus; -using TUGraz.VectoCore.Models.SimulationComponent; -using TUGraz.VectoCore.OutputData; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public class MockVehicle : VectoSimulationComponent, IVehicle, IFvInPort, IDriverDemandOutPort, IMileageCounter - { - internal MeterPerSecond MyVehicleSpeed; - internal IFvOutPort NextComponent; - - internal RequestData LastRequest = new RequestData(); - - public MockVehicle(IVehicleContainer cockpit) : base(cockpit) {} - protected override void DoWriteModalResults(IModalDataContainer container) {} - - protected override void DoCommitSimulationStep() {} - - public IFvInPort InPort() - { - return this; - } - - public IDriverDemandOutPort OutPort() - { - return this; - } - - public MeterPerSecond VehicleSpeed - { - get { return MyVehicleSpeed; } - } - - public bool VehicleStopped - { - get { return MyVehicleSpeed.IsEqual(0.SI<MeterPerSecond>(), 0.01.SI<MeterPerSecond>()); } - } - - public Kilogram VehicleMass - { - get { return 7500.SI<Kilogram>(); } - } - - public Kilogram VehicleLoading - { - get { return 0.SI<Kilogram>(); } - } - - public Kilogram TotalMass - { - get { return VehicleMass; } - } - - public CubicMeter CargoVolume { get; set; } - - public Newton AirDragResistance(MeterPerSecond previousVelocity, MeterPerSecond nextVelocity) - { - return 0.SI<Newton>(); - } - - public Newton RollingResistance(Radian gradient) - { - return 0.SI<Newton>(); - } - - public Newton SlopeResistance(Radian gradient) - { - return 0.SI<Newton>(); - } - - public void Connect(IFvOutPort other) - { - NextComponent = other; - } - - public IResponse Request(Second absTime, Second dt, MeterPerSquareSecond acceleration, Radian gradient, bool b) - { - LastRequest = new RequestData { - abstime = absTime, - dt = dt, - acceleration = acceleration, - gradient = gradient - }; - return new ResponseSuccess() { Source = this }; - } - - public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient) - { - throw new NotImplementedException(); - } - - public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration) - { - throw new NotImplementedException(); - } - - public class RequestData - { - public Second abstime; - public Second dt; - public MeterPerSquareSecond acceleration; - public Radian gradient; - } - - public Meter Distance - { - get { return 0.SI<Meter>(); } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using TUGraz.VectoCommon.Models; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Connector.Ports; +using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.Simulation; +using TUGraz.VectoCore.Models.Simulation.DataBus; +using TUGraz.VectoCore.Models.SimulationComponent; +using TUGraz.VectoCore.OutputData; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public class MockVehicle : VectoSimulationComponent, IVehicle, IFvInPort, IDriverDemandOutPort, IMileageCounter + { + internal MeterPerSecond MyVehicleSpeed; + internal IFvOutPort NextComponent; + + internal RequestData LastRequest = new RequestData(); + + public MockVehicle(IVehicleContainer cockpit) : base(cockpit) {} + protected override void DoWriteModalResults(IModalDataContainer container) {} + + protected override void DoCommitSimulationStep() {} + + public IFvInPort InPort() + { + return this; + } + + public IDriverDemandOutPort OutPort() + { + return this; + } + + public MeterPerSecond VehicleSpeed + { + get { return MyVehicleSpeed; } + } + + public bool VehicleStopped + { + get { return MyVehicleSpeed.IsEqual(0.SI<MeterPerSecond>(), 0.01.SI<MeterPerSecond>()); } + } + + public Kilogram VehicleMass + { + get { return 7500.SI<Kilogram>(); } + } + + public Kilogram VehicleLoading + { + get { return 0.SI<Kilogram>(); } + } + + public Kilogram TotalMass + { + get { return VehicleMass; } + } + + public CubicMeter CargoVolume { get; set; } + + public Newton AirDragResistance(MeterPerSecond previousVelocity, MeterPerSecond nextVelocity) + { + return 0.SI<Newton>(); + } + + public Newton RollingResistance(Radian gradient) + { + return 0.SI<Newton>(); + } + + public Newton SlopeResistance(Radian gradient) + { + return 0.SI<Newton>(); + } + + public void Connect(IFvOutPort other) + { + NextComponent = other; + } + + public IResponse Request(Second absTime, Second dt, MeterPerSquareSecond acceleration, Radian gradient, bool b) + { + LastRequest = new RequestData { + abstime = absTime, + dt = dt, + acceleration = acceleration, + gradient = gradient + }; + return new ResponseSuccess() { Source = this }; + } + + public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient) + { + throw new NotImplementedException(); + } + + public IResponse Initialize(MeterPerSecond vehicleSpeed, Radian roadGradient, MeterPerSquareSecond startAcceleration) + { + throw new NotImplementedException(); + } + + public class RequestData + { + public Second abstime; + public Second dt; + public MeterPerSquareSecond acceleration; + public Radian gradient; + } + + public Meter Distance + { + get { return 0.SI<Meter>(); } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs index 43f636130d5a818a4cfbe1075dd354f462775667..3cd6443191aa4c920190ce135534f361aaf73ca1 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections.Generic; using TUGraz.VectoCommon.Exceptions; diff --git a/VectoCore/VectoCoreTest/Utils/ResultFileHelper.cs b/VectoCore/VectoCoreTest/Utils/ResultFileHelper.cs index d747cfc73d2321350bc60d36dedfbba13df41307..64593797957e507ab8d9e3f8f34062619cfc5cfa 100644 --- a/VectoCore/VectoCoreTest/Utils/ResultFileHelper.cs +++ b/VectoCore/VectoCoreTest/Utils/ResultFileHelper.cs @@ -1,158 +1,158 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Models.Simulation.Data; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Utils -{ - public static class ResultFileHelper - { - public static void TestModFile(string expectedFile, string actualFile, string[] testColumns = null, - bool testRowCount = true) - { - TestModFiles(new[] { expectedFile }, new[] { actualFile }, testColumns, testRowCount); - } - - public static void TestModFiles(IEnumerable<string> expectedFiles, IEnumerable<string> actualFiles, - string[] testColumns = null, bool testRowcount = true) - { - var resultFiles = expectedFiles.ZipAll(actualFiles, (expectedFile, actualFile) => new { expectedFile, actualFile }); - foreach (var result in resultFiles) { - Assert.IsTrue(File.Exists(result.actualFile), "MOD File is missing: " + result); - Assert.IsTrue(File.Exists(result.expectedFile), "Expected File is missing: " + result); - - var expected = VectoCSVFile.Read(result.expectedFile); - var actual = VectoCSVFile.Read(result.actualFile); - - if (actual.Columns.Contains(ModalResultField.v_act.GetShortCaption()) && - !double.IsNaN(actual.Rows[0].Field<string>(ModalResultField.v_act.GetShortCaption()).ToDouble(double.NaN))) { - // test v_act >= 0 - Assert.IsTrue(actual.Rows.Cast<DataRow>() - .All(r => r.ParseDouble(ModalResultField.v_act.GetShortCaption()).IsGreaterOrEqual(0)), - "v_act must not be negative."); - - // test v_targ >= 0 - Assert.IsTrue(actual.Rows.Cast<DataRow>() - .All(r => r.ParseDouble(ModalResultField.v_targ.GetShortCaption()).IsGreaterOrEqual(0)), - "v_targ must not be negative."); - } - - if (actual.Columns.Contains(ModalResultField.dist.GetShortCaption()) && - !double.IsNaN(actual.Rows[0].Field<string>(ModalResultField.dist.GetShortCaption()).ToDouble(double.NaN))) { - // test distance monotonous increasing - - var distPrev = actual.Rows[0].ParseDouble(ModalResultField.dist.GetShortCaption()); - for (var i = 1; i < actual.Rows.Count; i++) { - var dist = actual.Rows[i].ParseDouble(ModalResultField.dist.GetShortCaption()); - Assert.IsTrue(distPrev.IsSmallerOrEqual(dist), "distance must not decrease."); - distPrev = dist; - } - } - - if (testRowcount) { - Assert.AreEqual(expected.Rows.Count, actual.Rows.Count, - string.Format("Moddata: Row count differs.\nExpected {0} Rows in {1}\nGot {2} Rows in {3}", expected.Rows.Count, - result.expectedFile, actual.Rows.Count, result.actualFile)); - } - - var actualCols = actual.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); - var expectedCols = expected.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); - - if (testColumns != null) { - actualCols = - actual.Columns.Cast<DataColumn>() - .Where(col => testColumns.Any(req => req.Equals(col.ColumnName))).Select(x => x.ColumnName) - .OrderBy(x => x) - .ToList(); - expectedCols = expected.Columns.Cast<DataColumn>() - .Where(col => testColumns.Any(req => req.Equals(col.ColumnName))).Select(x => x.ColumnName) - .OrderBy(x => x) - .ToList(); - } - - CollectionAssert.AreEqual(expectedCols, actualCols, - string.Format("Moddata {3}: Columns differ:\nExpected: {0}\nMissing:{1},\nToo Much:{2}", - string.Join(", ", expectedCols), - string.Join(", ", expectedCols.Except(actualCols)), - string.Join(", ", actualCols.Except(expectedCols)), result.actualFile)); - - for (var i = 0; testRowcount && i < expected.Rows.Count; i++) { - var expectedRow = expected.Rows[i]; - var actualRow = actual.Rows[i]; - - foreach (var field in testColumns ?? new string[0]) { - Assert.AreEqual(expectedRow.ParseDoubleOrGetDefault(field), actualRow.ParseDoubleOrGetDefault(field), 1e-4, - string.Format("t: {0} field: {1}", i, field)); - } - } - } - } - - public static void TestSumFile(string expectedFile, string actualFile, string[] testColumns = null) - { - Assert.IsTrue(File.Exists(actualFile), "SUM File is missing: " + actualFile); - - var expected = VectoCSVFile.Read(expectedFile, fullHeader: true); - var actual = VectoCSVFile.Read(actualFile, fullHeader: true); - - Assert.AreEqual(expected.Rows.Count, actual.Rows.Count, - string.Format("SUM File row count differs.\nExpected {0} Rows in {1}\nGot {2} Rows in {3}", expected.Rows.Count, - expectedFile, actual.Rows.Count, actualFile)); - - var actualCols = actual.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); - var expectedCols = expected.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); - - CollectionAssert.AreEqual(expectedCols, actualCols, - string.Format("SUM FILE {3}: Columns differ:\nExpected: {0}\nMissing:{1},\nToo Much:{2}", - string.Join(", ", expectedCols), - string.Join(", ", expectedCols.Except(actualCols)), - string.Join(", ", actualCols.Except(expectedCols)), - actualFile)); - - for (var i = 0; i < expected.Rows.Count; i++) { - var expectedRow = expected.Rows[i]; - var actualRow = actual.Rows[i]; - - foreach (var field in testColumns ?? new string[0]) { - AssertHelper.AreRelativeEqual(expectedRow.ParseDoubleOrGetDefault(field), actualRow.ParseDoubleOrGetDefault(field), - string.Format("t: {0} field: {1}", i, field)); - } - } - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Utils +{ + public static class ResultFileHelper + { + public static void TestModFile(string expectedFile, string actualFile, string[] testColumns = null, + bool testRowCount = true) + { + TestModFiles(new[] { expectedFile }, new[] { actualFile }, testColumns, testRowCount); + } + + public static void TestModFiles(IEnumerable<string> expectedFiles, IEnumerable<string> actualFiles, + string[] testColumns = null, bool testRowcount = true) + { + var resultFiles = expectedFiles.ZipAll(actualFiles, (expectedFile, actualFile) => new { expectedFile, actualFile }); + foreach (var result in resultFiles) { + Assert.IsTrue(File.Exists(result.actualFile), "MOD File is missing: " + result); + Assert.IsTrue(File.Exists(result.expectedFile), "Expected File is missing: " + result); + + var expected = VectoCSVFile.Read(result.expectedFile); + var actual = VectoCSVFile.Read(result.actualFile); + + if (actual.Columns.Contains(ModalResultField.v_act.GetShortCaption()) && + !double.IsNaN(actual.Rows[0].Field<string>(ModalResultField.v_act.GetShortCaption()).ToDouble(double.NaN))) { + // test v_act >= 0 + Assert.IsTrue(actual.Rows.Cast<DataRow>() + .All(r => r.ParseDouble(ModalResultField.v_act.GetShortCaption()).IsGreaterOrEqual(0)), + "v_act must not be negative."); + + // test v_targ >= 0 + Assert.IsTrue(actual.Rows.Cast<DataRow>() + .All(r => r.ParseDouble(ModalResultField.v_targ.GetShortCaption()).IsGreaterOrEqual(0)), + "v_targ must not be negative."); + } + + if (actual.Columns.Contains(ModalResultField.dist.GetShortCaption()) && + !double.IsNaN(actual.Rows[0].Field<string>(ModalResultField.dist.GetShortCaption()).ToDouble(double.NaN))) { + // test distance monotonous increasing + + var distPrev = actual.Rows[0].ParseDouble(ModalResultField.dist.GetShortCaption()); + for (var i = 1; i < actual.Rows.Count; i++) { + var dist = actual.Rows[i].ParseDouble(ModalResultField.dist.GetShortCaption()); + Assert.IsTrue(distPrev.IsSmallerOrEqual(dist), "distance must not decrease."); + distPrev = dist; + } + } + + if (testRowcount) { + Assert.AreEqual(expected.Rows.Count, actual.Rows.Count, + string.Format("Moddata: Row count differs.\nExpected {0} Rows in {1}\nGot {2} Rows in {3}", expected.Rows.Count, + result.expectedFile, actual.Rows.Count, result.actualFile)); + } + + var actualCols = actual.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); + var expectedCols = expected.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); + + if (testColumns != null) { + actualCols = + actual.Columns.Cast<DataColumn>() + .Where(col => testColumns.Any(req => req.Equals(col.ColumnName))).Select(x => x.ColumnName) + .OrderBy(x => x) + .ToList(); + expectedCols = expected.Columns.Cast<DataColumn>() + .Where(col => testColumns.Any(req => req.Equals(col.ColumnName))).Select(x => x.ColumnName) + .OrderBy(x => x) + .ToList(); + } + + CollectionAssert.AreEqual(expectedCols, actualCols, + string.Format("Moddata {3}: Columns differ:\nExpected: {0}\nMissing:{1},\nToo Much:{2}", + string.Join(", ", expectedCols), + string.Join(", ", expectedCols.Except(actualCols)), + string.Join(", ", actualCols.Except(expectedCols)), result.actualFile)); + + for (var i = 0; testRowcount && i < expected.Rows.Count; i++) { + var expectedRow = expected.Rows[i]; + var actualRow = actual.Rows[i]; + + foreach (var field in testColumns ?? new string[0]) { + Assert.AreEqual(expectedRow.ParseDoubleOrGetDefault(field), actualRow.ParseDoubleOrGetDefault(field), 1e-4, + string.Format("t: {0} field: {1}", i, field)); + } + } + } + } + + public static void TestSumFile(string expectedFile, string actualFile, string[] testColumns = null) + { + Assert.IsTrue(File.Exists(actualFile), "SUM File is missing: " + actualFile); + + var expected = VectoCSVFile.Read(expectedFile, fullHeader: true); + var actual = VectoCSVFile.Read(actualFile, fullHeader: true); + + Assert.AreEqual(expected.Rows.Count, actual.Rows.Count, + string.Format("SUM File row count differs.\nExpected {0} Rows in {1}\nGot {2} Rows in {3}", expected.Rows.Count, + expectedFile, actual.Rows.Count, actualFile)); + + var actualCols = actual.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); + var expectedCols = expected.Columns.Cast<DataColumn>().Select(x => x.ColumnName).OrderBy(x => x).ToList(); + + CollectionAssert.AreEqual(expectedCols, actualCols, + string.Format("SUM FILE {3}: Columns differ:\nExpected: {0}\nMissing:{1},\nToo Much:{2}", + string.Join(", ", expectedCols), + string.Join(", ", expectedCols.Except(actualCols)), + string.Join(", ", actualCols.Except(expectedCols)), + actualFile)); + + for (var i = 0; i < expected.Rows.Count; i++) { + var expectedRow = expected.Rows[i]; + var actualRow = actual.Rows[i]; + + foreach (var field in testColumns ?? new string[0]) { + AssertHelper.AreRelativeEqual(expectedRow.ParseDoubleOrGetDefault(field), actualRow.ParseDoubleOrGetDefault(field), + string.Format("t: {0} field: {1}", i, field)); + } + } + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/SITest.cs b/VectoCore/VectoCoreTest/Utils/SITest.cs index e54670fdb529e71b54ed30a2f6f26c12fcd6b6a8..e68b08af69d167cc4a92f4720ba12ea7c56419a2 100644 --- a/VectoCore/VectoCoreTest/Utils/SITest.cs +++ b/VectoCore/VectoCoreTest/Utils/SITest.cs @@ -1,448 +1,448 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - -using System; -using System.Diagnostics.CodeAnalysis; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using TUGraz.VectoCommon.Exceptions; -using TUGraz.VectoCommon.Utils; -using TUGraz.VectoCore.Utils; - -namespace TUGraz.VectoCore.Tests.Utils -{ - [TestClass] - public class SITest - { - [TestMethod] - [SuppressMessage("ReSharper", "UnusedVariable")] - public void SI_TypicalUsageTest() - { - //mult - var angularVelocity = 600.RPMtoRad(); - var torque = 1500.SI<NewtonMeter>(); - var power = angularVelocity * torque; - Assert.IsInstanceOfType(power, typeof(Watt)); - Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500, power.Value()); - - var siStandardMult = power * torque; - Assert.IsInstanceOfType(siStandardMult, typeof(SI)); - Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500 * 1500, siStandardMult.Value()); - Assert.IsTrue(siStandardMult.HasEqualUnit(new SI().Watt.Newton.Meter)); - - //div - var torque2 = power / angularVelocity; - Assert.IsInstanceOfType(torque2, typeof(NewtonMeter)); - Assert.AreEqual(1500, torque2.Value()); - - var siStandardDiv = power / power; - Assert.IsInstanceOfType(siStandardMult, typeof(SI)); - Assert.IsTrue(siStandardDiv.HasEqualUnit(new SI())); - Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500 * 1500, siStandardMult.Value()); - - var force = torque / 100.SI<Meter>(); - Assert.IsInstanceOfType(force, typeof(Newton)); - Assert.AreEqual(15, force.Value()); - - var test = 2.0.SI<PerSecond>(); - var reziprok = 1.0 / test; - Assert.AreEqual(0.5, reziprok.Value()); - Assert.IsTrue(1.SI<Second>().HasEqualUnit(reziprok)); - - //add - PerSecond angVeloSum = 600.RPMtoRad() + 400.SI<PerSecond>(); - AssertHelper.AreRelativeEqual(600 * 2 * Math.PI / 60 + 400, angVeloSum); - AssertHelper.Exception<VectoException>(() => { var x = 500.SI().Watt + 300.SI().Newton; }); - - //subtract - PerSecond angVeloDiff = 600.RPMtoRad() - 400.SI<PerSecond>(); - AssertHelper.AreRelativeEqual(600 * 2 * Math.PI / 60 - 400, angVeloDiff); - - //general si unit - var generalSIUnit = 3600000000.0.SI().Gramm.Per.Kilo.Watt.Hour.ConvertTo().Kilo.Gramm.Per.Watt.Second; - Assert.IsInstanceOfType(generalSIUnit, typeof(SI)); - Assert.AreEqual(1, generalSIUnit.Value()); - - //type conversion - var engineSpeed = 600.0; - PerSecond angularVelocity3 = engineSpeed.RPMtoRad(); - - // convert between units measures - var angularVelocity4 = engineSpeed.SI().Rounds.Per.Minute.ConvertTo().Radian.Per.Second; - Assert.IsInstanceOfType(angularVelocity4, typeof(SI)); - - // cast SI to specialized unit classes. - PerSecond angularVelocity5 = angularVelocity4.Cast<PerSecond>(); - Assert.AreEqual(angularVelocity3, angularVelocity5); - Assert.AreEqual(angularVelocity3.Value(), angularVelocity4.Value()); - - // ConvertTo only allows conversion if the units are correct. - AssertHelper.Exception<VectoException>(() => { var x = 40.SI<Newton>().ConvertTo().Watt; }); - var res1 = 40.SI<Newton>().ConvertTo().Newton; - - // Cast only allows the cast if the units are correct. - AssertHelper.Exception<VectoException>(() => { var x = 40.SI().Newton.Cast<Watt>(); }); - var res2 = 40.SI().Newton.Cast<Newton>(); - } - - [TestMethod] - public void SI_Test() - { - var si = new SI(); - Assert.AreEqual(0.0, si.Value()); - Assert.AreEqual("0.0000 [-]", si.ToString()); - Assert.IsTrue(si.HasEqualUnit(new SI())); - - var si2 = 5.SI().Watt; - Assert.AreEqual("5.0000 [W]", si2.ToString()); - - var si3 = 2.SI().Radian.Per.Second; - Assert.AreEqual("2.0000 [1/s]", si3.ToString()); - - var si4 = si2 * si3; - Assert.AreEqual("10.0000 [W/s]", si4.ToString()); - Assert.IsTrue(si4.HasEqualUnit(new SI().Watt.Per.Second)); - Assert.AreEqual("10.0000 [kgm^2/s^4]", si4.ToBasicUnits().ToString()); - - var kg = 5.SI().Kilo.Gramm; - Assert.AreEqual(5.0, kg.Value()); - Assert.AreEqual("5.0000 [kg]", kg.ToString()); - - kg = kg.ConvertTo().Kilo.Gramm.Clone(); - Assert.AreEqual(5.0, kg.Value()); - Assert.AreEqual("5.0000 [kg]", kg.ToString()); - - kg = kg.ConvertTo().Gramm.Clone(); - Assert.AreEqual(5000, kg.Value()); - Assert.AreEqual("5000.0000 [g]", kg.ToString()); - - var x = 5.SI(); - Assert.AreEqual((2.0 / 5.0).SI(), 2 / x); - Assert.AreEqual((5.0 / 2.0).SI(), x / 2); - Assert.AreEqual((2.0 * 5.0).SI(), 2 * x); - Assert.AreEqual((5.0 * 2.0).SI(), x * 2); - - Assert.AreEqual((2.0 / 5.0).SI(), 2.0 / x); - Assert.AreEqual((5.0 / 2.0).SI(), x / 2.0); - Assert.AreEqual((2 * 5).SI(), 2.0 * x); - Assert.AreEqual((5 * 2).SI(), x * 2.0); - - //var y = 2.SI(); - //Assert.AreEqual((2 * 5).SI(), y * x); - - //var percent = 10.SI<Radian>().ConvertTo().GradientPercent; - //Assert.AreEqual(67.975.ToString("F3") + " [Percent]", percent.ToString("F3")); - //Assert.AreEqual(67.975, percent.Value(), 0.001); - - Assert.AreEqual(45.0 / 180.0 * Math.PI, VectoMath.InclinationToAngle(1).Value(), 0.000001); - } - - [TestMethod] - [SuppressMessage("ReSharper", "UnusedVariable")] - public void SI_Comparison_Operators() - { - var v1 = 600.SI<NewtonMeter>(); - var v2 = 455.SI<NewtonMeter>(); - var v3 = 600.SI<NewtonMeter>(); - var v4 = 100.SI<Watt>(); - var d = 700; - - Assert.IsTrue(v1 > v2); - Assert.IsFalse(v1 < v2); - AssertHelper.Exception<VectoException>(() => { var x = v1 < v4; }, - "Operator '<' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] < 100.0000 [W]"); - AssertHelper.Exception<VectoException>(() => { var x = v1 > v4; }, - "Operator '>' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] > 100.0000 [W]"); - AssertHelper.Exception<VectoException>(() => { var x = v1 <= v4; }, - "Operator '<=' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] <= 100.0000 [W]"); - AssertHelper.Exception<VectoException>(() => { var x = v1 >= v4; }, - "Operator '>=' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] >= 100.0000 [W]"); - - SI si = null; - Assert.IsFalse(si > 3); - Assert.IsFalse(si < 3); - Assert.IsFalse(si >= 3); - Assert.IsFalse(si <= 3); - - Assert.IsFalse(3 > si); - Assert.IsFalse(3 < si); - Assert.IsFalse(si >= 3); - Assert.IsFalse(si <= 3); - - Assert.IsTrue(v2 < v1); - Assert.IsFalse(v2 > v1); - - Assert.IsTrue(v1 >= v2); - Assert.IsFalse(v1 <= v2); - - Assert.IsTrue(v2 <= v1); - Assert.IsFalse(v2 >= v1); - - Assert.IsTrue(v1 <= v3); - Assert.IsTrue(v1 >= v3); - - Assert.IsTrue(v1 < d); - Assert.IsFalse(v1 > d); - Assert.IsFalse(v1 >= d); - Assert.IsTrue(v1 <= d); - - Assert.AreEqual(1, new SI().CompareTo(null)); - Assert.AreEqual(1, new SI().CompareTo("not an SI")); - Assert.AreEqual(-1, new SI().Meter.CompareTo(new SI().Kilo.Meter.Per.Hour)); - Assert.AreEqual(1, new SI().Newton.Meter.CompareTo(new SI().Meter)); - - Assert.AreEqual(0, 1.SI().CompareTo(1.SI())); - Assert.AreEqual(-1, 1.SI().CompareTo(2.SI())); - Assert.AreEqual(1, 2.SI().CompareTo(1.SI())); - } - - [TestMethod] - [SuppressMessage("ReSharper", "UnusedVariable")] - public void SI_Test_Addition_Subtraction() - { - AssertHelper.AreRelativeEqual(3.SI(), 1.SI() + 2.SI()); - AssertHelper.AreRelativeEqual(-1.SI(), 1.SI() - 2.SI()); - - AssertHelper.AreRelativeEqual(3.SI<Scalar>(), 1.SI<Scalar>() + 2.SI<Scalar>()); - AssertHelper.AreRelativeEqual(3.SI<Scalar>(), 1 + 2.SI<Scalar>()); - AssertHelper.AreRelativeEqual(3.SI<Scalar>(), 1.SI<Scalar>() + 2); - AssertHelper.AreRelativeEqual(-1.SI<Scalar>(), 1.SI<Scalar>() - 2.SI<Scalar>()); - AssertHelper.AreRelativeEqual(-1.SI<Scalar>(), 1 - 2.SI<Scalar>()); - AssertHelper.AreRelativeEqual(-1.SI<Scalar>(), 1.SI<Scalar>() - 2); - - AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 1.SI<NewtonMeter>() + 2.SI<NewtonMeter>()); - AssertHelper.AreRelativeEqual(-1.SI<NewtonMeter>(), 1.SI<NewtonMeter>() - 2.SI<NewtonMeter>()); - - AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 1.SI().Newton.Meter + 2.SI<NewtonMeter>()); - AssertHelper.AreRelativeEqual(-1.SI<NewtonMeter>(), 1.SI().Newton.Meter - 2.SI<NewtonMeter>()); - - AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 1.SI<NewtonMeter>() + 2.SI().Newton.Meter); - AssertHelper.AreRelativeEqual(-1.SI<NewtonMeter>(), 1.SI<NewtonMeter>() - 2.SI().Newton.Meter); - - AssertHelper.Exception<VectoException>(() => { var x = 1.SI().Second - 1.SI<Meter>(); }, - "Operator '-' can only operate on SI Objects with the same unit. Got: 1.0000 [s] - 1.0000 [m]"); - } - - [TestMethod] - public void SI_SpecialUnits() - { - Scalar scalar = 3.SI<Scalar>(); - AssertHelper.AreRelativeEqual(3.SI(), scalar); - double scalarDouble = scalar; - AssertHelper.AreRelativeEqual(3, scalarDouble); - - MeterPerSecond meterPerSecond = 2.SI<MeterPerSecond>(); - AssertHelper.AreRelativeEqual(2.SI().Meter.Per.Second, meterPerSecond); - - Second second = 1.SI<Second>(); - AssertHelper.AreRelativeEqual(1.SI().Second, second); - - Watt watt = 2.SI<Watt>(); - AssertHelper.AreRelativeEqual(2.SI().Watt, watt); - - PerSecond perSecond = 1.SI<PerSecond>(); - AssertHelper.AreRelativeEqual(1.SI().Per.Second, perSecond); - - SI rpm = 20.SI().Rounds.Per.Minute; - AssertHelper.AreRelativeEqual(20.SI().Rounds.Per.Minute, rpm); - AssertHelper.AreRelativeEqual(20.RPMtoRad(), rpm); - AssertHelper.AreRelativeEqual(2.0943951023931953, rpm); - - Radian radian = 30.SI<Radian>(); - AssertHelper.AreRelativeEqual(30.SI().Radian, radian); - AssertHelper.AreRelativeEqual(30, radian); - - Newton newton = 3.SI<Newton>(); - AssertHelper.AreRelativeEqual(3.SI().Newton, newton); - - NewtonMeter newtonMeter = 5.SI<NewtonMeter>(); - AssertHelper.AreRelativeEqual(5.SI().Newton.Meter, newtonMeter); - AssertHelper.AreRelativeEqual(5.SI().Meter.Newton, newtonMeter); - - MeterPerSquareSecond meterPerSquareSecond = 3.SI<MeterPerSquareSecond>(); - AssertHelper.AreRelativeEqual(3.SI().Meter.Per.Square.Second, meterPerSquareSecond); - - Kilogram kilogram = 3.SI<Kilogram>(); - AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm, kilogram); - AssertHelper.AreRelativeEqual(3, kilogram); - - SquareMeter squareMeter = 3.SI<SquareMeter>(); - AssertHelper.AreRelativeEqual(3.SI().Square.Meter, squareMeter); - - CubicMeter cubicMeter = 3.SI<CubicMeter>(); - AssertHelper.AreRelativeEqual(3.SI().Cubic.Meter, cubicMeter); - - KilogramSquareMeter kilogramSquareMeter = 3.SI<KilogramSquareMeter>(); - AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Square.Meter, kilogramSquareMeter); - - KilogramPerWattSecond kilogramPerWattSecond = 3.SI<KilogramPerWattSecond>(); - AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Per.Watt.Second, kilogramPerWattSecond); - } - - /// <summary> - /// VECTO-111 - /// </summary> - [TestMethod] - public void SI_ReziprokDivision() - { - var test = 2.0.SI<Second>(); - - var actual = 1.0 / test; - var expected = 0.5.SI<PerSecond>(); - - AssertHelper.AreRelativeEqual(expected, actual); - } - - [TestMethod] - public void SI_Multiplication_Division() - { - AssertHelper.AreRelativeEqual(12.SI(), 3.SI() * 4.SI()); - AssertHelper.AreRelativeEqual(12.SI(), 3 * 4.SI()); - AssertHelper.AreRelativeEqual(12.SI(), 3.SI() * 4); - - AssertHelper.AreRelativeEqual(12.SI<NewtonMeter>(), 3.SI<Newton>() * 4.SI<Meter>()); - AssertHelper.AreRelativeEqual(12.SI<NewtonMeter>(), 3 * 4.SI<NewtonMeter>()); - AssertHelper.AreRelativeEqual(12.SI<NewtonMeter>(), 3.SI<NewtonMeter>() * 4); - AssertHelper.AreRelativeEqual(12.SI().Square.Newton.Meter, 3.SI<NewtonMeter>() * 4.SI<NewtonMeter>()); - - AssertHelper.AreRelativeEqual(3.SI(), 12.SI() / 4); - AssertHelper.AreRelativeEqual(3.SI(), 12.SI() / 4.SI()); - AssertHelper.AreRelativeEqual(3.SI(), 12.SI<NewtonMeter>() / 4.SI<NewtonMeter>()); - - AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 12.SI<NewtonMeter>() / 4); - AssertHelper.AreRelativeEqual(3.SI().Per.Newton.Meter, 12 / 4.SI<NewtonMeter>()); - - var newtonMeter = 10.SI<NewtonMeter>(); - var perSecond = 5.SI<PerSecond>(); - var watt = (10 * 5).SI<Watt>(); - var second = (1.0 / 5.0).SI<Second>(); - - AssertHelper.AreRelativeEqual(watt, newtonMeter * perSecond); - AssertHelper.AreRelativeEqual(watt, perSecond * newtonMeter); - - AssertHelper.AreRelativeEqual(newtonMeter, watt / perSecond); - AssertHelper.AreRelativeEqual(perSecond, watt / newtonMeter); - - AssertHelper.AreRelativeEqual(second, newtonMeter / watt); - } - - [TestMethod] - public void SI_MeterPerSecond_Div_Meter() - { - PerSecond actual = 6.SI<MeterPerSecond>() / 2.SI<Meter>(); - AssertHelper.AreRelativeEqual(3.SI().Per.Second, actual); - } - - [TestMethod] - public void SI_SimplifyUnits() - { - AssertHelper.AreRelativeEqual(3.SI(), 18.SI().Kilo.Gramm / 6.SI().Kilo.Gramm); - AssertHelper.AreRelativeEqual(3.SI(), 18.SI<NewtonMeter>() / 6.SI<NewtonMeter>()); - - AssertHelper.AreRelativeEqual(18.SI(), 3.SI().Kilo.Gramm * 6.SI().Per.Kilo.Gramm); - AssertHelper.AreRelativeEqual(18.SI<Meter>(), 3.SI().Kilo.Gramm.Meter * 6.SI().Per.Kilo.Gramm); - - AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Square.Meter.Per.Cubic.Second, 3.SI<Watt>()); - AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Meter.Per.Square.Second, 3.SI<Newton>()); - AssertHelper.AreRelativeEqual(3000.SI().Kilo.Gramm, 3.SI().Ton); - AssertHelper.AreRelativeEqual(3.SI().Kilo.Kilo.Gramm.ConvertTo().Ton, 3000.SI().Kilo.Gramm.ConvertTo().Ton); - - AssertHelper.AreRelativeEqual(3.SI<Meter>(), 3000.SI().Milli.Meter); - - AssertHelper.AreRelativeEqual(36.SI().Square.Newton.Meter, 6.SI<NewtonMeter>() * 6.SI<NewtonMeter>()); - AssertHelper.AreRelativeEqual(36.SI().Newton.Newton.Meter.Meter, 6.SI<NewtonMeter>() * 6.SI<NewtonMeter>()); - - AssertHelper.AreRelativeEqual(3.SI().Meter.Per.Second, 3.SI<Newton>().Second.Per.Kilo.Gramm); - } - - [TestMethod] - public void SI_Math() - { - AssertHelper.AreRelativeEqual(-3, -3.SI().Value()); - AssertHelper.AreRelativeEqual(3.SI(), (-3).SI().Abs()); - } - - [TestMethod] - [SuppressMessage("ReSharper", "ReturnValueOfPureMethodIsNotUsed")] - public void SI_Equality() - { - Assert.AreEqual(3.SI(), 3.SI()); - Assert.AreEqual(3.SI<NewtonMeter>(), 3.SI<NewtonMeter>()); - - Assert.IsFalse(3.SI<NewtonMeter>().IsEqual(4.SI<NewtonMeter>())); - Assert.IsFalse(3.SI<NewtonMeter>().IsEqual(3.SI<Meter>())); - - Assert.IsTrue(3.SI().IsEqual(4, 10)); - - var x = 4.SI(); - var y = x; - var z = 4.SI(); - Assert.IsTrue(x.Equals(y)); - - Assert.IsFalse(3.SI().Equals(null)); - Assert.IsFalse(3.SI().IsEqual(4.SI())); - Assert.IsTrue(z.Equals(x)); - Assert.IsFalse(3.SI().Equals(3.SI<Newton>())); - - var newton1 = 3.SI<Newton>(); - var newton2 = 3.SI<Newton>(); - Assert.IsTrue(newton1.Equals(newton2)); - - Assert.IsTrue(3.SI().IsEqual(3.SI())); - Assert.IsTrue(3.SI().IsEqual(3)); - - Assert.IsFalse(3.SI().IsEqual(2.9.SI())); - Assert.IsFalse(3.SI().IsEqual(2.9)); - - // just calling to test wether the functions are not throwing an exception. - 3.SI().GetHashCode(); - 3.0.SI().GetHashCode(); - 4.SI<NewtonMeter>().GetHashCode(); - } - - [TestMethod] - public void SI_Output() - { - Assert.AreEqual("3.0000", 3.SI().ToOutputFormat()); - Assert.AreEqual("3.0000 [-]", 3.SI().ToOutputFormat(showUnit: true)); - Assert.AreEqual("3.5000", 3.5.SI().ToOutputFormat()); - Assert.AreEqual("3.5000", 3.5.SI<Newton>().ToOutputFormat()); - Assert.AreEqual("3.50 [N]", 3.5.SI<Newton>().ToOutputFormat(2, showUnit: true)); - Assert.AreEqual("18.00 [m/s]", 5.SI<MeterPerSecond>().ToOutputFormat(2, 3.6, true)); - Assert.AreEqual("18.0000", 5.SI<MeterPerSecond>().ToOutputFormat(outputFactor: 3.6)); - - Assert.AreEqual("10.0000 [m^2]", 10.SI<SquareMeter>().ToOutputFormat(showUnit: true)); - - Assert.AreEqual("10.0000 [m^3]", 10.SI<CubicMeter>().ToOutputFormat(showUnit: true)); - - Assert.AreEqual("0.5000 [m/s^2]", 0.5.SI<MeterPerSquareSecond>().ToOutputFormat(showUnit: true)); - } - } +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + +using System; +using System.Diagnostics.CodeAnalysis; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TUGraz.VectoCommon.Exceptions; +using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Utils; + +namespace TUGraz.VectoCore.Tests.Utils +{ + [TestClass] + public class SITest + { + [TestMethod] + [SuppressMessage("ReSharper", "UnusedVariable")] + public void SI_TypicalUsageTest() + { + //mult + var angularVelocity = 600.RPMtoRad(); + var torque = 1500.SI<NewtonMeter>(); + var power = angularVelocity * torque; + Assert.IsInstanceOfType(power, typeof(Watt)); + Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500, power.Value()); + + var siStandardMult = power * torque; + Assert.IsInstanceOfType(siStandardMult, typeof(SI)); + Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500 * 1500, siStandardMult.Value()); + Assert.IsTrue(siStandardMult.HasEqualUnit(new SI().Watt.Newton.Meter)); + + //div + var torque2 = power / angularVelocity; + Assert.IsInstanceOfType(torque2, typeof(NewtonMeter)); + Assert.AreEqual(1500, torque2.Value()); + + var siStandardDiv = power / power; + Assert.IsInstanceOfType(siStandardMult, typeof(SI)); + Assert.IsTrue(siStandardDiv.HasEqualUnit(new SI())); + Assert.AreEqual(600.0 / 60 * 2 * Math.PI * 1500 * 1500, siStandardMult.Value()); + + var force = torque / 100.SI<Meter>(); + Assert.IsInstanceOfType(force, typeof(Newton)); + Assert.AreEqual(15, force.Value()); + + var test = 2.0.SI<PerSecond>(); + var reziprok = 1.0 / test; + Assert.AreEqual(0.5, reziprok.Value()); + Assert.IsTrue(1.SI<Second>().HasEqualUnit(reziprok)); + + //add + PerSecond angVeloSum = 600.RPMtoRad() + 400.SI<PerSecond>(); + AssertHelper.AreRelativeEqual(600 * 2 * Math.PI / 60 + 400, angVeloSum); + AssertHelper.Exception<VectoException>(() => { var x = 500.SI().Watt + 300.SI().Newton; }); + + //subtract + PerSecond angVeloDiff = 600.RPMtoRad() - 400.SI<PerSecond>(); + AssertHelper.AreRelativeEqual(600 * 2 * Math.PI / 60 - 400, angVeloDiff); + + //general si unit + var generalSIUnit = 3600000000.0.SI().Gramm.Per.Kilo.Watt.Hour.ConvertTo().Kilo.Gramm.Per.Watt.Second; + Assert.IsInstanceOfType(generalSIUnit, typeof(SI)); + Assert.AreEqual(1, generalSIUnit.Value()); + + //type conversion + var engineSpeed = 600.0; + PerSecond angularVelocity3 = engineSpeed.RPMtoRad(); + + // convert between units measures + var angularVelocity4 = engineSpeed.SI().Rounds.Per.Minute.ConvertTo().Radian.Per.Second; + Assert.IsInstanceOfType(angularVelocity4, typeof(SI)); + + // cast SI to specialized unit classes. + PerSecond angularVelocity5 = angularVelocity4.Cast<PerSecond>(); + Assert.AreEqual(angularVelocity3, angularVelocity5); + Assert.AreEqual(angularVelocity3.Value(), angularVelocity4.Value()); + + // ConvertTo only allows conversion if the units are correct. + AssertHelper.Exception<VectoException>(() => { var x = 40.SI<Newton>().ConvertTo().Watt; }); + var res1 = 40.SI<Newton>().ConvertTo().Newton; + + // Cast only allows the cast if the units are correct. + AssertHelper.Exception<VectoException>(() => { var x = 40.SI().Newton.Cast<Watt>(); }); + var res2 = 40.SI().Newton.Cast<Newton>(); + } + + [TestMethod] + public void SI_Test() + { + var si = new SI(); + Assert.AreEqual(0.0, si.Value()); + Assert.AreEqual("0.0000 [-]", si.ToString()); + Assert.IsTrue(si.HasEqualUnit(new SI())); + + var si2 = 5.SI().Watt; + Assert.AreEqual("5.0000 [W]", si2.ToString()); + + var si3 = 2.SI().Radian.Per.Second; + Assert.AreEqual("2.0000 [1/s]", si3.ToString()); + + var si4 = si2 * si3; + Assert.AreEqual("10.0000 [W/s]", si4.ToString()); + Assert.IsTrue(si4.HasEqualUnit(new SI().Watt.Per.Second)); + Assert.AreEqual("10.0000 [kgm^2/s^4]", si4.ToBasicUnits().ToString()); + + var kg = 5.SI().Kilo.Gramm; + Assert.AreEqual(5.0, kg.Value()); + Assert.AreEqual("5.0000 [kg]", kg.ToString()); + + kg = kg.ConvertTo().Kilo.Gramm.Clone(); + Assert.AreEqual(5.0, kg.Value()); + Assert.AreEqual("5.0000 [kg]", kg.ToString()); + + kg = kg.ConvertTo().Gramm.Clone(); + Assert.AreEqual(5000, kg.Value()); + Assert.AreEqual("5000.0000 [g]", kg.ToString()); + + var x = 5.SI(); + Assert.AreEqual((2.0 / 5.0).SI(), 2 / x); + Assert.AreEqual((5.0 / 2.0).SI(), x / 2); + Assert.AreEqual((2.0 * 5.0).SI(), 2 * x); + Assert.AreEqual((5.0 * 2.0).SI(), x * 2); + + Assert.AreEqual((2.0 / 5.0).SI(), 2.0 / x); + Assert.AreEqual((5.0 / 2.0).SI(), x / 2.0); + Assert.AreEqual((2 * 5).SI(), 2.0 * x); + Assert.AreEqual((5 * 2).SI(), x * 2.0); + + //var y = 2.SI(); + //Assert.AreEqual((2 * 5).SI(), y * x); + + //var percent = 10.SI<Radian>().ConvertTo().GradientPercent; + //Assert.AreEqual(67.975.ToString("F3") + " [Percent]", percent.ToString("F3")); + //Assert.AreEqual(67.975, percent.Value(), 0.001); + + Assert.AreEqual(45.0 / 180.0 * Math.PI, VectoMath.InclinationToAngle(1).Value(), 0.000001); + } + + [TestMethod] + [SuppressMessage("ReSharper", "UnusedVariable")] + public void SI_Comparison_Operators() + { + var v1 = 600.SI<NewtonMeter>(); + var v2 = 455.SI<NewtonMeter>(); + var v3 = 600.SI<NewtonMeter>(); + var v4 = 100.SI<Watt>(); + var d = 700; + + Assert.IsTrue(v1 > v2); + Assert.IsFalse(v1 < v2); + AssertHelper.Exception<VectoException>(() => { var x = v1 < v4; }, + "Operator '<' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] < 100.0000 [W]"); + AssertHelper.Exception<VectoException>(() => { var x = v1 > v4; }, + "Operator '>' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] > 100.0000 [W]"); + AssertHelper.Exception<VectoException>(() => { var x = v1 <= v4; }, + "Operator '<=' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] <= 100.0000 [W]"); + AssertHelper.Exception<VectoException>(() => { var x = v1 >= v4; }, + "Operator '>=' can only operate on SI Objects with the same unit. Got: 600.0000 [Nm] >= 100.0000 [W]"); + + SI si = null; + Assert.IsFalse(si > 3); + Assert.IsFalse(si < 3); + Assert.IsFalse(si >= 3); + Assert.IsFalse(si <= 3); + + Assert.IsFalse(3 > si); + Assert.IsFalse(3 < si); + Assert.IsFalse(si >= 3); + Assert.IsFalse(si <= 3); + + Assert.IsTrue(v2 < v1); + Assert.IsFalse(v2 > v1); + + Assert.IsTrue(v1 >= v2); + Assert.IsFalse(v1 <= v2); + + Assert.IsTrue(v2 <= v1); + Assert.IsFalse(v2 >= v1); + + Assert.IsTrue(v1 <= v3); + Assert.IsTrue(v1 >= v3); + + Assert.IsTrue(v1 < d); + Assert.IsFalse(v1 > d); + Assert.IsFalse(v1 >= d); + Assert.IsTrue(v1 <= d); + + Assert.AreEqual(1, new SI().CompareTo(null)); + Assert.AreEqual(1, new SI().CompareTo("not an SI")); + Assert.AreEqual(-1, new SI().Meter.CompareTo(new SI().Kilo.Meter.Per.Hour)); + Assert.AreEqual(1, new SI().Newton.Meter.CompareTo(new SI().Meter)); + + Assert.AreEqual(0, 1.SI().CompareTo(1.SI())); + Assert.AreEqual(-1, 1.SI().CompareTo(2.SI())); + Assert.AreEqual(1, 2.SI().CompareTo(1.SI())); + } + + [TestMethod] + [SuppressMessage("ReSharper", "UnusedVariable")] + public void SI_Test_Addition_Subtraction() + { + AssertHelper.AreRelativeEqual(3.SI(), 1.SI() + 2.SI()); + AssertHelper.AreRelativeEqual(-1.SI(), 1.SI() - 2.SI()); + + AssertHelper.AreRelativeEqual(3.SI<Scalar>(), 1.SI<Scalar>() + 2.SI<Scalar>()); + AssertHelper.AreRelativeEqual(3.SI<Scalar>(), 1 + 2.SI<Scalar>()); + AssertHelper.AreRelativeEqual(3.SI<Scalar>(), 1.SI<Scalar>() + 2); + AssertHelper.AreRelativeEqual(-1.SI<Scalar>(), 1.SI<Scalar>() - 2.SI<Scalar>()); + AssertHelper.AreRelativeEqual(-1.SI<Scalar>(), 1 - 2.SI<Scalar>()); + AssertHelper.AreRelativeEqual(-1.SI<Scalar>(), 1.SI<Scalar>() - 2); + + AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 1.SI<NewtonMeter>() + 2.SI<NewtonMeter>()); + AssertHelper.AreRelativeEqual(-1.SI<NewtonMeter>(), 1.SI<NewtonMeter>() - 2.SI<NewtonMeter>()); + + AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 1.SI().Newton.Meter + 2.SI<NewtonMeter>()); + AssertHelper.AreRelativeEqual(-1.SI<NewtonMeter>(), 1.SI().Newton.Meter - 2.SI<NewtonMeter>()); + + AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 1.SI<NewtonMeter>() + 2.SI().Newton.Meter); + AssertHelper.AreRelativeEqual(-1.SI<NewtonMeter>(), 1.SI<NewtonMeter>() - 2.SI().Newton.Meter); + + AssertHelper.Exception<VectoException>(() => { var x = 1.SI().Second - 1.SI<Meter>(); }, + "Operator '-' can only operate on SI Objects with the same unit. Got: 1.0000 [s] - 1.0000 [m]"); + } + + [TestMethod] + public void SI_SpecialUnits() + { + Scalar scalar = 3.SI<Scalar>(); + AssertHelper.AreRelativeEqual(3.SI(), scalar); + double scalarDouble = scalar; + AssertHelper.AreRelativeEqual(3, scalarDouble); + + MeterPerSecond meterPerSecond = 2.SI<MeterPerSecond>(); + AssertHelper.AreRelativeEqual(2.SI().Meter.Per.Second, meterPerSecond); + + Second second = 1.SI<Second>(); + AssertHelper.AreRelativeEqual(1.SI().Second, second); + + Watt watt = 2.SI<Watt>(); + AssertHelper.AreRelativeEqual(2.SI().Watt, watt); + + PerSecond perSecond = 1.SI<PerSecond>(); + AssertHelper.AreRelativeEqual(1.SI().Per.Second, perSecond); + + SI rpm = 20.SI().Rounds.Per.Minute; + AssertHelper.AreRelativeEqual(20.SI().Rounds.Per.Minute, rpm); + AssertHelper.AreRelativeEqual(20.RPMtoRad(), rpm); + AssertHelper.AreRelativeEqual(2.0943951023931953, rpm); + + Radian radian = 30.SI<Radian>(); + AssertHelper.AreRelativeEqual(30.SI().Radian, radian); + AssertHelper.AreRelativeEqual(30, radian); + + Newton newton = 3.SI<Newton>(); + AssertHelper.AreRelativeEqual(3.SI().Newton, newton); + + NewtonMeter newtonMeter = 5.SI<NewtonMeter>(); + AssertHelper.AreRelativeEqual(5.SI().Newton.Meter, newtonMeter); + AssertHelper.AreRelativeEqual(5.SI().Meter.Newton, newtonMeter); + + MeterPerSquareSecond meterPerSquareSecond = 3.SI<MeterPerSquareSecond>(); + AssertHelper.AreRelativeEqual(3.SI().Meter.Per.Square.Second, meterPerSquareSecond); + + Kilogram kilogram = 3.SI<Kilogram>(); + AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm, kilogram); + AssertHelper.AreRelativeEqual(3, kilogram); + + SquareMeter squareMeter = 3.SI<SquareMeter>(); + AssertHelper.AreRelativeEqual(3.SI().Square.Meter, squareMeter); + + CubicMeter cubicMeter = 3.SI<CubicMeter>(); + AssertHelper.AreRelativeEqual(3.SI().Cubic.Meter, cubicMeter); + + KilogramSquareMeter kilogramSquareMeter = 3.SI<KilogramSquareMeter>(); + AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Square.Meter, kilogramSquareMeter); + + KilogramPerWattSecond kilogramPerWattSecond = 3.SI<KilogramPerWattSecond>(); + AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Per.Watt.Second, kilogramPerWattSecond); + } + + /// <summary> + /// VECTO-111 + /// </summary> + [TestMethod] + public void SI_ReziprokDivision() + { + var test = 2.0.SI<Second>(); + + var actual = 1.0 / test; + var expected = 0.5.SI<PerSecond>(); + + AssertHelper.AreRelativeEqual(expected, actual); + } + + [TestMethod] + public void SI_Multiplication_Division() + { + AssertHelper.AreRelativeEqual(12.SI(), 3.SI() * 4.SI()); + AssertHelper.AreRelativeEqual(12.SI(), 3 * 4.SI()); + AssertHelper.AreRelativeEqual(12.SI(), 3.SI() * 4); + + AssertHelper.AreRelativeEqual(12.SI<NewtonMeter>(), 3.SI<Newton>() * 4.SI<Meter>()); + AssertHelper.AreRelativeEqual(12.SI<NewtonMeter>(), 3 * 4.SI<NewtonMeter>()); + AssertHelper.AreRelativeEqual(12.SI<NewtonMeter>(), 3.SI<NewtonMeter>() * 4); + AssertHelper.AreRelativeEqual(12.SI().Square.Newton.Meter, 3.SI<NewtonMeter>() * 4.SI<NewtonMeter>()); + + AssertHelper.AreRelativeEqual(3.SI(), 12.SI() / 4); + AssertHelper.AreRelativeEqual(3.SI(), 12.SI() / 4.SI()); + AssertHelper.AreRelativeEqual(3.SI(), 12.SI<NewtonMeter>() / 4.SI<NewtonMeter>()); + + AssertHelper.AreRelativeEqual(3.SI<NewtonMeter>(), 12.SI<NewtonMeter>() / 4); + AssertHelper.AreRelativeEqual(3.SI().Per.Newton.Meter, 12 / 4.SI<NewtonMeter>()); + + var newtonMeter = 10.SI<NewtonMeter>(); + var perSecond = 5.SI<PerSecond>(); + var watt = (10 * 5).SI<Watt>(); + var second = (1.0 / 5.0).SI<Second>(); + + AssertHelper.AreRelativeEqual(watt, newtonMeter * perSecond); + AssertHelper.AreRelativeEqual(watt, perSecond * newtonMeter); + + AssertHelper.AreRelativeEqual(newtonMeter, watt / perSecond); + AssertHelper.AreRelativeEqual(perSecond, watt / newtonMeter); + + AssertHelper.AreRelativeEqual(second, newtonMeter / watt); + } + + [TestMethod] + public void SI_MeterPerSecond_Div_Meter() + { + PerSecond actual = 6.SI<MeterPerSecond>() / 2.SI<Meter>(); + AssertHelper.AreRelativeEqual(3.SI().Per.Second, actual); + } + + [TestMethod] + public void SI_SimplifyUnits() + { + AssertHelper.AreRelativeEqual(3.SI(), 18.SI().Kilo.Gramm / 6.SI().Kilo.Gramm); + AssertHelper.AreRelativeEqual(3.SI(), 18.SI<NewtonMeter>() / 6.SI<NewtonMeter>()); + + AssertHelper.AreRelativeEqual(18.SI(), 3.SI().Kilo.Gramm * 6.SI().Per.Kilo.Gramm); + AssertHelper.AreRelativeEqual(18.SI<Meter>(), 3.SI().Kilo.Gramm.Meter * 6.SI().Per.Kilo.Gramm); + + AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Square.Meter.Per.Cubic.Second, 3.SI<Watt>()); + AssertHelper.AreRelativeEqual(3.SI().Kilo.Gramm.Meter.Per.Square.Second, 3.SI<Newton>()); + AssertHelper.AreRelativeEqual(3000.SI().Kilo.Gramm, 3.SI().Ton); + AssertHelper.AreRelativeEqual(3.SI().Kilo.Kilo.Gramm.ConvertTo().Ton, 3000.SI().Kilo.Gramm.ConvertTo().Ton); + + AssertHelper.AreRelativeEqual(3.SI<Meter>(), 3000.SI().Milli.Meter); + + AssertHelper.AreRelativeEqual(36.SI().Square.Newton.Meter, 6.SI<NewtonMeter>() * 6.SI<NewtonMeter>()); + AssertHelper.AreRelativeEqual(36.SI().Newton.Newton.Meter.Meter, 6.SI<NewtonMeter>() * 6.SI<NewtonMeter>()); + + AssertHelper.AreRelativeEqual(3.SI().Meter.Per.Second, 3.SI<Newton>().Second.Per.Kilo.Gramm); + } + + [TestMethod] + public void SI_Math() + { + AssertHelper.AreRelativeEqual(-3, -3.SI().Value()); + AssertHelper.AreRelativeEqual(3.SI(), (-3).SI().Abs()); + } + + [TestMethod] + [SuppressMessage("ReSharper", "ReturnValueOfPureMethodIsNotUsed")] + public void SI_Equality() + { + Assert.AreEqual(3.SI(), 3.SI()); + Assert.AreEqual(3.SI<NewtonMeter>(), 3.SI<NewtonMeter>()); + + Assert.IsFalse(3.SI<NewtonMeter>().IsEqual(4.SI<NewtonMeter>())); + Assert.IsFalse(3.SI<NewtonMeter>().IsEqual(3.SI<Meter>())); + + Assert.IsTrue(3.SI().IsEqual(4, 10)); + + var x = 4.SI(); + var y = x; + var z = 4.SI(); + Assert.IsTrue(x.Equals(y)); + + Assert.IsFalse(3.SI().Equals(null)); + Assert.IsFalse(3.SI().IsEqual(4.SI())); + Assert.IsTrue(z.Equals(x)); + Assert.IsFalse(3.SI().Equals(3.SI<Newton>())); + + var newton1 = 3.SI<Newton>(); + var newton2 = 3.SI<Newton>(); + Assert.IsTrue(newton1.Equals(newton2)); + + Assert.IsTrue(3.SI().IsEqual(3.SI())); + Assert.IsTrue(3.SI().IsEqual(3)); + + Assert.IsFalse(3.SI().IsEqual(2.9.SI())); + Assert.IsFalse(3.SI().IsEqual(2.9)); + + // just calling to test wether the functions are not throwing an exception. + 3.SI().GetHashCode(); + 3.0.SI().GetHashCode(); + 4.SI<NewtonMeter>().GetHashCode(); + } + + [TestMethod] + public void SI_Output() + { + Assert.AreEqual("3.0000", 3.SI().ToOutputFormat()); + Assert.AreEqual("3.0000 [-]", 3.SI().ToOutputFormat(showUnit: true)); + Assert.AreEqual("3.5000", 3.5.SI().ToOutputFormat()); + Assert.AreEqual("3.5000", 3.5.SI<Newton>().ToOutputFormat()); + Assert.AreEqual("3.50 [N]", 3.5.SI<Newton>().ToOutputFormat(2, showUnit: true)); + Assert.AreEqual("18.00 [m/s]", 5.SI<MeterPerSecond>().ToOutputFormat(2, 3.6, true)); + Assert.AreEqual("18.0000", 5.SI<MeterPerSecond>().ToOutputFormat(outputFactor: 3.6)); + + Assert.AreEqual("10.0000 [m^2]", 10.SI<SquareMeter>().ToOutputFormat(showUnit: true)); + + Assert.AreEqual("10.0000 [m^3]", 10.SI<CubicMeter>().ToOutputFormat(showUnit: true)); + + Assert.AreEqual("0.5000 [m/s^2]", 0.5.SI<MeterPerSquareSecond>().ToOutputFormat(showUnit: true)); + } + } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs b/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs index 82a27e4014886c277485aa278d3a273f0c9a9df8..ff189bc3c6b2f60d0245e74e8433e574b3ef0d9c 100644 --- a/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs +++ b/VectoCore/VectoCoreTest/Utils/ShiftPolygonDrawer.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Collections; using System.Collections.Generic; diff --git a/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs b/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs index c9c082cb14365a0edb11158e4c85e0e9bb1156cb..9f45dc77dda3ed6b0c2eecda8591a278c064ecbd 100644 --- a/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs +++ b/VectoCore/VectoCoreTest/Utils/VectoMathTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System; using System.Linq; using NUnit.Framework; diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs index 68f6e3f6da4b45f63b434c786e1f15e807dbf734..25f0dc1d1985a3d49bc1c3f4a22d3cabc1b9eca9 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs index f109dd7a551fa365ad20c514457f1ca0e5056b47..999c06fe8f47f4166af51042b414ed2004f8893d 100644 --- a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputRefTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Linq; using System.Xml; diff --git a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs index 230b5a3255e359b356d7b236b5c3ac7561676a54..b04558a032a19f417e6e7b5efd78f3bd41e4bc67 100644 --- a/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLEngineeringInputSingleTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Linq; using System.Xml; diff --git a/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs b/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs index ce9a110becfa29997f57c301bfc6ca77c0393a83..1f4d70c0726e37d663fc3ce6ba383e13f259526c 100644 --- a/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLWritingTest.cs @@ -1,34 +1,34 @@ -/* -* This file is part of VECTO. -* -* Copyright © 2012-2016 European Union -* -* Developed by Graz University of Technology, -* Institute of Internal Combustion Engines and Thermodynamics, -* Institute of Technical Informatics -* -* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved -* by the European Commission - subsequent versions of the EUPL (the "Licence"); -* You may not use VECTO except in compliance with the Licence. -* You may obtain a copy of the Licence at: -* -* https://joinup.ec.europa.eu/community/eupl/og_page/eupl -* -* Unless required by applicable law or agreed to in writing, VECTO -* distributed under the Licence is distributed on an "AS IS" basis, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the Licence for the specific language governing permissions and -* limitations under the Licence. -* -* Authors: -* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology -* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology -* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology -* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology -* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology -* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology -*/ - +/* +* This file is part of VECTO. +* +* Copyright © 2012-2017 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology +* Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology +* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology +*/ + using System.IO; using System.Xml; using Microsoft.VisualStudio.TestTools.UnitTesting;