Jump to content

Simple sectorwise site corrections text output script


Recommended Posts

Hi everyone,

Yesterday I hacked up a quick script for a colleague. It's simple and useful, so I thought of just posting it here in case anyone finds it helpful. I'll just paste the script source in here.


The script finds all the turbine sites in the project root and writes a text file of sectorwise corrections in a way which is convenient for some other progam to read and use.


Best wishes, Duncan.






Utility
Project

Sub Main()

Filename = "c:\temp\Output.txt"
'Delimiter = vbTab
'Delimiter= "; "
Delimiter = ", "

Set FSO = CreateObject("Scripting.FileSystemObject")
Set TextStream = FSO.CreateTextFile(Filename, True)

Set Project= ReportingAssistant.TypeCaster.CastMemberToProject(ReportingAssistant.SelectedHierarchyMember)

Project.DoAllFeasibleCalculations

Set Iterator = Project.AsIHierarchyMember.Children.FilterByClass(ReportingAssistant.AllClasses.TurbineSiteClass)

Set TurbineSite = ReportingAssistant.TypeCaster.CastMemberToTurbineSite(Iterator.FirstMember)

Do While Not TurbineSite Is Nothing
X = TurbineSite.AsIWaspSite.Location.X
Y = TurbineSite.AsIWaspSite.Location.Y
Z = TurbineSite.HubHeightAgl
SectorCount = TurbineSite.AsIWaspSite.SiteAssessment.CountOfSectors
For SectorIndex = 1 To SectorCount
OroSpeed = TurbineSite.AsIWaspSite.SiteAssessment.SectorForIndex(SectorIndex).OrographicCorrection.SpeedMultiplier
OroTurn = TurbineSite.AsIWaspSite.SiteAssessment.SectorForIndex(SectorIndex).OrographicCorrection.DirectionDeflectionDegrees
RoughSpeed = TurbineSite.AsIWaspSite.SiteAssessment.SectorForIndex(SectorIndex).RoughnessCorrection.SpeedMultiplier
OneLine = TurbineSite.Description
OneLine = OneLine & Delimiter & X & Delimiter & Y & Delimiter & Z & Delimiter & SectorIndex & Delimiter
OneLine = OneLine & ReportingAssistant.FormatValueWithPointDecimal(OroSpeed) & Delimiter
OneLine = OneLine & ReportingAssistant.FormatValueWithPointDecimal(OroTurn) & Delimiter
OneLine = OneLine & ReportingAssistant.FormatValueWithPointDecimal(RoughSpeed)
TextStream.WriteLine OneLine
Next
Set TurbineSite = ReportingAssistant.TypeCaster.CastMemberToTurbineSite(Iterator.NextMember)
Loop

Call ReportingAssistant.DisplayFileInNotepad(Filename)
TextStream.Close
Set fso = Nothing

End Sub

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