Jump to content

Return helpful error message when wrong hierarchy member is selected


Recommended Posts

Hi Duncan,

I wrote a WAsP report script that only applies to wind farm hierarchy members, so it requires a wind farm to be selected. However, I'll be distributing this script to many "civilians", and to pre-empt a million questions and "bug" reports, I'd like the script to appear in WAsP's Reports menu even when no wind farm is selected, in which case it would return a helpful MsgBox when run.

I tried the code below, but this doesn't capture the error in VBScript but rather in the WAsP Script Debugging Assistant, hence no civilan-friendly MsgBox.

Any suggestions?

Is there a method that returns the class of the currently selected hierarchy member so I can test for it in the script?

    On Error Resume Next
Set WindFarm = ReportingAssistant.CastableSelectedMember.AsIWindFarm
On Error GoTo 0
If Err.Number <> 0 Then
MsgBox ("Please select a wind farm in the hierarchy.")
Exit Sub
End If
Link to comment
  • 4 weeks later...
Did you know that you can browse all these interfaces for yourself, using (for example), the VBA code editor in Excel?

In Excel, goto 'Tools... Macro... Visual Basic Editor...'. This will launch a lightweight old-fashioned visual basic editor. On this window, go to 'Tools... References..'

You'll see a long list of check-able items. If you're using WAsP 9, then select Rvea0104Interfaces.tlb for the WAsP hierarchy member interfaces and Rvea0103.dll for the reporting assistant interfaces.

Check those files, and press OK. Then back in the editor, press F2 to bring up the Object Browser. Now select Rvea0103 in the drop-down list. You'll see the WaspReportingAssistant object at the bottom of the list of classes which appears.

Select it in the left hand side list and a list of the members (methods and properties) of the class appears on the right.
Link to comment
I was not aware of this. This will help a lot.

I'm actually using WAsP 8. I'm guessing Rvea0072.tlb has the hierarchy member interfaces? However I can't tell which .dll contains the reporting assistant interfaces -- there are a lot of rvea####.dll's there. Any hints?


Perhaps this very useful tip should be advertised more widely? I'm guessing that this resource may have been overlooked by some who have requested WAsP scripting documentation on this forum and elsewhere. I suppose that in most cases, the Object Browser trick would be enough to figure things out on one's own.
Link to comment
Yes, we should disseminate this tip more widely. It has been mentioned in various places, but to be honest I can't remember where. I am just now updating the RveaScripting documentation, so I will put this information in there.

There are lots of Rvea****.dlls and .tlbs. Some are for WEng, some for various versions of WAsP, and some are used by more than one client.

Rv72 is actually about time series datasets, and is not used by the main WAsP program.

For WAsP 8, you should be looking at Rvea0044.tlb, and Rvea0053.dll for the reporting assistant stuff.

Have you considered upgrading? WAsP 8 is more than 5 years old now.
Link to comment
Well, I would personally love to upgrade due to the nice new functionalities, but there is some inertia to overcome...

In the meantime, WAsP 8.4 works adequately, considering we at GH use it almost exclusively in combination with WindFarmer, meaning we only use WAsP as a bare-bones calculation engine for the "up and down" WA methodology. I understand the calculation engine in WAsP 9 is identical.

As for WAsP 10, I think the general stance is wait-and-see: I heard through the grapevine that there are upcoming updates to the WAsP 10 way of determining roughness roses, with expected changes in results for coastal and offshore sites.

Looking forward to the updated scripting documentation! And thanks again for the above tips.
Link to comment

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...