Power Analysis of Spring Mass Damper System
This example shows how to analyze the mechanical power and energy of a spring mass damper system using functionality available with the Powertrain Blockset™. The model subsystems contain Power Accounting Bus Creator blocks that report system power and energy consumption across the spring mass damper system.
Run Simulation
Click Run to create an autoblks.pwr.PlantInfo
object that analyzes the model energy consumption. Use the PwrUnits
and EnrgyUnits
properties to set the units.
SysName = 'powerAnalysis'; open(SysName); SysPwrAnalysis = autoblks.pwr.PlantInfo(SysName); SysPwrAnalysis.PwrUnits = 'kW'; SysPwrAnalysis.EnrgyUnits = 'MJ';
Use run
method to turn on logging, run simulation, and add logged data to the object.
SysPwrAnalysis.run;
Overall Summary
Display the final energy values for each subsystem.
SysPwrAnalysis.dispSysSummary
System Name Efficiency Energy Loss (MJ) Energy Input (MJ) Energy Output (MJ) Energy Stored (MJ) -------------------------------------------------------------------------------------------------------------------------- powerAnalysis 0.158 -0.00162 0.00193 0 0.000304 Mass1Spring1Damper1 0.514 -0.000479 0.000984 -0.000385 0.00012 Mass2Spring3Damper3 0.352 -0.00114 0.00175 -0.000477 0.00014 Spring2Damper2 0.993 -5.7e-06 0.000862 -0.000812 4.43e-05
Write summary to spreadsheet.
SysPwrAnalysis.xlsSysSummary(fullfile(fileparts(which('GenerateEnergyReport')), 'EnergySummary.xlsx'))
Subsystem1 Summary
SubSys1Name = 'powerAnalysis/Mass1Spring1Damper1';
SubSys1PwrAnalysis = SysPwrAnalysis.findChildSys(SubSys1Name);
SubSys1PwrAnalysis.dispSignalSummary;
powerAnalysis/Mass1Spring1Damper1 Average Efficiency = 0.51 Signal Energy (MJ) ----------------------------------- Inputs 0.000984 Transferred 0.000417 0.000413 3.88e-06 Not transferred 0.000567 0.000567 0 Outputs -0.000385 -0.000381 -3.46e-06 Losses -0.000479 -0.000434 -4.46e-05 Stored 0.00012 0.000117 3.47e-06
Subsystem2 Summary
SubSys2Name = 'powerAnalysis/Spring2Damper2';
SubSys2PwrAnalysis = SysPwrAnalysis.findChildSys(SubSys2Name);
SubSys2PwrAnalysis.dispSignalSummary;
powerAnalysis/Spring2Damper2 Average Efficiency = 0.99 Signal Energy (MJ) ----------------------------------- Inputs 0.000862 Transferred 0.000862 0.000469 7.97e-06 0.000381 3.46e-06 Not transferred 0 0 Outputs -0.000812 -0.000393 -1.86e-06 -0.000413 -3.88e-06 Losses -5.7e-06 -5.7e-06 Stored 4.43e-05 4.43e-05
Subsystem3 Summary
SubSys3Name = 'powerAnalysis/Mass2Spring3Damper3';
SubSys3PwrAnalysis = SysPwrAnalysis.findChildSys(SubSys3Name);
SubSys3PwrAnalysis.dispSignalSummary;
powerAnalysis/Mass2Spring3Damper3 Average Efficiency = 0.35 Signal Energy (MJ) ----------------------------------- Inputs 0.00175 Transferred 0.000395 0.000393 1.86e-06 Not transferred 0.00136 0.00136 0 Outputs -0.000477 -0.000469 -7.97e-06 Losses -0.00114 -0.000894 -0.000244 Stored 0.00014 0.000147 -7.46e-06
SDI Plots
SysPwrAnalysis.sdiSummary({SubSys1Name, SubSys2Name, SubSys3Name})
See Also
autoblks.pwr.PlantInfo
(Powertrain Blockset) | Power Accounting Bus Creator (Powertrain Blockset)
Related Topics
- Analyze Power and Energy (Powertrain Blockset)