Calculate efficiency as function of dissipated power losses

`efficiency = elec_getEfficiency('loadIdentifier',node)`

`efficiency = elec_getEfficiency('loadIdentifier',node,startTime,endTime)`

```
[efficiency,lossesTable]
= elec_getEfficiency('loadIdentifier',node)
```

returns the efficiency of a circuit based on the data extracted from a Simscape™ logging node. `efficiency`

= elec_getEfficiency(`'loadIdentifier'`

,`node`

)

Before you call this function, you must have the simulation log variable in your
current workspace. Create the simulation log variable by simulating the model with
data logging turned on, or load a previously saved variable from a file. If
`node`

is the name of the simulation log variable, then the
table contains the data for all semiconductor blocks in the model. If
`node`

is the name of a node in the simulation data tree,
then the table contains the data only for the blocks within that node.

Checking efficiency allows you to determine if circuit components are operating
within their requirements. All blocks in the Semiconductor Devices library, as well
as some other blocks, have an internal variable called
`power_dissipated`

, which represents the instantaneous power
dissipated by the block. This instantaneous dissipated power includes only the real
power (not the reactive or apparent power) that the block dissipates. When you log
simulation data, the time-value series for this variable represents the power
dissipated by the block over time. You can view and plot this data using the
Simscape Results Explorer. The `ee_getPowerLossTimeSeries`

function also allows you to access this
data.

The `elec_getEfficiency`

function calculates the efficiency of
the circuit based on the losses for blocks that have a
`power_dissipated`

variable and that you identify as a load
block. The equation for efficiency is

$$Eff=100\cdot \frac{{P}_{load}}{{P}_{loss}+{P}_{load}},$$

where:

*Eff*is the efficiency of the circuit.*P*is the output power, that is, the power dissipated by load blocks._{load}*P*is the power dissipated by nonload blocks._{loss}

This equation assumes that all loss mechanisms are captured by blocks containing
at least one `power_dissipated`

variable. If the model contains any
lossy blocks that do not have this variable, the efficiency calculation gives
incorrect results.

Some blocks have more than one `power_dissipated`

variable,
depending on their configuration. For example, the N-Channel MOSFET
block has separate `power_dissipated`

logging nodes for the MOSFET,
the gate resistor, and for the source and drain resistors if they have nonzero
resistance values. The function sums all these losses to provide the total power
loss for the block, averaged over simulation time. The function uses the loss data
to calculate the efficiency of the circuit.

returns the efficiency of a circuit based on the `efficiency`

= elec_getEfficiency(`'loadIdentifier'`

,`node`

,`startTime`

,`endTime`

)`power_dissipated`

data extracted from a Simscape logging node within a time interval. `startTime`

and `endTime`

represent the start and end of the time interval
for calculating the efficiency. If you omit these two input arguments, the function
calculates the efficiency over the whole simulation time.

`[`

returns the efficiency of a circuit and the power loss contributions of the nonload
blocks in a circuit based on the data extracted from a Simscape logging node.`efficiency`

,`lossesTable`

]
= elec_getEfficiency(`'loadIdentifier'`

,`node`

)

The output power equals the total power dissipated by blocks that you identify as load blocks.

The input power equals the output power plus the total power dissipated by blocks that you do not identify as load blocks.

The

`power_dissipated`

variables capture all loss contributions.

`ee_getEfficiency`

| `ee_getPowerLossSummary`

| `ee_getPowerLossTimeSeries`

| `sscexplore`

- About Simulation Data Logging (Simscape)
- About the Simscape Results Explorer (Simscape)