import com.powsybl.iidm.network.EnergySource

parameters {
  computationType OPF
  withAdequacyResults true
  withRedispatchingResults true
}

for (l in network.branches){
branch(l.id){
baseCaseFlowResults true
maxThreatFlowResults true
branchRatingsBaseCase 170
branchRatingsOnContingency 170
}
} 


for (g in network.generators){
if (g.id.contains('BAT')) {
generator(g.id){
adequacyDownCosts "bat_cost_down"
adequacyUpCosts "bat_cost_up"
redispatchingDownCosts "bat_redisp_cost_down"
redispatchingUpCosts "bat_redisp_cost_up"
}
}

else if (g.energySource in [EnergySource.OTHER, EnergySource.THERMAL]) {
generator(g.id){
adequacyDownCosts "others_cost_down"
adequacyUpCosts "others_cost_up"
redispatchingDownCosts "others_redisp_cost_down"
redispatchingUpCosts "others_redisp_cost_up"
}
}

else if (g.energySource == EnergySource.SOLAR) {
generator(g.id){
adequacyDownCosts "solar_cost_down"
adequacyUpCosts "solar_cost_up"
redispatchingDownCosts "solar_redisp_cost_down"
redispatchingUpCosts "solar_cost_up"
}
}

else if (g.energySource == EnergySource.WIND) {
generator(g.id){
adequacyDownCosts "wind_cost_down"
adequacyUpCosts "wind_cost_up"
redispatchingDownCosts "wind_redisp_cost_down"
redispatchingUpCosts "wind_cost_up"
}
}

else if (g.energySource == EnergySource.HYDRO) {
generator(g.id){
adequacyDownCosts "hydro_cost_down"
adequacyUpCosts "hydro_cost_up"
redispatchingDownCosts "hydro_redisp_cost_down"
redispatchingUpCosts "hydro_redisp_cost_up"
}
}
}