Subject: Is there a way to import values without excel with good performance? Posted: 3/18/2017 Viewed: 1683 times
I'm doing an automatization process in WEAP and I need to upload the initial Z1 and Initial Z2 variables for all branches.
I was tring to do that using the DataExpresion way:
WEAP.DataExpression(\Demand Sites and Catchments\CatchmentX\CoverY:Initial Z1) = var1
But it is very slow. I have 856 parameters to import and it take around 15 minutes to upload.
I'm going to run it in a Server without excel.
Is there another way to import a lot of values in WEAP without excel and with a good performance?
Subject: Re: Is there a way to import values without excel with good performance? Posted: 3/20/2017 Viewed: 1263 times
Without knowing very much about your model and the values, I wonder if it might be easier for you to use a key assumption, or a key assumption combined with some sort of equation appropriate for each variable or land use type.
If all the values are unique, it might be easier for you to actually upload the values themselves for initial Z1 and Z2. This isn't actually as hard as it sounds, and then they would be in your model and you wouldn't have to use the script.
Example of how to do this for Z2:
In the data view, navigate to any of the catchments into the tab "initial Z2". In the WEAP ribbon menu, go to Edit/Export Expressions to Excel. In the window that pops up, select Branches: All, Scenarios: Current Accounts (unless you're modeling the Z2 in a particular scenario), Variable: Initial Z2, and leave the 3 checked boxes checked. This will produce an Excel document with all the initial Z2 values. Hopefully you can format your existing Excel document and this document to make it easy to copy and paste the Initial Z2 values (you can use the filter in the Excel document you created).
When you're done, go back into WEAP, and go to Edit/Import Expressions from Excel. This will take all the initial Z2 values and enter them into WEAP for you.
You can perform a similar process (remember to use the filter!) for the Initial Z1 of the different land use types.
The WEAP tutorial has an example of this export/import process in the module "Data, Results and Formatting" if you would like to see a detailed example of this process.
Subject: Re: Is there a way to import values without excel with good performance? Posted: 3/20/2017 Viewed: 1622 times
No, I do not think there is a faster way to do what you want to do. Importing expressions from Excel is the only way to change multiple branch expressions at once.
One other option would be to read the Z1 and Z2 values from one or more CSV files, which you could update before each run. In this approach, the expressions would not change (ReadFromFile), but the CSV file would change.
Topic "Is there a way to import values without excel with good performance?"