Main Content

isEnrgyBalanced

Logical flag for energy conservation

Description

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

Algorithms

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

EErr=Etrans+EnottransEstore

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.

Etotal=12(0tend(|Ptrans|+|Pnottrans|+|Pstore|)dt)|t=tend

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

Condition

|EErr|Etotal<EnrgyBalRelTol

or

Etotal<EnrgyBalAbsTol

The equations use these variables.

EErr

Energy conservation error

Etotal

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