Contenido principal

plot

R2026b

Plot data associated with EnergyInfo or ExergyInfo object

Since R2026b

Description

plot(block_EnergyInfo) plots the cumulative energy for the block, assigning specific line styles and colors to each combination of energy category and energy type. block_EnergyInfo is an EnergyInfo object.

example

plot(block_ExergyInfo) plots the cumulative exergy for the block, assigning specific line styles and colors to each combination of exergy category and type. block_ExergyInfo is an ExergyInfo object.

Examples

collapse all

This example shows how you can plot energy usage for a block in a model.

Open the Permanent Magnet DC Motor example model, which already has data logging enabled for the whole model.

openExample("simscape/PermanentMagnetDCMotorExample")

Enable energy accounting and run the simulation to create the simulation log variable simlog_PermanentMagnetDCMotor (as specified by the Workspace variable name model configuration parameter) in your current workspace:

set_param(bdroot,"SimscapeUseEnergyAccounting","on")
sim("PermanentMagnetDCMotor");

Get the energy usage for the Friction block in the DC Motor subsystem. You can use tab completion to navigate through the simulation log data tree. You can also use the simscape.logging.findNode function to find the node corresponding to the block.

fr_energyInfo = getEnergyInfo(simlog_PermanentMagnetDCMotor.DC_Motor.Friction)
fr_energyInfo = 

  EnergyInfo with properties:

           Path: "PermanentMagnetDCMotor/DC Motor/Friction"
    Assumptions: [2×5 table]
        Summary: [2×5 table]
          Ports: [1×1 struct]
         Energy: [125×2 timetable]
          Power: [125×2 timetable]

View the energy usage summary.

fr_energyInfo.Summary
ans =

  2×5 table

        Type            Ports           External         Converted       Accumulated
    ____________    _____________    ______________    ______________    ___________

    "Mechanical"    0.0041018 (J)             0 (J)    -0.0041018 (J)       0 (J)   
    "Thermal"               0 (J)    -0.0041018 (J)     0.0041018 (J)       0 (J)   

The summary shows that the block acquired 0.0041018 J of mechanical energy through its ports and converted all this energy into thermal. The thermal energy is classified as external, which means that it got dissipated.

Plot the cumulative energy usage for the block.

plot(fr_energyInfo)

Energy usage plot

The plot shows how the cumulative energy of each combination of category and type used by the block changes over time.

Input Arguments

collapse all

Energy usage data for a block, specified as an EnergyInfo object.

Exergy usage data for a block, specified as an ExergyInfo object.

Version History

Introduced in R2026b