Jump to content

hdse

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by hdse

  1. Thank you very much
    I publish my code for importing turbines locations from a file, if it can be useful to someone.

    turbinespath="C:\Users\hdse\Desktop\test.txt"

    Set Project = ReportingAssistant.SelectedHierarchyMember


    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set strData = objFSO.OpenTextFile("C:\Users\hdse\Desktop\test.txt")

    Dim oRE : Set oRE = New RegExp
    oRE.Global = True
    oRE.Pattern = "\w+"

    Dim arrFileLines()
    i=0
    Do Until strData.AtEndOfStream
    ReDim Preserve arrFileLines(i)
    arrFileLines(i) = strData.ReadLine
    Dim oMTS : Set oMTS = oRE.Execute(arrFileLines(i))

    Set Member = WindFarm.AsIHierarchyMember.Insertions.New.ByClassID(ehmcTurbineSite).Execute
    Set TurbineSite = ReportingAssistant.TypeCaster.CastMemberToTurbineSite(Member)
    TurbineSite.Description = oMTS(0)
    TurbineSite.HubHeightAgl = Generator.DefaultHeight
    Call TurbineSite.AsIWaspSite.Move(oMTS(1), oMTS(2))

    i = i + 1
    Loop
  2. Thank you very much, it helped a lot.
    However, I don't know why the following is not working.
    I want to create a Wind Farm and add wind turbine locations from a .txt file

    turbinespath="C:\Users\hdse\Desktop\d300D900\test.txt"

    Set Project = ReportingAssistant.SelectedHierarchyMember

    ' Insert a Wind Farm
    Set Member = Project.Insertions.New.ByClassID(ehmcTurbineSiteGroup).Execute
    Set WindFarm = ReportingAssistant.TypeCaster.CastMemberToWindFarm(Member)

    ' Insert the Turbine Sites
    Set Member = WindFarm.AsIHierarchyMember.Insertions.FromFile.ByClassID(ehmcTurbineSite).Execute(turbinespath, Nothing)
    Set TurbineSites = ReportingAssistant.TypeCaster.CastMemberToTurbineSite(Member)


    The Wind Farm is created but the importing of the site locations is not working.

    The error is:
    Script control reported the error: 
    Object required: 'ByClassID(...)'


    I also tried to insert a generator in the wind farm like this:

    generatorpath="C:\ProgramData\WAsP\WAsP11\Wind turbine generators\Vestas V112-3.0 MW"

    ' Insert a Wind Farm
    Set Member = Project.Insertions.New.ByClassID(ehmcTurbineSiteGroup).Execute
    Set WindFarm = ReportingAssistant.TypeCaster.CastMemberToWindFarm(Member)

    ' Insert a generator
    Set Member = WindFarm.AsIhierarchyMember.Insertions.FromFile.ByClassID(ehmcWindTurbineGenerator).Execute(generatorpath, Nothing)
    Set Generator = ReportingAssistant.TypeCaster.CastMemberToWindTurbineGenerator(Member)


    and it says:

    Script control reported the error: 
    could not insert a Wind turbine generator to the hierarchy


    Thank you for your help !
  3. Hello,
    I am writing a script in order to automatize the manipulation of the workspace. In this context I want, to start with, to import a vector map and an observed wind climate.

    My code is the following:

    mappath="C:\Users\hdse\Documents\sea.map"
    owcpath="C:\Users\hdse\Documents\Portugal.owc"

    Set Project = ReportingAssistant.SelectedHierarchyMember
    Set Cluster = Project.Insertions.New.ByClassID(ehmcTurbineSiteGroup).Execute
    Set hmOwc = Project.Insertions.FromFile.ByClassID(ehmcObservedWindClimate).Execute(owcpath, Nothing)
    Set MapSea = Project.Insertions.FromFile.ByClassID(ehmcVectorMap).Execute(mappath,Nothing)


    The turbine site group is created successfully, but I have this error:

    Script control reported the error: 
    Object required: 'Project.Insertions.FromFile.ByClassID(...)'

    The last execution line attempt was for an unknown line number.
    Script: 'essai1', version: 11.01.0001


    The problem is coming from the file insertion, but I could`nt find the mistake.
    I hope you will be able to help me
    Thank you !
×
×
  • Create New...