示例#1
0
 def test_temp_drilling(self):
     t = ptd.temp(trajectory, 1)
     self.assertIsInstance(t.tdsi, list)
     self.assertIsInstance(t.tds, list)
     self.assertIsInstance(t.ta, list)
     self.assertIsInstance(t.tcsg, list)
     self.assertIsInstance(t.tsr, list)
     self.assertIsInstance(t.tfm, list)
    def test_temp_behavior(self):
        t = 2

        # For Drilling
        st = ptd.temp(t, log=True).behavior()
        self.assertEqual(len(st.tbot), len(st.tout))
        self.assertIsInstance(st.finaltime, type(t))
        self.assertIsInstance(st.tbot, list)
        self.assertIsInstance(st.tout, list)

        # For Production
        st = ptp.temp(t, log=True).behavior()
        self.assertIsInstance(st.finaltime, type(t))
        self.assertIsInstance(st.tout, list)

        # For Injection
        st = pti.temp(t, log=True).behavior()
        self.assertIsInstance(st.finaltime, type(t))
        self.assertIsInstance(st.tbot, list)
示例#3
0
def plot():
    time = request.args.get("time")
    depth = request.args.get("depth")
    wd = request.args.get("wd")
    well_profile = request.args.get("well_profile")
    kop = request.args.get("kop")
    eob = request.args.get("eob")
    build_angle = request.args.get("build_angle")
    kop2 = request.args.get("kop2")
    eob2 = request.args.get("eob2")
    sod = request.args.get("sod")
    eod = request.args.get("eod")
    plot_type = request.args.get("plot_type")
    plot_md = request.args.get("plot_md")
    deltat = request.args.get("deltat")
    dt_tdsi = request.args.get("dt_tdsi")
    dt_ta = request.args.get("dt_ta")
    dt_tr = request.args.get("dt_tr")
    dt_tcsg = request.args.get("dt_tcsg")
    dt_tfm = request.args.get("dt_tfm")
    dt_tsr = request.args.get("dt_tsr")

    # TUBULAR
    n_casings = request.args.get("n_casings")
    dro = request.args.get("dro")
    dri = request.args.get("dri")
    ddo = request.args.get("ddo")
    ddi = request.args.get("ddi")

    # OPERATIONAL PARAMETERS
    tin = request.args.get("tin")
    q = request.args.get("q")
    rpm = request.args.get("rpm")
    t = request.args.get("t")
    tbit = request.args.get("tbit")
    wob = request.args.get("wob")
    rop = request.args.get("rop")
    an = request.args.get("an")

    # DENSITIES
    rhol = request.args.get("rhol")
    rhod = request.args.get("rhod")
    rhoc = request.args.get("rhoc")
    rhor = request.args.get("rhor")
    rhofm = request.args.get("rhofm")
    rhow = request.args.get("rhow")
    rhocem = request.args.get("rhocem")

    wtg = request.args.get("wtg")
    gt = request.args.get("gt")

    if time is None:
        time = 5
        depth = 3000
        wd = 150
        well_profile = "V"
        kop = 600
        eob = 1500
        build_angle = 40
        kop2 = 1800
        eob2 = 2300
        sod = 2000
        eod = 2600
        plot_type = 1
        plot_md = 1
        deltat = 1
        dt_tdsi = True
        dt_ta = False
        dt_tr = False
        dt_tcsg = False
        dt_tfm = True
        dt_tsr = False
        n_casings = 0

        # TUBULAR
        casings_list = []
        dro = 21
        dri = 17.716
        ddo = 4.5
        ddi = 4

        # OPERATIONAL PARAMETERS
        tin = 20
        q = 794.933
        rpm = 100
        t = 2
        tbit = 1.35
        wob = 22.41
        rop = 14.4
        an = 3100

        # DENSITIES
        rhol = 1.198
        rhod = 7.6
        rhoc = 7.8
        rhor = 7.8
        rhofm = 2.245
        rhow = 1.029
        rhocem = 2.7

        wtg = -0.005
        gt = 0.0238

    else:
        time = float(time)
        depth = float(depth)
        wd = float(wd)
        well_profile = str(well_profile)
        kop = float(kop)
        eob = float(eob)
        build_angle = int(build_angle)
        kop2 = float(kop2)
        eob2 = float(eob2)
        sod = float(sod)
        eod = float(eod)
        plot_type = int(plot_type)
        plot_md = float(plot_md)
        deltat = float(deltat)
        dt_tdsi = bool(dt_tdsi)
        dt_ta = bool(dt_ta)
        dt_tr = bool(dt_tr)
        dt_tcsg = bool(dt_tcsg)
        dt_tfm = bool(dt_tfm)
        dt_tsr = bool(dt_tsr)
        n_casings = int(n_casings)

        # TUBULAR
        casings_list = []
        for i in range(1, n_casings+1):
            csg_dict = {"od": float(request.args.get("od" + str(i))), "id": float(request.args.get("id" + str(i))),
                        "depth": float(request.args.get("depth" + str(i)))}
            casings_list.append(csg_dict)
        dro = float(dro)
        dri = float(dri)
        ddo = float(ddo)
        ddi = float(ddi)

        # OPERATIONAL PARAMETERS
        tin = float(tin)
        q = float(q)
        rpm = float(rpm)
        t = float(t)
        tbit = float(tbit)
        wob = float(wob)
        rop = float(rop)
        an = float(an)

        # DENSITIES
        rhol = float(rhol)
        rhod = float(rhod)
        rhoc = float(rhoc)
        rhor = float(rhor)
        rhofm = float(rhofm)
        rhow = float(rhow)
        rhocem = float(rhocem)

        wtg = float(wtg)
        gt = float(gt)

    inputs = {'time':time, 'depth':depth, 'wd':wd, 'well_profile':well_profile, 'kop':kop, 'eob':eob,
              'build_angle':build_angle, 'kop2':kop2, 'eob2':eob2, 'sod':sod, 'eod':eod, 'plot_type':plot_type,
              'plot_md':plot_md, 'deltat':deltat, 'n_casings':n_casings}

    # Others parameters: the ones which should be used for the attribute 'change_inputs'
    others = {'wd':wd, 'tin':tin, 'q':q, 'rpm':rpm, 't':t, 'tbit':tbit, 'wob':wob, 'rop':rop, 'an':an, 'rhol':rhol,
              'rhod':rhod, 'rhoc':rhoc, 'rhor':rhor, 'rhofm':rhofm, 'rhow':rhow, 'rhocem':rhocem, 'dro':dro, 'dri':dri,
              'ddo':ddo, 'ddi':ddi, 'wtg':wtg, 'gt':gt}

    inputs.update(others)  # Merge 'others' into the 'inputs' dictionary

    error_raised = error_messages(inputs)  # Checking process for warning messages depending on the inputs

    if error_raised == 0:
        if plot_type != 5:
            temp = ptd.temp(time, mdt=depth, casings=casings_list, profile=well_profile, change_input=others,
                            build_angle=build_angle, kop=kop, eob=eob, kop2=kop2, eob2=eob2, sod=sod, eod=eod)

        if plot_type == 1:
            fig1 = create_figure1(temp)
        if plot_type == 2:
            fig1 = create_figure2(temp, plot_md)
        if plot_type == 3:
            fig1 = create_figure3(temp)
        if plot_type == 4:
            fig1 = create_figure4(temp.stab())
        if plot_type == 5:
            temps = ptd.temps(time, deltat, mdt=depth, profile=well_profile, change_input=others, build_angle=build_angle,
                              kop=kop, eob=eob, kop2=kop2, eob2=eob2, sod=sod, eod=eod)
            fig1 = create_figure5(temps, tdsi=dt_tdsi, ta=dt_ta, tr=dt_tr, tcsg=dt_tcsg, tfm=dt_tfm, tsr=dt_tsr)

        wellpath = get(depth, profile=well_profile, build_angle=build_angle, kop=kop, eob=eob, kop2=kop2,
                                       eob2=eob2, sod=sod, eod=eod)
        fig2 = plot_wellpath(wellpath)

        p = row(fig2, fig1)

    else:
        p = figure(sizing_mode='stretch_both')

    return p, inputs