Welcome to the RAS Solution Forums HECRAS Controller SteadyFlow_SetFlow function – How can I input multiple profiles?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #8258
    granadier
    Participant

    Hello guys,

    I’m trying to simulate a steady flow condition with Hec-Ras Controller (5.0.7) using Python. My intention is to simulate more than 100 flow profiles at once in the same channel, if possible.
    For inputting these profiles and its flow rates (Q), I’m using the SteadyFlow_SetFlow function. However, I’m having problems to define the “Q” variable in my code, because I don’t really know how to handle such a variable in Python (I’m still a beginner, haha).

    I was dealing with Q as a list, first writing the Profile ID code and then the corresponding flow rate, like this example:
    Q = [1, 100, 2, 250, 3, 350]
    hec.SteadyFlow_SetFlow(RivName,RchName,RScmp,Q)

    The script runs well, but only the first profile is created and computed. The others are just ignored.

    Anyone knows how to declare that “Q” variable for considering multiple profiles in Python?

    #13625
    Rodrigo Perdigão
    Participant

    Hello, Granadier!

    I tried to use that function too but it’s not working and I don’t know why. I tried using Q vector like a list or tuple.

    But if you do want to do that, there’s another way. You can just edit the .f01 file using python functions to read and write a new .f01 file like if you were manipulating a common text file.

    To do that you can use something like:

    with open(r’C:\Users\Rodrigo\Desktop\teste.f01′) as f:
    lines = f.readlines()

    And then edit the line 6 (attachment) inserting your new values and then saving it in a new .f01 file with the same name. Remeber to write each value in fields of 8.

    I don’t think that’s a good solution, but I hope it can help you. Nowadays I’m doing several applications editing input data “manually” in python and using HECRASController just to run ShowRAS, Project_Open, Compute_CurrentPlan and Project_Save.

    Regards,
    Rodrigo Perdigão

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.