public PowerPlantLoad(string name, PowerPlantType type, decimal pMin, decimal pMax, decimal windPercentage, decimal power) { Name = name; RealPMin = CalculateRealPower(pMin, type, windPercentage); RealPMax = CalculateRealPower(pMax, type, windPercentage); Power = power; }
public PowerPlant(string name, PowerPlantType type, decimal efficiency, decimal pMin, decimal pMax) { Name = name; Type = type; Efficiency = efficiency; PMin = pMin; PMax = pMax; }
private static decimal CalculateRealPower(decimal power, PowerPlantType type, decimal windPercentage) { var realPower = type == PowerPlantType.WindTurbine ? power * (windPercentage / 100) : power; // Keep only one digit after decimal point if necessary // Always need to round down since it's impossible to add non existing power (ex. 21.55 to 21.5 and not to 21.6) return(Math.Floor(realPower * 10) / 10); }
public void InitializeFromStruct(PowerPlant powerPlant, PowerPlantType powerPlantType) { CurrentPower = powerPlant.CurrentPower; MaxPower = powerPlantType.MaxPower; PowerPerTurn = powerPlantType.PowerPerTurn; }