public PowerPlantsResponse ComputeUnitCommitment(PowerPlantsPayload payload) { var loadToProduce = payload.load; var response = new PowerPlantsResponse(payload); foreach (var powerPlantResponse in response.PowerPlants.OrderBy(p => p.meritOrder)) { if (loadToProduce > 0) { loadToProduce = powerPlantResponse.Product(loadToProduce); } } return(response); }
public ActionResult <IEnumerable <PowerPlantsResponse> > PowerPlantsProduction([FromBody] PowerPlantsPayload payload) { if (payload == null) { _logger.LogError("missing payload"); return(NotFound()); } return(Ok(_powerPlantsComputingService.ComputeUnitCommitment(payload))); }