Main Content

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.

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 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.

Energy

After a simulation, the autoblks.pwr.PlantInfo class calculates changes in stored, input, and output energy for each signal using these equations.

ΔEstore=0tfinalPstoredt              ΔEinput=0tfinalPinputdt             ΔEoutput=0tfinalPoutputdt

Negative changes in energy, ΔE, indicate energy was transferred out of the component or subsystem to other components or lost to the environment. Positive changes in energy, ΔE, indicate energy was transferred to the system or component. For example, an EV battery not connected to a charger has a negative change in stored energy, ΔEstore, because the stored battery energy was transferred to the inverter or lost to the environment.

Efficiency

To calculate the average efficiency, the autoblks.pwr.PlantInfo class AvgEff property uses the total change in stored, input, and output energy. The AvgEff property implements this equation.

ηavg={ΔEstoreΔEoutputΔEinput     ΔEstore0ΔEoutputΔEstoreΔEinput       ΔEstore<0

To calculate the instantaneous efficiency, the autoblks.pwr.PlantInfo class Eff property uses stored, input, and output power. The Eff property implements this equation.

η=|PoutputPstore(Pstore>0)PinputPstore(Pstore<0)|

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.

  • Road load power transferred from wheel to vehicle.

  • 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.

Ptrans+Pnottrans=Pstore

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

ΔEstore, ΔEinput, ΔEoutput

Change in stored, input and output energy

ηavg

Average efficiency

η

Instantaneous efficiency

See Also

|

Related Examples

More About