Documentation

## Analyze Power and Energy

To assess powertrain efficiency, you can evaluate and report power and energy for component-level blocks and system-level reference applications.

These reference applications include live scripts that analyze the energy consumption. After you open the reference applications, double-click to open the live script. To generate the energy report, select Run.

The plant model blocks calculate transferred, stored, and not transferred power. The blocks use the Power Accounting Bus Creator to log the power signals that the live script uses. If you use your own block in the reference application, add the Power Accounting Bus Creator to your subsystem to log the power signals.

The live script provides:

• An overall energy summary that the script exports to an Excel® spreadsheet.

• Engine plant, electric plant, and drivetrain efficiencies, including an engine plant histogram of time spent at different efficiencies.

• Data logging so that you can use the Simulation Data Inspector to analyze the powertrain efficiency, power, and energy signals.

### Live Script

The live script uses the `autoblks.pwr.PlantInfo` class to turn on data logging, run the simulation, and report power and energy results. Before running the simulation, the script finds all of the Power Accounting Bus Creator blocks in the model and turns on data logging. During the simulation, the model logs the transferred, not transferred, and stored power. The script uses the logged data to calculate efficiency, energy loss, energy input, and energy output for each component and subsystem. If the component does not conserve energy, the script issues warnings. Finally, the script provides an overall vehicle energy summary, a detailed subsystem summary, and Simulation Data Inspector time series plots.

#### Run Simulation

When you run the simulation, the script creates the `autoblks.pwr.PlantInfo` object to analyze the model energy and power consumption. Use these properties to set the units:

• `PwrUnits`

• `EnrgyUnits`

When the script creates the `autoblks.pwr.PlantInfo` object, the constructor searches the model for Power Accounting Bus Creator blocks. Starting at the top-level model, the constructor creates a child object for each subsystem that contains Power Accounting Bus Creator blocks. The constructor stops at the blocks that have a Power Accounting Bus Creator.

To track the power transferred between the components, the constructor uses the transferred power ports defined in the Power Accounting Bus Creator block mask.

To calculate the efficiency, the `autoblks.pwr.PlantInfo` class `Eff` property implements this equation.

`$\eta =|\frac{\sum {P}_{output}-{\sum }^{\text{​}}{P}_{store}\left({P}_{store}>0\right)}{{\sum }^{\text{​}}{P}_{input}-{\sum }^{\text{​}}{P}_{store}\left({P}_{store}<0\right)}|$`

To determine if the system conserves energy, the `isEnrgyBalanced` method checks the energy conservation at each time step. If the energy conservation error is within an error tolerance, the method returns true.

#### Overall Summary

The overall summary provides the efficiency, energy loss, energy input, energy output, and energy stored at the component- and system-level. The summary includes hyperlinks that you can use to investigate model blocks and subsystems.

The script uses the `autoblks.pwr.PlantInfo` class `xlsSysSummary` method to export the analysis to an Excel spreadsheet.

#### Plant Summary

The script provides engine plant, electric plant, and drivetrain efficiencies. Specifically, the script includes the signal energy, and an engine efficiency histogram.

#### Simulation Data Inspector Summary

The script includes the `autoblks.pwr.PlantInfo` class `sdiSummary` method to create Simulation Data Inspector power, energy, and efficiency signal plots.

### Power Signals

The system-level power and energy accounting tests that the system satisfies the conservation of energy. If the component does not conserve energy, the live script issues warnings.

The Power Accounting Bus Creator for the plant blocks in the reference applications sort the signals into three power types.

Power TypeDescriptionExamples

Ptrans

Transferred

Power transferred between blocks:

• Positive signals indicate flow into block

• Negative signals indicate flow out of block

• Crankshaft power transferred from mapped engine to transmission.

• Rate of heat flow transferred from throttle to manifold volume.

Pnottrans

Not transferred

Power crossing the block boundary, but not transferred:

• Positive signals indicate an input

• Negative signals indicate a loss

• Rate of heat transfer with the environment.

• From environment is an input (positive signal)

• To environment is a loss (negative signal)

• Flow boundary with the environment.

• From environment is an input (positive signal)

• To environment is a loss (negative signal)

• Mapped engine fuel flow.

Pstore

Stored

Stored energy rate of change:

• Positive signals indicate an increase

• Negative signals indicate a decrease

Energy rate of change:

• Battery storage

• Kinetic energy in drivetrain components

• Vehicle potential energy

• Vehicle velocity

The power signals satisfy this equation.

`${\sum }^{\text{​}}{P}_{trans}+{\sum }^{\text{​}}{P}_{nottrans}={\sum }^{\text{​}}{P}_{store}$`

To conserve energy, sum of transferred power signals must be near zero.

The equations use these variables.

 Ptrans Transferred power Pnottrans Not transferred power Pstore Stored power Pinput, Poutput Input and output power logged by Power Accounting Bus Creator block