diff --git a/Directory.Build.props b/Directory.Build.props index b9e9577cd23a3b9c1b1deb133a629690cec45fed..1c6bee655b6959f864f99d9336793857ca01dbd2 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,7 @@ <!--<DefineConstants>CERTIFICATION_RELEASE</DefineConstants>--> <!-- Global VECTO Version --> - <MainProductVersion>0.7.8</MainProductVersion> + <MainProductVersion>0.7.9</MainProductVersion> <VersionSuffix>DEV</VersionSuffix> <!-- The following settings are used as default values for ALL projects --> diff --git a/Directory.Build.targets b/Directory.Build.targets index adb0bbe5ce19a05275019ed062324e91848e840d..c9c06bc38267f03fab4173b475beef36eb1e5c83 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -20,13 +20,14 @@ <ItemGroup> <!-- All files for net45 --> - <Net45VECTO Include="$(SolutionDir)VECTO\bin\Release\net45\*.exe*"/> + <Net45VECTO Include="$(SolutionDir)VECTO\bin\Release\net45\*.exe"/> <Net45VECTO Include="$(SolutionDir)VECTO\bin\Release\net45\*.dll*"/> - <Net45HashingTool Include="$(SolutionDir)HashingTool\bin\Release\net45\*.exe*"/> + <Net45Vecto Include="$(SolutionDir)VECTO\bin\Release\net45\nlog.config"/> + <Net45HashingTool Include="$(SolutionDir)HashingTool\bin\Release\net45\*.exe"/> <Net45HashingTool Include="$(SolutionDir)HashingTool\bin\Release\net45\*.dll*"/> - <Net45HashingTool Include="$(SolutionDir)HashingCmd\bin\Release\net45\*.exe*"/> + <Net45HashingTool Include="$(SolutionDir)HashingCmd\bin\Release\net45\*.exe"/> <Net45HashingTool Include="$(SolutionDir)HashingCmd\bin\Release\net45\*.dll*"/> - <Net45VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net45\*.exe*"/> + <Net45VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net45\*.exe"/> <Net45VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net45\*.dll*"/> </ItemGroup> <Copy SourceFiles="@(Net45VectoCommandLine)" DestinationFolder="$(DeployPath)net45"/> @@ -35,13 +36,14 @@ <ItemGroup> <!-- All files for net48 --> - <Net48VECTO Include="$(SolutionDir)VECTO\bin\Release\net48\*.exe*"/> + <Net48VECTO Include="$(SolutionDir)VECTO\bin\Release\net48\*.exe"/> <Net48VECTO Include="$(SolutionDir)VECTO\bin\Release\net48\*.dll*"/> - <Net48HashingTool Include="$(SolutionDir)HashingCmd\bin\Release\net48\*.exe*"/> + <Net48Vecto Include="$(SolutionDir)VECTO\bin\Release\net48\nlog.config"/> + <Net48HashingTool Include="$(SolutionDir)HashingCmd\bin\Release\net48\*.exe"/> <Net48HashingTool Include="$(SolutionDir)HashingCmd\bin\Release\net48\*.dll*"/> - <Net48VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net48\*.exe*"/> + <Net48VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net48\*.exe"/> <Net48VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net48\*.dll*"/> - <Net48VectoMultistage Include="$(SolutionDir)VECTO3GUI2020\bin\Release\net48\*.exe*"/> + <Net48VectoMultistage Include="$(SolutionDir)VECTO3GUI2020\bin\Release\net48\*.exe"/> <Net48VectoMultistage Include="$(SolutionDir)VECTO3GUI2020\bin\Release\net48\*.dll*"/> </ItemGroup> <Copy SourceFiles="@(Net48VectoCommandLine)" DestinationFolder="$(DeployPath)net48"/> @@ -53,6 +55,7 @@ <!-- All files for net6.0 --> <Vecto Include="$(SolutionDir)VECTO\bin\Release\net6.0-windows\VECTO.*" Exclude="*.dev.json"/> <Vecto Include="$(SolutionDir)VECTO\bin\Release\net6.0-windows\*.dll"/> + <Vecto Include="$(SolutionDir)VECTO\bin\Release\net6.0-windows\nlog.config"/> <VectoRuntimes Include="$(SolutionDir)VECTO\bin\Release\net6.0-windows\runtimes\**\*.*"/> <VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net6.0\vectocmd.*" Exclude="*.dev.json"/> <VectoCommandLine Include="$(SolutionDir)VectoConsole\bin\Release\net6.0\*.dll"/> diff --git a/Documentation/User Manual Source/Release Notes Vecto3.x.pptx b/Documentation/User Manual Source/Release Notes Vecto3.x.pptx index d0a0e0aea336c18e477643c8ee6bfd639fae05a4..8bff50339356cdc703753c405d8e996ed61698b6 100644 Binary files a/Documentation/User Manual Source/Release Notes Vecto3.x.pptx and b/Documentation/User Manual Source/Release Notes Vecto3.x.pptx differ diff --git a/Documentation/User Manual/1-user-interface/A_index.md b/Documentation/User Manual/1-user-interface/A_index.md index 37f1ab1516006ed88b0c9535746b3bd19523e936..97c90b5d43927fb4a756d6b50ccb5d3c41cb0036 100644 --- a/Documentation/User Manual/1-user-interface/A_index.md +++ b/Documentation/User Manual/1-user-interface/A_index.md @@ -6,12 +6,16 @@ When VECTO starts the [Main Form](#main-form) is loaded. Closing this form will - [Main Form](#main-form) - [Settings](#settings) - [Job Editor](#job-editor) -- [Vehicle Editor](#vehicle-editor-general-tab) -- [Vehicle Editor](#vehicle-editor-powertrain-tab) -- [Vehicle Editor](#vehicle-editor-electric-components-tab) -- [Vehicle Editor](#vehicle-editor-torque-limits-tab) -- [Vehicle Editor](#vehicle-editor-adas-tab) -- [Vehicle Editor](#vehicle-editor-pto-tab) +- [Vehicle Editor - General](#vehicle-editor-general-tab) +- [Vehicle Editor - Powertrain](#vehicle-editor-powertrain-tab) +- [Vehicle Editor - Electric Machine](#vehicle-editor-electric-machine-tab) +- [Vehicle Editor - REESS](#vehicle-editor-reess-tab) +- [Vehicle Editor - IEPC](#vehicle-editor-iepc-tab) +- [Vehicle Editor - IHPC](#vehicle-editor-ihpc-tab) +- [Vehicle Editor - GenSet](#vehicle-editor-genset-tab) +- [Vehicle Editor - Torque Limits](#vehicle-editor-torque-limits-tab) +- [Vehicle Editor - ADAS](#vehicle-editor-adas-tab) +- [Vehicle Editor - PTO](#vehicle-editor-pto-tab) - [Aux Dialog](#auxiliary-dialog) - [BusAux Dialog](#busauxiliary-dialog) - [Engine Editor](#engine-editor) diff --git a/Documentation/User Manual/1-user-interface/F_VEH-Editor.md b/Documentation/User Manual/1-user-interface/F_VEH-Editor.md index dedaa0870e0891e3d6dee554da2b8b40b51d0d40..dbafd237a94e0b898b39f1b01c46576cef5ae021 100644 --- a/Documentation/User Manual/1-user-interface/F_VEH-Editor.md +++ b/Documentation/User Manual/1-user-interface/F_VEH-Editor.md @@ -220,7 +220,7 @@ In case that the gearbox' maximum torque is lower than the engine's maximum torq Next, the maximum available torque for the electric machine can be reduced at the vehicle level, both for propulsion and recuperation. The input file is the same as the maximum drive and maximum recuperation curve (see [Electric Motor Max Torque File](#electric-motor-max-torque-file-.vemp)) -Last, the overall propulsion of the vehicle (i.e., HEV Px, electric motor plus combustion engine) can be limited. The "Propulsion Torque Limit" curve limits the maximum effective torque at the gearbox input shaft over the input speed. This curve is added to the combustion engine's maximum torque curve (only positive values are allowed!). For details on the file format see [Vehicle Boosting Limits](#vehcle-boosing-limits-.vemp). The propulsion torque limit has to be provided from 0 rpm to the maximum speed of the combustion engine. In case of P3 or P4 configuration, the torque at the gearbox input shaft is calculated assuming that the electric motor does not contribute to propelling the vehicle, considering the increased losses in the transmission components inbetween. For P2.5 powertrain configurations no special calculations are necessary as this architecture is internally anyhow modelled as P2 architecture. +Last, the overall propulsion of the vehicle (i.e., HEV Px, electric motor plus combustion engine) can be limited. The "Propulsion Torque Limit" curve limits the maximum effective torque at the gearbox input shaft over the input speed. This curve is added to the combustion engine's maximum torque curve (only positive values are allowed!). For details on the file format see [Vehicle Boosting Limits](#vehicle-boosting-limits-.vtqp). The propulsion torque limit has to be provided from 0 rpm to the maximum speed of the combustion engine. In case of P3 or P4 configuration, the torque at the gearbox input shaft is calculated assuming that the electric motor does not contribute to propelling the vehicle, considering the increased losses in the transmission components inbetween. For P2.5 powertrain configurations no special calculations are necessary as this architecture is internally anyhow modelled as P2 architecture. ## Vehicle Editor -- ADAS Tab diff --git a/Documentation/User Manual/1-user-interface/H1_HybridStrategyParams-Editor.md b/Documentation/User Manual/1-user-interface/H1_HybridStrategyParams-Editor.md index b3cff88c75d41593b7b57fb3c70672ed67cb0aea..c8e7aeb3cff86ed3a7954eb409455f973054fad5 100644 --- a/Documentation/User Manual/1-user-interface/H1_HybridStrategyParams-Editor.md +++ b/Documentation/User Manual/1-user-interface/H1_HybridStrategyParams-Editor.md @@ -6,7 +6,7 @@ ### Description -The [Hybrid Strategy Parameters File (.vhctl)](#hybrid-strategy-parameters-file-.vhctl) defines all parameters used by the [Hybrid Control Strategy](#hybrid-control-strategy) to evaluate the best option for splitting the demanded torque between electric motor and combustion engine. +The [Hybrid Strategy Parameters File (.vhctl)](#hybrid-strategy-parameters-file-.vhctl) defines all parameters used by the [Parallel Hybrid Control Strategy](#parallel-hybrid-control-strategy)/[Serial Hybrid Control Strategy](#serial-hybrid-control-strategy) to evaluate the best option for splitting the demanded torque between electric motor and combustion engine. ### Strategy Parameters diff --git a/Documentation/User Manual/1-user-interface/H_GBX-Editor.md b/Documentation/User Manual/1-user-interface/H_GBX-Editor.md index 5ddaec22fbced1dd77948bdb1931908adac51547..639d3487ee6f6207ce2669c06399cf22335215ae 100644 --- a/Documentation/User Manual/1-user-interface/H_GBX-Editor.md +++ b/Documentation/User Manual/1-user-interface/H_GBX-Editor.md @@ -71,7 +71,7 @@ Automated Manual Transmission - Hybrid Electric vehicle : Gearshift is handled by the hybrid controller. Shift lines (calculated in the same way as for conventional vehicles) are used as upper and lower boundary for allowed ICE operating points. Automated Manual Transmission - Pure Electric vehicle -: Efficiency shift based strategy. The calculation of gearshift lines and the gearshift rules are [described here](#FFOOO) +: Efficiency shift based strategy. The calculation of gearshift lines and the gearshift rules are [described here](#pev-gear-shift-model) Automatic Transmission - Conventional vehicle : Efficiency shift. The calculation of gearshift lines and the gearshift rules are [described here](#shift-strategy-apt-gearshift-rules) @@ -80,7 +80,7 @@ Automatic Transmission - Hybrid Electric vehicle : Gearshift is handled by the hybrid controller. Shift lines (calculated in the same way as for conventional vehicles) are used as upper and lower boundary for allowed ICE operating points. Automatic Transmission (APT-N) - Pure Electric vehicle -: Efficiency shift based strategy. The calculation of gearshift lines and the gearshift rules are [described here](#FFOOO) +: Efficiency shift based strategy. The calculation of gearshift lines and the gearshift rules are [described here](#pev-gear-shift-model) <div class="engineering"> diff --git a/Documentation/User Manual/1-user-interface/L_ElectricMotor.md b/Documentation/User Manual/1-user-interface/L_ElectricMotor.md index 7e0b88e4c37561618ab23854a0748e03f466e2cc..77cf5a81526c6c2cb3bfaeb5347ac36c21237f81 100644 --- a/Documentation/User Manual/1-user-interface/L_ElectricMotor.md +++ b/Documentation/User Manual/1-user-interface/L_ElectricMotor.md @@ -47,7 +47,7 @@ Max. Drive and Max. Generation Torque Curve : Torque over engine speed the electric motor can apply on its output shaft. (see [Electric Motor Max Torque File (.vemp)](#electric-motor-max-torque-file-.vemp)). The max drive and max generation torque have to be provided for two different voltage levels. Electric Power Consumption Map -: Defines the electric power that is required to provide a certain mechanical power (torque and angular speed) at the motor's shaft. This map is used to calculate the electric power demand. The electric power consumption map shall cover a torque range exceeding the max. drive and max. generation torque and shall cover the speed range from 0 up to the maximum speed. (see [Electric Motor Map (.vemo)](#electric-motor-map-.vemo)). The power map has to be provided for two different voltage levels. +: Defines the electric power that is required to provide a certain mechanical power (torque and angular speed) at the motor's shaft. This map is used to calculate the electric power demand. The electric power consumption map shall cover a torque range exceeding the max. drive and max. generation torque and shall cover the speed range from 0 up to the maximum speed. (see [Electric Motor Map (.vemo)](#electric-motor-power-map-.vemo)). The power map has to be provided for two different voltage levels. Voltage Level Low/High : Applicable voltage level for the electric power consumption map and max drive/generation torque curve diff --git a/Documentation/User Manual/1-user-interface/N_IEPC.md b/Documentation/User Manual/1-user-interface/N_IEPC.md index 72de151a220e69b76de1af6cc313c27aeeb38dd1..13932980c6b4032bb4c13e275ef9da1f6d568705 100644 --- a/Documentation/User Manual/1-user-interface/N_IEPC.md +++ b/Documentation/User Manual/1-user-interface/N_IEPC.md @@ -54,7 +54,7 @@ Max. Drive and Max. Generation Torque Curve : Torque over engine speed the electric motor can apply on its output shaft. (see [IEPC Max Torque File (.vemp)](#iepc-max-torque-file-.viepcp)). The max drive and max generation torque have to be provided for two different voltage levels. Electric Power Consumption Map -: Defines the electric power that is required to provide a certain mechanical power (torque and angular speed) at the motor's shaft. This map is used to calculate the electric power demand. The electric power consumption map shall cover a torque range exceeding the max. drive and max. generation torque and shall cover the speed range from 0 up to the maximum speed. (see [IEPC Map (.viepco)](#iepc-map-.viepco)). The power map has to be provided for two different voltage levels and all gears. +: Defines the electric power that is required to provide a certain mechanical power (torque and angular speed) at the motor's shaft. This map is used to calculate the electric power demand. The electric power consumption map shall cover a torque range exceeding the max. drive and max. generation torque and shall cover the speed range from 0 up to the maximum speed. (see [IEPC Map (.viepco)](#iepc-power-map-.viepco)). The power map has to be provided for two different voltage levels and all gears. Voltage Level Low/High : Applicable voltage level for the electric power consumption map and max drive/generation torque curve diff --git a/Documentation/User Manual/1-user-interface/O_IHPC.md b/Documentation/User Manual/1-user-interface/O_IHPC.md index e7969a7d5eced477216bccb97df2854a85a34b4f..b4724e77a7b6df357c0deee4539721fadb680cbf 100644 --- a/Documentation/User Manual/1-user-interface/O_IHPC.md +++ b/Documentation/User Manual/1-user-interface/O_IHPC.md @@ -51,7 +51,7 @@ Max. Drive and Max. Generation Torque Curve : Torque over engine speed the electric motor can apply on its output shaft. (see [Electric Motor Max Torque File (.vemp)](#electric-motor-max-torque-file-.vemp)). The max drive and max generation torque have to be provided for two different voltage levels. Electric Power Consumption Map -: Defines the electric power that is required to provide a certain mechanical power (torque and angular speed) at the motor's shaft. This map is used to calculate the electric power demand. The electric power consumption map shall cover a torque range exceeding the max. drive and max. generation torque and shall cover the speed range from 0 up to the maximum speed. (see [Electric Motor Map (.viepco)](#electric-motor-map-.vemo)). The power map has to be provided for two different voltage levels and all gears. +: Defines the electric power that is required to provide a certain mechanical power (torque and angular speed) at the motor's shaft. This map is used to calculate the electric power demand. The electric power consumption map shall cover a torque range exceeding the max. drive and max. generation torque and shall cover the speed range from 0 up to the maximum speed. (see [Electric Motor Map (.viepco)](#electric-motor-power-map-.vemo)). The power map has to be provided for two different voltage levels and all gears. Voltage Level Low/High : Applicable voltage level for the electric power consumption map and max drive/generation torque curve diff --git a/Documentation/User Manual/3-simulation-models/Electric_Motor.md b/Documentation/User Manual/3-simulation-models/Electric_Motor.md index d96d45d86eed7c371fecb7b0f928b43c19071cff..221d374fc7703564f1df6293679d201bd0f90eef 100644 --- a/Documentation/User Manual/3-simulation-models/Electric_Motor.md +++ b/Documentation/User Manual/3-simulation-models/Electric_Motor.md @@ -12,7 +12,7 @@ The electric motor is modeled by basically 4 map files: - Engine speed for overload torque ($n_\textrm{T,ovl}$) - Maximum overload time ($t_\textrm{ovl}$) -The first two curves are read from a .vemp file (see [Electric Motor Max Torque File (.vemp)](#electric-motor-max-torque-file-.vemp)). The drag curve is provided in a .vemd file (see [Electric Motor Drag Curve File (.vemd)](#electric-motor-drag-curve-file-.vemd)) and the electric power map in a .vemo file (see [Electric Motor Map (.vemo)](#electric-motor-map-.vemo)). +The first two curves are read from a .vemp file (see [Electric Motor Max Torque File (.vemp)](#electric-motor-max-torque-file-.vemp)). The drag curve is provided in a .vemd file (see [Electric Motor Drag Curve File (.vemd)](#electric-motor-drag-curve-file-.vemd)) and the electric power map in a .vemo file (see [Electric Motor Map (.vemo)](#electric-motor-power-map-.vemo)). During the simulation the maximum drive torque, maximum generation torque, and electric power map is interpolated for both voltage levels and the actual value used is interpolated between both voltage levels with the current internal voltage of the REESS. diff --git a/Documentation/User Manual/3-simulation-models/Engine_FC_Correction.md b/Documentation/User Manual/3-simulation-models/Engine_FC_Correction.md index a9282f9bd3ef258accf62d489213799876d05723..2735062bda4541975ecda6bdfb7b0aad3676e25e 100644 --- a/Documentation/User Manual/3-simulation-models/Engine_FC_Correction.md +++ b/Documentation/User Manual/3-simulation-models/Engine_FC_Correction.md @@ -143,9 +143,9 @@ $$ $\textbf{\textrm{FC\_WHR}} = - (\textrm{E\_WHR\_mech} + \textrm{E\_WHR\_el\_mech}) \cdot k_\textrm{engline}$ -#### Hybrid Vehicles: REESS SoC Correction +#### Parallel Hybrid Vehicles: REESS SoC Correction -If the REESS Soc at the end of the simulation is higher than the initial SoC the correction is done according to: +If the REESS Soc at the end of the simulation is different than the initial SoC the correction is done according to: $$ \textbf{\textrm{FC\_SoC}} = -\frac{\Delta\textrm{E\_REESS} \cdot k_\textrm{engline}}{\eta_{\textrm{EM}_\textrm{chg}} \cdot \eta_{\textrm{REESS}_\textrm{chg}}} @@ -164,6 +164,24 @@ $\eta_{\textrm{REESS}_\textrm{chg}} = \frac{\textrm{E\_REESS\_INT\_CHG}}{\textrm $\eta_{\textrm{REESS}_\textrm{dischg}} = \frac{\textrm{E\_REESS\_INT\_DISCHG}}{\textrm{E\_REEES\_T\_DISCHG}}$ +#### Serial Hybrid Vehicles: REESS SoC Correction + +If the REESS Soc at the end of the simulation is different than the initial SoC the correction is done according to: + +$FC_\textrm{gen,charging} = \sum{FC_\textrm{mod,final}\cdot dt}$ + +$E_\textrm{gen,el} = \sum{P_\textrm{em,el}\cdot dt}$ + +If the GenSet was on during the cycle, the SoC correction is done according to: + +$\textrm{FC\_SOC} = \Delta\textrm{E\_REESS} \cdot \frac{FC_\textrm{gen,charging}}{E_\textrm{gen,el}}$ + +If the GenSet was never on during the cycle, the SoC correction is done according to: + +$\textrm{FC\_SOC} = \Delta\textrm{E\_REESS} \cdot \frac{FC_\textrm{gen,optimal}}{E_\textrm{gen,el,optimal}}$ + +where $FC_\textrm{gen,optimal}$ and $E_\textrm{gen,el,optimal}$ are the fuel consumption and generated electric power in the optimal operating point of the GenSet + ### Corrected Total Fuel Consumption The final fuel consumption after all corrections are applied is calcualted as follows: diff --git a/Documentation/User Manual/3-simulation-models/GearShift.md b/Documentation/User Manual/3-simulation-models/GearShift.md index 192a4c5009b4fcf7c497a8f12b5990925e5e26e9..626bcc4c29fa3bb6ba71ee6142b021f185b86de7 100644 --- a/Documentation/User Manual/3-simulation-models/GearShift.md +++ b/Documentation/User Manual/3-simulation-models/GearShift.md @@ -24,7 +24,28 @@ $a_{demand} = a_{act} * a_{red}$ for $(n_{act} > n_{T98h})$ $a_{red} = 1+ (\textrm{AccelerationFactorNP98h} - 1) / (n_{P98h} - n_{T98h}) * (n - n_{T98h})$ for $(n_{act} > n_{T98h})$ +## PEV Gear Shift Model +The gear shift lines for pure electric vehicles is different than for conventional vehicles and HEV as the shape of maximum torque curve is typically very different. +The figure below depicts a typical maximum torque curve (orange) and maximum power curve (blue) for an electric motor. The downshift and upshift lines are plotted with a dot-dashed green line. +**Basics:** + + * Downshift for operation point left of green dot-dashed downshift lines + * Upshift for operation point right of green dot-dashed upshift line + * EffShift method applied for operation point between downshift and upshift lines (refer to user manual) + +**Driving:** + + * Maximum downshift speed always located at n_P80low (where 80% of max power is available) + * For EM in de-rating n_P80low is calculated from the de-rated power curve + +**Braking:** + + * EffShift is suppressed for operation point within red shaded area(2% below max recuperation power) + * New gear after downshift is selected so that operation point is closest to and above n_brake_target_norm (or only closest to n_brake_target_norm in case no operation point with higher speed exists) + + + diff --git a/Documentation/User Manual/3-simulation-models/IEPC.md b/Documentation/User Manual/3-simulation-models/IEPC.md index e15c2e98b0e35809d6258d497d71a2f6408e84a1..ba25b0d1d933a0808fa4fbd4f49746fef6a05f95 100644 --- a/Documentation/User Manual/3-simulation-models/IEPC.md +++ b/Documentation/User Manual/3-simulation-models/IEPC.md @@ -19,3 +19,6 @@ The first two curves are read from a .viepcp file (see [IEPC Max Torque File (.v In the VECTO simulation, the IEPC component is virtually split up into the electric machine (with gear-dependent electric power maps), an APT-N gearbox in case of a multi-speed gearbox or a single-speed gearbox in case the IEPC has only a single fixed transmission ratio, and optionally an axle gear. All virtual powertrain components (gearbox, axlegear) are modeled as loss-less components. Thus, the simulation of an IEPC is similar to E2 vehicles in case of a multi-speed gearbox or an E3 vehicle in case of a single-speed gearbox. + + +All signals with the suffix "_int" refer to the electric motor, while signals without this suffix refer to the whole component. \ No newline at end of file diff --git a/Documentation/User Manual/3-simulation-models/HybridControlStrategy.md b/Documentation/User Manual/3-simulation-models/ParallelHybridControlStrategy.md similarity index 99% rename from Documentation/User Manual/3-simulation-models/HybridControlStrategy.md rename to Documentation/User Manual/3-simulation-models/ParallelHybridControlStrategy.md index 8a289e85e06fcaaeb9919464bcff77c1678cf02f..36fb74baea9f6cf0b361dd60b9714bdf81555f00 100644 --- a/Documentation/User Manual/3-simulation-models/HybridControlStrategy.md +++ b/Documentation/User Manual/3-simulation-models/ParallelHybridControlStrategy.md @@ -1,4 +1,4 @@ -## Hybrid Control Strategy +## Parallel Hybrid Control Strategy The basic principle of the hybrid control strategy is to evaluate different options of operating modes, i.e., different splits of the demanded torque at the wheels among the electric motor and the combustion engine. For every option a cost function is calculated, taking onto account the required electric energy and the fuel consumption. Out of the examined operating modes the best option, i.e, the option with the lowest cost value is selected. diff --git a/Documentation/User Manual/3-simulation-models/SerialHybridControlStrategy.md b/Documentation/User Manual/3-simulation-models/SerialHybridControlStrategy.md new file mode 100644 index 0000000000000000000000000000000000000000..dcf5fcc23ac22de29d0e6088d2cab07a0e011a63 --- /dev/null +++ b/Documentation/User Manual/3-simulation-models/SerialHybridControlStrategy.md @@ -0,0 +1,17 @@ +## Serial Hybrid Control Strategy + +The basic principle of the serial hybrid strategy is to operate the GenSet in three different states, depending on the power demand of the drivetrain and the REESS' state of charge. So the serial hybrid strategy operates as a three-point controller with a hysteresis. + +The following picture illustrates the basic idea. If the SoC is above the target SoC, the GenSet is off and the vehicle drives solely from the battery. When the SoC gets lower and reaches the SoC_min threshold, the GenSet is switched on. As long as the SoC is between SoC_min and SoC_target, the GenSet operates in the optimal operating point. When the upper threshold SoC_target is reached, the GenSet is switched off. In case the power demand from the drivetrain is higher than what the GenSet can provide in the optimal point and the SoC falls below the lower threshold SoC_min, the GenSet operates either in the maximum power operating point (if the drivetrain power demand is higher than the power generated in the optimal point) or in the optimal point. + + + +The statemachine for the serial hybrid control strategy is depicted here: + + + +**Note:** The SoC boundaries (SoC_target and SoC_min) shall be narrower than the batteries SoC limits so that on the one hand the vehicle can still recuperate even in case the REESS is charging and reaching the target SoC and on the other hand that there is a buffer available if the drivetrain power demand is high and the GenSet needs some time to ramp up to the maximal power operating point. + +### GenSet Pre-Processing + +The optimal and maximal GenSet operating points are calculated in a pre-processing step. The fuel consumption and generated electric power is calculated for 400 different operating points: from ICE idle speed up to the maximum speed (minimum of ICE and electric motor), and from 0 mechanical power up to the maximum mechanical power of the ICE. Out of this set of operating points the one with the highest electrical power and the operating point with the best fuel efficiency is selected. This is done for the GenSet operating in de-rating or not. \ No newline at end of file diff --git a/Documentation/User Manual/5-input-and-output-files/VEMx.md b/Documentation/User Manual/5-input-and-output-files/VEMx.md index 558e193d7f980dbb7a66c84190108bfb0443f0b1..082c9785e33a987d0005526f0e1a72d24e8e3884 100644 --- a/Documentation/User Manual/5-input-and-output-files/VEMx.md +++ b/Documentation/User Manual/5-input-and-output-files/VEMx.md @@ -36,7 +36,7 @@ n [rpm] , T_drag [Nm] ~~~ -## Electric Motor Map (.vemo) +## Electric Motor Power Map (.vemo) This file is used to interpolate the electric power required for a certain mechanical power at the eletric motor's shaft. The file uses the [VECTO CSV format](#csv). diff --git a/Documentation/User Manual/files.txt b/Documentation/User Manual/files.txt index c1599e07eeb224587db1858b7f1d3434296b428b..0f124838b1720dbc1e488bc934c7bb924bf4f489 100644 --- a/Documentation/User Manual/files.txt +++ b/Documentation/User Manual/files.txt @@ -51,7 +51,8 @@ 3-simulation-models/IEPC.md 3-simulation-models/IHPC.md 3-simulation-models/Electric_Storage.md -3-simulation-models/HybridControlStrategy.md +3-simulation-models/ParallelHybridControlStrategy.md +3-simulation-models/SerialHybridControlStrategy.md 5-input-and-output-files/input-output.md 5-input-and-output-files/XML_Job-File_DeclarationMode.md 5-input-and-output-files/XML_DeclarationReport.md diff --git a/Documentation/User Manual/pics/PEV_Gearshift.png b/Documentation/User Manual/pics/PEV_Gearshift.png new file mode 100644 index 0000000000000000000000000000000000000000..1d53b5f42ba7819fd8a06d4a8f678e2cbe8437d7 Binary files /dev/null and b/Documentation/User Manual/pics/PEV_Gearshift.png differ diff --git a/Documentation/User Manual/pics/SerialHybrid_SoCBoundaries.png b/Documentation/User Manual/pics/SerialHybrid_SoCBoundaries.png new file mode 100644 index 0000000000000000000000000000000000000000..54400d29165440784f62341f2796dd24cee41730 Binary files /dev/null and b/Documentation/User Manual/pics/SerialHybrid_SoCBoundaries.png differ diff --git a/Documentation/User Manual/pics/SerialHybrid_Statemachine.png b/Documentation/User Manual/pics/SerialHybrid_Statemachine.png new file mode 100644 index 0000000000000000000000000000000000000000..3d7699052898a236cce1cd4bba50e60f3443f386 Binary files /dev/null and b/Documentation/User Manual/pics/SerialHybrid_Statemachine.png differ diff --git a/Documentation/User Manual/pics/Structure_IEPC.png b/Documentation/User Manual/pics/Structure_IEPC.png new file mode 100644 index 0000000000000000000000000000000000000000..0d5516d8fecfb124f7631bb24c833e2317322fb7 Binary files /dev/null and b/Documentation/User Manual/pics/Structure_IEPC.png differ diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto index 3a4d93f4e55bb31268825f80295bf5fa14d13d01..8a512cdc25ac9820315eebe7f86c5e092cdd846c 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto index 23dc4d8779da2a340976283944f098d7eb74b70f..2ab4f8bf9b742f0a46926c1420d415675ee3666b 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto index d826a010c7133b88f2373c6b8335da18a2eee0c8..5d89f019a50181b0141105044b797fde6a715aef 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto index d2d2ae973f430cb783c48cda76335d11ebaa8890..5925a85219ca99d7b501ff3f7bf79958daa47892 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto @@ -13,7 +13,7 @@ "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto index f06545a5fa8c567c132fcd4291c0c5292bcce37c..062c8afc0b9a5bff0446643fa4bc12dafda2e3fd 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto index 4e6fcefa3c70689d8a89bcd47a51d7a232e28799..9538da5609863d3ffaa9bf85c2de1d8c1b9bc71b 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto index f402ce770e3afc13e7c5ea64530f48e7a1d7fbad..2fd2b70b39928185dfc0386856f71fbc24538f4e 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto index 72acd74aa5bf7b92fd7d255647930ba7d795b433..e2d61bb3cf1cc8ca5c0cb018ba79199940c984c0 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto @@ -13,7 +13,7 @@ "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto index aad5769a42aa7bd720108aafe4ffa096c0f3c056..7ec225a223d54ed23c9cd0574f4530a400a3482e 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto @@ -13,7 +13,7 @@ "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto index e19150c83618395c69db102b100b2b5f86454850..ba8202f067e933c6f2cd89ed52a5467f0f112061 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1Axl.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto index 6cc64ff5def0f1da6b0d8886c28e8766af675975..1dd51ccf02019fe181c5badaa0dbab77f59cf43f 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1Whl1.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto index 588039a710bb50e1812a6280716bfd2d173aa006..81cc58e814c1a3820881479d3bf415b846a5139b 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1Whl2.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto index cbac5f5b98ffd3ea3898e10e3c21a2bdefb0fd8b..06cacde4807c12faa7f4722ba2ee71390e7784c2 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1.vveh", "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto index 18db3d71b4ebdaa1349292d4d437a40c9a80f158..21a2352cde5e232cf14f1544fb8d827041ab6367 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3Axl.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto index 9690d09aa289af9262fcbb00b8ec99eadcce93bf..3175f83ee9e4ec595a6d40d08321563bec18d439 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3Whl1.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto index e8e507aeeaae83a7255e425e2b9134ac82860c7f..ad0b870299038f1c349f7dfa238b6ebfdf9dddd8 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3Whl2.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto index 146dfc42c35740688df216b61ebf31ead92f1074..8328d24a4f7528cfb1b4ca0514b165fea3c01dbd 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3.vveh", "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto index 33adc6edc976be6d12ddeee3b5bdbfab21a3078d..827203304d4e57baf3969bc144df68ebe9b383d7 100644 --- a/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto +++ b/Generic Vehicles/Engineering Mode/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3_drag.vveh", "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG.vecto b/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG.vecto index 4162131fec9bfd65e0a3bef9d98727f69dc939b0..ab22922c1aacea1127fd7759fc5b270ad0b8b791 100644 --- a/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG.vecto +++ b/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "AMT.vgbx", "TCU": "AMT.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_Cont30kW.vecto b/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_Cont30kW.vecto index c2df3a63c1ab882cecf95a3afd872725d64b07f7..ecd53cd35042187e3d408edb20b3bf1e838f5b12 100644 --- a/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_Cont30kW.vecto +++ b/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_Cont30kW.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle_Cont30kW.vveh", "GearboxFile": "AMT.vgbx", "TCU": "AMT.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_PTO.vecto b/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_PTO.vecto index ef6bce22665e635241f43acc8dc6452e9c3559cd..2702a4b2eabca7e6df9ceacfee088a92106e09d6 100644 --- a/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_PTO.vecto +++ b/Generic Vehicles/Engineering Mode/GenericVehicleE2/BEV_ENG_PTO.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle_PTO.vveh", "GearboxFile": "AMT.vgbx", "TCU": "AMT.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/Generic Vehicles/Engineering Mode/GenericVehicleE4/BEV_ENG.vecto b/Generic Vehicles/Engineering Mode/GenericVehicleE4/BEV_ENG.vecto index 848cbedfec8882596cf73994d23ee6aa265df47d..ec011003c58ce5edb86c0e676c3a7dc0fc7ebc66 100644 --- a/Generic Vehicles/Engineering Mode/GenericVehicleE4/BEV_ENG.vecto +++ b/Generic Vehicles/Engineering Mode/GenericVehicleE4/BEV_ENG.vecto @@ -8,7 +8,7 @@ "Body": { "SavedInDeclMode": false, "VehicleFile": "BatteryElectricVehicle.vveh", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Bus.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/Tools/HashingCmdStart/HashingCmdStart.csproj b/Tools/HashingCmdStart/HashingCmdStart.csproj index 9fcebb397cf5049487e500b331ed850f47cbed4c..b8a4abbaa30bdefb1ae1d291ba4e4f0f27dfa9a8 100644 --- a/Tools/HashingCmdStart/HashingCmdStart.csproj +++ b/Tools/HashingCmdStart/HashingCmdStart.csproj @@ -8,4 +8,8 @@ <DefineConstants /> </PropertyGroup> + <ItemGroup> + <Compile Include="..\VECTOStart\StarterHelper.cs" Link="StarterHelper.cs" /> + </ItemGroup> + </Project> diff --git a/Tools/HashingCmdStart/Program.cs b/Tools/HashingCmdStart/Program.cs index 4ee38c806d52ec7f2ee2e774945c926e400537ee..f3b287ab1d002769cb532880115205f80372126c 100644 --- a/Tools/HashingCmdStart/Program.cs +++ b/Tools/HashingCmdStart/Program.cs @@ -1,65 +1,7 @@ -using System; -using Microsoft.Win32; -using System.Diagnostics; -using System.Reflection; -using System.IO; - -namespace TUGraz.VECTO +namespace TUGraz.VECTO { class Program { - static void Main() - { - var version = GetHighestNETVersion(); - Process.Start(new ProcessStartInfo($"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe") { - WorkingDirectory = Directory.GetCurrentDirectory() - }); - } - - private static string GetHighestNETVersion() - { - if (SupportsNet60()) { - return "net60"; - } - - if (SupportsNet48()) { - return "net48"; - } - - return "net45"; - } - - private static bool SupportsNet60() - { - try { - var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") { - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true - }); - - p.WaitForExit(); - var output = p.StandardOutput.ReadToEnd(); - return output.Contains("Microsoft.WindowsDesktop.App 6"); - } catch (Exception e) { - Console.WriteLine(e); - } - - return false; - } - - private static bool SupportsNet48() - { - const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"; - using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { - if (ndpKey != null && ndpKey.GetValue("Release") != null) { - var releaseKey = (int)ndpKey.GetValue("Release"); - return releaseKey >= 528040; - } - - return false; - } - } + static void Main(string[] args) => StarterHelper.StartVECTO(args); } -} +} \ No newline at end of file diff --git a/Tools/HashingToolStart/HashingToolStart.csproj b/Tools/HashingToolStart/HashingToolStart.csproj index e3d1dcf88ad6968750da69b00fd4acc572fe495b..c1f363bb2227524a61d13f8ba908bdc184e2c5bf 100644 --- a/Tools/HashingToolStart/HashingToolStart.csproj +++ b/Tools/HashingToolStart/HashingToolStart.csproj @@ -8,4 +8,12 @@ <TargetFrameworks>net45</TargetFrameworks> <DefineConstants /> </PropertyGroup> + + <ItemGroup> + <Compile Include="..\VECTOStart\StarterHelper.cs" Link="StarterHelper.cs" /> + </ItemGroup> + + <ItemGroup> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> </Project> diff --git a/Tools/HashingToolStart/Program.cs b/Tools/HashingToolStart/Program.cs index c02231108231f8e676d4c49d64708861628ef3af..6d55a719f74068db46301e4485e52d527b6ce2ba 100644 --- a/Tools/HashingToolStart/Program.cs +++ b/Tools/HashingToolStart/Program.cs @@ -1,66 +1,19 @@ -using System; -using Microsoft.Win32; -using System.Diagnostics; -using System.Reflection; -using System.IO; +using System.Windows.Forms; +using System; namespace TUGraz.VECTO { class Program { - static void Main() - { - var version = GetHighestNETVersion(); - Process.Start(new ProcessStartInfo($"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe") { - WorkingDirectory = Directory.GetCurrentDirectory() - }); - } - - private static string GetHighestNETVersion() - { - //todo mk2022-02-17 hashing tool currently only works under net45. this has to be fixed. - //if (SupportsNet60()) { - // return "net60"; - //} - - //if (SupportsNet48()) { - // return "net48"; - //} - - return "net45"; - } - - private static bool SupportsNet60() + static void Main(string[] args) { try { - var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") { - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true - }); - - p.WaitForExit(); - var output = p.StandardOutput.ReadToEnd(); - return output.Contains("Microsoft.WindowsDesktop.App 6"); + // mk20220707: hashing tool currently only works under net45, therefore we hardcoded the version + StarterHelper.StartVECTO(new[]{"net45"}); } catch (Exception e) { - Console.WriteLine(e); + MessageBox.Show(e.Message); } - - return false; } - private static bool SupportsNet48() - { - const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"; - using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { - if (ndpKey != null && ndpKey.GetValue("Release") != null) { - var releaseKey = (int)ndpKey.GetValue("Release"); - return releaseKey >= 528040; - } - - return false; - } - } } -} +} \ No newline at end of file diff --git a/Tools/VECTOConsoleStart/Program.cs b/Tools/VECTOConsoleStart/Program.cs index 4ee38c806d52ec7f2ee2e774945c926e400537ee..178aabefbf8e59c15ecad4b119b343f94ccb3928 100644 --- a/Tools/VECTOConsoleStart/Program.cs +++ b/Tools/VECTOConsoleStart/Program.cs @@ -1,65 +1,7 @@ -using System; -using Microsoft.Win32; -using System.Diagnostics; -using System.Reflection; -using System.IO; - -namespace TUGraz.VECTO +namespace TUGraz.VECTO { class Program { - static void Main() - { - var version = GetHighestNETVersion(); - Process.Start(new ProcessStartInfo($"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe") { - WorkingDirectory = Directory.GetCurrentDirectory() - }); - } - - private static string GetHighestNETVersion() - { - if (SupportsNet60()) { - return "net60"; - } - - if (SupportsNet48()) { - return "net48"; - } - - return "net45"; - } - - private static bool SupportsNet60() - { - try { - var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") { - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true - }); - - p.WaitForExit(); - var output = p.StandardOutput.ReadToEnd(); - return output.Contains("Microsoft.WindowsDesktop.App 6"); - } catch (Exception e) { - Console.WriteLine(e); - } - - return false; - } - - private static bool SupportsNet48() - { - const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"; - using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { - if (ndpKey != null && ndpKey.GetValue("Release") != null) { - var releaseKey = (int)ndpKey.GetValue("Release"); - return releaseKey >= 528040; - } - - return false; - } - } + static void Main(string[] args) => StarterHelper.StartVECTO(args); } } diff --git a/Tools/VECTOConsoleStart/VECTOConsoleStart.csproj b/Tools/VECTOConsoleStart/VECTOConsoleStart.csproj index eb31dee287a0b3b2fdcfb7d6069dfdfbde1f7296..a87fbbd03e9cd78f53ccf2b74f476cd77ef64b4b 100644 --- a/Tools/VECTOConsoleStart/VECTOConsoleStart.csproj +++ b/Tools/VECTOConsoleStart/VECTOConsoleStart.csproj @@ -9,4 +9,12 @@ <DefineConstants /> </PropertyGroup> + <ItemGroup> + <Compile Include="..\VECTOStart\StarterHelper.cs" Link="StarterHelper.cs" /> + </ItemGroup> + + <ItemGroup> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + </Project> diff --git a/Tools/VECTOMultistageStart/Program.cs b/Tools/VECTOMultistageStart/Program.cs index 2dce9c985988ae71a5b9ae7bff4d3f32ca46718a..aeb288b8560de2928c7339bc928501f4126b11b7 100644 --- a/Tools/VECTOMultistageStart/Program.cs +++ b/Tools/VECTOMultistageStart/Program.cs @@ -1,47 +1,18 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Reflection; +using System.Windows.Forms; +using System; namespace TUGraz.VECTO { class Program { - static void Main() - { - var version = GetHighestNETVersion(); - Process.Start(new ProcessStartInfo($"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe") { - WorkingDirectory = Directory.GetCurrentDirectory() - }); - } - - private static string GetHighestNETVersion() - { - if (SupportsNet60()) { - return "net60"; - } - - return "net48"; - } - - private static bool SupportsNet60() + static void Main(string[] args) { try { - var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") { - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true - }); - - p.WaitForExit(); - var output = p.StandardOutput.ReadToEnd(); - return output.Contains("Microsoft.WindowsDesktop.App 6"); + StarterHelper.StartVECTO(args, "net48", "net60"); } catch (Exception e) { - Console.WriteLine(e); + MessageBox.Show(e.Message); } - - return false; } + } } diff --git a/Tools/VECTOMultistageStart/VECTOMultistage.csproj b/Tools/VECTOMultistageStart/VECTOMultistage.csproj index 06003236964e93d1b1df5cbf892ea81e74adc5f9..da3310873330bb510cc8a4fbb7f13b06a93bf3a5 100644 --- a/Tools/VECTOMultistageStart/VECTOMultistage.csproj +++ b/Tools/VECTOMultistageStart/VECTOMultistage.csproj @@ -9,4 +9,12 @@ <DefineConstants /> </PropertyGroup> + <ItemGroup> + <Compile Include="..\VECTOStart\StarterHelper.cs" Link="StarterHelper.cs" /> + </ItemGroup> + + <ItemGroup> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + </Project> diff --git a/Tools/VECTOStart/Program.cs b/Tools/VECTOStart/Program.cs index e5896e5d2f72524d42735eed5cff5d2af1143e1e..34b6e45df9c3dde2df7eafbbcce41beaf4fdd926 100644 --- a/Tools/VECTOStart/Program.cs +++ b/Tools/VECTOStart/Program.cs @@ -1,64 +1,16 @@ using System; -using Microsoft.Win32; -using System.Diagnostics; -using System.IO; -using System.Reflection; +using System.Windows.Forms; namespace TUGraz.VECTO { class Program { - static void Main() - { - var version = GetHighestNETVersion(); - Process.Start(new ProcessStartInfo($"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe") { - WorkingDirectory = Directory.GetCurrentDirectory() - }); - } - - private static string GetHighestNETVersion() - { - if (SupportsNet60()) { - return "net60"; - } - - if (SupportsNet48()) { - return "net48"; - } - - return "net45"; - } - - private static bool SupportsNet60() + static void Main(string[] args) { try { - var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") { - CreateNoWindow = true, - UseShellExecute = false, - RedirectStandardError = true, - RedirectStandardOutput = true - }); - - p.WaitForExit(); - var output = p.StandardOutput.ReadToEnd(); - return output.Contains("Microsoft.WindowsDesktop.App 6"); + StarterHelper.StartVECTO(args); } catch (Exception e) { - Console.WriteLine(e); - } - - return false; - } - - private static bool SupportsNet48() - { - const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"; - using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { - if (ndpKey != null && ndpKey.GetValue("Release") != null) { - var releaseKey = (int)ndpKey.GetValue("Release"); - return releaseKey >= 528040; - } - - return false; + MessageBox.Show(e.Message); } } } diff --git a/Tools/VECTOStart/StarterHelper.cs b/Tools/VECTOStart/StarterHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..40e4bab5374630491362afb3783fe97be601ce86 --- /dev/null +++ b/Tools/VECTOStart/StarterHelper.cs @@ -0,0 +1,92 @@ +using Microsoft.Win32; +using System; +using System.Collections; +using System.Diagnostics; +using System.IO; +using System.Reflection; + +namespace TUGraz.VECTO +{ + class StarterHelper + { + public static void StartVECTO(string[] args, params string[] validVersions) + { + var path = "No path found."; + string version = "No version found."; + if (validVersions is null || validVersions.Length == 0) { + validVersions = new[] { "net45", "net48", "net60" }; + } + try { + if (args.Length > 0) { + version = args[0].ToLower(); + } else { + version = GetHighestNETVersion(); + } + + path = $"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe"; + Process.Start(new ProcessStartInfo(path) { + WorkingDirectory = Directory.GetCurrentDirectory() + }); + ValidateVersion(version, validVersions); + } catch (Exception e) { + var message = $"Error during starting VECTO.\nDetected .NET version: {version}\nTried to open path: {path}\n{e.Message}"; + File.AppendAllText("LOG.txt", $"{DateTime.Now} {message}\n"); + Console.WriteLine(message); + throw new Exception(message); + } + } + + private static void ValidateVersion(string version, params string[] validVersions) + { + if (!((IList)validVersions).Contains(version)) + throw new Exception($"Invalid .NET Version supplied. Only the following values are valid: {string.Join(", ", validVersions)}"); + } + + private static string GetHighestNETVersion() + { + if (SupportsNet60()) { + return "net60"; + } + + if (SupportsNet48()) { + return "net48"; + } + + return "net45"; + } + + private static bool SupportsNet60() + { + try { + var p = Process.Start(new ProcessStartInfo("dotnet", "--list-runtimes") { + CreateNoWindow = true, + UseShellExecute = false, + RedirectStandardError = true, + RedirectStandardOutput = true + }); + + p.WaitForExit(); + var output = p.StandardOutput.ReadToEnd(); + return output.Contains("Microsoft.WindowsDesktop.App 6"); + } catch (Exception e) { + Console.WriteLine(e); + } + + return false; + } + + private static bool SupportsNet48() + { + const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"; + using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) { + if (ndpKey != null && ndpKey.GetValue("Release") != null) { + var releaseKey = (int)ndpKey.GetValue("Release"); + return releaseKey >= 528040; + } + + return false; + } + } + + } +} diff --git a/Tools/VECTOStart/VECTOStart.csproj b/Tools/VECTOStart/VECTOStart.csproj index c4cdcdedd451f9f16406bf197f3157ce195d5910..176ff3fc47fc375c2433a24d2546b29532da300d 100644 --- a/Tools/VECTOStart/VECTOStart.csproj +++ b/Tools/VECTOStart/VECTOStart.csproj @@ -10,4 +10,8 @@ <DefineConstants /> </PropertyGroup> + <ItemGroup> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + </Project> diff --git a/VECTO/GUI/AboutBox.vb b/VECTO/GUI/AboutBox.vb index c6b819ac8a9f344c92a4ae03cff6f8dc07c6ca1f..ec6c41301123c7e08075ee239d1826296705a321 100644 --- a/VECTO/GUI/AboutBox.vb +++ b/VECTO/GUI/AboutBox.vb @@ -15,7 +15,11 @@ Imports TUGraz.VectoCore.Utils ''' </summary> Public Class AboutBox Private Sub F10_AboutBox_Load(sender As Object, e As EventArgs) Handles MyBase.Load - Text = "VECTO " & VECTOvers & " / VectoCore" & VectoSimulationCore.BranchSuffix & " " & COREvers +#If NET47_OR_GREATER Or NET5_0_OR_GREATER Then + Text = "VECTO " & VECTOvers & " / VectoCore" & VectoSimulationCore.BranchSuffix & " " & COREvers & " / " & Runtime.InteropServices.RuntimeInformation.FrameworkDescription +#Else + Text = "VECTO " & VECTOvers & " / VectoCore" & VectoSimulationCore.BranchSuffix & " " & COREvers & " / .NET Framework " & If(Environment.Version.Revision < 42000, "4.5", "4.6") +#End If End Sub Private Sub LinkLabel1_LinkClicked_1(sender As Object, e As LinkLabelLinkClickedEventArgs) _ diff --git a/VECTO/GUI/BusAuxiliariesEngParametersForm.vb b/VECTO/GUI/BusAuxiliariesEngParametersForm.vb index c6cc99d90a031a6ddb275c60221f1ff960044edc..48275186388b183d740b1ada1500e75b11ca63bf 100644 --- a/VECTO/GUI/BusAuxiliariesEngParametersForm.vb +++ b/VECTO/GUI/BusAuxiliariesEngParametersForm.vb @@ -170,7 +170,7 @@ Public Class BusAuxiliariesEngParametersForm _busAuxParamsFile = "" Text = "Bus Auxiliaries Parameters Editor" LbStatus.Text = "" - + pnSmartElectricParams.Enabled = false _changed = False End Sub diff --git a/VECTO/GUI/GearboxForm.vb b/VECTO/GUI/GearboxForm.vb index 6f2a7700558dd99feebb0c91fa41213ab90b471f..17d975510c3e8ea4583c0ae6b5c1c3797f7e8c0d 100644 --- a/VECTO/GUI/GearboxForm.vb +++ b/VECTO/GUI/GearboxForm.vb @@ -513,7 +513,7 @@ Public Class GearboxForm Change() - Dim hasTorqueConverter = gStype.AutomaticTransmission() AndAlso gStype <> GearboxType.APTN + Dim hasTorqueConverter = gStype.AutomaticTransmission() AndAlso gStype <> GearboxType.APTN AndAlso gStype <> GearboxType.IHPC 'ChTCon.Enabled = (GStype.AutomaticTransmission()) gbTC.Enabled = hasTorqueConverter pnTcEngineering.Enabled = Not Cfg.DeclMode AndAlso hasTorqueConverter diff --git a/VECTO/GUI/HybridStrategyParamsForm.vb b/VECTO/GUI/HybridStrategyParamsForm.vb index 84a77e72d1eb3cf6a7f46dff1d2a2213309c3524..471ac649dea59195b22e023b6eb866602f0df587 100644 --- a/VECTO/GUI/HybridStrategyParamsForm.vb +++ b/VECTO/GUI/HybridStrategyParamsForm.vb @@ -133,6 +133,7 @@ Public Class HybridStrategyParamsForm pnCostFactorSoCExponent.Enabled = True pnGenset.Enabled = False Case VectoSimulationJobType.SerialHybridVehicle + case VectoSimulationJobType.IEPC_S pnEquivFactor.Enabled = False pnEquivFactorCharge.Enabled = False pnMinSoC.Enabled = True @@ -193,6 +194,7 @@ Public Class HybridStrategyParamsForm tbCostFactorSoCExponent.Text = If(Double.IsNaN(strategyParams.CostFactorSOCExpponent), 5, strategyParams.CostFactorSOCExpponent).ToGUIFormat() Case VectoSimulationJobType.SerialHybridVehicle + Case VectoSimulationJobType.IEPC_S tbMinSoC.Text = (strategyParams.MinSoC * 100).ToGUIFormat() tbTargetSoC.Text = (strategyParams.TargetSoC * 100).ToGUIFormat() diff --git a/VECTO/GUI/IEPCForm.vb b/VECTO/GUI/IEPCForm.vb index eedc20a6ea900fd04323ae9a5015ee8e1a0ae22d..813e992f2995855e3bf3d079c36c53e12e88a300 100644 --- a/VECTO/GUI/IEPCForm.vb +++ b/VECTO/GUI/IEPCForm.vb @@ -709,6 +709,10 @@ Public Class IEPCForm Private Sub cbDesignTypeWheelMotor_CheckedChanged(sender As Object, e As EventArgs) Handles cbDesignTypeWheelMotor.CheckedChanged tbNumberOfDesignTypeWheelMotor.Enabled = cbDesignTypeWheelMotor.Checked + cbDifferentialIncluded.Enabled = Not cbDesignTypeWheelMotor.Checked + if (cbDesignTypeWheelMotor.Checked) then + cbDifferentialIncluded.Checked = False + end if If tbNumberOfDesignTypeWheelMotor.Enabled = False Then _ tbNumberOfDesignTypeWheelMotor.Text = "0" Change() diff --git a/VECTO/GUI/MainForm.vb b/VECTO/GUI/MainForm.vb index dcd784a7afba838e843472e0e2d064175780447e..252bd4402bc425526ab7c668d781d133eec6330f 100644 --- a/VECTO/GUI/MainForm.vb +++ b/VECTO/GUI/MainForm.vb @@ -29,16 +29,14 @@ ' Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology ' -Imports System.Collections.Generic +Imports System.Collections.Concurrent Imports System.ComponentModel Imports System.IO -Imports System.Linq Imports TUGraz.VectoCore.Models.Simulation.Impl Imports TUGraz.VectoCore.InputData.FileIO.JSON Imports System.Text Imports System.Threading Imports System.Xml -Imports System.Xml.Linq Imports Microsoft.VisualBasic.FileIO Imports Ninject Imports TUGraz.VectoCommon.Exceptions @@ -50,7 +48,6 @@ Imports TUGraz.VectoCore Imports TUGraz.VectoCore.InputData.FileIO.XML Imports TUGraz.VectoCore.Models.Simulation Imports TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory -Imports TUGraz.VectoCore.Models.SimulationComponent.Data Imports TUGraz.VectoCore.OutputData Imports TUGraz.VectoCore.OutputData.FileIO Imports TUGraz.VectoCore.Utils @@ -274,6 +271,10 @@ Public Class MainForm _genCheckAllLock = False _genChecked = 0 + Dim logMessageTimer As New Windows.Forms.Timer(components) + logMessageTimer.Interval = 100 + AddHandler logMessageTimer.Tick, AddressOf TimerLogMessages_Tick + logMessageTimer.Start() 'Load Tabs properly (otherwise problem with ListViews) For x = 0 To TabControl1.TabCount - 1 @@ -1530,9 +1531,7 @@ lbFound: lv0.SubItems.Add(Now.ToString("HH:mm:ss.ff")) lv0.SubItems.Add(source) - If LvMsg.Items.Count > 9999 Then LvMsg.Items.RemoveAt(0) - - LogFile.WriteToLog(id, msg & vbTab & source) + Task.Run(Sub() LogFile.WriteToLog(id, msg & vbTab & source)) Select Case id @@ -1561,10 +1560,26 @@ lbFound: lv0.Tag = link End If + _logItemQueue.Enqueue(lv0) + End Sub + + Private ReadOnly _logItemQueue As New ConcurrentQueue(Of ListViewItem) - LvMsg.Items.Add(lv0) + Private Sub TimerLogMessages_Tick(sender As Object, e As EventArgs) + If Not _logItemQueue.IsEmpty Then - lv0.EnsureVisible() + LvMsg.BeginUpdate() + Dim item As ListViewItem = Nothing + While _logItemQueue.TryDequeue(item) + LvMsg.Items.Add(item) + If LvMsg.Items.Count > 9999 Then + LvMsg.Items.RemoveAt(0) + End If + End While + + LvMsg.Items(LvMsg.Items.Count - 1).EnsureVisible() + LvMsg.EndUpdate() + End If End Sub diff --git a/VECTO/GUI/VectoJobForm.vb b/VECTO/GUI/VectoJobForm.vb index 2a1ffb8d412bddc3c08cb27b145476d1e3139c4e..daf588d1b81f9e27f5bb07e6b4197e090e6fb343 100644 --- a/VECTO/GUI/VectoJobForm.vb +++ b/VECTO/GUI/VectoJobForm.vb @@ -484,7 +484,7 @@ Public Class VectoJobForm Else TbENG.Text = "" End If - If (JobType <> VectoSimulationJobType.BatteryElectricVehicle orelse inputData.JobInputData.Vehicle.Components.GearboxInputData IsNot Nothing) Then + If (inputData.JobInputData.Vehicle.Components.GearboxInputData IsNot Nothing) Then TbGBX.Text = GetRelativePath(inputData.JobInputData.Vehicle.Components.GearboxInputData.DataSource.SourceFile, _basePath) Else TbGBX.Text = "" @@ -1084,7 +1084,7 @@ Public Class VectoJobForm GrAuxMech.Enabled = False pnShiftParams.Enabled = True gbEngineStopStart.Visible = False - + pnHybridStrategy.Enabled = true End Select End Sub diff --git a/VECTO/GUI/VehicleForm.vb b/VECTO/GUI/VehicleForm.vb index 1783d6aaaae0051ee8ce52b29bf3979fdc6934ec..fc51649d2aa1b1c5aece60321d5e6f710153e924 100644 --- a/VECTO/GUI/VehicleForm.vb +++ b/VECTO/GUI/VehicleForm.vb @@ -495,7 +495,7 @@ Public Class VehicleForm tbGenSetRatio.Text = gen.RatioADC.ToGUIFormat() End If - If (vehicle.VehicleType = VectoSimulationJobType.ParallelHybridVehicle) Then + If (vehicle.VehicleType = VectoSimulationJobType.ParallelHybridVehicle OrElse vehicle.VehicleType = VectoSimulationJobType.IHPC) Then 'tbMaxDrivetrainPwr.Text = vehicle.MaxDrivetrainPower.ConvertToKiloWatt().Value.ToXMLFormat(2) 'ToDo ElectricMotorTorqueLimits changed 'tbEmTorqueLimits.Text = if (Not vehicle.ElectricMotorTorqueLimits Is Nothing, GetRelativePath(vehicle.ElectricMotorTorqueLimits.Source, basePath), "") @@ -933,7 +933,7 @@ Public Class VehicleForm veh.EmTorqueLimitsFile.Init(GetPath(file), tbEmTorqueLimits.Text) End If - If (VehicleType = VectoSimulationJobType.ParallelHybridVehicle AndAlso Not String.IsNullOrEmpty(tbPropulsionTorqueLimit.Text)) Then + If ((VehicleType = VectoSimulationJobType.ParallelHybridVehicle OrElse VehicleType = VectoSimulationJobType.IHPC) AndAlso Not String.IsNullOrEmpty(tbPropulsionTorqueLimit.Text)) Then veh.PropulsionTorqueFile.Init(GetPath(file), tbPropulsionTorqueLimit.Text) End If diff --git a/VECTO/Input Files/IEPCInputData.vb b/VECTO/Input Files/IEPCInputData.vb index 1ac648e0f266c4e974241fcf36aa28930051d0c5..f135608ae98f1fbae5d1f149be32e5799baca9e1 100644 --- a/VECTO/Input Files/IEPCInputData.vb +++ b/VECTO/Input Files/IEPCInputData.vb @@ -109,7 +109,7 @@ Public Class IEPCInputData If Not entry.SubItems(1).Text = Nothing Then _ currentEntry.MaxOutputShaftTorque = entry.SubItems(1).Text.ToDouble().SI(Of NewtonMeter) If Not entry.SubItems(2).Text = Nothing Then _ - currentEntry.MaxOutputShaftSpeed = entry.SubItems(2).Text.ToDouble().SI(Of PerSecond) + currentEntry.MaxOutputShaftSpeed = entry.SubItems(2).Text.ToDouble().RPMtoRad() _gears.Add(currentEntry) Next diff --git a/VECTO/VECTO.vbproj b/VECTO/VECTO.vbproj index 85de0a6f581d1151d321495058b2d965b8a34932..f1b4d12e4aafc9fef59bdcd372acac11145797b3 100644 --- a/VECTO/VECTO.vbproj +++ b/VECTO/VECTO.vbproj @@ -14,6 +14,14 @@ <DefineTrace>false</DefineTrace> <DefineConstants /> </PropertyGroup> + <ItemGroup> + <None Remove="nlog.config" /> + </ItemGroup> + <ItemGroup> + <Content Include="nlog.config"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> diff --git a/VECTO/app.config b/VECTO/app.config deleted file mode 100644 index 49b939ba25f80d51440ce081d6cee91c67bf198b..0000000000000000000000000000000000000000 --- a/VECTO/app.config +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<configuration> - <configSections> - <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" /> - </configSections> - <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="false" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> - <targets async="true"> - <target xsi:type="Console" name="ConsoleLogger" error="true" /> - <target name="GUILogger" xsi:type="MethodCall" className="TUGraz.VECTO.MainForm, VECTO" methodName="LogMethod"> - <parameter layout="${level}" /> - <parameter layout="${message}" /> - </target> - <target xsi:type="File" name="LogFile" fileName="${basedir}/logs/log.txt" layout="${longdate} [${processid}:${threadid}@${machinename}] ${callsite:skipFrames=1} ${level:uppercase=true}: ${message} ${exception:format=tostring}" keepFileOpen="false" archiveFileName="${basedir}/logs/archive{#}.txt" maxArchiveFiles="1" archiveAboveSize="10000000" /> - </targets> - <rules> - <logger name="TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory" minlevel="Info" writeTo="LogFile" /> - <logger name="*" minlevel="Warn" writeTo="LogFile" /> - <logger name="*" minlevel="Warn" writeTo="GUILogger" /> - </rules> - </nlog> - <system.diagnostics> - <sources> - <source name="DefaultSource" switchName="DefaultSwitch"> - <listeners> - <add name="FileLog" /> - </listeners> - </source> - </sources> - <switches> - <add name="DefaultSwitch" value="Information" /> - </switches> - <sharedListeners> - <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" /> - </sharedListeners> - </system.diagnostics> -</configuration> \ No newline at end of file diff --git a/VECTO/nlog.config b/VECTO/nlog.config new file mode 100644 index 0000000000000000000000000000000000000000..550e301d5814b8552ec48d779b4cb520ab24ad70 --- /dev/null +++ b/VECTO/nlog.config @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="false" throwExceptions="false" internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log"> + <targets async="true"> + <target xsi:type="Console" name="ConsoleLogger" error="true" /> + <target name="GUILogger" xsi:type="MethodCall" className="TUGraz.VECTO.MainForm, VECTO" methodName="LogMethod"> + <parameter layout="${level}" /> + <parameter layout="${message}" /> + </target> + <target xsi:type="File" name="LogFile" fileName="${basedir}/logs/log.txt" layout="${longdate} [${processid}:${threadid}@${machinename}] ${callsite:skipFrames=1} ${level:uppercase=true}: ${message} ${exception:format=tostring}" keepFileOpen="false" archiveFileName="${basedir}/logs/archive{#}.txt" maxArchiveFiles="1" archiveAboveSize="10000000" /> + </targets> + <rules> + <logger name="TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory" minlevel="Info" writeTo="LogFile" /> + <logger name="*" minlevel="Warn" writeTo="LogFile" /> + <logger name="*" minlevel="Warn" writeTo="GUILogger" /> + </rules> +</nlog> \ No newline at end of file diff --git a/VECTO3GUI2020/Helper/Converter/EnumConverter.cs b/VECTO3GUI2020/Helper/Converter/EnumConverter.cs index 12dffc1f3c7d409f7f595d909feacf1f81361475..55f045ea57d1a8b72a43bd5cd7c8ff39faa06545 100644 --- a/VECTO3GUI2020/Helper/Converter/EnumConverter.cs +++ b/VECTO3GUI2020/Helper/Converter/EnumConverter.cs @@ -22,7 +22,7 @@ namespace VECTO3GUI2020.Helper.Converter var attributes = valueType.GetField(value.ToString())?.GetCustomAttributes( typeof(GuiLabelAttribute),false); - if (!(attributes?.First() is GuiLabelAttribute attribute)) { + if (!(attributes?.FirstOrDefault() is GuiLabelAttribute attribute)) { return value; } else { return attribute.Label; diff --git a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs index 57b1a4ba9b709c05cf039b5c4026294bdb168020..7c53ed93ce9b6fe067ef365b0eec308dbbf414b0 100644 --- a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs +++ b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLBusAuxiliariesWriter.cs @@ -64,7 +64,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter public override void Initialize() { - _defaultNamespace = XMLNamespaces.v2_10_2; + _defaultNamespace = XMLNamespaces.V24; _xElement = new XElement(_defaultNamespace + XMLNames.Component_Auxiliaries); } @@ -127,7 +127,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter { var dataElement = new XElement(_defaultNamespace + XMLNames.ComponentDataWrapper, - new XAttribute("xmlns" , XMLNamespaces.v2_10_2), + new XAttribute("xmlns" , XMLNamespaces.V24), new XAttribute(XMLNamespaces.Xsi + XMLNames.Attr_Type, "AUX_Conventional_CompletedBusType")); if (_inputData.ElectricConsumers != null) { diff --git a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs index 43fd5a161c5a9799b7a36a305ea0eb4b3db62720..d81f3a11e18dace97d64808396d94ff9e4287074 100644 --- a/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs +++ b/VECTO3GUI2020/Util/XML/Implementation/ComponentWriter/XMLVehicleWriter.cs @@ -221,7 +221,7 @@ namespace VECTO3GUI2020.Util.XML.Implementation.ComponentWriter protected override void Initialize() { - _defaultNamespace = XMLNamespaces.v2_10_2; + _defaultNamespace = XMLNamespaces.V24; _Xelement = new XElement(XMLNamespaces.V20 + XMLNames.Component_Vehicle, new XAttribute("xmlns", _defaultNamespace)); diff --git a/VECTO3GUI2020/Util/XML/XMLNamespaces.cs b/VECTO3GUI2020/Util/XML/XMLNamespaces.cs index c0053b0d80b7d34c33c4a9dbcc7b337cacb49431..dc88a706c7c62a3e6df7f1f3438a267aac8bf22e 100644 --- a/VECTO3GUI2020/Util/XML/XMLNamespaces.cs +++ b/VECTO3GUI2020/Util/XML/XMLNamespaces.cs @@ -9,14 +9,15 @@ namespace VECTO3GUI2020.Util.XML public static XNamespace Xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance"); public static XNamespace Tns = "urn:tugraz:ivt:VectoAPI:DeclarationInput"; public static XNamespace Tns_v20 = Tns.NamespaceName + ":v2.0"; - public static XNamespace V26 = DeclarationDefinition + ":DEV:v2.6"; + //public static XNamespace V26 = DeclarationDefinition + ":DEV:v2.6"; public static XNamespace V21 = DeclarationDefinition + ":v2.1"; - public static XNamespace V23 = DeclarationDefinition + ":DEV:v2.3"; + public static XNamespace V23 = DeclarationDefinition + ":v2.3"; + public static XNamespace V24 = DeclarationDefinition + ":v2.4"; public static XNamespace V20 = DeclarationDefinition + ":v2.0"; public static XNamespace V10 = DeclarationDefinition + ":v1.0"; - public static XNamespace V28 = DeclarationDefinition + ":DEV:v2.8"; - public static XNamespace v2_10_1 = DeclarationDefinition + ":DEV:v2.10.1"; - public static XNamespace v2_10_2 = DeclarationDefinition + ":DEV:v2.10.2"; + //public static XNamespace V28 = DeclarationDefinition + ":DEV:v2.8"; + //public static XNamespace v2_10_1 = DeclarationDefinition + ":DEV:v2.10.1"; + //public static XNamespace v2_10_2 = DeclarationDefinition + ":DEV:v2.10.2"; public static XNamespace Di = "http://www.w3.org/2000/09/xmldsig#"; @@ -33,11 +34,8 @@ namespace VECTO3GUI2020.Util.XML { V20, "v2.0"}, { V21, "v2.1"}, { V23, "v2.3"}, - { V26, "v2.6"}, + { V24, "v2.4"}, { Di, "di"}, - { V28, "v2.8"}, - {v2_10_2, "v2.10.2"}, - {v2_10_1, "v2.10.1"} }; public static string GetPrefix(XNamespace xNamespace) diff --git a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs index 480523a6357cd0ea5b61d48a2c42843dcc625a46..64af8453d7fa9575b0a459a00968c71a33635648 100644 --- a/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs +++ b/VECTO3GUI2020/ViewModel/Implementation/JobListViewModel.cs @@ -518,7 +518,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation } var fileWriter = new FileOutputWriter(GetOutputDirectory(fullFileName)); - var runsFactory = _simFactoryFactory.Factory(mode, input, fileWriter); + var runsFactory = _simFactoryFactory.Factory(mode, input, fileWriter, null, null); //var runsFactory = SimulatorFactory.CreateSimulatorFactory(mode, input, fileWriter); runsFactory.WriteModalResults = Settings.Default.WriteModalResults; runsFactory.ModalResults1Hz = Settings.Default.ModalResults1Hz; diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs index a74a1bf7b60518c7fbe105a1006d3c66172f0db5..dcb14c19bbb64a82783196179f5541bbf57420d4 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/MultistageJobViewModel_v0_1.cs @@ -203,7 +203,7 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation var inputData = new XMLDeclarationVIFInputData(vifData.MultistageJobInputData, vifData.VehicleInputData); - var factory = _simFactoryFactory.Factory(ExecutionMode.Declaration, inputData, writer); + var factory = _simFactoryFactory.Factory(ExecutionMode.Declaration, inputData, writer, null, null); //var factory = SimulatorFactory.CreateSimulatorFactory(ExecutionMode.Declaration, inputData, writer); FileHelper.CreateDirectory(outputFile); diff --git a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageViewModelBase.cs b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageViewModelBase.cs index 137647f0f4dd5a22a42c6fe95f3b6a44ba9ab15d..250f3ae508d10562071621c0abd6366a4c023861 100644 --- a/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageViewModelBase.cs +++ b/VECTO3GUI2020/ViewModel/MultiStage/Implementation/StageViewModelBase.cs @@ -183,8 +183,8 @@ namespace VECTO3GUI2020.ViewModel.MultiStage.Implementation var xElement = vehicleWriter.GetElement(); - var xDoc = xElement.CreateWrapperDocument(XMLNamespaces.v2_10_2); - Debug.WriteLine(xElement.CreateWrapperDocument(XMLNamespaces.v2_10_2).ToString()); + var xDoc = xElement.CreateWrapperDocument(XMLNamespaces.V24); + Debug.WriteLine(xElement.CreateWrapperDocument(XMLNamespaces.V24).ToString()); var valid = false; diff --git a/VectoCommon/VectoCommon/Models/PowertrainPosition.cs b/VectoCommon/VectoCommon/Models/PowertrainPosition.cs index 2c9753bde1da886c019e15285802d62fffc786db..260883a5acb273a05bf042eaf24a73f36cab8ad0 100644 --- a/VectoCommon/VectoCommon/Models/PowertrainPosition.cs +++ b/VectoCommon/VectoCommon/Models/PowertrainPosition.cs @@ -43,7 +43,7 @@ namespace TUGraz.VectoCommon.InputData } if (prefix.Equals("B", StringComparison.InvariantCultureIgnoreCase) || prefix.Equals("E", StringComparison.InvariantCultureIgnoreCase)) { - return (BatteryElectricPrefix + prefix + pos.Replace("B", "E")).ParseEnum<PowertrainPosition>(); + return (BatteryElectricPrefix + (prefix + pos).Replace("B", "E")).ParseEnum<PowertrainPosition>(); } throw new VectoException("invalid powertrain position {0}", pos); diff --git a/VectoCommon/VectoCommon/Utils/SI.cs b/VectoCommon/VectoCommon/Utils/SI.cs index 38faea4cd4c9fa93298d6e4a2515ecc1ee710fca..6776282cbbc86a44f4212c74d665da2f2549d32b 100644 --- a/VectoCommon/VectoCommon/Utils/SI.cs +++ b/VectoCommon/VectoCommon/Utils/SI.cs @@ -850,7 +850,7 @@ namespace TUGraz.VectoCommon.Utils /// <summary> /// SI Class for one per second [1/s]. /// </summary> - [DebuggerDisplay("{Val.ToString(\"F1\"),nq} [rad/s] ({AsRPM.ToString(\"F1\"),nq} [rpm)")] + [DebuggerDisplay("{Val.ToString(\"F1\"),nq} [rad/s] ({AsRPM.ToString(\"F1\"),nq} [rpm])")] public class PerSecond : SIBase<PerSecond> { private static readonly int[] Units = { 0, 0, -1, 0, 0, 0, 0 }; @@ -864,14 +864,36 @@ namespace TUGraz.VectoCommon.Utils return SIBase<PerSquareSecond>.Create(perSecond.Val / second.Value()); } + public static PerMeter operator /(PerSecond perSecond, MeterPerSecond second) + { + return SIBase<PerMeter>.Create(perSecond.Val / second.Value()); + } + public static MeterPerSecond operator *(PerSecond perSecond, Meter meter) { return SIBase<MeterPerSecond>.Create(perSecond.Val * meter.Value()); } - + public double AsRPM => Val * 60 / (2 * Math.PI); } + /// <summary> + /// SI Class for one per meter [1/m]. + /// </summary> + [DebuggerDisplay("{Val.ToString(\"F1\"),nq} [1/m]")] + public class PerMeter : SIBase<PerMeter> + { + private static readonly int[] Units = { 0, -1, 0, 0, 0, 0, 0 }; + + [DebuggerHidden] + private PerMeter(double val) : base(val, Units) { } + + public static PerSecond operator *(PerMeter perMeter, MeterPerSecond meterPerSecond) => + SIBase<PerSecond>.Create(perMeter.Val * meterPerSecond.Value()); + + public static PerSecond operator *(MeterPerSecond meterPerSecond, PerMeter perMeter) => perMeter * meterPerSecond; + } + /// <summary> /// SI Class for Meter per second [m/s]. /// </summary> diff --git a/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs b/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs index c89db25926b684630a9a98feba059d7ec3450a9b..8d67210f9e4cc22e58de82fe1996736413bd4ffc 100644 --- a/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs +++ b/VectoCommon/VectoCommon/Utils/StringExtensionMethods.cs @@ -54,14 +54,17 @@ namespace TUGraz.VectoCommon.Utils 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; + var success = double.TryParse(self, NumberStyles.Float, CultureInfo.InvariantCulture, out var retVal); + if (success) { + return retVal; + } + + if (defaultValue.HasValue) { + return defaultValue.Value; } + + // throws an exception + return double.Parse(self, CultureInfo.InvariantCulture); } public static int ToInt(this string self, int? defaultValue = null) diff --git a/VectoConsole/Program.cs b/VectoConsole/Program.cs index 7af3dd2e2c22ea290fe667a63c4259b20ff7de66..a3b973cece77d621addb072cb06f3f486f5814a8 100644 --- a/VectoConsole/Program.cs +++ b/VectoConsole/Program.cs @@ -236,7 +236,7 @@ Examples: } fileWriter = new FileOutputWriter(file); - var runsFactory = _kernel.Get<ISimulatorFactoryFactory>().Factory(mode, dataProvider, fileWriter); + var runsFactory = _kernel.Get<ISimulatorFactoryFactory>().Factory(mode, dataProvider, fileWriter, null, null); //var runsFactory = SimulatorFactory.CreateSimulatorFactory(mode, dataProvider, fileWriter); runsFactory.ModalResults1Hz = args.Contains("-1Hz"); runsFactory.WriteModalResults = args.Contains("-mod"); diff --git a/VectoCore/VectoCore/Configuration/Constants.cs b/VectoCore/VectoCore/Configuration/Constants.cs index cd55cf98a9c245406ea3d1187e4616f1984d6164..f4df273aa7cda478f3b1c98790a79b1406fb74c0 100644 --- a/VectoCore/VectoCore/Configuration/Constants.cs +++ b/VectoCore/VectoCore/Configuration/Constants.cs @@ -282,6 +282,11 @@ namespace TUGraz.VectoCore.Configuration public static readonly Meter BrakeNextTargetDistance = 2.5.SI<Meter>(); + /// <summary> + /// used in DriverModeBrake to detect if a vehicle is already below the speed of the brake trigger. + /// </summary> + public static readonly MeterPerSecond BrakeTriggerSpeedTolerance = 0.1.KMPHtoMeterPerSecond(); + public static readonly MeterPerSecond MinVelocityForCoast = 5.KMPHtoMeterPerSecond(); /// <summary> diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs index fa51f7d3a96df4b9726ef7fe5956a0af87c137f0..c6f024ab1807c796120c21246a97f63109cba6f4 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONVehicleData.cs @@ -146,6 +146,7 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON case VectoSimulationJobType.IEPC_E: return _adasInputData = new JSONADASInputDataV10BEV(this); case VectoSimulationJobType.ParallelHybridVehicle: + case VectoSimulationJobType.IHPC: case VectoSimulationJobType.SerialHybridVehicle: case VectoSimulationJobType.IEPC_S: return _adasInputData = new JSONADASInputDataV10HEV(this); diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Common/AbstractXMLType.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Common/AbstractXMLType.cs index a4c38f960ef474cdf54032b579a02c0b1a333960..aaf93c05a5982a2877a06e26a5f7036468896ed3 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Common/AbstractXMLType.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Common/AbstractXMLType.cs @@ -29,6 +29,7 @@ * Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology */ +using System; using System.Collections.Generic; using System.Xml; using TUGraz.VectoCommon.Exceptions; @@ -136,12 +137,14 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Common { protected virtual TableData ReadTableData(string baseElement, string entryElement, Dictionary<string, string> mapping) { - var entries = BaseNode.SelectNodes( - XMLHelper.QueryLocalName(baseElement, entryElement)); - if (entries != null && entries.Count > 0) { - return XMLHelper.ReadTableData(mapping, entries); + try { + var entries = BaseNode.SelectNodes(XMLHelper.QueryLocalName(baseElement, entryElement)); + if (entries != null && entries.Count > 0) { + return XMLHelper.ReadTableData(mapping, entries); + } + } catch (NullReferenceException) { + throw new VectoException($"Could not find element: {baseElement} {entryElement}"); } - return null; } } diff --git a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs index ef230ebba48ab98096cc5a792b95988ca808cb14..fabc32df8e7cf5fb8845ed0b38ed37f72d1e4f39 100644 --- a/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs +++ b/VectoCore/VectoCore/InputData/FileIO/XML/Declaration/DataProvider/XMLDeclarationComponentsDataProvider.cs @@ -191,16 +191,6 @@ namespace TUGraz.VectoCore.InputData.FileIO.XML.Declaration.DataProvider IAuxiliariesDeclarationInputData IVehicleComponentsDeclaration.AuxiliaryInputData => null; - #region Overrides of XMLDeclarationComponentsDataProviderV10 - - public override IAngledriveInputData AngledriveInputData => - ElementExists(XMLNames.Component_Angledrive) ? base.AngledriveInputData : null; - - public override IRetarderInputData RetarderInputData => - ElementExists(XMLNames.Component_Retarder) ? base.RetarderInputData : null; - - #endregion - public override IBusAuxiliariesDeclarationData BusAuxiliaries => _busAuxiliaries ?? (_busAuxiliaries = ComponentReader.BusAuxiliariesInputData); diff --git a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs index 5b8be5f3cb1c8a2704491be7ce94d08e8b29c473..dd4b6fbb01fbc77d3e354570e61467bae98d2206 100644 --- a/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs +++ b/VectoCore/VectoCore/InputData/Reader/DataObjectAdapter/EngineeringDataAdapter.cs @@ -1128,7 +1128,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter FullDriveTorque = gearboxData.Gears[key].MaxTorque } }.ToList(); - retVal[new GearshiftPosition(key)] = new VehicleMaxPropulsionTorque(gbxLimit); + retVal[new GearshiftPosition(key, true)] = new VehicleMaxPropulsionTorque(gbxLimit); continue; } @@ -1160,7 +1160,7 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter // if no gearbox limit is defined, MaxTorque is null; // in case of P3 or P4, do not apply gearbox limit to propulsion limit as ICE is already cropped with max torque var gearboxTorqueLimit = isP3OrP4Hybrid ? null : gearboxData.Gears[key].MaxTorque; - retVal[new GearshiftPosition(key)] = new VehicleMaxPropulsionTorque(IntersectMaxPropulsionTorqueCurve(entries, gearboxTorqueLimit)); + retVal[new GearshiftPosition(key, true)] = new VehicleMaxPropulsionTorque(IntersectMaxPropulsionTorqueCurve(entries, gearboxTorqueLimit)); } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/Electrics/SimpleBattery.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/Electrics/SimpleBattery.cs index 6fff2a8be4a8dcf535cdb86ffb59d39ff3118cea..2a7375c231c5ea8c72d3930b084c2a6556cad9c6 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/Electrics/SimpleBattery.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/DownstreamModules/Impl/Electrics/SimpleBattery.cs @@ -56,6 +56,12 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric } #endregion + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) => false; + + #endregion } // ######################################## @@ -114,6 +120,8 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric ConsumedEnergy = 0.SI<WattSecond>(); } public WattSecond ConsumedEnergy { get; set; } + + public State Clone() => (State)MemberwiseClone(); } #region Overrides of VectoSimulationComponent @@ -136,7 +144,17 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electric } AdvanceState(); } + #endregion + #region Implementation of IUpdateable + public bool UpdateFrom(object other) { + if (other is SimpleBattery b) { + PreviousState = b.PreviousState.Clone(); + SOC = b.SOC; + return true; + } + return false; + } #endregion } } diff --git a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ISimpleBattery.cs b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ISimpleBattery.cs index 2afae59c4be801d0be66884e164fffc859df2095..1c615da59feeee6c47f6faf5c003e56862a30e91 100644 --- a/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ISimpleBattery.cs +++ b/VectoCore/VectoCore/Models/BusAuxiliaries/Interfaces/DownstreamModules/Electrics/ISimpleBattery.cs @@ -1,4 +1,5 @@ using TUGraz.VectoCommon.Utils; +using TUGraz.VectoCore.Models.SimulationComponent; namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.Electrics { @@ -9,7 +10,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries.Interfaces.DownstreamModules.El } - public interface ISimpleBattery : ISimpleBatteryInfo + public interface ISimpleBattery : ISimpleBatteryInfo, IUpdateable { WattSecond ConsumedEnergy { get; } diff --git a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs index 481476c7796efa52764dca63c72bf5f8cda19aa1..ea6f671b0a563001a3caa80f31aedf6efff758de 100644 --- a/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs +++ b/VectoCore/VectoCore/Models/Simulation/DataBus/IGearboxInfo.cs @@ -78,6 +78,8 @@ namespace TUGraz.VectoCore.Models.Simulation.DataBus bool DisengageGearbox { get; } bool GearEngaged(Second absTime); + + bool RequestAfterGearshift { get; set; } } public interface IGearboxControl diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs index f21789bd2e01ed1fde5d3d9b1467d37d5aa9af2e..2639aeed79a2fe1624ad9db7d899f849746f16b8 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/PowertrainBuilder.cs @@ -1627,28 +1627,30 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl } } - public class SimpleCharger : IElectricChargerPort + public class SimpleCharger : IElectricChargerPort, IUpdateable { #region Implementation of IElectricChargerPort + private Watt _chargingPower; + public SimpleCharger() => _chargingPower = 0.SI<Watt>(); + public Watt Initialize() => _chargingPower = 0.SI<Watt>(); + public Watt PowerDemand(Second absTime, Second dt, Watt powerDemandEletricMotor, Watt auxPower, bool dryRun) => _chargingPower; + #endregion - public Watt ChargingPower { get; set; } - - public SimpleCharger() + #region Implementation of IUpdateable + public bool UpdateFrom(object other) { - ChargingPower = 0.SI<Watt>(); - } + if (other is IElectricSystemInfo es) { + _chargingPower = es.ChargePower; + return true; + } - public Watt Initialize() - { - ChargingPower = 0.SI<Watt>(); - return ChargingPower; - } + if (other is Watt w) { + _chargingPower = w; + return true; + } - public Watt PowerDemand(Second absTime, Second dt, Watt powerDemandEletricMotor, Watt auxPower, bool dryRun) - { - return ChargingPower; + return false; } - #endregion } @@ -1855,6 +1857,8 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl return true; } + public bool RequestAfterGearshift { get; set; } + #endregion } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactory.cs b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactory.cs index b73d633ee2c6cea9301fad8b3609b20974769438..b397c06ab0683e14844c96b018edfd773e3f9c5e 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactory.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/SimulatorFactory/SimulatorFactory.cs @@ -78,7 +78,10 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl.SimulatorFactory // return null; if (_followUpSimulatorFactoryCreator != null) { - return _followUpSimulatorFactoryCreator.GetNextFactory(); + var retVal = _followUpSimulatorFactoryCreator.GetNextFactory(); + retVal.SerializeVectoRunData = SerializeVectoRunData; + + return retVal; } else { return null; } diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs index fe1d5b29fe3e7539839b84b68bd63da411bdc5b4..4fe1178e02258dcad6efe887490d0a732c31265d 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/VehicleContainer.cs @@ -202,8 +202,49 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl WriteSumData?.RegisterComponent(component, RunData); } + private List<(IUpdateable, object)> ComponentUpdateList = new List<(IUpdateable, object)>(); + protected void UpdateComponentsInternal(IDataBus realContainer) + { + if (ComponentUpdateList.Any()) { + foreach (var (target, source) in ComponentUpdateList) { + target.UpdateFrom(source); + } + } else { + foreach (var (_, c) in _components) { +#if DEBUG + var found = false; +#endif + if (c is IUpdateable target) { + foreach (var (_, source) in (realContainer as VehicleContainer)._components) { + if (target.UpdateFrom(source)) { + ComponentUpdateList.Add((target, source)); +#if DEBUG + found = true; +#endif + } + } + } + +#if DEBUG + if (!found) { + Console.WriteLine("Test Component is not updateable: " + c.GetType()); + } +#endif + } + +#if DEBUG + var sourceList = ComponentUpdateList.Select(st => st.Item2).ToArray(); + foreach (var (_, source) in (realContainer as VehicleContainer)._components) { + if (!sourceList.Contains(source)){ + Console.WriteLine("Real Component is not used for update: " + source.GetType()); + } + } +#endif + ComponentUpdateList = ComponentUpdateList.Distinct().ToList(); + } + } public virtual void CommitSimulationStep(Second time, Second simulationInterval) { @@ -249,7 +290,7 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public virtual VectoRun.Status RunStatus { get; set; } - #endregion +#endregion public IReadOnlyCollection<VectoSimulationComponent> SimulationComponents() { @@ -290,22 +331,22 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl _gearboxInfo = new EngineOnlyGearboxInfo(this); } - #region Overrides of VehicleContainer +#region Overrides of VehicleContainer public override IMileageCounter MileageCounter => _mileageCounter; - #endregion +#endregion - #region Overrides of VehicleContainer +#region Overrides of VehicleContainer public override IVehicleInfo VehicleInfo => _vehicleInfo; - #endregion +#endregion - #region Overrides of VehicleContainer +#region Overrides of VehicleContainer public override IGearboxInfo GearboxInfo => _gearboxInfo; - #endregion +#endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs b/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs index 979140c4bf42541505cbf90fe33e3f423fca91ef..6ee398a33c537809c5005956f2c794792ff2400b 100644 --- a/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs +++ b/VectoCore/VectoCore/Models/Simulation/Impl/WHRCharger.cs @@ -5,7 +5,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.Simulation.Impl { - public class WHRCharger : StatefulVectoSimulationComponent<WHRCharger.State>, IElectricChargerPort + public class WHRCharger : StatefulVectoSimulationComponent<WHRCharger.State>, IElectricChargerPort, IUpdateable { public double Efficiency { get; } @@ -71,7 +71,20 @@ namespace TUGraz.VectoCore.Models.Simulation.Impl public WattSecond GeneratedEnergy { get; set; } public WattSecond ExcessiveEnergy { get; set; } + + public State Clone() => (State)MemberwiseClone(); + } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is WHRCharger c) { + PreviousState = c.PreviousState.Clone(); + return true; + } + return false; } + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs index c42d792ece20407478f89db7f2525e25cbf6649b..34559dde4aab10a71114be5c4f32364a79b6f22f 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/DCDCConverter.cs @@ -8,7 +8,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent { - public class DCDCConverter : StatefulVectoSimulationComponent<DCDCConverter.State>, IDCDCConverter + public class DCDCConverter : StatefulVectoSimulationComponent<DCDCConverter.State>, IDCDCConverter, IUpdateable { public double Efficiency { get; protected set; } @@ -90,6 +90,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent public WattSecond ConsumedEnergy { get; set; } public WattSecond MissingEnergy { get; set; } + + public State Clone() => (State)MemberwiseClone(); } + + #region Implementation of IUpdateable + public bool UpdateFrom(object other) { + if (other is DCDCConverter d) { + PreviousState = d.PreviousState.Clone(); + return true; + } + return false; + } + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs index ead6520b54df8872e43876e02c015cb8df5488f4..e1a85359dd7eab76c6cb292f8f0db0b7bc17edcc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/DrivingCycleData.cs @@ -145,6 +145,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data EngineSpeed = entry.EngineSpeed; FanSpeed = entry.FanSpeed; PTOPowerDemandDuringDrive = entry.PTOPowerDemandDuringDrive; + Highway = entry.Highway; } /// <summary> diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/EfficiencyMap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/EfficiencyMap.cs index 4df9c70a3c7a034acd0af0f875d48f3ab0616bad..54baf78c9eaed6b54f2872f7c35f5d96fdf334f7 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/EfficiencyMap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Data/ElectricMotor/EfficiencyMap.cs @@ -150,35 +150,23 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor } try { - var retVal = SearchAlgorithm.Search( - maxEmTorque, elPowerMaxEM.ElectricalPower - batPower, - -maxEmTorque * 0.1 * (maxEmTorque > 0 ? -1 : 1), - getYValue: x => { - var myX = (EfficiencyResult)x; - return myX.ElectricalPower - batPower; - }, - evaluateFunction: x => LookupElectricPower(avgSpeed, x, true), - criterion: x => { - var myX = (EfficiencyResult)x; - return (myX.ElectricalPower - batPower).Value(); - }, - searcher: this); + var retVal = SearchTorqueForElectricPower(batPower, avgSpeed, maxEmTorque, elPowerMaxEM); var tmp = LookupElectricPower(avgSpeed, retVal, true); - if ((tmp.ElectricalPower - batPower).IsGreater(Constants.SimulationSettings.InterpolateSearchTolerance)) { + if (VectoMath.Abs(tmp.ElectricalPower - batPower).IsGreater(Constants.SimulationSettings.InterpolateSearchTolerance)) { // searched operating point is not accurate enough... - retVal = SearchAlgorithm.Search( - maxEmTorque, elPowerMaxEM.ElectricalPower - batPower, - -maxEmTorque * 0.1 * (maxEmTorque > 0 ? -1 : 1), - getYValue: x => { - var myX = (EfficiencyResult)x; - return (myX.ElectricalPower - batPower) * 1e3; - }, - evaluateFunction: x => LookupElectricPower(avgSpeed, x, true), - criterion: x => { - var myX = (EfficiencyResult)x; - return (myX.ElectricalPower - batPower).Value() * 1e3; - }, - searcher: this); + retVal = SearchTorqueForElectricPower(batPower, avgSpeed, maxEmTorque, elPowerMaxEM, 1e3); + } + + if (maxEmTorque < 0) { + // propelling + if (retVal.IsSmaller(maxEmTorque)) { + retVal = SearchTorqueForElectricPower(batPower, avgSpeed, maxEmTorque, elPowerMaxEM, 1e3, true); + } + } else { + // recuperating + if (retVal.IsGreater(maxEmTorque)) { + retVal = SearchTorqueForElectricPower(batPower, avgSpeed, maxEmTorque, elPowerMaxEM, 1e3, true); + } } return retVal; } catch (VectoSearchFailedException vsfe) { @@ -188,6 +176,26 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor return null; } + private NewtonMeter SearchTorqueForElectricPower(Watt batPower, PerSecond avgSpeed, NewtonMeter maxEmTorque, + EfficiencyResult elPowerMaxEM, double factor = 1.0, bool forceLinesearch = false) + { + var retVal = SearchAlgorithm.Search( + maxEmTorque, elPowerMaxEM.ElectricalPower - batPower, + -maxEmTorque * 0.1 * (maxEmTorque > 0 ? -1 : 1), + getYValue: x => { + var myX = (EfficiencyResult)x; + return (myX.ElectricalPower - batPower) * factor; + }, + evaluateFunction: x => LookupElectricPower(avgSpeed, x, true), + criterion: x => { + var myX = (EfficiencyResult)x; + return (myX.ElectricalPower - batPower).Value() * factor; + }, + searcher: this, + forceLineSearch: forceLinesearch); + return retVal; + } + public PerSecond MaxSpeed { get { return _maxSpeed ?? (_maxSpeed = _efficiencyMapMech2El.Entries.Select(x => x.Y).Max().SI<PerSecond>()); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs b/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs index d4903f8f0bce7d77d53c52f467cb77f3a33ee50c..66338c293e6d96e6e450f26d251e0fee97bdb006 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/ElectricSystem.cs @@ -6,11 +6,13 @@ using TUGraz.VectoCore.Configuration; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Impl; using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent { - public class ElectricSystem : StatefulVectoSimulationComponent<ElectricSystem.State>, IElectricSystem, IElectricAuxConnecor, IElectricChargerConnector, IBatteryConnector + public class ElectricSystem : StatefulVectoSimulationComponent<ElectricSystem.State>, IElectricSystem, IElectricAuxConnecor, + IElectricChargerConnector, IBatteryConnector, IUpdateable { protected readonly List<IElectricAuxPort> Consumers = new List<IElectricAuxPort>(); @@ -141,7 +143,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent ConsumerPower = powerDemand; BatteryPower = batteryPower; } + + public State Clone() => (State)MemberwiseClone(); } + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is ElectricSystem s) { + PreviousState = s.PreviousState.Clone(); + return true; + } + + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs b/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs index 8ffddbf456c1cf2f3f9c42112a21cddca1f8df29..04a22c88b3c5ddbf69df4769bab30d8a6c5d54df 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IAuxPort.cs @@ -43,7 +43,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent void Connect(IAuxPort aux); } - public interface IAuxPort + public interface IAuxPort: IUpdateable { NewtonMeter Initialize(NewtonMeter torque, PerSecond angularSpeed); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs b/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs index 06e5019264e03483b670752220c06f5236bbe6d9..24c9b210d2348657fae37f93465e5da52abfbc37 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/IBrakes.cs @@ -33,7 +33,7 @@ using TUGraz.VectoCommon.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent { - public interface IBrakes + public interface IBrakes: IUpdateable { Watt BrakePower { get; set; } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/IUpdateable.cs b/VectoCore/VectoCore/Models/SimulationComponent/IUpdateable.cs new file mode 100644 index 0000000000000000000000000000000000000000..f60db9bb59ec3c8e23098c94fd182502cc3f25db --- /dev/null +++ b/VectoCore/VectoCore/Models/SimulationComponent/IUpdateable.cs @@ -0,0 +1,42 @@ +/* +* This file is part of VECTO. +* +* Copyright © 2012-2019 European Union +* +* Developed by Graz University of Technology, +* Institute of Internal Combustion Engines and Thermodynamics, +* Institute of Technical Informatics +* +* VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved +* by the European Commission - subsequent versions of the EUPL (the "Licence"); +* You may not use VECTO except in compliance with the Licence. +* You may obtain a copy of the Licence at: +* +* https://joinup.ec.europa.eu/community/eupl/og_page/eupl +* +* Unless required by applicable law or agreed to in writing, VECTO +* distributed under the Licence is distributed on an "AS IS" basis, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the Licence for the specific language governing permissions and +* limitations under the Licence. +* +* Authors: +* Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology +* Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology +* Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology +* Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University 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 IUpdateable + { + /// <summary> + /// Tries to update the internal state of this object from the other object. + /// </summary> + /// <returns>True if the update was possible. False if the update is not possible.</returns> + bool UpdateFrom(object other); + } +} \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs index 55b9974e750fb2884874cdaf446cfb27a14ee319..d63082eec148f69c0e9137a1cbfc32ed6a05a388 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AMTShiftStrategyOptimized.cs @@ -130,9 +130,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } - var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio / - GearboxModelData.Gears[currentGear.Gear].Ratio * GearboxModelData.Gears[tryNextGear.Gear].Ratio)) - .Cast<PerSecond>(); + var estimatedEngineSpeed = vehicleSpeedPostShift * (totalTransmissionRatio / + GearboxModelData.Gears[currentGear.Gear].Ratio * GearboxModelData.Gears[tryNextGear.Gear].Ratio); if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { continue; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs index cbff4a8327e1a2c68e13a4a631e571c78977b428..fd345f22f0dd77198f9511164f5e76a4eb8157f8 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/APTNGearbox.cs @@ -77,7 +77,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Gear = oldGear; return new ResponseDryRun(this, response) { ElectricMotor = { PowerRequest = response.ElectricMotor.PowerRequest }, - Gearbox = { PowerRequest = outTorque * outAngularVelocity }, + Gearbox = { + PowerRequest = outTorque * outAngularVelocity, + InputSpeed = inAngularVelocity, + InputTorque = inTorque, + OutputTorque = outTorque, + OutputSpeed = outAngularVelocity, + }, DeltaFullLoad = response.ElectricMotor.PowerRequest - fullLoad }; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs index 1de8dd3d0c4c7018288aa78a7c38708858541f93..087876ce24f6f1f24b288f591f5599b543301928 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATGearbox.cs @@ -40,17 +40,17 @@ using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.DataBus; using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; +using TUGraz.VectoCore.Models.SimulationComponent.Strategies; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class ATGearbox : AbstractGearbox<ATGearbox.ATGearboxState>, IHybridControlledGearbox + public class ATGearbox : AbstractGearbox<ATGearbox.ATGearboxState>, IHybridControlledGearbox, IUpdateable { protected internal readonly IShiftStrategy _strategy; protected internal readonly TorqueConverter TorqueConverter; private IIdleController _idleController; - protected internal bool RequestAfterGearshift; internal WattSecond _powershiftLossEnergy; protected internal KilogramSquareMeter EngineInertia; @@ -581,8 +581,27 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public bool Disengaged = true; public WattSecond PowershiftLossEnergy; public NewtonMeter PowershiftLoss; + + public new ATGearboxState Clone() => (ATGearboxState)MemberwiseClone(); + } public bool SwitchToNeutral { get; set; } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) + { + if (other is ATGearbox g) { + PreviousState = g.PreviousState.Clone(); + _powershiftLossEnergy = g._powershiftLossEnergy; + LastShift = g.LastShift; + return true; + } + + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs index 472d7b0eccf667a0170d8ea79954c608538ee593..dbda13c068acc15ad117c4da3d36f8d50610c388 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ATShiftStrategyOptimized.cs @@ -250,7 +250,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var inAngularVelocity = GearboxModelData.Gears[next.Gear].Ratio * outAngularVelocity; var totalTransmissionRatio = inAngularVelocity / (DataBus.VehicleInfo.VehicleSpeed + DataBus.DriverInfo.DriverAcceleration * dt); - var estimatedEngineSpeed = (vehicleSpeedPostShift * totalTransmissionRatio).Cast<PerSecond>(); + var estimatedEngineSpeed = vehicleSpeedPostShift * totalTransmissionRatio; if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { continue; } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs index e7b845bf7362c79d6caa4cef783f79cd4805e519..6c150c41888a239767076191a5bfa8ce02d1b2b1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AbstractGearbox.cs @@ -124,6 +124,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion public abstract bool GearEngaged(Second absTime); + public bool RequestAfterGearshift { get; set; } protected bool ConsiderShiftLosses(GearshiftPosition nextGear, NewtonMeter torqueOut) { @@ -170,5 +171,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public GearshiftPosition Gear; public TransmissionLossMap.LossMapResult TorqueLossResult; public DrivingBehavior DrivingBehavior; + + public new GearboxState Clone() => (GearboxState)base.Clone(); } } \ 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 b8c9d95da09aa07e50b7c9e7e5ba4389c4e8ebdf..dc0116d06b836915fbdf1c5007d601b744de5bb1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/AxleGear.cs @@ -39,7 +39,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class AxleGear : TransmissionComponent, IAxlegear + public class AxleGear : TransmissionComponent, IAxlegear, IUpdateable { public AxleGear(IVehicleContainer container, AxleGearData modelData) : base(container, modelData.AxleGear) { } @@ -81,5 +81,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl (PreviousState.InAngularVelocity + CurrentState.InAngularVelocity) / 2.0, CurrentState.InTorque); public double Ratio => ModelData.Ratio; + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is AxleGear g) { + PreviousState = g.PreviousState.Clone(); + return true; + } + + return false; + } + + #endregion } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs index c94143bc7e77789e4cdcb1b4f4e8eb2da86f4d94..1661ed67384c8576c9aafcb10725b0f2ce608296 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Battery.cs @@ -14,7 +14,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class Battery : StatefulVectoSimulationComponent<Battery.State>, IElectricEnergyStorage, IElectricEnergyStoragePort + public class Battery : StatefulVectoSimulationComponent<Battery.State>, IElectricEnergyStorage, IElectricEnergyStoragePort, IUpdateable { protected readonly BatteryData ModelData; @@ -270,8 +270,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt MaxDischargePower; public Watt BatteryLoss; public Second PulseDuration; + public State Clone() => (State)MemberwiseClone(); } + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is Battery b) { + PreviousState = b.PreviousState.Clone(); + return true; + } + + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs index be261e122a28b2eaec3dc6cc62e87a72a1e2e291..abd479fe01b31f9df6a95ecacbed5af098328836 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BatterySystem.cs @@ -14,9 +14,9 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class BatterySystem : StatefulVectoSimulationComponent<BatterySystem.State>, IElectricEnergyStorage, IElectricEnergyStoragePort + public class BatterySystem : StatefulVectoSimulationComponent<BatterySystem.State>, IElectricEnergyStorage, IElectricEnergyStoragePort, IUpdateable { - public class BatteryString + public class BatteryString: IUpdateable { protected readonly List<Battery> _batteries; @@ -111,6 +111,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl : MaxChargeCurrent(dt); return solutions.Where(x => Math.Sign(sign) == Math.Sign(x) && Math.Abs(x).IsSmallerOrEqual(Math.Abs(maxCurrent.Value()), 1e-3)).Min().SI<Ampere>(); } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is BatteryString bs) { + return _batteries.ZipAll(bs._batteries).All(ts => ts.Item1.UpdateFrom(ts.Item2)); + } + return false; + } + + #endregion } protected internal readonly Dictionary<int, BatteryString> Batteries = new Dictionary<int, BatteryString>(); @@ -377,6 +388,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt MaxDischargePower; public Watt BatteryLoss; public Second PulseDuration; + public State Clone() => (State)MemberwiseClone(); + } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is BatterySystem b) { + PreviousState = b.PreviousState.Clone(); + return Batteries.All(kv => kv.Value.UpdateFrom(b.Batteries[kv.Key])); + } + + return false; } + + #endregion } } \ 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 bf6ef7e401733830f8742026bdc155343526774e..738460f4cfca7fe491d39f8b86b90a5e81b61b09 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Brakes.cs @@ -41,8 +41,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public class Brakes : StatefulProviderComponent<SimpleComponentState, ITnOutPort, ITnInPort, ITnOutPort>, - IPowerTrainComponent, ITnOutPort, - ITnInPort, IBrakes + IPowerTrainComponent, ITnOutPort, ITnInPort, IBrakes, IUpdateable { public Watt BrakePower { get; set; } @@ -93,5 +92,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl BrakePower = 0.SI<Watt>(); base.DoCommitSimulationStep(time, simulationInterval); } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is Brakes b) { + PreviousState = b.PreviousState.Clone(); + BrakePower = b.BrakePower; + return true; + } + return false; + } + + #endregion } } \ 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 3465fa90b62566887383800703b6b2e56988954a..a2f3f19d393ab4114d21d2e5db07ddde404363a6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/BusAuxiliariesAdapter.cs @@ -31,6 +31,7 @@ using System; using TUGraz.VectoCommon.BusAuxiliaries; +using TUGraz.VectoCommon.Exceptions; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.BusAuxiliaries; @@ -378,6 +379,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var missingEnergy = energyDemand - batEnergy; if (AuxCfg.ElectricalUserInputsConfig.ConnectESToREESS) { + if (DCDCConverter is null) { + throw new VectoException("DCDCConverter is missing: The current configuration for the bus auxiliaries " + + "requires a DCDCConverter (ES supply from HEV REESS is activated)."); + } DCDCConverter.ConsumerEnergy(-missingEnergy, dryRun); } else { if (!dryRun) { @@ -396,6 +401,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public WattSecond MissingElectricEnergy { get; set; } public Watt ExcessiveDragPower = 0.SI<Watt>(); + + public BusAuxState Clone() => (BusAuxState)MemberwiseClone(); } public class ElectricStorageWrapper : ISimpleBatteryInfo @@ -433,5 +440,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is BusAuxiliariesAdapter b) { + PreviousState = b.PreviousState.Clone(); + return ElectricStorage.UpdateFrom(b.ElectricStorage); + } + + return false; + } + + #endregion } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs index 668e1523b35a4d0b139ea244d580668ffcbfaabb..d7d03ce19f404ce777e9906e1355ff79f49043d9 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Clutch.cs @@ -43,9 +43,8 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class - Clutch : StatefulProviderComponent<Clutch.ClutchState, ITnOutPort, ITnInPort, ITnOutPort>, IClutch, - ITnOutPort, ITnInPort + public class Clutch : StatefulProviderComponent<Clutch.ClutchState, ITnOutPort, ITnInPort, ITnOutPort>, IClutch, + ITnOutPort, ITnInPort, IUpdateable { protected readonly PerSecond _idleSpeed; protected readonly PerSecond _ratedSpeed; @@ -252,6 +251,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt ClutchLoss { get; set; } public bool ICEOn { get; set; } public PerSecond ICEOnSpeed { get; set; } + public new ClutchState Clone() => (ClutchState)base.Clone(); } + + #region Implementation of IUpdateable + + public virtual bool UpdateFrom(object other) { + if (other is Clutch c) { + PreviousState = c.PreviousState.Clone(); + return true; + } + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs index 0683d8833c5b63eb0a19c6c705a09fcdb795349e..a45144c5ca126b8a02fa0e5e2eacba9db14483bc 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DefaultDriverStrategy.cs @@ -753,7 +753,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public bool IsOverspeedAllowed(MeterPerSecond velocity, bool prohibitOverspeed = false) => !prohibitOverspeed - && Driver.DriverData.OverSpeed.Enabled + // allow overspeed either if enabled in the driver model, or ADAS PCC option 3 is enabled in the vehicle and we are on a highway + && (Driver.DriverData.OverSpeed.Enabled || ADAS.PredictiveCruiseControl == PredictiveCruiseControlType.Option_1_2_3 && DataBus.DrivingCycleInfo.CycleData.LeftSample.Highway) && velocity > Driver.DriverData.OverSpeed.MinSpeed && ApplyOverspeed(velocity) < (DataBus.VehicleInfo.MaxVehicleSpeed ?? 500.KMPHtoMeterPerSecond()); } @@ -1177,7 +1178,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl Second absTime, Meter ds, MeterPerSecond targetVelocity, Radian gradient, bool prohibitOverspeed = false) { - if (DataBus.VehicleInfo.VehicleSpeed.IsSmallerOrEqual(DriverStrategy.BrakeTrigger.NextTargetSpeed) && !DataBus.VehicleInfo.VehicleStopped) { + if (DataBus.VehicleInfo.VehicleSpeed.IsSmaller(DriverStrategy.BrakeTrigger.NextTargetSpeed, Constants.SimulationSettings.BrakeTriggerSpeedTolerance) + && !DataBus.VehicleInfo.VehicleStopped) { var retVal = HandleTargetspeedReached(absTime, ds, targetVelocity, gradient); for (var i = 0; i < 3 && retVal == null; i++) { retVal = HandleTargetspeedReached(absTime, ds, targetVelocity, gradient); diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs index 4f623cfa4501b73ca7c0de29522b51dafda09bff..a61d012880d55c66a6c438ce8cfda14fa67fa651 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DistanceBasedDrivingCycle.cs @@ -52,11 +52,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl /// </summary> public sealed class DistanceBasedDrivingCycle : StatefulProviderComponent <DistanceBasedDrivingCycle.DrivingCycleState, ISimulationOutPort, IDrivingCycleInPort, IDrivingCycleOutPort>, - IDrivingCycle, ISimulationOutPort, IDrivingCycleInPort, IDisposable + IDrivingCycle, ISimulationOutPort, IDrivingCycleInPort, IDisposable, IUpdateable { private const double LookaheadTimeSafetyMargin = 1.5; internal readonly IDrivingCycleData Data; - internal readonly DrivingCycleEnumerator CycleIntervalIterator; + internal DrivingCycleEnumerator CycleIntervalIterator; private bool _intervalProlonged; internal IdleControllerSwitcher IdleController; private Meter CycleEndDistance; @@ -579,5 +579,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { CycleIntervalIterator.Dispose(); } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is DistanceBasedDrivingCycle c) { + PreviousState = c.PreviousState.Clone(); + CycleIntervalIterator = c.CycleIntervalIterator; + //TODO MK-20220523 also allow updating from measuredspeeddrivingcycle? + return true; + } + + return false; + } + + #endregion } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyGearboxInfo.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyGearboxInfo.cs index 74ee79b2c1000f1b4084ef1899fc9d936ffccc2a..66cbd71d1c98257a598e418ece40099d758d9a03 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyGearboxInfo.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/DummyGearboxInfo.cs @@ -67,6 +67,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return true; } + public bool RequestAfterGearshift { get; set; } + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs index 69ad5fe4a116341f53ad34188a71f8c501187625..88247fe0a3e206243661de54853d63edebe05da7 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/ElectricMotor.cs @@ -9,12 +9,14 @@ using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Simulation; using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data; +using TUGraz.VectoCore.Models.SimulationComponent.Strategies; using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class ElectricMotor : StatefulProviderComponent<ElectricMotorState, ITnOutPort, ITnInPort, ITnOutPort>, IPowerTrainComponent, IElectricMotor, ITnOutPort, ITnInPort + public class ElectricMotor : StatefulProviderComponent<ElectricMotorState, ITnOutPort, ITnInPort, ITnOutPort>, + IPowerTrainComponent, IElectricMotor, ITnOutPort, ITnInPort, IUpdateable { protected internal IElectricSystem ElectricPower; @@ -161,7 +163,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl var avgEmSpeed = (prevEmSpeed + emSpeed) / 2; var inertiaTorqueEm = avgEmSpeed.IsEqual(0) ? 0.SI<NewtonMeter>() - : Formulas.InertiaPower(avgEmSpeed, PreviousState.EMSpeed, ModelData.Inertia, dt) / avgEmSpeed; + : Formulas.InertiaPower(emSpeed, PreviousState.EMSpeed, ModelData.Inertia, dt) / avgEmSpeed; var maxDriveTorqueEmMap = GetMaxDriveTorque(voltage, dt, avgEmSpeed, gear); var maxRecuperationTorqueEmMap = GetMaxRecuperationTorque(voltage, dt, avgEmSpeed, gear); @@ -576,6 +578,20 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { return emSpeed / ModelData.RatioADC; } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is ElectricMotor e && Position == e.Position) { + ThermalBuffer = e.ThermalBuffer; + DeRatingActive = e.DeRatingActive; + return true; + } + + return false; + } + + #endregion } public class ElectricMotorState // : SimpleComponentState @@ -603,5 +619,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt ElectricPowerToBattery; + + public ElectricMotorState Clone() => (ElectricMotorState)MemberwiseClone(); } } \ 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 0e91ba3ee5cef3c514a44ea0f2a6baba34320e4f..3d071bae437b80f86bfc1248f4f1458668988552 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/EngineAuxiliary.cs @@ -248,6 +248,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public PerSecond AngularSpeed; public Dictionary<string, Watt> PowerDemands; + + public State Clone() => (State)MemberwiseClone(); } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is EngineAuxiliary a) { + PreviousState = a.PreviousState.Clone(); + return true; + } + + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs index aa931e68de0714d1a848ce8f7d7e4e6f8e07ca9a..86c5c945cb8242a1236396b93a8b5e373081235e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Gearbox.cs @@ -43,7 +43,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class Gearbox : AbstractGearbox<GearboxState>, IHybridControlledGearbox + public class Gearbox : AbstractGearbox<GearboxState>, IHybridControlledGearbox, IUpdateable { /// <summary> /// The shift strategy. @@ -565,5 +565,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } public override Second LastShift => EngageTime; + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is Gearbox g) { + PreviousState = g.PreviousState.Clone(); + return true; + } + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/GensetChargerAdapter.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/GensetChargerAdapter.cs index 0a38a67fde8b6c1647d3bb04f5f4c5081a9982ea..1a43cf623976f9edf5c99975a358bf39e53fb1ea 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/GensetChargerAdapter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/GensetChargerAdapter.cs @@ -1,10 +1,11 @@ using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Models.Connector.Ports.Impl; +using TUGraz.VectoCore.Models.SimulationComponent.Strategies; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class GensetChargerAdapter : IElectricChargerPort + public class GensetChargerAdapter : IElectricChargerPort, IUpdateable { protected IElectricSystem es; protected Watt PowerGenerated; @@ -75,5 +76,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl #endregion } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is GenSetOperatingPoint p) { + ChargingPower = p.ElectricPower; + return true; + } + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs index 81a91730778d258669e80b1c3ab230f635acd7a3..0e2910e5e1eaf4937ee0ef2367616ae02e11c3a2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/HybridController.cs @@ -410,7 +410,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return _nextGear; } - protected GearshiftPosition InitStartGear(Second absTime, NewtonMeter outTorque, PerSecond outAngularVelocity) + protected virtual GearshiftPosition InitStartGear(Second absTime, NewtonMeter outTorque, PerSecond outAngularVelocity) { if (!DataBus.EngineCtl.CombustionEngineOn) { return _nextGear; @@ -617,7 +617,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public override void Disengage(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity) { } - protected GearshiftPosition InitStartGear(Second absTime, NewtonMeter outTorque, PerSecond outAngularVelocity) + protected override GearshiftPosition InitStartGear(Second absTime, NewtonMeter outTorque, PerSecond outAngularVelocity) { if (!DataBus.EngineCtl.CombustionEngineOn) { return _nextGear; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs index 26501658c316471ababf468afa74db57fa85a8fe..c441b6e66c7928b1ab0d838551784293e8e1a6e6 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/PEVAMTShiftStrategy.cs @@ -352,10 +352,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl continue; } - var estimatedEngineSpeed = (vehicleSpeedPostShift * (totalTransmissionRatio / - GearboxModelData.Gears[currentGear.Gear].Ratio * - GearboxModelData.Gears[tryNextGear.Gear].Ratio)) - .Cast<PerSecond>(); + var estimatedEngineSpeed = vehicleSpeedPostShift * (totalTransmissionRatio / + GearboxModelData.Gears[currentGear.Gear].Ratio * GearboxModelData.Gears[tryNextGear.Gear].Ratio); if (estimatedEngineSpeed.IsSmaller(shiftStrategyParameters.MinEngineSpeedPostUpshift)) { continue; } @@ -597,9 +595,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl } TestContainerSuperCap?.Initialize(DataBus.BatteryInfo.StateOfCharge); - if (TestContainerElectricSystemCharger != null) { - TestContainerElectricSystemCharger.ChargingPower = (DataBus.ElectricSystemInfo.ChargePower); - } + TestContainerElectricSystemCharger?.UpdateFrom(DataBus.ElectricSystemInfo.ChargePower); + //var pos = ModelData.ElectricMachinesData.FirstOrDefault().Item1; TestContainerElectricMotor.ThermalBuffer = diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs index b50f7d7e463308645f0d49080b280db24bd2c79d..2696b4904738e581962df417053be2ebe788e12e 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SimplePowertrainContainer.cs @@ -36,5 +36,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public MeterPerSecond NextBrakeTriggerSpeed => 0.SI<MeterPerSecond>(); #endregion + + public void UpdateComponents(IDataBus realContainer) => UpdateComponentsInternal(realContainer); } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SingleSpeedGearbox.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SingleSpeedGearbox.cs index 1138f7f98417e26bd4a8eb3deedfbf6d777c14fe..5a7e9c18f11e3e1ff34746012ba9c4a683e06d4a 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SingleSpeedGearbox.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SingleSpeedGearbox.cs @@ -86,6 +86,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl return true; } + public bool RequestAfterGearshift { get; set; } + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs index 96aba3d63c58f420e2ce372c5339f89f38aef03b..767422c91aa53f0880cf6065c23500d7ca7827a2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/StopStartCombustionEngine.cs @@ -12,7 +12,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class StopStartCombustionEngine : CombustionEngine + public class StopStartCombustionEngine : CombustionEngine, IUpdateable { private WattSecond EngineStartEnergy; @@ -230,6 +230,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl container[ModalResultField.P_WHR_mech_map] = 0.SI<Watt>(); container[ModalResultField.P_WHR_mech_corr] = 0.SI<Watt>(); } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) + { + if (other is CombustionEngine e) { + PreviousState = e.PreviousState; + return EngineAux.UpdateFrom(e.EngineAux); + } + return false; + } + + #endregion } public class SimplePowerrtrainCombustionEngine : StopStartCombustionEngine diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs index 041129065c6396b2a5e366e47eb03ed60b4fb1ea..bd0aa3e00d4bf82bdd00556b0eab86401e3b57a1 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/SuperCap.cs @@ -13,7 +13,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { - public class SuperCap : StatefulVectoSimulationComponent<SuperCap.State>, IElectricEnergyStorage, IElectricEnergyStoragePort + public class SuperCap : StatefulVectoSimulationComponent<SuperCap.State>, IElectricEnergyStorage, IElectricEnergyStoragePort, IUpdateable { private SuperCapData ModelData; @@ -199,6 +199,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Watt MaxChargePower; public Watt MaxDischargePower; public Watt InternalLoss; + + public State Clone() => (State)MemberwiseClone(); } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is SuperCap o) { + PreviousState = o.PreviousState.Clone(); + return true; + } + + return false; + } + + #endregion } } \ 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 54955db39f6ae5d4f853fbce13c490398f3040a3..a623f26eedf2044e766d7e7c05c453880c21ea40 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TorqueConverter.cs @@ -49,7 +49,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public class TorqueConverter : StatefulVectoSimulationComponent<TorqueConverter.TorqueConverterComponentState>, - ITnInPort, ITnOutPort, ITorqueConverter + ITnInPort, ITnOutPort, ITorqueConverter, IUpdateable { protected readonly IGearboxInfo Gearbox; protected readonly IShiftStrategy ShiftStrategy; @@ -506,6 +506,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public TorqueConverterOperatingPoint OperatingPoint; public bool IgnitionOn; + + public new TorqueConverterComponentState Clone() => (TorqueConverterComponentState)base.Clone(); } #region Implementation of ITorqueConverterControl @@ -520,6 +522,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public TorqueConverterOperatingPoint SetOperatingPoint { get; set; } + #endregion + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is TorqueConverter tc) { + PreviousState = tc.PreviousState.Clone(); + return true; + } + return false; + } + #endregion } } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs index adf81d3165fcf0300cfa043f492587fe38e414da..8c7603946fdbaaa6331829a66a17f4e65ead80e2 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/TransmissionComponent.cs @@ -49,6 +49,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public TransmissionLossMap.LossMapResult TorqueLossResult; //public NewtonMeter TorqueLoss = 0.SI<NewtonMeter>(); + public new TransmissionState Clone() => (TransmissionState)MemberwiseClone(); } protected TransmissionComponent(IVehicleContainer container, TransmissionData modelData) : base(container) diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs index 1ea0ef778e71df79a4fe3a7b8ea3b06f455a56f0..3d5576124f99d3047c1eb40808b9881fcb7e42ca 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Vehicle.cs @@ -47,8 +47,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public class Vehicle : StatefulProviderComponent<Vehicle.VehicleState, IDriverDemandOutPort, IFvInPort, IFvOutPort>, - IVehicle, IMileageCounter, IFvInPort, - IDriverDemandOutPort + IVehicle, IMileageCounter, IFvInPort, IDriverDemandOutPort, IUpdateable { internal readonly VehicleData ModelData; @@ -280,6 +279,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl $"slope_res: {SlopeResistance}, " + $"air_drag: {AirDragResistance}, " + $"traction force: {VehicleTractionForce}"; + + public VehicleState Clone() => (VehicleState)MemberwiseClone(); + } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is Vehicle v) { + PreviousState = v.PreviousState.Clone(); + MaxVehicleSpeed = v.MaxVehicleSpeed; + return true; + } + return false; } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs index 6afaf44cc2d0eb9b8d351fdc9c4eeb73e37b070c..fa96f336de519ac769a24c0706f64a8097b3f752 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Impl/Wheels.cs @@ -40,7 +40,7 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Impl { public class Wheels : StatefulProviderComponent<Wheels.WheelsState, IFvOutPort, ITnInPort, ITnOutPort>, IWheels, - IFvOutPort, ITnInPort + IFvOutPort, ITnInPort, IUpdateable { private readonly KilogramSquareMeter _totalWheelsInertia; @@ -49,6 +49,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public PerSecond AngularVelocity; public NewtonMeter TorqueIn; public NewtonMeter InertiaTorqueLoss; + + public WheelsState Clone() => (WheelsState)MemberwiseClone(); } public Wheels(IVehicleContainer cockpit, Meter rdyn, KilogramSquareMeter totalWheelsInertia) @@ -96,5 +98,17 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl public Kilogram ReducedMassWheels => (_totalWheelsInertia / DynamicTyreRadius / DynamicTyreRadius).Cast<Kilogram>(); public Meter DynamicTyreRadius { get; } + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is Wheels w) { + PreviousState = w.PreviousState.Clone(); + return true; + } + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs index 38e36b8cf9a9cdaef02709c0dec790d6404a75f1..3c07697b96fc9afd7037d9523372584661d31266 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/HybridStrategy.cs @@ -6,7 +6,6 @@ using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Utils; using TUGraz.VectoCore.Configuration; -using TUGraz.VectoCore.Models.BusAuxiliaries.DownstreamModules.Impl.Electrics; using TUGraz.VectoCore.Models.Connector.Ports.Impl; using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Simulation; @@ -45,44 +44,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies protected override IResponse RequestDryRun(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, GearshiftPosition nextGear, HybridStrategyResponse cfg) { - if (DataBus.VehicleInfo.VehicleStopped) { - TestPowertrain.Gearbox.Gear = Controller.ShiftStrategy.NextGear; - } - else if (PreviousState.GearboxEngaged) { - TestPowertrain.Gearbox.Gear = DataBus.GearboxInfo.Gear; - } else { - TestPowertrain.Gearbox.Gear = Controller.ShiftStrategy.NextGear; - } + TestPowertrain.UpdateComponents(); + TestPowertrain.Gearbox.Gear = DataBus.VehicleInfo.VehicleStopped ? Controller.ShiftStrategy.NextGear : PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear; TestPowertrain.Gearbox.Disengaged = !nextGear.Engaged; TestPowertrain.Gearbox.DisengageGearbox = !nextGear.Engaged; TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); TestPowertrain.HybridController.ApplyStrategySettings(cfg); TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); - TestPowertrain.Clutch.Initialize(DataBus.ClutchInfo.ClutchLosses); - TestPowertrain.Battery?.Initialize(DataBus.BatteryInfo.StateOfCharge); - if (TestPowertrain.Battery != null) { - TestPowertrain.Battery.PreviousState.PulseDuration = - (DataBus.BatteryInfo as Battery).PreviousState.PulseDuration; - } - if (TestPowertrain.BatterySystem != null) { - var batSystem = DataBus.BatteryInfo as BatterySystem; - foreach (var bsKey in batSystem.Batteries.Keys) { - for (var i = 0; i < batSystem.Batteries[bsKey].Batteries.Count; i++) { - TestPowertrain.BatterySystem.Batteries[bsKey].Batteries[i] - .Initialize(batSystem.Batteries[bsKey].Batteries[i].StateOfCharge); - } - } - TestPowertrain.BatterySystem.PreviousState.PulseDuration = - (DataBus.BatteryInfo as BatterySystem).PreviousState.PulseDuration; - } - TestPowertrain.SuperCap?.Initialize(DataBus.BatteryInfo.StateOfCharge); TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; - - var currentGear = DataBus.VehicleInfo.VehicleStopped ? Controller.ShiftStrategy.NextGear : PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear; - - if (nextGear.Engaged && !nextGear.Equals(currentGear)) { + + if (nextGear.Engaged && !nextGear.Equals(TestPowertrain.Gearbox.Gear)) { if (!AllowEmergencyShift && ModelData.GearboxData.Gears[nextGear.Gear].Ratio > ModelData.GearshiftParameters.RatioEarlyUpshiftFC) { return null; } @@ -95,11 +68,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return null; } - var vDrop = DataBus.VehicleInfo.VehicleSpeed - estimatedVelocityPostShift; - var vehicleSpeedPostShift = estimatedVelocityPostShift; // DataBus.VehicleInfo.VehicleSpeed - vDrop * ModelData.GearshiftParameters.VelocityDropFactor; TestPowertrain.Gearbox.Gear = nextGear; - var init = TestPowertrain.Container.VehiclePort.Initialize( - vehicleSpeedPostShift, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + var init = TestPowertrain.Container.VehiclePort.Initialize(estimatedVelocityPostShift, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); if (!AllowEmergencyShift && init.Engine.EngineSpeed.IsSmaller(ModelData.EngineData.IdleSpeed)) { return null; } @@ -107,68 +77,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies TestPowertrain.Gearbox._nextGear = Controller.ShiftStrategy.NextGear; TestPowertrain.Gearbox.Disengaged = !nextGear.Engaged; - - var combustionEngineInfo = DataBus.EngineInfo as CombustionEngine; - var enginePrevious = combustionEngineInfo.PreviousState; - TestPowertrain.CombustionEngine.Initialize(enginePrevious.EngineTorque, enginePrevious.EngineSpeed); - var testPreviousState = TestPowertrain.CombustionEngine.PreviousState; - testPreviousState.EngineOn = enginePrevious.EngineOn; - testPreviousState.EnginePower = enginePrevious.EnginePower; - testPreviousState.dt = enginePrevious.dt; - testPreviousState.EngineSpeed = enginePrevious.EngineSpeed; - testPreviousState.EngineTorque = enginePrevious.EngineTorque; - testPreviousState.EngineTorqueOut = enginePrevious.EngineTorqueOut; - testPreviousState.DynamicFullLoadTorque = enginePrevious.DynamicFullLoadTorque; - - switch (TestPowertrain.CombustionEngine.EngineAux) { - case EngineAuxiliary engineAux: - engineAux.PreviousState.AngularSpeed = - (combustionEngineInfo.EngineAux as EngineAuxiliary).PreviousState - .AngularSpeed; - break; - case BusAuxiliariesAdapter busAux: - busAux.PreviousState.AngularSpeed = - (combustionEngineInfo.EngineAux as BusAuxiliariesAdapter).PreviousState - .AngularSpeed; - if (busAux.ElectricStorage is SimpleBattery bat) { - bat.SOC = (combustionEngineInfo.EngineAux as BusAuxiliariesAdapter) - .ElectricStorage - .SOC; - } - break; - } - - if (TestPowertrain.DCDCConverter != null) { - TestPowertrain.DCDCConverter.PreviousState.ConsumedEnergy = - (DataBus.DCDCConverter as DCDCConverter).PreviousState.ConsumedEnergy; - } - - if (TestPowertrain.WHRCharger != null) { - TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = - DataBus.WHRCharger.PreviousState.GeneratedEnergy; - TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = - DataBus.WHRCharger.PreviousState.ExcessiveEnergy; - } - - TestPowertrain.Gearbox.PreviousState.InAngularVelocity = - (DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity; - - TestPowertrain.Clutch.PreviousState.InAngularVelocity = - (DataBus.ClutchInfo as SwitchableClutch).PreviousState.InAngularVelocity; - TestPowertrain.Clutch.PreviousState.OutAngularVelocity = - (DataBus.ClutchInfo as SwitchableClutch).PreviousState.OutAngularVelocity; - - //} - + TestPowertrain.CombustionEngine.UpdateFrom(DataBus.EngineInfo); + TestPowertrain.Gearbox.UpdateFrom(DataBus.GearboxInfo); + TestPowertrain.Clutch.UpdateFrom(DataBus.ClutchInfo); var pos = ModelData.ElectricMachinesData.FirstOrDefault().Item1; - TestPowertrain.ElectricMotor.ThermalBuffer = - (DataBus.ElectricMotorInfo(pos) as ElectricMotor).ThermalBuffer; - TestPowertrain.ElectricMotor.DeRatingActive = - (DataBus.ElectricMotorInfo(pos) as ElectricMotor).DeRatingActive; - + TestPowertrain.ElectricMotor.UpdateFrom(DataBus.ElectricMotorInfo(pos)); foreach (var emPos in TestPowertrain.ElectricMotorsUpstreamTransmission.Keys) { - TestPowertrain.ElectricMotorsUpstreamTransmission[pos].PreviousState.EMSpeed = - DataBus.ElectricMotorInfo(emPos).ElectricMotorSpeed; + TestPowertrain.ElectricMotorsUpstreamTransmission[pos].PreviousState.EMSpeed = DataBus.ElectricMotorInfo(emPos).ElectricMotorSpeed; } var retVal = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, true); @@ -193,58 +108,28 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies //tmp.FuelCosts = double.NaN; // = Tuple.Create(true, response.Gearbox.Gear - 1); tmp.IgnoreReason |= HybridConfigurationIgnoreReason.EngineSpeedBelowDownshift; } - - } - } - // ===================================================== - - public class HybridStrategyAT : AbstractHybridStrategy<ATGearbox> { + public HybridStrategyAT(VectoRunData runData, IVehicleContainer vehicleContainer) : base(runData, vehicleContainer) + { } - public HybridStrategyAT(VectoRunData runData, IVehicleContainer vehicleContainer) : base(runData, - vehicleContainer) - { - - } - - protected override IResponse RequestDryRun(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, - GearshiftPosition nextGear, HybridStrategyResponse cfg) + protected override IResponse RequestDryRun(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, GearshiftPosition nextGear, HybridStrategyResponse cfg) { + TestPowertrain.UpdateComponents(); + TestPowertrain.Gearbox.Gear = PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear; TestPowertrain.Gearbox.Disengaged = !nextGear.Engaged; TestPowertrain.Gearbox.DisengageGearbox = !nextGear.Engaged; TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); TestPowertrain.HybridController.ApplyStrategySettings(cfg); TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); - // TestPowertrain.Clutch.Initialize(DataBus.ClutchInfo.ClutchLosses); - TestPowertrain.Battery?.Initialize(DataBus.BatteryInfo.StateOfCharge); - if (TestPowertrain.Battery != null) { - TestPowertrain.Battery.PreviousState.PulseDuration = - (DataBus.BatteryInfo as Battery).PreviousState.PulseDuration; - } - if (TestPowertrain.BatterySystem != null) { - var batSystem = DataBus.BatteryInfo as BatterySystem; - foreach (var bsKey in batSystem.Batteries.Keys) { - for (var i = 0; i < batSystem.Batteries[bsKey].Batteries.Count; i++) { - TestPowertrain.BatterySystem.Batteries[bsKey].Batteries[i] - .Initialize(batSystem.Batteries[bsKey].Batteries[i].StateOfCharge); - } - } - TestPowertrain.BatterySystem.PreviousState.PulseDuration = - (DataBus.BatteryInfo as BatterySystem).PreviousState.PulseDuration; - } - TestPowertrain.SuperCap?.Initialize(DataBus.BatteryInfo.StateOfCharge); - + TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; - - var currentGear = PreviousState.GearboxEngaged ? DataBus.GearboxInfo.Gear : Controller.ShiftStrategy.NextGear; - - var gearboxInfo = DataBus.GearboxInfo as ATGearbox; - if (nextGear.Engaged && !nextGear.Equals(currentGear)) { + + if (nextGear.Engaged && !nextGear.Equals(TestPowertrain.Gearbox.Gear)) { if (!AllowEmergencyShift && ModelData.GearboxData.Gears[nextGear.Gear].Ratio > ModelData.GearshiftParameters.RatioEarlyUpshiftFC) { return null; } @@ -254,130 +139,44 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } var vDrop = DataBus.DriverInfo.DriverAcceleration * ModelData.GearshiftParameters.ATLookAheadTime; - var vehicleSpeedPostShift = (DataBus.VehicleInfo.VehicleSpeed + vDrop * ModelData.GearshiftParameters.VelocityDropFactor).LimitTo( - 0.KMPHtoMeterPerSecond(), DataBus.DrivingCycleInfo.CycleData.LeftSample.VehicleTargetSpeed); - - //var estimatedVelocityPostShift = VelocityDropData.Interpolate(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); - //if (!AllowEmergencyShift && !estimatedVelocityPostShift.IsGreater(DeclarationData.GearboxTCU.MIN_SPEED_AFTER_TRACTION_INTERRUPTION)) { - // return null; - //} - + var vehicleSpeedPostShift = (DataBus.VehicleInfo.VehicleSpeed + vDrop * ModelData.GearshiftParameters.VelocityDropFactor).LimitTo(0.KMPHtoMeterPerSecond(), DataBus.DrivingCycleInfo.CycleData.LeftSample.VehicleTargetSpeed); if (nextGear.TorqueConverterLocked.HasValue && nextGear.TorqueConverterLocked.Value) { var inAngularVelocity = ModelData.GearboxData.Gears[nextGear.Gear].Ratio * outAngularVelocity; - if (inAngularVelocity.IsEqual(0)) { return null; } - var totalTransmissionRatio = inAngularVelocity / - (DataBus.VehicleInfo.VehicleSpeed + - DataBus.DriverInfo.DriverAcceleration * dt); - + var totalTransmissionRatio = inAngularVelocity / (DataBus.VehicleInfo.VehicleSpeed + DataBus.DriverInfo.DriverAcceleration * dt); var estimatedEngineSpeed = (vehicleSpeedPostShift * totalTransmissionRatio).Cast<PerSecond>(); if (estimatedEngineSpeed.IsSmaller(ModelData.GearshiftParameters.MinEngineSpeedPostUpshift)) { return null; } } - //var vDrop = DataBus.VehicleInfo.VehicleSpeed - estimatedVelocityPostShift; - //var vehicleSpeedPostShift = estimatedVelocityPostShift; // DataBus.VehicleInfo.VehicleSpeed - vDrop * ModelData.GearshiftParameters.VelocityDropFactor; TestPowertrain.Gearbox.Gear = nextGear; TestPowertrain.Gearbox.RequestAfterGearshift = true; - //var init = TestPowertrain.Container.VehiclePort.Initialize( - // vehicleSpeedPostShift, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); - //if (!AllowEmergencyShift && init.Engine.EngineSpeed.IsSmaller(ModelData.EngineData.IdleSpeed)) { - // return null; - //} } else { - TestPowertrain.Gearbox.RequestAfterGearshift = gearboxInfo.RequestAfterGearshift; + TestPowertrain.Gearbox.RequestAfterGearshift = DataBus.GearboxInfo.RequestAfterGearshift; } - //TestPowertrain.Gearbox.ShiftToLocked = (DataBus.GearboxInfo as ATGearbox).ShiftToLocked; - + if (!nextGear.Engaged) { - //TestPowertrain.Gearbox._nextGear = Controller.ShiftStrategy.NextGear; TestPowertrain.Gearbox.Disengaged = !nextGear.Engaged; } - //if (!PreviousState.GearboxEngaged) { - var engineInfo = DataBus.EngineInfo as CombustionEngine; - var enginePrevious = engineInfo.PreviousState; - TestPowertrain.CombustionEngine.Initialize(enginePrevious.EngineTorque, enginePrevious.EngineSpeed); - var testEnginePrevious = TestPowertrain.CombustionEngine.PreviousState; - testEnginePrevious.EngineOn = enginePrevious.EngineOn; - testEnginePrevious.EnginePower = enginePrevious.EnginePower; - testEnginePrevious.dt = enginePrevious.dt; - testEnginePrevious.EngineSpeed = enginePrevious.EngineSpeed; - testEnginePrevious.EngineTorque = enginePrevious.EngineTorque; - testEnginePrevious.EngineTorqueOut = enginePrevious.EngineTorqueOut; - testEnginePrevious.DynamicFullLoadTorque = enginePrevious.DynamicFullLoadTorque; - - switch (TestPowertrain.CombustionEngine.EngineAux) { - case EngineAuxiliary engineAux: - engineAux.PreviousState.AngularSpeed = (engineInfo.EngineAux as EngineAuxiliary).PreviousState.AngularSpeed; - break; - case BusAuxiliariesAdapter busAux: - busAux.PreviousState.AngularSpeed = (engineInfo.EngineAux as BusAuxiliariesAdapter).PreviousState.AngularSpeed; - if (busAux.ElectricStorage is SimpleBattery bat) { - bat.SOC = (engineInfo.EngineAux as BusAuxiliariesAdapter) - .ElectricStorage - .SOC; - } - break; - } - - if (TestPowertrain.DCDCConverter != null) { - TestPowertrain.DCDCConverter.PreviousState.ConsumedEnergy = - (DataBus.DCDCConverter as DCDCConverter).PreviousState.ConsumedEnergy; - } - - if (TestPowertrain.WHRCharger != null) { - TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = - DataBus.WHRCharger.PreviousState.GeneratedEnergy; - TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = - DataBus.WHRCharger.PreviousState.ExcessiveEnergy; - } - - TestPowertrain.Gearbox.PreviousState.OutAngularVelocity = gearboxInfo.PreviousState.OutAngularVelocity; - TestPowertrain.Gearbox.PreviousState.InAngularVelocity = gearboxInfo.PreviousState.InAngularVelocity; - TestPowertrain.Gearbox._powershiftLossEnergy = gearboxInfo._powershiftLossEnergy; - TestPowertrain.Gearbox.PreviousState.PowershiftLossEnergy = gearboxInfo.PreviousState.PowershiftLossEnergy; - TestPowertrain.Gearbox.LastShift = gearboxInfo.LastShift; - TestPowertrain.Gearbox.PreviousState.Gear = gearboxInfo.PreviousState.Gear; - + TestPowertrain.CombustionEngine.UpdateFrom(DataBus.EngineInfo); + TestPowertrain.Gearbox.UpdateFrom(DataBus.GearboxInfo); if (nextGear.TorqueConverterLocked.HasValue && !nextGear.TorqueConverterLocked.Value) { - var dataBusTorqueConverterInfo = DataBus.TorqueConverterInfo as TorqueConverter; - var prev = dataBusTorqueConverterInfo.PreviousState; - var testTCPrevious = TestPowertrain.TorqueConverter.PreviousState; - testTCPrevious.InAngularVelocity = prev.InAngularVelocity; - testTCPrevious.InTorque = prev.InTorque; - testTCPrevious.OutAngularVelocity = prev.OutAngularVelocity; - testTCPrevious.IgnitionOn = prev.IgnitionOn; + TestPowertrain.TorqueConverter.UpdateFrom(DataBus.TorqueConverterInfo); } - //TestPowertrain.Clutch.PreviousState.InAngularVelocity = - // (DataBus.ClutchInfo as SwitchableClutch).PreviousState.InAngularVelocity; - - //} - var pos = ModelData.ElectricMachinesData.FirstOrDefault().Item1; - TestPowertrain.ElectricMotor.ThermalBuffer = - (DataBus.ElectricMotorInfo(pos) as ElectricMotor).ThermalBuffer; - TestPowertrain.ElectricMotor.DeRatingActive = - (DataBus.ElectricMotorInfo(pos) as ElectricMotor).DeRatingActive; - + TestPowertrain.ElectricMotor.UpdateFrom(DataBus.ElectricMotorInfo(pos)); foreach (var emPos in TestPowertrain.ElectricMotorsUpstreamTransmission.Keys) { - TestPowertrain.ElectricMotorsUpstreamTransmission[pos].PreviousState.EMSpeed = - DataBus.ElectricMotorInfo(emPos).ElectricMotorSpeed; + TestPowertrain.ElectricMotorsUpstreamTransmission[pos].PreviousState.EMSpeed = DataBus.ElectricMotorInfo(emPos).ElectricMotorSpeed; } try { - var retVal = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, - outAngularVelocity, false); - - //if (retVal.Source is TorqueConverter) { - // return null; - //} - + var retVal = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); retVal.HybridController.StrategySettings = cfg; return retVal; } catch (Exception e) { @@ -423,22 +222,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } - // ===================================================== - public abstract class AbstractHybridStrategy<T> : LoggingObject, IHybridControlStrategy where T : class, IHybridControlledGearbox, IGearbox { - public class StrategyState { public PerSecond AngularVelocity { get; set; } public HybridStrategyResponse Response { get; set; } public List<HybridResultEntry> Evaluations; public HybridResultEntry Solution { get; set; } - public bool GearboxEngaged { get; set; } - public Second ICEStartTStmp { get; set; } - public Second GearshiftTriggerTstmp { get; set; } public NewtonMeter MaxGbxTq { get; set; } public bool ICEOn { get; set; } @@ -569,18 +362,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies GearshiftPosition nextGear; if (DataBus.VehicleInfo.VehicleStopped) { nextGear = Controller.ShiftStrategy.NextGear; - } - else if (!DataBus.GearboxInfo.GearEngaged(absTime)) { + } else if (!DataBus.GearboxInfo.GearEngaged(absTime)) { nextGear = Controller.ShiftStrategy.NextGear; - } - else if (PreviousState.GearboxEngaged) { + } else if (PreviousState.GearboxEngaged) { nextGear = DataBus.GearboxInfo.Gear; } else { nextGear = Controller.ShiftStrategy.NextGear; } if (DataBus.DriverInfo.DrivingAction == DrivingAction.Accelerate && StrategyParameters.MaxPropulsionTorque?.GetVECTOValueOrDefault(nextGear) != null && DataBus.GearboxInfo.TCLocked) { - + var emOff = new HybridStrategyResponse { CombustionEngineOn = DataBus.EngineInfo.EngineOn, // AllowICEOff(absTime), GearboxInNeutral = false, @@ -653,7 +444,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies case DrivingAction.Halt: HandleHaltAction(absTime, dt, outTorque, outAngularVelocity, dryRun, eval); break; - default: throw new ArgumentOutOfRangeException(); + default: + throw new ArgumentOutOfRangeException(); } @@ -703,8 +495,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies CurrentState.GearshiftTriggerTstmp = absTime; } - DebugData.Add("AHS.R", new { DataBus.DriverInfo.DrivingAction, Evaluations = eval, - Best = best, RetVal = retVal, DryRun = dryRun }); + DebugData.Add("AHS.R", new { + DataBus.DriverInfo.DrivingAction, + Evaluations = eval, + Best = best, + RetVal = retVal, + DryRun = dryRun + }); return retVal; } @@ -863,7 +660,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } var testRequest = RequestDryRun(absTime, dt, outTorque, outAngularVelocity, nextGear, emOff); if (testRequest != null && testRequest.Engine.EngineSpeed < ModelData.EngineData.FullLoadCurves[0].NTq99hSpeed) { - var maxGbxTorque = StrategyParameters.MaxPropulsionTorque?.GetVECTOValueOrDefault(nextGear).FullLoadDriveTorque(testRequest.Gearbox.InputSpeed); + var maxGbxTorque = StrategyParameters.MaxPropulsionTorque?.GetVECTOValueOrDefault(nextGear)?.FullLoadDriveTorque(testRequest.Gearbox.InputSpeed); candidates[nextGear] = maxGbxTorque != null ? Tuple.Create(maxGbxTorque * testRequest.Gearbox.InputSpeed, testRequest) : Tuple.Create(testRequest.Gearbox.InputTorque * testRequest.Gearbox.InputSpeed, testRequest); @@ -987,7 +784,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var isP1 = DataBus.PowertrainInfo.ElectricMotorPositions.Contains(PowertrainPosition.HybridP1); if (isP1 && (!ModelData.VehicleData.ADAS.EngineStopStart || !isPCC)) return false; - + //normal case: only turn of ICE if ESS is activated and the minimal ICE on time is exceeded. var MinICEonTimeExceeded = PreviousState.ICEStartTStmp is null || absTime.IsGreaterOrEqual(PreviousState.ICEStartTStmp + StrategyParameters.MinICEOnTime); @@ -1008,8 +805,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var disengageSpeedThreshold = ModelData.GearboxData.DisengageWhenHaltingSpeed; // hint: only check for halting speed if vehicle is actually braking to halt. - var vehiclespeedBelowThreshold = DataBus.VehicleInfo.VehicleSpeed.IsSmaller(disengageSpeedThreshold) - && (DataBus.DriverInfo.NextBrakeTriggerSpeed?.IsEqual(0) ?? false); + var vehiclespeedBelowThreshold = DataBus.VehicleInfo.VehicleSpeed.IsSmaller(disengageSpeedThreshold) + && (DataBus.DriverInfo.NextBrakeTriggerSpeed?.IsEqual(0) ?? false); if (ElectricMotorCanPropellDuringTractionInterruption || DataBus.GearboxInfo.GearEngaged(absTime)) { @@ -1030,8 +827,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies GearshiftPosition nextGear; if (!DataBus.GearboxInfo.GearEngaged(absTime)) { nextGear = new GearshiftPosition(0); - } - else if (PreviousState.GearboxEngaged) { + } else if (PreviousState.GearboxEngaged) { nextGear = DataBus.GearboxInfo.Gear; } else { nextGear = Controller.ShiftStrategy.NextGear; @@ -1062,7 +858,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var endSpeed = DataBus.VehicleInfo.VehicleSpeed + DataBus.DriverInfo.DriverAcceleration * ModelData.GearboxData.TractionInterruption; if (EngineSpeedTooLow(response) - && (DataBus.GearboxInfo.GearboxType.ManualTransmission() || DataBus.GearboxInfo.GearboxType == GearboxType.IHPC) + && (DataBus.GearboxInfo.GearboxType.ManualTransmission() || DataBus.GearboxInfo.GearboxType == GearboxType.IHPC) && endSpeed.IsSmallerOrEqual(disengageSpeedThreshold, 0.1.KMPHtoMeterPerSecond())) { var responseEmOff = ResponseEmOff; responseEmOff.Gear = new GearshiftPosition(0); @@ -1072,7 +868,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return; } - if (GearList.HasPredecessor(nextGear) + if (GearList.HasPredecessor(nextGear) && EngineSpeedTooLow(response) && (!vehiclespeedBelowThreshold || AllowEmergencyShift)) { // engine speed would fall below idling speed - consider downshift @@ -1127,7 +923,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var downshift = ResponseEmOff; //downshift.Gear = GearList.Predecessor(nextGear); downshift.Gear = best; // GearList.Predecessor(nextGear); - downshift.Setting.GearboxInNeutral = best.Gear == 0; + downshift.Setting.GearboxInNeutral = best.Gear == 0; downshift.Setting.ShiftRequired = best.Gear == 0; eval.Add(downshift); return; @@ -1298,6 +1094,10 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } } else { if (emRecuperationTq.IsGreater(0)) { + var voltage = DataBus.BatteryInfo.InternalVoltage; + var maxbatDragTq = DataBus.ElectricMotorInfo(emPos).GetTorqueForElectricPower(voltage, + response.ElectricSystem.MaxPowerDrag, response.ElectricMotor.AngularVelocity, dt, nextGear, + false); eval.Add( new HybridResultEntry { ICEOff = !DataBus.EngineInfo.EngineOn, @@ -1307,7 +1107,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies GearboxInNeutral = false, NextGear = nextGear, MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>> { - { emPos, Tuple.Create(response.ElectricMotor.AngularVelocity, response.ElectricMotor.MaxRecuperationTorque) } + { emPos, Tuple.Create(response.ElectricMotor.AngularVelocity, VectoMath.Min(maxbatDragTq, response.ElectricMotor.MaxRecuperationTorque)) } } } }); @@ -1343,11 +1143,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies private GearshiftPosition FindBestGearForBraking(GearshiftPosition nextGear, IResponse firstResponse) { - var endSpeed = DataBus.VehicleInfo.VehicleSpeed + + var endSpeed = DataBus.VehicleInfo.VehicleSpeed + DataBus.DriverInfo.DriverAcceleration * ModelData.GearboxData.TractionInterruption; - + // only disengage if we are actually braking for halting (meaning: next brake trigger speed is 0). - if (DataBus.GearboxInfo.GearboxType.ManualTransmission() + if (DataBus.GearboxInfo.GearboxType.ManualTransmission() && (DataBus.DriverInfo.NextBrakeTriggerSpeed?.IsEqual(0) ?? false) && endSpeed.IsSmallerOrEqual(ModelData.GearboxData.DisengageWhenHaltingSpeed, 0.1.KMPHtoMeterPerSecond())) { return new GearshiftPosition(0); @@ -1734,7 +1534,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies // ICE is off, selected solution has a too low or too high engine speed - keep ICE off retVal.CombustionEngineOn = false; } - if (best.IgnoreReason.EngineSpeedTooLow() && !DataBus.EngineInfo.EngineOn + if (best.IgnoreReason.EngineSpeedTooLow() && !DataBus.EngineInfo.EngineOn && DataBus.VehicleInfo.VehicleSpeed.IsGreater(ModelData.GearshiftParameters.StartSpeed)) { // ICE is off, selected solution has a too low or too high engine speed - keep ICE off retVal.CombustionEngineOn = false; diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs index 995b7b21150e34339e81981217bb4a5c7526618b..78f5fa87f671a6be67ae557651f7615a54b8ba52 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/SerialHybridStrategy.cs @@ -19,104 +19,47 @@ using TUGraz.VectoCore.Utils; namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies { - public class SerialHybridStrategyAT : AbstractSerialHybridStrategy<APTNGearbox> { public SerialHybridStrategyAT(VectoRunData runData, IVehicleContainer container) : base(runData, container) { } #region Overrides of AbstractSerialHybridStrategy<ATGearbox> - protected override DrivetrainDemand GetDrivetrainPowerDemand(Second absTime, Second dt, NewtonMeter outTorque, - PerSecond outAngularVelocity, GenSetOperatingPoint maxPowerGenset) + protected override DrivetrainDemand GetDrivetrainPowerDemand(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, GenSetOperatingPoint maxPowerGenset) { - if (TestPowertrain.Gearbox != null) { - var gearboxInfo = DataBus.GearboxInfo as APTNGearbox; - if (gearboxInfo == null) { - throw new VectoException("AT Gearbox Required!"); - } - var currentGear = DataBus.VehicleInfo.VehicleStopped - ? gearboxInfo.NextGear - : DataBus.GearboxInfo.Gear; + TestPowertrain.UpdateComponents(); - TestPowertrain.Gearbox.PreviousState.InAngularVelocity = - gearboxInfo.PreviousState.InAngularVelocity; + if (TestPowertrain.Gearbox != null) { + var gearboxInfo = DataBus.GearboxInfo as APTNGearbox ?? throw new VectoException("AT Gearbox Required!"); + var currentGear = DataBus.VehicleInfo.VehicleStopped ? gearboxInfo.NextGear : DataBus.GearboxInfo.Gear; TestPowertrain.Gearbox.Disengaged = gearboxInfo.Disengaged; TestPowertrain.Gearbox.DisengageGearbox = gearboxInfo.DisengageGearbox; TestPowertrain.Gearbox.Gear = currentGear; TestPowertrain.Gearbox._nextGear = gearboxInfo.NextGear; } TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); - (TestPowertrain.Container.VehicleInfo as Vehicle).PreviousState.Velocity = - (DataBus.VehicleInfo as Vehicle).PreviousState.Velocity; - - TestPowertrain.ElectricMotor.ThermalBuffer = - (DataBus.ElectricMotorInfo(EmPosition) as ElectricMotor).ThermalBuffer; - TestPowertrain.ElectricMotor.DeRatingActive = - (DataBus.ElectricMotorInfo(EmPosition) as ElectricMotor).DeRatingActive; - - TestPowertrain.Battery?.Initialize(DataBus.BatteryInfo.StateOfCharge); - if (TestPowertrain.Battery != null) { - TestPowertrain.Battery.PreviousState.PulseDuration = - (DataBus.BatteryInfo as Battery).PreviousState.PulseDuration; - TestPowertrain.Battery.PreviousState.PowerDemand = - (DataBus.BatteryInfo as Battery).PreviousState.PowerDemand; - } - if (TestPowertrain.BatterySystem != null) { - var batSystem = DataBus.BatteryInfo as BatterySystem; - foreach (var bsKey in batSystem.Batteries.Keys) { - for (var i = 0; i < batSystem.Batteries[bsKey].Batteries.Count; i++) { - TestPowertrain.BatterySystem.Batteries[bsKey].Batteries[i] - .Initialize(batSystem.Batteries[bsKey].Batteries[i].StateOfCharge); - } - } - TestPowertrain.BatterySystem.PreviousState.PulseDuration = - (DataBus.BatteryInfo as BatterySystem).PreviousState.PulseDuration; - TestPowertrain.BatterySystem.PreviousState.PowerDemand = (DataBus.BatteryInfo as BatterySystem).PreviousState.PowerDemand; - } - - TestPowertrain.Charger.ChargingPower = maxPowerGenset.ElectricPower; - - if (TestPowertrain.WHRCharger != null) { - TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = - DataBus.WHRCharger.PreviousState.GeneratedEnergy; - TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = - DataBus.WHRCharger.PreviousState.ExcessiveEnergy; - } - - TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, - Controller.PreviousState.OutAngularVelocity); - - if (TestPowertrain.Gearbox != null) { - var gearboxInfo = DataBus.GearboxInfo as APTNGearbox; - TestPowertrain.Gearbox.PreviousState.OutAngularVelocity = gearboxInfo.PreviousState.OutAngularVelocity; - TestPowertrain.Gearbox.PreviousState.InAngularVelocity = gearboxInfo.PreviousState.InAngularVelocity; - } - + TestPowertrain.Charger.UpdateFrom(maxPowerGenset); + TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); + TestPowertrain.Gearbox?.UpdateFrom(DataBus.GearboxInfo); + TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; - var testResponse = - TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); - TestPowertrain.HybridController.ApplyStrategySettings(new HybridStrategyResponse() { - CombustionEngineOn = false, - MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>>() { - { - EmPosition, - Tuple.Create(testResponse.ElectricMotor.AvgDrivetrainSpeed, -testResponse.ElectricMotor.TorqueRequest) - } + var testResponse = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); + TestPowertrain.HybridController.ApplyStrategySettings(new HybridStrategyResponse { + CombustionEngineOn = false, + MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>> { + { EmPosition, Tuple.Create(testResponse.ElectricMotor.AvgDrivetrainSpeed, -testResponse.ElectricMotor.TorqueRequest) } } }); - var testResponse2 = - TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, - false); - return new DrivetrainDemand() { + var testResponse2 = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); + return new DrivetrainDemand { AvgEmDrivetrainSpeed = testResponse2.ElectricMotor.AvgDrivetrainSpeed, EmTorqueDemand = testResponse2.ElectricMotor.TorqueRequest, ElectricPowerDemand = testResponse2.ElectricSystem.ConsumerPower, Response = testResponse2 }; } - - + #endregion } @@ -131,77 +74,32 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies protected override DrivetrainDemand GetDrivetrainPowerDemand(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, GenSetOperatingPoint maxPowerGenset) { - if (TestPowertrain.Gearbox != null) { - var currentGear = DataBus.VehicleInfo.VehicleStopped - ? (DataBus.GearboxInfo as Gearbox).NextGear - : DataBus.GearboxInfo.Gear; - - TestPowertrain.Gearbox.PreviousState.InAngularVelocity = - (DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity; - TestPowertrain.Gearbox.Disengaged = (DataBus.GearboxInfo as Gearbox).Disengaged; - TestPowertrain.Gearbox.DisengageGearbox = (DataBus.GearboxInfo as Gearbox).DisengageGearbox; - TestPowertrain.Gearbox.Gear = currentGear; - TestPowertrain.Gearbox._nextGear = (DataBus.GearboxInfo as Gearbox).NextGear; - } - TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); - - TestPowertrain.ElectricMotor.ThermalBuffer = - (DataBus.ElectricMotorInfo(EmPosition) as ElectricMotor).ThermalBuffer; - TestPowertrain.ElectricMotor.DeRatingActive = - (DataBus.ElectricMotorInfo(EmPosition) as ElectricMotor).DeRatingActive; - - TestPowertrain.Battery?.Initialize(DataBus.BatteryInfo.StateOfCharge); - if (TestPowertrain.Battery != null) { - TestPowertrain.Battery.PreviousState.PulseDuration = - (DataBus.BatteryInfo as Battery).PreviousState.PulseDuration; - TestPowertrain.Battery.PreviousState.PowerDemand = - (DataBus.BatteryInfo as Battery).PreviousState.PowerDemand; - } - if (TestPowertrain.BatterySystem != null) { - var batSystem = DataBus.BatteryInfo as BatterySystem; - foreach (var bsKey in batSystem.Batteries.Keys) { - for (var i = 0; i < batSystem.Batteries[bsKey].Batteries.Count; i++) { - TestPowertrain.BatterySystem.Batteries[bsKey].Batteries[i] - .Initialize(batSystem.Batteries[bsKey].Batteries[i].StateOfCharge); - } - } - TestPowertrain.BatterySystem.PreviousState.PulseDuration = - (DataBus.BatteryInfo as BatterySystem).PreviousState.PulseDuration; - TestPowertrain.BatterySystem.PreviousState.PowerDemand = (DataBus.BatteryInfo as BatterySystem).PreviousState.PowerDemand; - } - - TestPowertrain.Charger.ChargingPower = maxPowerGenset.ElectricPower; - - if (TestPowertrain.WHRCharger != null) { - TestPowertrain.WHRCharger.PreviousState.GeneratedEnergy = - DataBus.WHRCharger.PreviousState.GeneratedEnergy; - TestPowertrain.WHRCharger.PreviousState.ExcessiveEnergy = - DataBus.WHRCharger.PreviousState.ExcessiveEnergy; - } + TestPowertrain.UpdateComponents(); - TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, - Controller.PreviousState.OutAngularVelocity); - TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; if (TestPowertrain.Gearbox != null) { - TestPowertrain.Gearbox.PreviousState.InAngularVelocity = - (DataBus.GearboxInfo as Gearbox).PreviousState.InAngularVelocity; + var g = DataBus.GearboxInfo as Gearbox ?? throw new VectoException("AMT Gearbox Required!"); + TestPowertrain.Gearbox.Disengaged = g.Disengaged; + TestPowertrain.Gearbox.DisengageGearbox = g.DisengageGearbox; + TestPowertrain.Gearbox.Gear = DataBus.VehicleInfo.VehicleStopped ? g.NextGear : DataBus.GearboxInfo.Gear; + TestPowertrain.Gearbox._nextGear = g.NextGear; } - var testResponse = - TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); - TestPowertrain.HybridController.ApplyStrategySettings(new HybridStrategyResponse() { + TestPowertrain.Container.VehiclePort.Initialize(DataBus.VehicleInfo.VehicleSpeed, DataBus.DrivingCycleInfo.RoadGradient ?? 0.SI<Radian>()); + TestPowertrain.Charger.UpdateFrom(maxPowerGenset); + TestPowertrain.HybridController.Initialize(Controller.PreviousState.OutTorque, Controller.PreviousState.OutAngularVelocity); + TestPowertrain.Gearbox?.UpdateFrom(DataBus.GearboxInfo); + + TestPowertrain.Brakes.BrakePower = DataBus.Brakes.BrakePower; + + var testResponse = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); + TestPowertrain.HybridController.ApplyStrategySettings(new HybridStrategyResponse { CombustionEngineOn = false, - MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>>() { - { - EmPosition, - Tuple.Create(testResponse.ElectricMotor.AvgDrivetrainSpeed, -testResponse.ElectricMotor.TorqueRequest) - } + MechanicalAssistPower = new Dictionary<PowertrainPosition, Tuple<PerSecond, NewtonMeter>> { + { EmPosition, Tuple.Create(testResponse.ElectricMotor.AvgDrivetrainSpeed, -testResponse.ElectricMotor.TorqueRequest) } } }); - var testResponse2 = - TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, - false); - return new DrivetrainDemand() { + var testResponse2 = TestPowertrain.HybridController.NextComponent.Request(absTime, dt, outTorque, outAngularVelocity, false); + return new DrivetrainDemand { AvgEmDrivetrainSpeed = testResponse2.ElectricMotor.AvgDrivetrainSpeed, EmTorqueDemand = testResponse2.ElectricMotor.TorqueRequest, ElectricPowerDemand = testResponse2.ElectricSystem.ConsumerPower, @@ -213,7 +111,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies // ======================================================================= - public abstract class AbstractSerialHybridStrategy<T> : LoggingObject, IHybridControlStrategy where T : class, IHybridControlledGearbox, IGearbox + public abstract class AbstractSerialHybridStrategy<T> : LoggingObject, IHybridControlStrategy where T : class, IHybridControlledGearbox, IGearbox { public enum StateMachineState @@ -251,13 +149,13 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies protected TestPowertrain<T> TestPowertrain; protected TestGenset TestGenSet; protected GenSetCharacteristics GenSetCharacteristics; - + protected PowertrainPosition EmPosition; protected DryRunSolutionState DryRunSolution { get; set; } - public AbstractSerialHybridStrategy (VectoRunData runData, IVehicleContainer container) + public AbstractSerialHybridStrategy(VectoRunData runData, IVehicleContainer container) { DataBus = container; ModelData = runData; @@ -293,8 +191,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies PowertrainBuilder.BuildSimpleGenSet(runData, gensetContainer); TestGenSet = new TestGenset(gensetContainer, DataBus); - - container.AddPreprocessor(new GensetPreprocessor(GenSetCharacteristics ,TestGenSet, runData.EngineData, + + container.AddPreprocessor(new GensetPreprocessor(GenSetCharacteristics, TestGenSet, runData.EngineData, runData.ElectricMachinesData.FirstOrDefault(x => x.Item1 == PowertrainPosition.GEN)?.Item2)); } @@ -311,7 +209,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } GenSetCharacteristics.ContinuousTorque = ModelData.ElectricMachinesData - .FirstOrDefault(x => x.Item1 == EmPosition)?.Item2.Overload.ContinuousTorque ?? 0.SI<NewtonMeter>(); + .FirstOrDefault(x => x.Item1 == EmPosition)?.Item2.Overload.ContinuousTorque ?? 0.SI<NewtonMeter>(); PreviousState.AngularVelocity = outAngularVelocity; PreviousState.SMState = DataBus.BatteryInfo.StateOfCharge > StrategyParameters.TargetSoC @@ -539,22 +437,21 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } return ApproachGensetOperatingPoint(absTime, dt, gensetLimit, gensetState); - + } public GenSetOperatingPoint GensetOff => new - GenSetOperatingPoint - { - ICEOn = false, - ICESpeed = ModelData.EngineData.IdleSpeed, - ICETorque = null, - EMTorque = null - }; + GenSetOperatingPoint { + ICEOn = false, + ICESpeed = ModelData.EngineData.IdleSpeed, + ICETorque = null, + EMTorque = null + }; public GenSetOperatingPoint GensetIdle => new GenSetOperatingPoint() { - ICEOn = true, + ICEOn = true, ICESpeed = ModelData.EngineData.IdleSpeed, - ICETorque = 0.SI<NewtonMeter>(), + ICETorque = 0.SI<NewtonMeter>(), EMTorque = null, }; @@ -710,7 +607,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies var iceSpeed = op.ICESpeed; var emTqDt = op.ICETorque; - + TestGenSet.ElectricMotorCtl.EMTorque = emTqDt; var r1 = TestGenSet.ElectricMotor.Request(absTime, dt, 0.SI<NewtonMeter>(), iceSpeed); @@ -850,8 +747,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies return (tqDt, iceSpeed, r1); } - - + + public IResponse AmendResponse(IResponse response, Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun) { @@ -863,7 +760,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies CurrentState.ICEOn = DataBus.EngineCtl.CombustionEngineOn; PreviousState = CurrentState; CurrentState = new StrategyState(); - + AllowEmergencyShift = false; } @@ -878,12 +775,12 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public void OperatingpointChangedDuringRequest(Second absTime, Second dt, NewtonMeter outTorque, PerSecond outAngularVelocity, bool dryRun, IResponse retVal) { - + } public void RepeatDrivingAction(Second absTime) { - + } #endregion @@ -944,8 +841,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public GenSetOperatingPoint OptimalPoint { - get - { + get { if (_optimalPoint == null) { var tmp = OptimalPoints.Values.SelectMany(x => x).Where(x => x.ElectricPower > MinGensetPower).ToArray(); if (!tmp.Any()) { @@ -960,8 +856,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public GenSetOperatingPoint OptimalPointDeRated { - get - { + get { if (_optimalPointDerated == null) { var tmp = OptimalPoints.Values.SelectMany(x => x).Where(x => x.EMTorque.IsSmaller(ContinuousTorque)).Where(x => x.ElectricPower > MinGensetPower).ToArray(); if (!tmp.Any()) { @@ -970,7 +865,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies .Where(x => x.EMTorque.IsSmaller(ContinuousTorque)).ToArray(); } - + _optimalPointDerated = tmp.MinBy(x => x.FuelConsumption / x.ElectricPower); } diff --git a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs index 42c94ada790908d2e4738c008ef42098078168a5..e198f3a774097cf830318e2bfc940f4a71a842da 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/Strategies/TestPowertrain.cs @@ -43,6 +43,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public class TestPowertrain<T> where T: class, IHybridControlledGearbox, IGearbox { public SimplePowertrainContainer Container; + public IDataBus RealContainer; + public T Gearbox; public SimpleHybridController HybridController; @@ -63,6 +65,8 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public TestPowertrain(SimplePowertrainContainer container, IDataBus realContainer) { Container = container; + RealContainer = realContainer; + Gearbox = Container.GearboxCtl as T; HybridController = Container.HybridController as SimpleHybridController; @@ -110,9 +114,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies } //Brakes = new MockBrakes(container); } + + public void UpdateComponents() => Container.UpdateComponents(RealContainer); } - public class MockBrakes : VectoSimulationComponent, IBrakes + public class MockBrakes : VectoSimulationComponent, IBrakes, IUpdateable { public MockBrakes(IVehicleContainer container) : base(container) { @@ -138,6 +144,19 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Strategies public Watt BrakePower { get; set; } #endregion + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is IBrakes b) { + BrakePower = b.BrakePower; + return true; + } + + return false; + } + + #endregion } public class MockDrivingCycle : VectoSimulationComponent, IDrivingCycleInfo diff --git a/VectoCore/VectoCore/Models/SimulationComponent/SwitchableClutch.cs b/VectoCore/VectoCore/Models/SimulationComponent/SwitchableClutch.cs index 9b8d9bbe851ce95fcb5c2485e95e731f112560f8..3cd054bcf8f9e1c86fea271a987f5f89928b9d9b 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/SwitchableClutch.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/SwitchableClutch.cs @@ -142,5 +142,18 @@ namespace TUGraz.VectoCore.Models.SimulationComponent #endregion #endregion + + #region Implementation of IUpdateable + + public override bool UpdateFrom(object other) { + if (other is SwitchableClutch c) { + PreviousState = c.PreviousState.Clone(); + ClutchOpen = c.ClutchOpen; + return true; + } + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs b/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs index fc4bdcb94e16870aa78e5e62244ead66d1fd734e..9e2874f554efc2aeb604ab301e790e249654dc86 100644 --- a/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs +++ b/VectoCore/VectoCore/Models/SimulationComponent/VectoSimulationComponent.cs @@ -146,5 +146,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent OutTorque = outTorque; OutAngularVelocity = outAngularVelocity; } + + public SimpleComponentState Clone() => (SimpleComponentState)MemberwiseClone(); } } \ No newline at end of file diff --git a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs index d74e5936b04e372a22cc2c44fd5aa9c3e33f866e..d72c196e6f3a646ec6985da39dd8a58fef454ecb 100644 --- a/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs +++ b/VectoCore/VectoCore/OutputData/FileIO/JSONFileWriter.cs @@ -154,10 +154,10 @@ public class JSONFileWriter : IOutputFileWriter var currentGear = new Dictionary<string, object> { { JsonKeys.Gearbox_Gear_Ratio, gear.Ratio } }; - if(gear.MaxOutputShaftSpeed != null) + if(gear.MaxOutputShaftTorque != null) currentGear.Add(JsonKeys.Gearbox_Gear_MaxOutShaftTorque, gear.MaxOutputShaftTorque.Value()); if(gear.MaxOutputShaftSpeed != null) - currentGear.Add(JsonKeys.Gearbox_Gear_MaxOutShaftSpeed, gear.MaxOutputShaftSpeed.Value()); + currentGear.Add(JsonKeys.Gearbox_Gear_MaxOutShaftSpeed, gear.MaxOutputShaftSpeed.AsRPM); gears.Add(currentGear); } diff --git a/VectoCore/VectoCore/OutputData/XML/ComponentWriter/ComponentWriterNinjectModule.cs b/VectoCore/VectoCore/OutputData/XML/ComponentWriter/ComponentWriterNinjectModule.cs index 3f3db79d76b2e71da25560524c8385f86ad378ec..015197523b60bc480e6c83c7d20e26d9aa617ece 100644 --- a/VectoCore/VectoCore/OutputData/XML/ComponentWriter/ComponentWriterNinjectModule.cs +++ b/VectoCore/VectoCore/OutputData/XML/ComponentWriter/ComponentWriterNinjectModule.cs @@ -20,7 +20,7 @@ namespace TUGraz.VectoCore.OutputData.XML.ComponentWriter //ADASTypes - var v2102 = XMLDeclarationNamespaces.v2_10_2; + var v2102 = XMLDeclarationNamespaces.V24; Bind<IDeclarationAdasWriter>().To<AdasConventionalWriter>(). Named(GetName(GroupNames.ADAS_Conventional_Type, v2102)); diff --git a/VectoCore/VectoCore/OutputData/XML/GroupWriter/XMLGroupWriterNinjectModule.cs b/VectoCore/VectoCore/OutputData/XML/GroupWriter/XMLGroupWriterNinjectModule.cs index 8b46e43aa233bfcba2c95f6a080357daa2e20ff7..084c13b344a0414f3707190a63d4f11e788af428 100644 --- a/VectoCore/VectoCore/OutputData/XML/GroupWriter/XMLGroupWriterNinjectModule.cs +++ b/VectoCore/VectoCore/OutputData/XML/GroupWriter/XMLGroupWriterNinjectModule.cs @@ -22,7 +22,7 @@ namespace TUGraz.VectoCore.OutputData.XML.GroupWriter Bind<IGroupWriterFactory>().ToFactory(() => new UseFirstTwoArgumentsAsInstanceProvider(1, false)).InSingletonScope(); ///Vehicle V2_10_2 - var v2102 = XMLDeclarationNamespaces.v2_10_2; + var v2102 = XMLDeclarationNamespaces.V24; Bind<IVehicleDeclarationGroupWriter>().To<CompletedBusGeneralParametersWriterV2_10_2>().InSingletonScope(). Named(GetName(GroupNames.Vehicle_CompletedBus_GeneralParametersSequenceGroup, v2102)); Bind<IVehicleDeclarationGroupWriter>().To<CompletedBusParametersWriterV2_10_2>().InSingletonScope(). diff --git a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationNamespaces.cs b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationNamespaces.cs index fb74d2980b0303cad5bb2489ef9e8534637d76f8..47ab2e5bb42d3161bce0e91fdbf78bc522d8b1c7 100644 --- a/VectoCore/VectoCore/OutputData/XML/XMLDeclarationNamespaces.cs +++ b/VectoCore/VectoCore/OutputData/XML/XMLDeclarationNamespaces.cs @@ -16,6 +16,7 @@ namespace TUGraz.VectoCore.OutputData.XML public static readonly XNamespace V26 = DeclarationDefinition + ":DEV:v2.6"; public static readonly XNamespace V21 = DeclarationDefinition + ":v2.1"; public static readonly XNamespace V23 = DeclarationDefinition + ":DEV:v2.3"; + public static readonly XNamespace V24 = DeclarationDefinition + ":v2.4"; public static readonly XNamespace V20 = DeclarationDefinition + ":v2.0"; public static readonly XNamespace V10 = DeclarationDefinition + ":v1.0"; public static readonly XNamespace V28 = DeclarationDefinition + ":DEV:v2.8"; diff --git a/VectoCore/VectoCore/Utils/SearchAlgorithm.cs b/VectoCore/VectoCore/Utils/SearchAlgorithm.cs index d821eaf669d44e01054d220d36b619588a79c13d..4fe1b3ca9cd1ed8a31de51b052ff2632001cc252 100644 --- a/VectoCore/VectoCore/Utils/SearchAlgorithm.cs +++ b/VectoCore/VectoCore/Utils/SearchAlgorithm.cs @@ -178,7 +178,6 @@ namespace TUGraz.VectoCore.Utils //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.LocalData.Select(d => d.b).Join()); @@ -295,7 +294,6 @@ namespace TUGraz.VectoCore.Utils 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.LocalData.Select(d => d.b).Join()); diff --git a/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs b/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs index d78e66dd6bea66512708184f4d9991a4c7b25b3d..3030e51b634808bc89fdf9acfa013ee96fcab7a9 100644 --- a/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs +++ b/VectoCore/VectoCoreTest/Integration/CompletedBus/CompletedBusFactorMethodTest.cs @@ -882,7 +882,7 @@ namespace TUGraz.VectoCore.Tests.Integration.CompletedBus genericDriver.LookAheadCoasting.LookAheadDistanceFactor); Assert.AreEqual(genericDriver.LookAheadCoasting, specificDriver.LookAheadCoasting); - Assert.AreEqual(true, genericDriver.OverSpeed.Enabled); + Assert.AreEqual(false, genericDriver.OverSpeed.Enabled); Assert.AreEqual(DeclarationData.Driver.OverSpeed.MinSpeed, genericDriver.OverSpeed.MinSpeed); Assert.AreEqual(DeclarationData.Driver.OverSpeed.AllowedOverSpeed, genericDriver.OverSpeed.OverSpeed); Assert.AreEqual(genericDriver.OverSpeed, specificDriver.OverSpeed); diff --git a/VectoCore/VectoCoreTest/Integration/XMLReportTest.cs b/VectoCore/VectoCoreTest/Integration/XMLReportTest.cs index 0cc437a0238b53d8f57c1dfc69a7f17f66d64cf7..5a4db3dbbb6edcf98fb40e13e5c722d00378f84e 100644 --- a/VectoCore/VectoCoreTest/Integration/XMLReportTest.cs +++ b/VectoCore/VectoCoreTest/Integration/XMLReportTest.cs @@ -129,11 +129,11 @@ namespace TUGraz.VectoCore.Tests.Integration //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_4x2_vehicle-class-3_EURO6_2018.xml"), //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_4x2_vehicle-class-4_EURO6_2018.xml"), TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Tractor_4x2_vehicle-class-5_EURO6_2018.xml"), - //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_6x2_vehicle-class-9_EURO6_2018.xml"), - //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Tractor_6x2_vehicle-class-10_EURO6_2018.xml"), - //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_6x4_vehicle-class-11_EURO6_2018.xml"), - //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Tractor_6x4_vehicle-class-12_EURO6_2018.xml"), - TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_8x4_vehicle-class-16_EURO6_2018.xml")] + TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_6x2_vehicle-class-9_EURO6_2018.xml"), + //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Tractor_6x2_vehicle-class-10_EURO6_2018.xml"), + //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_6x4_vehicle-class-11_EURO6_2018.xml"), + //TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Tractor_6x4_vehicle-class-12_EURO6_2018.xml"), + TestCase(@"TestData\XML\XMLReaderDeclaration\GroupTest\Rigid Truck_8x4_vehicle-class-16_EURO6_2018.xml")] public void TestXMLSummaryReportExists(string jobfile) { var dataProvider = xmlInputReader.CreateDeclaration(jobfile); diff --git a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs index b9a879cade91ac8ed597c404028e856d094fb63a..9693e144ff62a8a0d1bd9a5a3e7256eeaa8c7bdc 100644 --- a/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs +++ b/VectoCore/VectoCoreTest/Models/Declaration/DeclarationDataTest.cs @@ -334,14 +334,15 @@ namespace TUGraz.VectoCore.Tests.Models.Declaration } [TestCase("only the drive shaft of the PTO - shift claw, synchronizer, sliding gearwheel", 50), - TestCase("only the drive shaft of the PTO - multi-disc clutch", 1000), - TestCase("only the drive shaft of the PTO - multi-disc clutch, oil pump", 2000), - TestCase("drive shaft and/or up to 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 300), - TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch", 1500), - TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch, oil pump", 3000), - TestCase("drive shaft and/or more than 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 600), - TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch", 2000), - TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch, oil pump", 4000), + TestCase("only the drive shaft of the PTO - multi-disc clutch", 350), + TestCase("only the drive shaft of the PTO - multi-disc clutch, oil pump", 3000), + TestCase("drive shaft and/or up to 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 150), + TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch", 400), + TestCase("drive shaft and/or up to 2 gear wheels - multi-disc clutch, oil pump", 3050), + TestCase("drive shaft and/or more than 2 gear wheels - shift claw, synchronizer, sliding gearwheel", 200), + TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch", 450), + TestCase("drive shaft and/or more than 2 gear wheels - multi-disc clutch, oil pump", 3100), + TestCase("PTO which includes 1 or more additional gearmesh(es), without disconnect clutch", 1500), TestCase("only one engaged gearwheel above oil level", 0)] public void AuxPTOTransmissionTest(string technology, double value) { diff --git a/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs b/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs index 304b051c8294fdf6506a8ed370425ac3133f6007..479abf518325f8a4b02b3f643f04f50443ead14a 100644 --- a/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs +++ b/VectoCore/VectoCoreTest/Models/Simulation/PwheelModeTests.cs @@ -179,7 +179,7 @@ namespace TUGraz.VectoCore.Tests.Models.Simulation }; // call builder (actual test) - var jobContainer = PowertrainBuilder.Build(data, new MockModalDataContainer()); + var jobContainer = PowertrainBuilder.Build(data, new MockModalDataContainer(), container => {}); } /// <summary> diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto index e19150c83618395c69db102b100b2b5f86454850..ba8202f067e933c6f2cd89ed52a5467f0f112061 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed+Axle/IEPC_ENG_Gbx1Axl.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1Axl.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto index 6cc64ff5def0f1da6b0d8886c28e8766af675975..1dd51ccf02019fe181c5badaa0dbab77f59cf43f 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl1/IEPC_ENG_Gbx1Whl1.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1Whl1.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto index 588039a710bb50e1812a6280716bfd2d173aa006..81cc58e814c1a3820881479d3bf415b846a5139b 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed-Whl2/IEPC_ENG_Gbx1Whl2.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1Whl2.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto index cbac5f5b98ffd3ea3898e10e3c21a2bdefb0fd8b..06cacde4807c12faa7f4722ba2ee71390e7784c2 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx1Speed/IEPC_ENG_Gbx1.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx1.vveh", "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto index 18db3d71b4ebdaa1349292d4d437a40c9a80f158..21a2352cde5e232cf14f1544fb8d827041ab6367 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed+Axle/IEPC_ENG_Gbx3Axl.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3Axl.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto index 9690d09aa289af9262fcbb00b8ec99eadcce93bf..3175f83ee9e4ec595a6d40d08321563bec18d439 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl1/IEPC_ENG_Gbx3Whl1.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3Whl1.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto index e8e507aeeaae83a7255e425e2b9134ac82860c7f..ad0b870299038f1c349f7dfa238b6ebfdf9dddd8 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed-Whl2/IEPC_ENG_Gbx3Whl2.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3Whl2.vveh", "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto index 146dfc42c35740688df216b61ebf31ead92f1074..8328d24a4f7528cfb1b4ca0514b165fea3c01dbd 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3.vveh", "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto index 33adc6edc976be6d12ddeee3b5bdbfab21a3078d..827203304d4e57baf3969bc144df68ebe9b383d7 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericIEPC/IEPC_Gbx3Speed/IEPC_ENG_Gbx3_drag.vecto @@ -11,7 +11,7 @@ "VehicleFile": "IEPCVehicle_Gbx3_drag.vveh", "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG.vecto index e2f6ed93a6696a8fa7aae1ebba919c150f420657..8d82756d7f1b98a89e6182b180626404ea42bd48 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "Transmission\\AMT_12.vgbx", "TCU": "Transmission\\AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed.vecto index ec266b20cc3dc2fc8c20f670fae33786d01c5ab8..66bba96eaddbeb065d0c95aa91995032fdeeeb32 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "3speedEV.vgbx", "TCU": "3speedEV.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed_PTO.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed_PTO.vecto index ec266b20cc3dc2fc8c20f670fae33786d01c5ab8..66bba96eaddbeb065d0c95aa91995032fdeeeb32 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed_PTO.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_3speed_PTO.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "3speedEV.vgbx", "TCU": "3speedEV.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_BusAux.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_BusAux.vecto index ad0c66fd9de8f64feb647900fa7e0c9a56874fda..6743a508040d5974319c4db16072dc099d512458 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_BusAux.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_BusAux.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "Transmission\\AMT_12.vgbx", "TCU": "Transmission\\AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "BusAux": "PEV-BusAux.vaux", "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_Cont30kW.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_Cont30kW.vecto index 04b69288e4334d0eab87a44a8ebf08d585b80282..3b65310ebef94914d0a6170b2192e5b957940faa 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_Cont30kW.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB2/BEV_ENG_Cont30kW.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle_Cont30kW.vveh", "GearboxFile": "Transmission\\AMT_12.vgbx", "TCU": "Transmission\\AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG.vecto index d69297d3ed4882ce1c708668d7b5206376557e2f..51dd2a06950949301086db652838b462be5b450e 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "Axle.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG_Cont30kW.vecto b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG_Cont30kW.vecto index 705655eaba2db9136cd90e30270f850807a310b1..8ec9fd1af2ba384fd7b4ffa2480fd96e629c8435 100644 --- a/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG_Cont30kW.vecto +++ b/VectoCore/VectoCoreTest/TestData/BatteryElectric/GenericVehicleB3/BEV_ENG_Cont30kW.vecto @@ -10,7 +10,7 @@ "EngineOnlyMode": false, "VehicleFile": "BatteryElectricVehicle_Cont30kW.vveh", "GearboxFile": "Axle.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithAxlegearInputRetarder.vecto b/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithAxlegearInputRetarder.vecto index 5b5966ed15e472fb25689e1726ae6e73e6ff354a..6558eb7b69156fa298eda476a4875e1023b4345a 100644 --- a/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithAxlegearInputRetarder.vecto +++ b/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithAxlegearInputRetarder.vecto @@ -9,7 +9,7 @@ "SavedInDeclMode": false, "VehicleFile": "E3WithAxlegearInputRetarder.vveh", "GearboxFile": "Axle.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithoutAxlegearInputRetarder.vecto b/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithoutAxlegearInputRetarder.vecto index b22ec1812d358119f628b2faa56164b3f270fcb6..016c4a91ed91ad0744db4077634e25e85c042768 100644 --- a/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithoutAxlegearInputRetarder.vecto +++ b/VectoCore/VectoCoreTest/TestData/Components/Retarder/E3/E3WithoutAxlegearInputRetarder.vecto @@ -9,7 +9,7 @@ "SavedInDeclMode": false, "VehicleFile": "E3WithoutAxlegearInputRetarder.vveh", "GearboxFile": "Axle.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto index 3a4d93f4e55bb31268825f80295bf5fa14d13d01..8a512cdc25ac9820315eebe7f86c5e092cdd846c 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed+Axle/IEPC-S_ENG_Gbx1Axl.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto index 23dc4d8779da2a340976283944f098d7eb74b70f..2ab4f8bf9b742f0a46926c1420d415675ee3666b 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl1/IEPC-S_ENG_Gbx1Whl1.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto index d826a010c7133b88f2373c6b8335da18a2eee0c8..5d89f019a50181b0141105044b797fde6a715aef 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed-Whl2/IEPC-S_ENG_Gbx1Whl2.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto index d2d2ae973f430cb783c48cda76335d11ebaa8890..5925a85219ca99d7b501ff3f7bf79958daa47892 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx1Speed/IEPC-S_ENG_Gbx1.vecto @@ -13,7 +13,7 @@ "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto index f06545a5fa8c567c132fcd4291c0c5292bcce37c..062c8afc0b9a5bff0446643fa4bc12dafda2e3fd 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed+Axle/IEPC-S_ENG_Gbx3Axl.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto index 4e6fcefa3c70689d8a89bcd47a51d7a232e28799..9538da5609863d3ffaa9bf85c2de1d8c1b9bc71b 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl1/IEPC-S_ENG_Gbx3Whl1.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto index f402ce770e3afc13e7c5ea64530f48e7a1d7fbad..2fd2b70b39928185dfc0386856f71fbc24538f4e 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed-Whl2/IEPC-S_ENG_Gbx3Whl2.vecto @@ -13,7 +13,7 @@ "GearboxFile": "", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto index 72acd74aa5bf7b92fd7d255647930ba7d795b433..e2d61bb3cf1cc8ca5c0cb018ba79199940c984c0 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3.vecto @@ -13,7 +13,7 @@ "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto index aad5769a42aa7bd720108aafe4ffa096c0f3c056..7ec225a223d54ed23c9cd0574f4530a400a3482e 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericIEPC-S/IEPC-S_Gbx3Speed/IEPC-S_ENG_Gbx3_drag.vecto @@ -13,7 +13,7 @@ "GearboxFile": "Axlegear.vgbx", "TCU": "../Common/ShiftParameters.vtcu", "HybridStrategyParams": "../Common/Hybrid_Parameters.vhctl", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "../Common/Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_S2_Job/BEV_ENG.vecto b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_S2_Job/BEV_ENG.vecto index e2f6ed93a6696a8fa7aae1ebba919c150f420657..8d82756d7f1b98a89e6182b180626404ea42bd48 100644 --- a/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_S2_Job/BEV_ENG.vecto +++ b/VectoCore/VectoCoreTest/TestData/Hybrids/GenericVehicle_S2_Job/BEV_ENG.vecto @@ -11,7 +11,7 @@ "VehicleFile": "BatteryElectricVehicle.vveh", "GearboxFile": "Transmission\\AMT_12.vgbx", "TCU": "Transmission\\AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_NoADAS.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_NoADAS.vecto index 54a59ab91ee0ecc110bda2d8cf6d5987ddfc7f87..4cf15812e921aa297cc1b79a04d2173f59d12748 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_NoADAS.vecto +++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_NoADAS.vecto @@ -10,7 +10,7 @@ "VehicleFile": "Class5_E2_NoADAS.vveh", "GearboxFile": "AMT_12.vgbx", "TCU": "AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC12.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC12.vecto index 2acb421b46b679d886d0daa000a6e4b3b050b290..4a956d908cc324c9ae5c935f0bd0dd68d93803a7 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC12.vecto +++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC12.vecto @@ -10,7 +10,7 @@ "VehicleFile": "Class5_E2_PCC12.vveh", "GearboxFile": "AMT_12.vgbx", "TCU": "AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC123.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC123.vecto index e558eb2ca5c936b21db3ae2d9e6fbaa131927e30..bb51af7c5a5c2eeece5c7b7e15e2c73b1c7f5d17 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC123.vecto +++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E2_PCC123.vecto @@ -10,7 +10,7 @@ "VehicleFile": "Class5_E2_PCC123.vveh", "GearboxFile": "AMT_12.vgbx", "TCU": "AMT_12.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E3_PCC123.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E3_PCC123.vecto index 9bce71d427a4484045db6fef5fe8b1efc52abfce..bad6f441fb8357612fca69b0521b5204f679787f 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E3_PCC123.vecto +++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E3_PCC123.vecto @@ -9,7 +9,7 @@ "SavedInDeclMode": false, "VehicleFile": "Class5_E3_PCC123.vveh", "GearboxFile": "Axle.vgbx", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E4_PCC123.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E4_PCC123.vecto index 5435ec8f994f828a4330acc40402b16c5029be22..ce5a2813a4ad2bee44c1c833c0986990868adb3e 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E4_PCC123.vecto +++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/Group5PCCEng/Class5_E4_PCC123.vecto @@ -8,7 +8,7 @@ "Body": { "SavedInDeclMode": false, "VehicleFile": "Class5_E4_PCC123.vveh", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/VECTO-1483/E4_Group 5 LH_ll.vecto b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/VECTO-1483/E4_Group 5 LH_ll.vecto index 441d634fe82a10701f6c315fb4805be12b302ad7..558661d334ad4adc3ff5d055d43d0e8678ffa0ae 100644 --- a/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/VECTO-1483/E4_Group 5 LH_ll.vecto +++ b/VectoCore/VectoCoreTest/TestData/Integration/ADAS-PEV/VECTO-1483/E4_Group 5 LH_ll.vecto @@ -8,7 +8,7 @@ "Body": { "SavedInDeclMode": false, "VehicleFile": "E4_Group5_LH_ll.vveh", - "Padd_electric": 3540.0, + "Padd_electric": 0.0, "VACC": "Truck.vacc", "EngineStopStartAtVehicleStopThreshold": 2.0, "EngineStopStartMaxOffTimespan": 120.0, diff --git a/VectoCore/VectoCoreTest/Utils/MockBrakes.cs b/VectoCore/VectoCoreTest/Utils/MockBrakes.cs index 755580cfdaac54c5bb8776c400073a7a9cba8365..eba2ca40b3d624acc1d5e0c3fc28dde1ae9fcdde 100644 --- a/VectoCore/VectoCoreTest/Utils/MockBrakes.cs +++ b/VectoCore/VectoCoreTest/Utils/MockBrakes.cs @@ -36,7 +36,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Tests.Utils { - public class MockBrakes : VectoSimulationComponent, IBrakes + public class MockBrakes : VectoSimulationComponent, IBrakes, IUpdateable { public MockBrakes(IVehicleContainer vehicle) : base(vehicle) { @@ -48,5 +48,18 @@ namespace TUGraz.VectoCore.Tests.Utils protected override void DoWriteModalResults(Second time, Second simulationInterval, IModalDataContainer container) {} protected override void DoCommitSimulationStep(Second time, Second simulationInterval) {} + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + if (other is IBrakes b) { + BrakePower = b.BrakePower; + return true; + } + + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs index 8f656aa0f2f11b41ab940f0c0c43e3ea5b921a6d..1e83d9820061133dbf102f5aa7fb910f448d731b 100644 --- a/VectoCore/VectoCoreTest/Utils/MockGearbox.cs +++ b/VectoCore/VectoCoreTest/Utils/MockGearbox.cs @@ -131,6 +131,8 @@ namespace TUGraz.VectoCore.Tests.Utils return _clutchClosed; } + public bool RequestAfterGearshift { get; set; } + public bool ClutchClosed(Second absTime) { return _clutchClosed; diff --git a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs index 2ed1530d619674ed8ca686e7fa248356d731ac0e..c8deb24c1f02e08ba6757a95f3dd127ef84b8d8b 100644 --- a/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs +++ b/VectoCore/VectoCoreTest/Utils/MockVehicleContainer.cs @@ -48,7 +48,7 @@ using TUGraz.VectoCore.OutputData; namespace TUGraz.VectoCore.Tests.Utils { - public class MockVehicleContainer : IVehicleContainer, IEngineInfo, IEngineControl, IVehicleInfo, IClutchInfo, IBrakes, IAxlegearInfo, IWheelsInfo, IDriverInfo, IDrivingCycleInfo, IMileageCounter, IGearboxInfo, IGearboxControl, IPowertainInfo + public class MockVehicleContainer : IVehicleContainer, IEngineInfo, IEngineControl, IVehicleInfo, IClutchInfo, IBrakes, IAxlegearInfo, IWheelsInfo, IDriverInfo, IDrivingCycleInfo, IMileageCounter, IGearboxInfo, IGearboxControl, IPowertainInfo, IUpdateable { // only CycleData Lookup is set / accessed... @@ -315,6 +315,8 @@ namespace TUGraz.VectoCore.Tests.Utils return ClutchClosed(absTime); } + public bool RequestAfterGearshift { get; set; } + #endregion public IEnumerable<ISimulationPreprocessor> GetPreprocessingRuns { get { return new ISimulationPreprocessor[] { }; } } @@ -339,5 +341,13 @@ namespace TUGraz.VectoCore.Tests.Utils public VectoSimulationJobType VehicleArchitecutre { get; } #endregion + + #region Implementation of IUpdateable + + public bool UpdateFrom(object other) { + return false; + } + + #endregion } } \ No newline at end of file diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs index 3b8acaf915aac426e8528049a394595062d20d59..2bbb611ebd9468ba3e53bcb90db23813c14a014e 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputTest.cs @@ -859,7 +859,7 @@ namespace TUGraz.VectoCore.Tests.XML var lookup = DeclarationData.PTOTransmission.Lookup(ptoDataProvider.PTOTransmissionType); Assert.AreEqual("only the drive shaft of the PTO - multi-disc clutch", ptoDataProvider.PTOTransmissionType); - Assert.AreEqual(1000, lookup.PowerDemand.Value()); + Assert.AreEqual(350, lookup.PowerDemand.Value()); } [TestCase] diff --git a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv24.cs b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv24.cs index e9489aa2ba4b7a7b8a6809e436588f839bee105e..c209074e66391df9f42de882021fbba7410dc076 100644 --- a/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv24.cs +++ b/VectoCore/VectoCoreTest/XML/XMLDeclarationInputv24.cs @@ -802,7 +802,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.IsNull(vehicle.Components.AngledriveInputData); Assert.IsNull(vehicle.Components.RetarderInputData); Assert.IsNull(vehicle.Components.AirdragInputData); - Assert.AreEqual(0, vehicle.TorqueLimits.Count); + Assert.IsNull(vehicle.TorqueLimits); Assert.IsNull(vehicle.ElectricMotorTorqueLimits);//Vehicle EM Drive Limits } else @@ -1007,7 +1007,7 @@ namespace TUGraz.VectoCore.Tests.XML Assert.IsNull(vehicle.Components.RetarderInputData); Assert.IsNull(vehicle.Components.AirdragInputData); Assert.IsNull(vehicle.CargoVolume); - Assert.IsEmpty(vehicle.TorqueLimits); + Assert.IsNull(vehicle.TorqueLimits); Assert.IsNull(vehicle.ElectricMotorTorqueLimits); } else @@ -1155,7 +1155,7 @@ namespace TUGraz.VectoCore.Tests.XML { Assert.IsNull(vehicle.Components.AngledriveInputData); Assert.IsNull(vehicle.Components.RetarderInputData); - Assert.IsEmpty(vehicle.TorqueLimits); + Assert.IsNull(vehicle.TorqueLimits); Assert.IsNull(vehicle.ElectricMotorTorqueLimits); } else