package com.njcn.advance.utils.assess;

import lombok.Data;

import java.util.List;

/**
 * Description:
 * Date: 2025/05/30  下午 3:34【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
public class VoltageFlickerUtil {

    // Calculate long-term flicker for wind farm
    public static double calculateWindFarmFlicker(Double ssc,
            List<WindFarmLoads> windFarmLoadsList) {

        double sum = 0;
        for (int i = 0; i < windFarmLoadsList.size(); i++) {
            sum += windFarmLoadsList.get(i).getFlickerCoefficient()*windFarmLoadsList.get(i).getRatedApparentPower();
        }

        return Math.sqrt(sum)/ssc;
    }

    // Calculate long-term flicker for non-wind farm loads
    //flickerCoefficient默认0.3直流电弧炉一般取0.30
    public static double calculateNonWindFarmFlicker(
            double voltageFluctuation, double flickerCoefficient) {

        return flickerCoefficient * voltageFluctuation;
    }

    // Get flicker limit based on voltage level
    public static double getFlickerLimit(double voltageLevel) {
        return voltageLevel <= 110 ? 1.0 : 0.8;
    }
    //风电场类负荷
    @Data
    public static class WindFarmLoads{
        private Double ratedApparentPower;//风机额定视在功率
        private Double flickerCoefficient;//风机闪变系数
    }
}
