Jump to content

Placing a turbine in a site group


Recommended Posts

Hi,

I have a script that currently exports information on the turbines under a site group. I, however, also need the same information about the met mast locations. I would therefore like to, in my script, place a turbine on the mast location with the hh of the measurements in the tab file.

Then recalculate and export the information.

And finally delete the turbine.

Is there anyway this is possible. I can't seem to get my head around the Wasp interfaces and methods.

Thanks.

- Hans Peter
Link to comment
  • 4 weeks later...
Hi Hans Peter,

Sorry if the WAsP hierarchy interfaces are confusing. They were designed to be rather generic and support new types of hierarchy member in future. In retrospect I see that we could also have implemented other, simpler, interfaces on the same underlying model, which might have made scripting simpler. We'll consider that for the next generation of code.

Meanwhile, here's a suggestion about what you want to achieve.




Set Site = Project.AsIHierarchyMember.Insertions.New.ByClassID(ehmcTurbineSite).Execute

If Not Atlas.MetStation Is Nothing Then
Set MetStation = Atlas.MetStation
If MetStation.AsIWaspSite.IsLocatedInMap Then
Site.AsIWaspSite.Move MetStation.AsIWaspSite.Location.x, MetStation.AsIWaspSite.Location.y
Site.HubHeightAgl = MetStation.AnemometerHeightAgl
Site.AsICalculatingHierarchyMember.DoAllPossibleCalculations
MsgBox Site.PredictedWindClimate.EmergentProbabilityDistribution.MeanSpeed
End If
End Sub

Site.AsIHierarchyMember.Remove

Workspace.AllMembers.FilterByClass




I hope that this works, or gives you a clue.

If the enum member ehmcTurbineSite doesn't work, then replace it with integer value 7.

I assume that you have only one atlas in the project. If you have different atlases associated with different turbine sites or farms, then it's more complicated to find them all. Let me know if that's what you need and I can post some sample code.

Duncan.
Link to comment
Hi Duncan,

Thanks for the answer. Unfortunately I do, in fact, need to take into account more than one atlas. At least for most cases. Normally I would run one wind farm with several site groups under it. The site groups are only based on the met masts, so for each different met mast, I would have a site group under the wind farm.

Re-doing calculations for each met mast wouldn't normally be a problem as the extra time to do this isn't critical. Hopefully that makes it easier to insert and delete the site?

Let me know what you come up with.

Thanks.

- Hans Peter
Link to comment
Hi Hans Peter,


I'm imagining a project with one or more wind farms, and under each wind farm there are groups of turbine sites and different groups can have different wind atlases with different met stations. Is that what you're doing?


For each met station, you want to create an equivalent turbine site and do a siting calculation.


First of all, did you know that you can get direct access to the met station's own back prediction? Metstation.BackPrediction.PredictedWeibullRose will give you a rose of AKF. For the climate, you don't need to insert a turbine site. But maybe you want the AEP result. For that, you would definitely need a turbine site so that you can use the associated WTG.


In any case, you need a way to find these met stations in the project hierarchy. There are a couple of ways to get them. Depending on what else is going on in the hierarchy, the easiest might be to use the 'AllMembers' property of the workspace. This will give you a flat collection of all the members in the entire workspace. You can then filter this collection to select all the met stations, and iterate over those.


To get a reference to the workspace from any hierarchy member, just do this:
Set WorkspaceMember = SomeMember.AsIHierarchyMember.Project.AsIHierarchyMember.Parent


Each HM can find its project, and you can rely on the workspace being the parent of every project. Now this reference you have is a generic IHierarchyMember type. To use IWorkspace-specific methods, you need to type cast it like this:
Set Workspace = TypeCaster.CastMemberToWorkspace(WorkspaceMember)


Then get a reference to the met. station class like this:
Set MsClass = ReportingAssistant.AllClasses.ByID(ehmcMetStation)


Use this met. station class to filter the workspace members collection, thus:
MetStations = Foo.AllMembers.FilterByClass(MsClass)


Now your variable MetStations is an iterator (type IHierarchyMemberGroupIterator) which you can loop over to work with each one in turn.


You can insert a new turbine site and move it around the hierarchy to do the calculations you need. But it's probably easier to create and destroy a new turbine site for each met station you want to work with. But you need to put it in the right place. It can't be a child of the met station, or even of the met. station's parent wind atlas. So you need to go up two levels in the hierarchy and insert it there. You could do it like this:
If Not Metstation.AssociatedWindAtlas Is Nothing Then
Set AtlasParent = Metstation.AssociatedWindAtlas.AsIHierarchyMember.Parent
Set TempSite = AtlasParent.Insertions.New.ByClassID(ehmcTurbineSite).Execute
End Sub


Does any of this help? Is it relevant to what you're trying to do? Do you want a complete code example?

Duncan.
Link to comment
Hi Duncan,

Thanks for the quick turn-around!

It is exactly the climate I need; AEP isn't required. So I think the method of just iterating through all met stations and getting the backprediction will be perfect. I'll see if I can figure out a way to actually do this in a script. If I can't, I'll let you know that help is required ;-)

Thanks again.

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