Documentation

# pe_getEfficiency

Calculate efficiency as a function of dissipated power losses

## Syntax

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

## Description

example

````efficiency = pe_getEfficiency('loadIdentifier',node)` returns the efficiency of a circuit based on the data extracted from a Simscape™ logging node.Before you call this function, generate or load the simulation log variable to your workspace. To generate the variable, simulate the model with simulation data logging enabled. For more information, see About Simulation Data Logging (Simscape). To load a previously saved variable from a file, right-click on the file and select Load. Checking efficiency allows you to determine if circuit components are operating within their requirements. Blocks in the Semiconductor > Fundamental Components library and the Delta-Connected Load, Wye-Connected Load, and RLC (Three-Phase) blocks have an internal block variable called power_dissipated. This variable represents the instantaneous dissipated power, which 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 `pe_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*\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, for the MOSFET (Ideal, Switching) block, both the `diode` node and the `ideal_switch` node have a `power_dissipated` logging node. The function sums the power losses for both nodes 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.The nonideal semiconductor blocks also have thermal variants. Thermal variants have thermal ports that allow you to model the heat that is generated due to switching events and conduction losses. If you use a thermal variant, the function calculates power losses and efficiencies based on the thermal parameters that you specify. Essentially, the power dissipated is equal to the heat generated.If you use a variant without a thermal port, the function calculates power losses and efficiencies based on the electrical parameters that you specify, such as on-state resistance and off-state conductance.```

example

````efficiency = pe_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] = pe_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 `pe_getEfficiency` function. Data logging is enabled locally, and the option to limit data points is off.

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

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

Ensure that all blocks that have power_dissipated variables are considered in the efficiency calculation. Enable data logging for the whole model.

`set_param(model,'SimscapeLogType','all')`

Designate the load. Rename the Wye-Connected Load block from `RL` to `RL_Load`.

`set_param([model,'/RL'],'Name','RL_Load')`

Run the simulation and create the simulation log variable.

`sim(model)`

The simulation log variable simlog_ee_pwm_two_level is saved in the workspace.

Calculate the efficiency percentage.

`efficiency = pe_getEfficiency('Load',simlog_ee_pwm_two_level)`
```efficiency = 99.1940```

This example shows how to calculate efficiency based on the power dissipated for a specific time period using the `pe_getEfficiency` function. Data logging is enabled locally, and the option to limit data points is off.

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

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

Ensure that all blocks that have power_dissipated variables are considered in the efficiency calculation. Enable data logging for the whole model.

`set_param(model,'SimscapeLogType','all')`

Designate the load. Rename the Wye-Connected Load block from `RL` to `RL_Load`.

`set_param([model,'/RL'],'Name','RL_Load')`

Run the simulation and create the simulation log variable.

`sim(model)`

The simulation log variable simlog_ee_pwm_two_level is saved in the workspace.

The model simulation stop time is 0.2 seconds. Calculate efficiency for the interval when the simulation time, t, is between 0.00 and 0.005 seconds.

`efficiency = pe_getEfficiency('Load',simlog_ee_pwm_two_level,0.000,0.005)`
```efficiency = 99.1093```

This example shows how using the `pe_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. Data logging is enabled locally, and the option to limit data points is off.

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

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

Ensure that all blocks that have power_dissipated variables are considered in the efficiency calculation. Enable data logging for the whole model.

`set_param(model,'SimscapeLogType','all')`

Designate the load. Rename the Wye-Connected Load block from `RL` to `RL_Load`.

`set_param([model,'/RL'],'Name','RL_Load')`

Run the simulation and create the simulation log variable.

`sim(model)`

The simulation log variable simlog_ee_pwm_two_level is saved in the workspace.

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

`[efficiency,lossesTable] = pe_getEfficiency('Load',simlog_ee_pwm_two_level)`
```efficiency = 99.1940 lossesTable = 1×2 table LoggingNode Power ___________________________________________ ______ 'ee_pwm_two_level.Converter.converter_Xabc' 268.73```

## 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 blocks shown in the table.

Block Name in the Model`DC Impedance``AC Impedance`Y-Ld
`'loadIdentifier'``'d'`YesYesYes
`'Load'`NoNoNo
`'D'`YesNoNo

The `pe_getEfficiency` function does not return the correct data for any of these `'loadIdentifier'` values.

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

Block Name in the Model`DC Impedance````AC Impedance_Load_1```Y-Load_2
`'loadIdentifier'``'1'`NoYesNo
`'2'`NoNoYes
`'Load'`NoYesYes

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_ee_pwm_two_level`

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.

## Compatibility Considerations

expand all

Not recommended starting in R2019a