def get_unit_qoil(PE_server, unit): return float( PE.DoGet( PE_server, "GAP.MOD[{PROD}].SEP[{" + unit + "}].SolverResults[0].OilRate"))
def solve_network_rb(PE_server): PE.DoCmd(PE_server, "GAP.SOLVENETWORK(3, MOD[0])") return None
def showinterface(PE_server, s): PE.DoCmd(PE_server, "GAP.SHOWINTERFACE(" + str(s) + ")") return None
def choose_unit(PE_server, unit): PE.DoCmd(PE_server, "GAP.MOD[{PROD}].SEP[$].MASK()") PE.DoCmd(PE_server, "GAP.MOD[{PROD}].SEP[{" + unit + "}].UNMASK()") return None
def unmask_all_units(PE_server): PE.DoCmd(PE_server, "GAP.MOD[{PROD}].SEP[$].UNMASK()") return None
def close_pipes(PE_server, pipe_close): for p in pipe_close: PE.DoCmd(PE_server, "GAP.MOD[{PROD}].PIPE[{" + p + "}].MASK()") return None
def set_pipes(PE_server, pipe_close, pipe_open): for p in pipe_close: PE.DoCmd(PE_server, "GAP.MOD[{PROD}].PIPE[{" + p + "}].MASK()") for p in pipe_open: PE.DoCmd(PE_server, "GAP.MOD[{PROD}].PIPE[{" + p + "}].UNMASK()") return None
def get_all(PE_server, s): return PE.DoGet(PE_server, s).split("|")[:-1]
def set_chokes_calculated(PE_server): PE.DoSet(PE_server, "GAP.MOD[{PROD}].WELL[$].DPControl", "CALCULATED") PE.DoSet(PE_server, "GAP.MOD[{PROD}].WELL[$].DPControlValue", 0) return None
def open_well(PE_server, well): PE.DoSet(PE_server, "GAP.MOD[{PROD}].WELL[{" + well + "}].DPControl", "CALCULATED") PE.DoSet(PE_server, "GAP.MOD[{PROD}].WELL[{" + well + "}].DPControlValue", 0) return None
def shut_well(PE_server, well): PE.DoSet(PE_server, "GAP.MOD[{PROD}].WELL[{" + well + "}].DPControl", "FIXEDVALUE") PE.DoSet(PE_server, "GAP.MOD[{PROD}].WELL[{" + well + "}].DPControlValue", 10000) return None
def set_unit_pres(PE_server, unit, pres): PE.DoSet(PE_server, "GAP.MOD[{PROD}].SEP[{" + unit + "}].SolverPres[0]", pres) return None