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 Analyze Power and Energy 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.
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.
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:
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
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
Eff property implements this equation.
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
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
xlsSysSummary method to export the analysis to an Excel spreadsheet.
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
sdiSummary method to create Simulation Data Inspector power,
energy, and efficiency signal plots.
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 transferred between blocks:
Power crossing the block boundary, but not transferred:
Stored energy rate of change:
Energy rate of change:
The power signals satisfy this equation.
To conserve energy, sum of transferred power signals must be near zero.
The equations use these variables.
Not transferred power
Input and output power logged by Power Accounting Bus Creator block
Power Accounting Bus Creator |