jfcorbett Posted December 14, 2010 Posted December 14, 2010 I'd like to perform the following manipulations on workspace objects:1. Change height of met station2. Change hub height of turbine sites3. Change map reference (If I include, say, 5 .map files in the .wwh archive, can I change which one the map object references to? The idea is that the roughness length values used change from map to map.)Would it be possible for you to show me some example code to do the above? Thanks!
jfcorbett Posted December 16, 2010 Posted December 16, 2010 Forgot to add:4. Adjust the standard heights (so that they match the mast and turbine heights).
Duncan Posted December 16, 2010 Posted December 16, 2010 In WAsP, the met station height is taken from the TAB file, but I think you can actually change it in a script. Try ...MetStation.AsIWaspSite.WorkingHeightAgl = 34(Assuming you have got a correctly-typed reference to your MetStation object.)For TurbineSites, just assign a new value like thisTurbineSite.HubHeightAgl =75more later... D.
Duncan Posted December 23, 2010 Posted December 23, 2010 For this map reference thing, you could either have all the different maps in the workspace root and move them into the project in turn as needed, or you could keep them externally on disk and insert them from files in turn as needed. One makes for a big, self-contained workspace, and the other for a small workspace with map files outside. Which sounds better?
jfcorbett Posted December 26, 2010 Posted December 26, 2010 The self-contained workspace option sounds cleaner and safer. The larger file size isn't really a problem. It sounds like this is the way to go. If you could show me some example code to move maps back and forth as you suggest, then that would be great. Merry Christmas!Jean-François
Ray Posted December 28, 2010 Posted December 28, 2010 Hi Jean-François,Here is some code which will allow you to move a map from workspace level into a project:Set Project = ReportingAssistant.CastableSelectedMember.AsIWaspProjectSet Workspace = Project.AsIHierarchyMember.ParentSet WorkspaceMapsIterator = Workspace.Children.FilterByClass(ReportingAssistant.AllClasses.VectorMapClass)Set Map = WorkspaceMapsIterator.FirstMemberDo While Not Map Is Nothing If Map.Description = "MyMap" Then Set HierarchyMove = Map.BeginMove Set HierarchyMove.CandidateNewParent = Project If HierarchyMove.IsMovePossible Then HierarchyMove.PerformMove Else Msgbox "This move not possible!" End If Exit Do End If Set Map = WorkspaceMapsIterator.NextMember LoopIt is important to note that if the project already has a child member which is a map, then it will be replaced with the new map. If you don't want to lose this existing map then you should move it out to the workspace level before moving another one into the project.Here is an example of how to move a map from the project back out to the workspace:Set Map = Project.AsIHierarchyMember.Children.FirstMemberByClass(ReportingAssistant.AllClasses.VectorMapClass)If Not Map Is Nothing Then Set HierarchyMove = Map.BeginMove Set HierarchyMove.CandidateNewParent = Workspace If HierarchyMove.IsMovePossible Then HierarchyMove.PerformMove Else Msgbox "This move not possible!" End IfEnd IfRegards,Ray
Ray Posted December 28, 2010 Posted December 28, 2010 and here is some code to change the standard heights:Set Project = ReportingAssistant.CastableSelectedMember.AsIWaspProjectSet Configuration = Project.AsIRveaConfigurable.Configuration' Change the number of standard heightsConfiguration.ParameterByID("NUMSTDH").Value=5' Set default values for the standard heightsConfiguration.ParameterByID("STDH1").Value=10Configuration.ParameterByID("STDH2").Value=25Configuration.ParameterByID("STDH3").Value=50Configuration.ParameterByID("STDH4").Value=100Configuration.ParameterByID("STDH5").Value=200
jfcorbett Posted December 28, 2010 Posted December 28, 2010 Fabulous. This will save us loads of time and make WAsP that much more powerful. Thanks, JF
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