I had a doubt about WEAPs' optimization principle. The results of my simulation looks like the model would optimize the water alocation locally. In other words, it is like WEAP would calculate step by step the water alocation without changing the reservoir operation if some demand site isn't attended in one of the timesteps. To explane me better: I have a demand with highest priority that isn't attended at timestep 20, but if the reservoir would save more water in the timesteps before, he would attend the demand afterwords.
Does the WEAP calculate the hole operation again and again until he attends the demandas or does he calculate the best calculation for the 1. timestep, then for the 2. timestep, etc... till the end of the simulation period?
WEAP divides between demand priorities on each time step, so if your demand is met, the reservoir will retain water, but if it is not, the reservoir will release water. If you want to implement more sophisticated reservoir operations (for example, when the reservoir level is a below a certain threshold ("buffer zone"), it releases only a fraction of the water demanded, you can use the "operations" tab to program that in. You can also use the monthly time series wizard to change the threshold values or release fractions by month, if you prefer.
WEAP cannot hold water for the future unless you program it, because WEAP assumes the future is unknown. But you can make it do this in many different ways.
Mr. Jack Sieber
Subject: Re: WEAPs' optimization principle Posted: 12/7/2015 Viewed: 22935 times
WEAP is a simulation model, not an optimization model. When making allocations in a timestep, WEAP does NOT attempt to look ahead to future timesteps, or even to lower-priority demands in the same timesetep. As Stephanie pointed out, you can use the reservoir rule curves (Top of Conservation, Top of Buffer -- which can varying over time or scenario) to release or hold water in anticipation of future needs.
Subject: Re: WEAPs' optimization principle Posted: 1/12/2016 Viewed: 22758 times
Dear Forum,
With the aim of restrict the system to attend the flow requirement during all the time steps (streamflow always same or bigger than flow requirement), I want to make an external programmation/script in C language. Therefore, I would like to know if the correct way is to make a call in the expression builder option. How do I pass the input variables form the model to the script? These variables are the stream flows, the time steps and the flow requirements. I also would like to know, how to return the results from the external script to the model. The variables to return are the reservoir volumes and the demand priorities. Could somebody send me an example of a C script that was insert in the WEAP model?
Mr. Jack Sieber
Subject: Re: WEAPs' optimization principle Posted: 1/12/2016 Viewed: 22755 times
You can use the WEAP function "Call" to call a script (Visual Basic Script, Javascript, Python, Perl, Ruby) or a compiled DLL and get a result value. If you want to call a C program, you will need to compile it into a DLL. See the help for Call for more information, including an example of a C program and details on how to call the program and get the result value: http://www.weap21.org/WebHelp/Call.htm
I still don't understand how to include WEAP's variables and functions into my script. for example if I need the Flow requirement how do I name it in the script?
It seams that all the examples work with aleatory parameters and I want to use results of WEAP's simulation.
Eng. MICOL BRAMBILLA
Subject: Re: WEAPs' optimization principle Posted: 1/13/2016 Viewed: 22710 times
I am trying to insert the example of WEAP's user guide for a DLL file in c language into the model. I inserted exactly the same code (ex. Call( C:\Users\GRH\Desktop\test.dll ! Sum, 1, 2, 3, 4, 5) ;) but the model can't recognize the parameters. Some idea why it is not working. Or maybe somebody have another example that works, so that I can compare them.
thanks
Mr. Jack Sieber
Subject: Re: WEAPs' optimization principle Posted: 1/13/2016 Viewed: 22706 times
What error message do you get? Perhaps there was a problem when you built the DLL? Did you export the Sum function?
Perhaps your computer is not allowing you to call a dll that is located on the desktop? You could try putting it into the WEAP program directory (C:\Program Files (x86)\WEAP) and calling it from there:
I couldn't call the .dll file so I started programing in vbscript.
I am trying to increase the reservoir priority in the time step before the minimum requirement can't be attended.
The algorithm is the following
Function calculeVazao( Vd, Vm)
If Vd >= Vm Then
calculeVazao = 3
Else
If Vd < Vm Then
calculeVazao = 2
End If
End If
End Function
Obviously the model changes the reservoire priority the time step after the not attendance of the minimum requirement.
I also tried with the prevTSCalcTS but the model doesn't permit to inser results with this operation.
Some body knows how to use results from the "future" to change the priorities in the past?
It is not possible to reference the current or future value of streamflow in an expression for reservoir priority, because this could be circular -- each dependent on the other.
By the way, you could replace your vbscript with an If WEAP expression, e.g., If(Vd >= Vm, 3, 2). In this case, it would be