Contenido principal

createSankeyPlot

Create Sankey diagram

Since R2024b

Description

The createSankeyPlot(PlantInfoObj) method creates a Sankey diagram of the energy in a system or subsystem. Use the autoblks.pwr.PlantInfo object to evaluate and report power and energy for component-level blocks and system-level models.

createSankeyPlot(___,Name=Value) allows specified name-value arguments to set a plot title, specify subsystem that you want to analyze, and remove losses below a threshold.

After you use the findChildSys method to retrieve the autoblks.pwr.PlantInfo object for the system that you want to analyze, use the createSankeyPlot(SubSystem) method to create a Sankey diagram to visualize total energy input, output, and losses. For more information, see ChildSys.

example

Examples

collapse all

Analyze the power and energy in the conventional vehicle reference application. Use the createSankeyPlot method to visualize power loss.

Open the conventional vehicle reference application. By default, the application has a mapped 1.5 L spark-ignition (SI) engine and a dual clutch transmission. Project files open in a writable location.

Set the system name to ConfiguredConventionalVirtualVehicle.

Create the autoblks.pwr.PlantInfo object.

Use the PwrUnits and EnrgyUnits properties to specify the units.

SysName = 'ConfiguredConventionalVirtualVehicle';
VehPwrAnalysis = autoblks.pwr.PlantInfo(SysName);
VehPwrAnalysis.PwrUnits = 'kW';
VehPwrAnalysis.EnrgyUnits = 'kW*h';

Use the run method to turn on logging, run simulation, and add logged data to the object.

run(VehPwrAnalysis);

Use the dispSysSummary method to display the results.

dispSysSummary(VehPwrAnalysis);

Use the xlsSysSummary method to write the results to a spreadsheet.

xlsSysSummary(VehPwrAnalysis,'EnergySummary.xlsx');

Use the findChildSys method to retrieve the autoblks.pwr.PlantInfo object for the Engine subsystem.

To display the results, use the dispSignalSummary method.

Use the histogramEff method to display a histogram of the time spent at each engine plant efficiency.

EngSysName = SysName+"/Vehicle/ConfiguredSimulinkPlantModel/Engine";
EngPwrAnalysis = VehPwrAnalysis.findChildSys(EngSysName);
dispSignalSummary(EngPwrAnalysis,EngSysName);
histogramEff(EngPwrAnalysis);

Use the findChildSys method to retrieve the autoblks.pwr.PlantInfo object for the Transmission subsystem.

To display the results, use the dispSignalSummary method.

TransSysName = SysName+"/Vehicle/ConfiguredSimulinkPlantModel/Transmission";
TransPwrAnalysis = findChildSys(VehPwrAnalysis,TransSysName);
dispSignalSummary(TransPwrAnalysis,TransSysName);

To plot the results, use the sdiSummary method.

sdiSummary(VehPwrAnalysis,{EngSysName,TransSysName})

To create a Sankey diagram, use the createSankeyPlot method.

VehOnlyAnalysis = VehPwrAnalysis.findChildSys(SysName + "/Vehicle");
SankeySubsystems = string({VehOnlyAnalysis.Children.SysName});
createSankeyPlot(VehPwrAnalysis,ChildSys=SankeySubsystems);

Input Arguments

collapse all

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

Data Types: function_handle

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: ChildSys=SankeySubsystems

Sankey diagram title, specified as a string or character vector.

Example: Title="Sankey Diagram"

Data Types: string | character vector

Subsystems that you want to visualize on a Sankey diagram, specified as a string or character vector.

Use this table to interpret the arrows created for displaying energy information for the subsystems specified by the ChildSys argument.

GoalChildSys ValueInput ArrowsOutput ArrowsLoss Arrows

Display top-level system energy information.

Not specified

Creates arrows for the total system energy input and stored energy consumed. For example, a decrease in battery charge represents an input.

Creates arrows for the total system energy output and stored energy. For example, an HEV drive cycle simulation resulting in a higher state of charge represents a battery output.

Creates an arrow for the total system energy losses.

Display individual subsystem energy information.

Specified

Creates arrows representing a total input or consumed energy for each subsystem listed in ChildSys.

Detailed breakdown by specified subsystems plus Other Inputs:

  • Individual subsystem energy inputs that are not transferred.

  • Individual subsystem stored energy inputs.

  • Subsystems specified with energy inputs below the value of PctThreshold are grouped into Other Inputs.

  • Remaining inputs from subsystems not specified are grouped into Other Inputs.

Creates arrows representing a total output or stored energy for each subsystem listed in ChildSys.

Detailed breakdown by specified subsystems plus Other Outputs:

  • Individual subsystem energy outputs that are not transferred.

  • Individual subsystem stored energy outputs.

  • Subsystems specified with energy outputs below the value of PctThreshold are grouped into Other Outputs.

  • Remaining outputs from subsystems not specified are grouped into Other Outputs.

Creates arrows representing a total energy loss for each subsystem listed in ChildSys.

Detailed breakdown by specified subsystems plus Other Losses:

  • Individual subsystem energy losses.

  • Subsystems specified with energy losses below the value of PctThreshold are grouped into Other Losses.

  • Remaining losses from subsystems not specified are grouped into Other Losses.

Display energy information for all components with power accounting blocks.

"all"

Creates arrows for every component in the system. Components with energy inputs below the value of PctThreshold are grouped into Other Inputs.

Creates arrows for every component in the system. Components with energy outputs below the value of PctThreshold are grouped into Other Outputs.

Creates arrows for every component in the system. Components with energy losses below the value of PctThreshold are grouped into Other Losses.

Example: ChildSys="ConfiguredConventionalVirtualVehicle/Vehicle/ConfiguredSimulinkPlantModel/Engine"

Data Types: string | character vector

Threshold percentage to remove input, output, and loss errors, specified as a scalar.

Example: PctThreshold=5

Data Types: double

Version History

Introduced in R2024b