23 lines
790 B
C#
23 lines
790 B
C#
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;
|
||
}
|
||
}
|