SSPC-Tester/SSPCTester.Logic/Calculation/PowerLoss.cs
2026-06-30 12:10:29 +08:00

23 lines
790 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace SSPCTester.Logic.Calculation;
/// <summary>
/// 功率损耗 / 效率计算(纯函数)。
/// 覆盖开发文档 §6.5 中 1.7-1.10 指标。
/// </summary>
public static class PowerLoss
{
/// <summary>电压降V = Vin - Vout。</summary>
public static double VoltageDrop(double vIn, double vOut) => vIn - vOut;
/// <summary>功率损耗W = Pin - Pout。</summary>
public static double LossWatts(double vIn, double iIn, double vOut, double iOut)
=> vIn * iIn - vOut * iOut;
/// <summary>效率(百分比) = Pout / Pin × 100。</summary>
public static double EfficiencyPct(double vIn, double iIn, double vOut, double iOut)
{
double pin = vIn * iIn;
return pin > 0 ? vOut * iOut / pin * 100.0 : 0;
}
}