Documentation

# ee_getEfficiency

Calculate efficiency as function of dissipated power losses

## Syntax

``efficiency = ee_getEfficiency('loadIdentifier',node)``
``````efficiency = ee_getEfficiency('loadIdentifier',node,... startTime,endTime)``````
``````[efficiency,lossesTable] = ee_getEfficiency('loadIdentifier',node)``````

## Description

example

````efficiency = ee_getEfficiency('loadIdentifier',node)` returns the efficiency of a circuit based on the data extracted from a Simscape™ logging 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 `ee_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.Pload is the output power, that is, the power dissipated by load blocks.Ploss is the power dissipated by nonload blocks. 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.```

example

``````efficiency = ee_getEfficiency('loadIdentifier',node,... startTime,endTime)``` returns the efficiency of a circuit based on the `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.```

example

``````[efficiency,lossesTable] = ee_getEfficiency('loadIdentifier',node)``` 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.```

## Examples

collapse all

This example shows how to calculate efficiency based on the power dissipated by blocks in a circuit using the `ee_getEfficiency` function.

Open the model. At the MATLAB® command prompt, enter:

```model = 'ee_converter_dcdc_class_e'; open_system(model) ```

The load in the model is represented by the R Load resistor. No other blocks with `power_dissipated` variables contain `Load` in their names. Therefore, you can use the string `Load` as the `loadIdentifier` argument.

If no string at least partially matches the names of all load blocks in your circuit, rename the load blocks using a schema that satisfies the matching criteria for the `loadIdentifier` argument.

This example model has data logging enabled. Run the simulation and create the simulation log variable.

```sim(model) ```

The simulation log variable `simlog_ee_converter_dcdc_class_e` is saved in your current workspace.

Calculate efficiency and display the results.

```efficiency = ee_getEfficiency('Load',simlog_ee_converter_dcdc_class_e) ```
```efficiency = 90.0324 ```

This example shows how to calculate efficiency based on the power dissipated for a specific time period using the `ee_getEfficiency` function.

Open the model. At the MATLAB® command prompt, enter:

```model = 'ee_converter_dcdc_class_e'; open_system(model) ```

The load in the model is represented by the R Load resistor. No other blocks with `power_dissipated` variables contain `Load` in their names. Therefore, you can use the string `Load` as the `loadIdentifier` argument.

If no string at least partially matches the names of all load blocks in your circuit, rename the load blocks using a schema that satisfies the matching criteria for the `loadIdentifier` argument.

This example model has data logging enabled. Run the simulation and create the simulation log variable.

```sim(model) ```

The simulation log variable `simlog_ee_converter_dcdc_class_e` is saved in your current workspace.

The model simulation time (t) is 1.25e-4 seconds. Calculate efficiency for the interval when t is between 1e-4 and 1.25e-4 seconds.

```efficiency = ee_getEfficiency('Load',simlog_ee_converter_dcdc_class_e,1e-4,1.25e-4) ```
```efficiency = 90.4879 ```

This example shows how using the `ee_getEfficiency` function allows you to calculate both the efficiency of the circuit and the power-loss contributions of the nonload blocks based on the power that they dissipate.

Open the model. At the MATLAB® command prompt, enter:

```model = 'ee_converter_dcdc_class_e'; open_system(model) ```

The load in the model is represented by the R Load resistor. No other blocks with `power_dissipated` variables contain `Load` in their names. Therefore, you can use the string `Load` as the `loadIdentifier` argument.

If no string at least partially matches the names of all load blocks in your circuit, rename the load blocks using a schema that satisfies the matching criteria for the `loadIdentifier` argument.

This example model has data logging enabled. Run the simulation and create the simulation log variable.

```sim(model) ```

The simulation log variable `simlog_ee_converter_dcdc_class_e` is saved in your current workspace.

Calculate the efficiency and power-loss contributions due to dissipated power.

```[efficiency,lossesTable] = ee_getEfficiency('Load',simlog_ee_converter_dcdc_class_e) ```
```efficiency = 90.0324 lossesTable = 7x2 table LoggingNode Power ______________________________________________ __________ {'ee_converter_dcdc_class_e.LDMOS' } 3.6584 {'ee_converter_dcdc_class_e.R_Trans.Resistor'} 2.911 {'ee_converter_dcdc_class_e.D2' } 1.9446 {'ee_converter_dcdc_class_e.D1' } 1.8371 {'ee_converter_dcdc_class_e.Cs' } 0.27392 {'ee_converter_dcdc_class_e.Ls' } 0.27098 {'ee_converter_dcdc_class_e.Cout' } 0.00044579 ```

## Input Arguments

collapse all

String that is a complete or partial match for the names of load blocks in the circuit. For example, consider a circuit that contains the four semiconductor blocks shown in the table.

Block Name in the Model`IGBT``IGBT1_Load``Diode``Diode1`
Block TypeN-Channel IGBTN-Channel IGBTDiodeDiode
`'loadIdentifier'``'IGBT'`YesYesNoNo
`'Diode'`NoNoYesYes
`'Load'`NoYesNoNo
`'1'`NoYesNoYes
`'D'`NoNoYesYes
`'d'`NoYesYesYes

The `ee_getEfficiency` function returns data just for the three load blocks only when the `'loadIdentifier'` is `'d'`.

A load-block naming schema that gives you better control over the output of the `ee_getEfficiency` function is shown in this table.

Block Name in the Model`IGBT``IGBT1_Load``Diode_Load``Diode1_Load`
Block TypeN-Channel IGBTN-Channel IGBTDiodeDiode
`'loadIdentifier'``'IGBT'`YesYesNoNo
`'Diode'`NoNoYesYes
`'Load'`NoYesYesYes

Example: `'Load'`

Data Types: `string`

Simulation log workspace variable, or a node within this variable, that contains the logged model simulation data, specified as a `Node` object. You specify the name of the simulation log variable by using the Workspace variable name parameter on the Simscape pane of the Configuration Parameters dialog box. To specify a node within the simulation log variable, provide the complete path to that node through the simulation data tree, starting with the top-level variable name.

If `node` is the name of the simulation log variable, then the table contains the data for all blocks in the model that contain `power_dissipated` variables. If `node` is the name of a node in the simulation data tree, then the table contains the data only for:

• Blocks or variables within that node

• Blocks or variables within subnodes at all levels of the hierarchy beneath that node

Example: `simlog.Cell1.MOS1`

Start of the time interval for calculating the efficiency, specified as a real number, in seconds. `startTime` must be greater than or equal to the simulation Start time and less than `endTime`.

Data Types: `double`

End of the time interval for calculating the efficiency, specified as a real number, in seconds. `endTime` must be greater than `startTime` and less than or equal to the simulation Stop time.

Data Types: `double`

## Output Arguments

collapse all

Efficiency of the circuit based on data extracted from a Simscape logging node.

Dissipated power losses for each nonload block, returned as a table. The first column lists logging nodes for all blocks that have at least one `power_dissipated` variable. The second column lists the corresponding losses in watts.

## Assumptions

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