Once the requests of the mechanical part have been defined, it is necessary to consider the electrical part to take into account any limitations given by the batteries and for the calculation of the power, current, voltage and SOC (State of Charge) parameters of the battery pack.

#### 2.2.1. Battery Limitations

To know the power that the electric motors must request from the batteries (or the power that thanks to the motors recharge the batteries) it is necessary to know the powers lost due to the Joule effect due to the resistances of the electric cables that connect the motors and batteries themselves. Obviously, the connection cables are present only in the presence of the relative motor; therefore, in the absence of the latter the related resistance is considered null. The connection cables’ resistances between batteries and front

${R}_{cable\_F}$ and rear

${R}_{cable\_R}$ motor are calculated as follows:

where

${\rho}_{Cu}$ is the resistivity of copper (or any other material the electrical cables under consideration can be made),

${L}_{cable\_F}$ and

${L}_{cable\_R}$ are the total lengths of the connection cables of the front and rear motor respectively,

$\frac{\pi}{4}{\left({\Phi}_{cable\_F}\right)}^{2}$ and

$\frac{\pi}{4}{\left({\Phi}_{cable\_R}\right)}^{2}$ are the cross-sectional areas of the front and rear cables while

${\Phi}_{cable\_F}$ is the diameter of the front cables and

${\Phi}_{cable\_R}$ is the diameter of the rear cables.

Within the “Power Required” block, the total power required of the batteries by the electric motors (or that the motors could guarantee as input to the batteries) is calculated, instant by instant. This power is the result of an approximation as no voltage drop is considered as regards the resistance of cables and electric motors. In particular, the total power required

${P}_{tot\_req}$ is equal to the sum of the power required by the front motor

${P}_{req\_F}$ and that required by the rear motor

${P}_{req\_R}$. The calculation of the latter two quantities is represented in Equations (17) and (18).

where

$Y$ and

$Z$ are worth 1 if the motors require energy from the batteries, -1 if the motors act as generators by sending energy to the battery pack.

$V$ is the voltage of the battery pack and is calculated in the Simulink “Battery Pack” block of the model,

${\eta}_{mot\_ref\_F}$ and

${\eta}_{mot\_ref\_R}$ are the electrical efficiencies of the front and rear motor and they are obtained through a special block, which is present inside the “Power Required” block. The electrical efficiencies of the motors are calculated by the model only if the considered motor is present, otherwise the relative efficiency is set to zero. In particular, the efficiency of each motor is obtained thanks to a two-dimensional Lookup Table that receives in input the motor torque and motor speed and returns the efficiency.

To calculate the overall power input or output from the battery pack, it is also necessary to know the power supplied by the generators (if they are present). In this first version of the model, the possibility of integrating the vehicle with a number of generators ${N}_{gen}$ that is zero or greater than zero was considered, where all the generators installed on the vehicle are identical and all have the same operation instant by instant.

Furthermore, no resistance of the connection cables between generators and batteries was considered, considered negligible. In particular, the generators have a constant rotation speed and a constant rated power output over time, unless the need to cut power due to the limitations imposed by the maximum performance of the battery pack.

In the “Generators” subassembly, the electrical efficiency of the single generator is obtained starting from the nominal power (${P}_{gen\_nom}$, positive) of the single generator and its rotation speed ${\omega}_{gen}$, through a two-dimensional Lookup Table. Multiplying the efficiency by the rated power and by the number of generators gives the total maximum power value (${P}_{gen\_th}$, positive) that the generators can supply as input to the battery pack.

For the comparison of the balance of the power required, entering or leaving the battery pack, with the limitations of the pack itself, it is also necessary to consider the contribution of the power lost inside the cells due to their electrical resistance. First of all, the model, starting from the total power entering or leaving the battery pack and the voltage of the pack, calculates the theoretically required current

${I}_{req}$ if there are no limitations given by the batteries, as in Equation (19).

where

${P}_{acc}$ is the total power consumed by the vehicle accessories, considered constant. A Lookup Table, which receives the temperature of the battery pack and the SOC at the input, returns the resistance

$R$ of the single cell to the output.

Finally, the calculation of the total power

${P}_{battI2R}$ of all cells, dissipated by Joule effect in the entire battery pack is:

where

