Duncan Posted December 6, 2016 Posted December 6, 2016 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.UtilityProjectSub 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.DoAllFeasibleCalculationsSet 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)LoopCall ReportingAssistant.DisplayFileInNotepad(Filename)TextStream.CloseSet fso = NothingEnd Sub]]>
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now