Display Name: HEALSIMULATION
Description: tool
Category:
Help URL: https://geoserver.ct.ufpb.br/arcgis/rest/directories/arcgisoutput/HEAL/HEALSIMULATION3_GPServer/HEAL_HEALSIMULATION3/HEALSIMULATION.htm
Execution Type: esriExecutionTypeAsynchronous
Parameters:
Parameter: input_simulation
Data Type: GPString
Display Name input_simulation
Description: input
Direction: esriGPParameterDirectionInput
Default Value: {"configuracao_geral_csv":"disponibilidade;demanda;mes_inicial;n_anos\ncenario de normalidade;sem pisf;1;2","reservatorios_csv":"nome;storagemax;storagemin;vol_inicial;vol_meta;vol_cheia;abastecimento_humano;criacao_animal;vazao_ecologica;irrigacao;aquicultura;industria;outros_usuarios_de_agua;volume_meta\nmachado;1597000;73240;798500;798500;1517150;;;;;;;;\npoco_fundo;10600311;4612;5300155.5;5300155.5;10070295.45;;;;;;;;\nmateus_vieira;2752200;754900;1376100;1376100;2614590;;;;;;;;\njucazinho_antonio_gouveia_neto;204820676;0;102410338;102410338;194579642.2;;;;;;;;\nvarzea_do_una;11568010;224000;5784005;5784005;10989609.5;;;;;;;;\ntabocaspiaca;1167924;30364;583962;583962;1109527.8;;;;;;;;\nengenheiro_gercino_pontes_tabocas;13600000;156379;6800000;6800000;12920000;;;;;;;;\ncarpina;255369167;0;127684583.5;127684583.5;242600708.65;;;;;;;;\ncursai;13033990;469000;6516995;6516995;12382290.5;;;;;;;;\ngoita;52535576;792500;26267788;26267788;49908797.2;;;;;;;;\ntapacura;104870609;743234;52435304.5;52435304.5;99627078.55;;;;;;;;\nmatriz_da_luz;1245968;49268;622984;622984;1183669.6;;;;;;;;\noitis;3404837;198943;1702418.5;1702418.5;3234595.15;;;;;;;;"}
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: input_gams
Data Type: GPString
Display Name input_gams
Description: input
Direction: esriGPParameterDirectionInput
Default Value: *__HEAL_FULL_GAMS_V13__
* -------------------------------------------------------------------------------
*****************MODEL FOR INTEGRATED WATER RESOURCES ALLOCATION**********************
SCALARS
MaxDrawdown fracao maxima de deplecionamento mensal /{input_maxdrawdown}/ MetaAtendimento "Meta global entre zero e um" /{input_metaatendimento}/ MetaRetornoEconomico "Meta economica entre zero e um" /{input_metaatendimento}/
NAtendimentosSH "Quantidade de registros com demanda positiva"
RetornoEconomicoMaxTeorico "Retorno com toda a demanda atendida"
NHumanDemand ;
VARIABLE
obj5HSpercent
AllocALLPercent
AllocALLPercentSH
DeltaRN(n,y,m)
DivertMonth(n,y,m)
RetornoEconomico "Retorno economico total"
objMetaRetornoEconomico "Erro quadratico em relacao a meta economica"
;
POSITIVE VARIABLE
RStorageEndDif(n,y,m)
Return(n,y,m)
PercentualRetornoEconomico "Retorno obtido dividido pelo maximo teorico"
;
VARIABLES
objRStorageEndDif1
;
EQUATIONS
R_no(n,y,m)
Divert_permonth(n,y,m)
R_nl(n,y,m)
R_nn(n,y,m)
R_Area(n,y,m)
EVP(n,y,m)
AllocatedWaterInPercent(n,y,m)
AllocatedWaterInPercentO(n,y,m)
FinalStorage(n,y,m)
DeltaR(n,y,m)
ReservoirReleaseRestriction(n,y,m)
Return_no(n,y,m)
objective1percent
objectiveEndStorage1
objectiveSH
objective5
calculaRetornoEconomico
calculaPercentualEconomico
objectiveMetaRetornoEconomico
;
* -------------------------------------------------------------------------------
* INITIAL VALUES
* -------------------------------------------------------------------------------
Divert.up(n,y,m)$(n_demand(n)) = Demand(n,m)*1000000/(Days(m)*24*60*60);
Divert.fx(n,y,m)$(n_demand(n) and Demand(n,m) = 0) = 0;
Divert.l(n,y,m)$(n_demand(n) and Demand(n,m) > 0) = Demand(n,m) * 1000000 / (Days(m) * 24 * 60 * 60);
* Initial reservoir storage.
RStorage.l(n,y,m)$n_reservoirs(n) = beg_S(n);
* Conta somente os registros que possuem demanda original positiva.
NAtendimentosSH = sum((n,y,m)$(n_demand(n) and DemandOriginal(n,m) > 0), 1);
* ------------------------------WATER BALANCE------------------------------------
* -------------------------------------------------------------------------------
* 1. RIVER SECTION NODE
* -------------------------------------------------------------------------------
R_no(n,y,m)$(n_riversection(n))..
Release(n,y,m) =e=
Inflow(n,y,m)
- sum(n1$(n_to_nr(n,n1)),
Divert(n1,y,m));
* -------------------------------------------------------------------------------
* 2. STORAGE-AREA RELATION
* -------------------------------------------------------------------------------
R_area(n,y,m)$(n_reservoirs(n))..
RArea(n,y,m) =e=
PolyStorageArea(n,'5')
+ PolyStorageArea(n,'4')*RStorage(n,y,m)
+ PolyStorageArea(n,'3')*power(RStorage(n,y,m),2)
+ PolyStorageArea(n,'2')*power(RStorage(n,y,m),3)
+ PolyStorageArea(n,'1')*power(RStorage(n,y,m),4);
* -------------------------------------------------------------------------------
* 3. RESERVOIR MASS BALANCE [hm3]
* -------------------------------------------------------------------------------
R_nl(n,y,m)$(n_reservoirs(n))..
RStorage(n,y,m) =e=
beg_S(n)$(ord(m) EQ 1 and ord(y) EQ 1)
+ RStorage(n,y-1,m--1)$(
ord(m) EQ 1
and ord(y) GT 1
)
+ RStorage(n,y,m-1)$(
ord(m) NE 1
)
+ Inflow(n,y,m)
*Days(m)*24*60*60/1000000
- ResEVP(n,y,m)
- Release(n,y,m)
*Days(m)*24*60*60/1000000
- sum(n1$(n_to_nr(n,n1)),
Divert(n1,y,m))
*Days(m)*24*60*60/1000000;
* -------------------------------------------------------------------------------
* 4. RESERVOIR DELTA STORAGE [hm3/month]
* -------------------------------------------------------------------------------
DeltaR(n,y,m)$(n_reservoirs(n))..
DeltaRN(n,y,m) =e=
Inflow(n,y,m)
*Days(m)*24*60*60/1000000
- Release(n,y,m)
*Days(m)*24*60*60/1000000
- sum(n1$(n_to_nr(n,n1)),
Divert(n1,y,m))
*Days(m)*24*60*60/1000000
- ResEVP(n,y,m);
ReservoirReleaseRestriction(n,y,m)$(n_reservoirs(n))..
DeltaRN(n,y,m) =g= -MaxDrawdown*(
beg_S(n)$(ord(m) EQ 1 and ord(y) EQ 1)
+ RStorage(n,y-1,m--1)$(ord(m) EQ 1 and ord(y) GT 1)
+ RStorage(n,y,m-1)$(ord(m) NE 1));
* -------------------------------------------------------------------------------
* 5. EVAPORATION [hm3/month]
* -------------------------------------------------------------------------------
EVP(n,y,m)$(n_reservoirs(n))..
ResEVP(n,y,m) =e= 1.10 * Evaporation(n,m)/1000*RArea(n,y,m);
* -------------------------------------------------------------------------------
* 6. RETURN FLOW
* -------------------------------------------------------------------------------
Return_no(n,y,m)$(n_reservoirs(n) or n_riversection(n))..
Return(n,y,m) =e=
sum(n1$(n_to_nr(n,n1)),
Divert(n1,y,m)*returncoef(n1));
* -------------------------------------------------------------------------------
* 7. GROSS INFLOW TO ALL HYDROLOGICAL NODES [m3/s]
* -------------------------------------------------------------------------------
R_nn(n,y,m)$(n_reservoirs(n) or n_riversection(n))..
Inflow(n,y,m) =e=
sum(n1$(n_from_n(n1,n)),
Release(n1,y,m))
+ sum(n1$(n_from_n(n1,n)),
Return(n1,y,m))
+ runoff(n,y,m);
* ------------------------- EQUATIONS ANALYSIS AND OF ----------------------------
* Monthly diverted volume [m3/month]
Divert_permonth(n,y,m)..
DivertMonth(n,y,m) =e=
Divert(n,y,m)*Days(m)*24*60*60;
* Percentual de atendimento total: PISF fixo mais alocacao do sistema local.
AllocatedWaterInPercent(n,y,m)$(
n_demand(n) and DemandOriginal(n,m) > 0
)..
AllocationPercent(n,y,m) =e=
(Divert(n,y,m) * (Days(m)*24*60*60)
+ PISFAllocation(n,m)*1000000)
/ (DemandOriginal(n,m)*1000000);
AllocatedWaterInPercentO(n,y,m)$(
n_demand(n)
and DemandOriginal(n,m) = 0
)..
AllocationPercent(n,y,m) =e= 0;
* Retorno economico maximo teorico.
RetornoEconomicoMaxTeorico =
sum((n,y,m)$(
n_demand(n)
and DemandOriginal(n,m) > 0
),
w1new(n)
* DemandOriginal(n,m)
* 1000000
);
* Retorno economico do atendimento total.
calculaRetornoEconomico..
RetornoEconomico =e=
sum((n,y,m)$(
n_demand(n)
and DemandOriginal(n,m) > 0
),
w1new(n)
* (DivertMonth(n,y,m) + PISFAllocation(n,m)*1000000)
);
* Percentual do potencial economico atendido.
calculaPercentualEconomico..
PercentualRetornoEconomico =e=
RetornoEconomico
/ max(1e-9, RetornoEconomicoMaxTeorico);
* Desvio quadratico entre o volume final e o volume-meta.
FinalStorage(n,y,m)$(
n_reservoirs(n)
and lastyear(y)
and ord(m) = card(m)
)..
RStorageEndDif(n,y,m) =e=
sqr(
(RStorage(n,y,m) - end_S(n))
/ RStorageMax(n)
);
* -------------------------------------------------------------------------------
* OBJECTIVE FUNCTIONS
* -------------------------------------------------------------------------------
* Atendimento global em percentual.
objective1percent..
AllocALLPercent =e=
sum(n_demand(n), sum(y, sum(m, AllocationPercent(n,y,m))));
* Distancia entre atendimento global obtido e a meta escolhida.
objectiveSH..
AllocALLPercentSH =e=
sqr(
(
AllocALLPercent / max(1, NAtendimentosSH)
- MetaAtendimento
)
);
* Meta de armazenamento somente no final do horizonte.
objectiveEndStorage1..
objRStorageEndDif1 =e=
sum((n,y,m)$(
n_reservoirs(n)
and lastyear(y)
and ord(m) = card(m)
and RStorageMax(n) > 0
),
RStorageEndDif(n,y,m)
)
/ max(1, card(n_reservoirs));
* Atendimento medio do abastecimento humano.
NHumanDemand =
sum((n,y,m)$(
n_humansupply(n)
and DemandOriginal(n,m) > 0
), 1);
objective5..
obj5HSpercent =e=
sum((n,y,m)$(
n_humansupply(n)
and DemandOriginal(n,m) > 0
),
AllocationPercent(n,y,m)
)
/ max(1, NHumanDemand);
* Diferenca quadratica entre percentual economico obtido e meta.
objectiveMetaRetornoEconomico..
objMetaRetornoEconomico =e=
sqr(
PercentualRetornoEconomico
- MetaRetornoEconomico
);
*************Reference********************
MODEL waterallocationmodel /all/;
waterallocationmodel.tolInfRep = 1e-8;
Option NLP = CONOPT4;
*waterallocationmodel.optfile=1;
* PRIORIDADE OPCIONAL: ABASTECIMENTO HUMANO
SOLVE waterallocationmodel USING nlp MAXIMIZING obj5HSpercent;
Divert.fx(n_humansupply(n),y,m) = Divert.l(n,y,m);
* OBJETIVO: ATENDIMENTO
* Buscar o atendimento global escolhido pelo usuario.
SOLVE waterallocationmodel USING nlp MINIMIZING AllocALLPercentSH;
* Preservar o atendimento global alcancado; as alocacoes individuais
Divert.fx(n_demand(n),y,m) = Divert.l(n,y,m);
* Reduzir a falta de agua em relacao as metas finais.
SOLVE waterallocationmodel USING nlp MINIMIZING objRStorageEndDif1;
* Percentual de armazenamento apenas para saida de resultados
RStoragePercent.l(n,y,m) = 0;
RStoragePercent.l(n,y,m)$(
n_reservoirs(n)
and RStorageMax(n) > 0
) =
RStorage.l(n,y,m) / RStorageMax(n);
Parameter AllocationDifResult(n,y,m) "Deficit in meeting demands";
AllocationDifResult(n,y,m)$(n_demand(n)) =
Divert.l(n,y,m)*Days(m)*24*60*60
- Demand(n,m)*1000000;
option dispwidth=30;
display
AllocationPercent.l,
DivertMonth.l,
RStoragePercent.l,
RStorage.l,
AllocationDifResult;
*execute_unload "results_cen_reference_05_2026.gdx" AllocationPercent.l, DivertMonth.L, RStoragePercent.l, Rstorage.l, AllocationDifResult;
*$offtext
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: input_metaatendimento
Data Type: GPDouble
Display Name input_metaatendimento
Description: input
Direction: esriGPParameterDirectionInput
Default Value: 1
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: input_maxdrawdown
Data Type: GPDouble
Display Name input_maxdrawdown
Description: input
Direction: esriGPParameterDirectionInput
Default Value: 0.2
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: url_data
Data Type: GPString
Display Name url_data
Description: input
Direction: esriGPParameterDirectionInput
Default Value: http://geoserver.ct.ufpb.br/arcgis/rest/services/HEAL/ClimaDataUASPernambuco/MapServer
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: url_demand
Data Type: GPString
Display Name url_demand
Description: input
Direction: esriGPParameterDirectionInput
Default Value: http://services5.arcgis.com/Jt1k38F2SqtOkFI6/ArcGIS/rest/services/HEAL_Capibaribe_2025_Clip/FeatureServer/1/
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: url_stream
Data Type: GPString
Display Name url_stream
Description: input
Direction: esriGPParameterDirectionInput
Default Value: http://services5.arcgis.com/Jt1k38F2SqtOkFI6/ArcGIS/rest/services/HEAL_Capibaribe_2025_Clip/FeatureServer/2/
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: url_reservoir
Data Type: GPString
Display Name url_reservoir
Description: input
Direction: esriGPParameterDirectionInput
Default Value: http://services5.arcgis.com/Jt1k38F2SqtOkFI6/ArcGIS/rest/services/HEAL_Capibaribe_2025_Clip/FeatureServer/3/
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: url_link
Data Type: GPString
Display Name url_link
Description: input
Direction: esriGPParameterDirectionInput
Default Value: http://services5.arcgis.com/Jt1k38F2SqtOkFI6/ArcGIS/rest/services/HEAL_Capibaribe_2025_Clip/FeatureServer/4/
Parameter Type: esriGPParameterTypeRequired
Category:
Parameter: JobNumber
Data Type: GPLong
Display Name JobNumber
Description:
Direction: esriGPParameterDirectionOutput
Default Value:
Parameter Type: esriGPParameterTypeDerived
Category:
Parameter: solver_summary
Data Type: GPString
Display Name solver_summary
Description:
Direction: esriGPParameterDirectionOutput
Default Value:
Parameter Type: esriGPParameterTypeDerived
Category:
Parameter: table
Data Type: GPRecordSet
Display Name table
Description:
Direction: esriGPParameterDirectionOutput
Default Value:
Fields: None
Features: None.
Parameter Type: esriGPParameterTypeDerived
Category:
Supported Operations:
Submit Job