${N}_{s}$ corresponds to the number of cells arranged in series inside the battery pack, while

${N}_{p}$ the number of those arranged in parallel. The power dissipated by the Joule effect thus obtained is relative to the case in the absence of limitations given by the maximum performance of the battery pack, but will be used, as an approximation, even in the cases in the presence of such limitations. In this way, in limited condition, an approximation of the power lost due to the internal resistance of the cells is made for excess. In the “Battery Limitations” block, the discharging and charging limitations of the batteries are considered. These limitations can be expressed as powers or as currents.

In particular, these limits are defined in function of the SOC of the pack and they are obtained in a dedicated subassembly which will be described later. The power balance shown below, in Equations (21) and (22), allows one to distinguish the case of discharge from that of recharging the batteries.

Discharge of the battery pack:

Charge of the battery pack:

Depending on whether the power balance mentioned above is positive (or null) or negative, one passes to considering an “if” subassembly or another in the Simulink model. In the case that the previous power balance is positive or null, the desired variables are the output from the “if” subassembly “Battery Discharge”. In this case, the generators can work by supplying the entire rated power as output, without the need for limitations.

In this block there are in turn two further “if” checks that divide the case in which there is no limitation imposed by the battery pack from that in which the power absorbed by the electric motors must be limited. The available power

${P}_{available}$, which can be taken from the battery pack, is calculated as:

which is valid in the event that the discharge limit of the battery pack is supplied as a limit current (positive,

${I}_{dischrg\_limit}$), if it is expressed as a power (positive,

${P}_{dischrg\_limit}$) the previous relationship must be reconstructed as follows:

where

${P}_{buffer}$ is simply a constant power that is used to keep within the discharge and charge limits with a defined tolerance, equal to the value of this constant and

${P}_{gen}$ is the “real” power supplied to the batteries by the generators, which in case of discharge is equal to the maximum power

${P}_{gen\_th}$, without the need for any limitation. The power to be taken from the battery pack consists of the sum of the power absorbed by the vehicle accessories (

${P}_{acc}$, considered constant) and the total power required by the electric motors

${P}_{tot\_req}$. By subtracting the contribution of these two powers from the maximum available, it is therefore possible to ascertain whether this is actually available and therefore no limitation is necessary or vice versa (i.e., if the result of this subtraction is positive or negative).

In the event that there are no limitations given by the battery pack being discharged, the required quantities will actually be the “real” ones of the vehicle, at the instant considered (remembering that the limitations of maximum drive torque have already been considered), and they will be taken as output from the first “if” block.

A binary control variable is also defined, $Limi{t}_{batt\_acc}$, defined in this case equal to 0, defined instead equal to 1 in the condition of limitation of the motors during traction due to the maximum performance of the batteries. The calculations are carried out in the second “if” block if it is necessary to impose limitations during the discharge phase. In the case with limitation in the discharge phase, if the available power is not enough even to power the accessories, obviously the electric motors will be turned off and it is necessary to define the ${P}_{acc}$ variable to keep track of the amount of power missing for the power supply of the accessories. ${P}_{acc}$ is defined equal to the difference between available power and power that should be absorbed by the accessories. On the other hand, if after the part of available power supplied to the accessories is considered, a part of power remains available; the latter will be used to power the electric motors.

In the presence of both motors, this power will be divided between front

${P}_{batt\_F}$ and rear

${P}_{batt\_R}$ through the distribution constant

$TractRati{o}_{acc}$. Below are the calculations of the front drive torque

${T}_{mot\_F}$, in Equation (25), and rear

${T}_{mot\_R}$, in Equation (27).

For the calculation of both motors torques, it is taken into account the resistance of the cables (but the relative voltage drop is neglected), the electrical efficiency of the motors (${\eta}_{mot\_F}$ and ${\eta}_{mot\_R}$, obtained by means of the Lookup Table, starting from the efficiency map of the motors) and the equality of the instantaneous rotation speed of the motor (${\omega}_{motor\_F}$ and ${\omega}_{motor\_R}$) is set as an approximation to the rotation speed relative to the previous instant of calculation (${\omega}_{motor\_prev\_F}$ and ${\omega}_{motor\_prev\_R}$) as show in the Equations (26) and (28).

