Jump to content

Heatflux parameter access via script


Recommended Posts

Posted
Hi WAsP users!

I'm currently working with WAsP11 scripting. My license is not a standard one ( no developer licence) .

I would like to create a script that allows me to access the heatflux calculation parameters (and change them) in a generalized wind climate object, recalculate the wind atlas and store/export wind results.

The step has to be repeat more than once for multiple heatflux values and on several climates.

In this particular case study, the parent object that contains the climate is a reference site one.

The operation is of course possible via gui succesfully; I'm trying to make it automatic accessing the objects parameters, but a straight forward note regarding climate object is found nor under the "IRererenceSite" object description , neither under the "IWaspSite" object description.

Does someone have any idea about it?

Thanks in advance. Gianluca
Posted
Hi Gianluca,


This must be one of the parameters sometimes displayed in the 'generalized wind climate report' if it differs from its default value. So I opened 'C:\Program Files (x86)\Wasp\Internal scripts\WAsP\WAsP 11 standard scripts.zip' and extracted the file called 'Generalised wind climate report (HTML).was9'. The section starting at line 92 of that file has a code for displaying non-default model parameters. Here you see objects called


Set Configuration = Project.AsIRveaConfigurable.Configuration
Set Parameter = Configuration.ParameterByIndex(ParameterIndex)


and the parameter object has a description, value, and default value. I am guessing that ParameterIndex refers to the numbers listed in the WAsP help file section 'Technical reference| WAsP Parameters| WAsP Parameters'. I am not sure whether these parameters only have read-only access from a script, but maybe you can test that for yourself. Actually, I am not much of a WAsP scripter, but I will watch this post and alert the programmers if you ask for help.


With best regards,
Morten
Posted
Hi Morten,

Thanks for the reply and thanks a lot for the hint: It drove me to solve half a very important part of the issues! Now I can access the configuration parameters, but the ones I need they are on line 127-133 (maybe we have different versions of the codes)

Set Configuration = ReportingAssistant.TypeCaster.CastMemberToRveaConfigurable(Atlas).Configuration
....
Set Parameter = Configuration.ParameterByID("PROFILEMODEL")

I can modify the parameters I access (in my case: heatflux parameters) and I find them modified in the workspace, as property of the parent object (in my case the reference). So I can for example update manually the calculations (via gui) and I see changes in the predicted wind climate.

Now the new problem is that if I set parameters inside a cycle (eg: "for" statement) and I update the calculations in each cycle (".DoAllPossibleCalculations(True)") my output main results (variables in "PredictedWindClimate") they do not update themselves as expected, or sometimes they just do it for the first iteration, but not systematically.

I worked around until export results also addressing to the example "Turbine site vertical profile (Excel).was9", where a similar approach has been used

Here and example of my output results

Step HOL V A K E

1 -100 7.469337 8.400805 2.685547 383.2154
2 -75 7.33301 8.252588 2.634766 367.2364
3 -50 7.33301 8.252588 2.634766 367.2364
4 -25 7.33301 8.252588 2.634766 367.2364
5 0 7.33301 8.252588 2.634766 367.2364
6 25 7.33301 8.252588 2.634766 367.2364
7 50 7.33301 8.252588 2.634766 367.2364
8 75 7.33301 8.252588 2.634766 367.2364
9 100 7.33301 8.252588 2.634766 367.2364

I'm starting guessing that I address to the wrong class, or I typecast in the wrong way.
Any suggestion?

Regards and thanks again for the support

Gianluca
Posted
Hi Gianluca,


Good to hear that you are making progress. I don't know enough to help you with the new problem, but one of the expert has promised to post a hint.


Best regards,
Morten
Posted
Hi Morten,

I was updating the post in the same moment I received your feedback ;) .
I overcome the issue: I wasn't updating the typecasting of the configuration inside cycle, and so I was always pointing to the first configuration parameters read outside the cycle. Basically I was cycling without effects ....

Here some feedabck results. With a for cycle I changed the heatflux offset parameter and calculated my reference for each step

Step HOL Vt At Kt
1 -80 6.347 7.153 2.498
2 -81 6.348 7.154 2.498
3 -82 6.349 7.156 2.498
4 -83 6.350 7.157 2.498
5 -84 6.351 7.158 2.498
6 -85 6.352 7.159 2.498
7 -86 6.353 7.160 2.498
8 -87 6.354 7.161 2.498
9 -88 6.355 7.162 2.498
10 -89 6.356 7.163 2.502
11 -90 6.357 7.164 2.502
12 -91 6.358 7.165 2.502
13 -92 6.359 7.166 2.502
14 -93 6.360 7.168 2.502
15 -94 6.361 7.169 2.502
16 -95 6.362 7.170 2.502
17 -96 6.363 7.171 2.502
18 -97 6.364 7.172 2.502
19 -98 6.365 7.173 2.502
20 -99 6.366 7.174 2.506
21 -100 6.367 7.175 2.502
22 -101 6.368 7.176 2.506
23 -102 6.368 7.177 2.506
24 -103 6.369 7.178 2.506
25 -104 6.370 7.179 2.506
26 -105 6.371 7.181 2.506
27 -106 6.372 7.182 2.506
28 -107 6.373 7.183 2.506
29 -108 6.374 7.184 2.506
30 -109 6.375 7.185 2.506
31 -110 6.376 7.186 2.510

Seems to be exactly what I wanted ;)

Thanks again for the precious hints!

G.
Posted
Hi GianLuca,


Nice work! I am already speculating whether our university students could do similar sensitivity studies by scripts, e.g. as part of their master theses.


Cheers,
Morten

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...