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