The foregoing is valid in the event that the electric motors must absorb power from the battery pack, but it could fall into the limit case in which the motors act as generators (

${P}_{tot\_req}<0$), but the power absorbed by the accessories is still sufficient to ensure that the batteries are being discharged. In this case, no limitation is required for the motors torque and the

$\mathsf{\u2206}{P}_{acc}$ will be calculated as follows (29).

The

$Limi{t}_{batt\_acc}$ control variable is defined for both motors and the output variable to the “if” block will be equal to 1 if that relating to at least one motor is unitary (i.e., if at least one of the motors is limited by the maximum performance of the battery pack), equal to zero vice versa. If a motor (front or rear) is not present on the vehicle in question, all the relevant quantities are defined as null, including the

$Limi{t}_{batt\_acc}$ variable. In case that the battery pack is in a recharging condition, the desired variables are output from the “Battery Charge” “if” subassembly, contained in the “Battery Limitations” block. In the “Battery Charge” block there are in turn two further “if” blocks that divide the case in which there is no limitation imposed by the battery pack from that in which it is necessary to implement limitations. The maximum power that the battery pack can absorb

${P}_{absorbable}$ is calculated using the following equation:

Equation (30) is valid if the discharge limit of the battery pack is supplied as a limit current (negative,

${I}_{chrg\_limit}$), if it is expressed as a power (always negative,

${P}_{chrg\_limit}$) the previous relationship must be reconstructed as follows:

It is therefore possible to understand if it is necessary to make limitations or not, considering the power contributions of generators and electric motors. The outputs are obtained from the “if” subassembly relating to the absence of limitations if the inequality (32) is valid, from the “if” subassembly relating to the presence of limitations vice versa.

When no limitation is required during the battery discharge, the system variables are considered equal to those resulting from the comparison with the maximum performance of the electric motors. $Limi{t}_{batt\_brak}$ binary control variable is also defined, null in the absence of limitations of the electric motors when braking (and also even if the motors participate in traction), set equal to 1 in the case of motor limitation during regenerative braking, due to battery limitations. $Limi{t}_{gen}$ is instead a binary quantity useful for checking that the generators have been limited (when it is equal to 1) or less (equal to zero).

The “if” subassembly relating to the presence of current limitations is in turn divided into two “if” subassembly, “Without Motor Power Restrictions” and “With Regenerative Braking Restriction”. The model recovers the variables of interest from the first “if” block if the maximum

${P}_{absorbable}$ that the battery can absorb (negative) is less than or equal to the required power

${P}_{tot\_req}$ (input or output to the battery pack) from the motors, vice versa from the second “if” subassembly. The logic adopted is to limit the generators first, so as to be able to guarantee the regenerative braking of the motors within the limits (so as to be able to exploit the traditional brakes of the vehicle to a minimum) and only in case of need for further limitation also limit the electric motors. If it is sufficient to implement the limitation to the generators only, the only new quantity to be calculated is precisely the “real” power that the generators supply to the battery input

${P}_{gen}$, equal to the difference between the total power of the motors

${P}_{tot\_req}$ and the maximum absorbable power battery

${P}_{absorbable}$. The difference has been structured in this way to ensure that the power of the generators is positive. If it is also necessary to limit the power of the electric motors, the generators will be turned off and all the power supplied as input to the battery will be guaranteed by the electric motors

${P}_{mot\_tot}={P}_{absorbable}$. In this case, the control variables will assume the following binary values, represented in Equations (33) and (34).

The total power supplied by the motors

${P}_{mot\_tot}$ is divided between the front

${P}_{batt\_F}$ and the rear

${P}_{batt\_R}$ by means of the distribution constant

$TractRati{o}_{brak}$. The new quantities of the system are obtained by means of the Equations from (35) to (38).

Again, the motors’ efficiencies are obtained by means of Lookup Tables and the voltage drops caused by the resistances of the electric cables are neglected. Furthermore, the rotation speed of the motors is approximated to that of the previous calculation instant. This part of the Simulink model, which includes the limitations of the battery pack, represents part modelling of the BMS. The logic of the BMS is strongly linked to the type of battery and the strategies adopted by the vehicle manufacturer. For this reason, these logics can vary greatly depending on the type of vehicle and its mission.