Main Content


Logical flag for energy conservation


flag=isEnrgyBalanced(PlantInfoObj) returns logical 1 (true) if the system conserves energy. Otherwise, it returns logical 0 (false).

Input Arguments

collapse all

autoblks.pwr.PlantInfo object for the system that you want to analyze.

Output Arguments

collapse all

Indicator of energy conservation, returned as a logical 1 (true) or 0 (false).

Data Types: logical


To determine if the system conserves energy, the isEnrgyBalanced method checks the energy conservation at each time step.


Blocks change the input energy plus released stored energy to output energy plus stored energy. For example, a mapped engine block uses fuel (not transferred energy) to produce torque (transferred energy) and heat loss (not transferred energy). The total modified energy represents the average between the input fuel energy and the energy exiting the system (torque and heat loss). To calculate the total energy modified by the block, the method uses the integral of the average transferred, not transferred, and stored power.


If the energy conservation error is within an error tolerance, the method returns true. Specifically, if either condition is met, the method returns true.





The equations use these variables.


Energy conservation error


Total energy modified by block

EnrgyBalRelTol, EnrgyBalAbsTol

Energy balance relative and absolute tolerance, respectively

Ptrans, Etrans

Transferred power and energy, respectively

Pnottrans, Enottrans

Not transferred power and energy, respectively

Pstore, Estore

Stored power and energy, respectively

Pinput, Poutput

Input and output power logged by Power Accounting Bus Creator block

Version History

Introduced in R2019a