Пример #1
0
    def make_calc_branch(ndata):
        _parent = None
        for _d in ndata:
            _name = _d.get("name")
            _paras = _d.get("parameters", None)
            _funcname = _d.get("funcname", None)
            _argmap = _d.get("argmap", None)
            _kwargs = _d.get("kwargs", None)
            _n = Calc(_name, _parent, parameters=_paras, funcname=_funcname,
                argmap=_argmap, kwargs=_kwargs)
            _parent = _n
        return _n._root

    calctree = make_calc_branch(add_branch)
    rootnode.add_child(calctree)
    rootnode.update()
    ab = rootnode.find_one_node("name", value="a + b")
    cd = rootnode.find_one_node("name", value="c + d")
    total = rootnode.find_one_node("name", value="total")


if True:
    subp1 = SubProc("subp1", parent=rootnode, 
                    data={"desc": "SubProc test"},
                    kwargs={"presc1":1e3},
                    cmd=["ls", "-l", "/home"]) 

    import math

    func1 = PyFunc("func1", parent=rootnode, 
Пример #2
0
                data={"desc": "pipe collapse calcs."},
                funcname="pipe_collapse_all") 


rootnode.plugin_func("vertical_stability", "pdover2t.dnvgl_st_f101")
rootnode.plugin_func("lateral_stability", "pdover2t.dnvgl_st_f101")

lc1_vstab = Calc("Calc: vertical stability", parent=P01_1, 
                data={"desc": "pipeline vertical stability check."},
                funcname="vertical_stability") 

lc1_lstab = Calc("Calc: lateral stability", parent=P01_1, 
                data={"desc": "pipeline lateral stability check."},
                funcname="lateral_stability") 

P01_2 = P01.add_child(P01_1.copy())
P01_2.name = "P-01 pipeline section 2, KP 0.3-15"
P01_2.KP = [0.3, 15.0]
P01_2.h_l = -420
P01_2.LC= 1
P01_2.D = 0.6172 + 2*0.0242
P01_2.t = 0.0242

P01_3 = P01.add_child(P01_2.copy())
P01_3.name = "P-01 pipeline section 3, KP 15-79.7"
P01_3.KP = [15.0, 79.7]
#P01_3.h_l = -420
#P01_3.LC= 1
P01_3.D = 0.6172 + 2*0.0214
P01_3.t = 0.0214
Пример #3
0
        funcname="pipe_hoop_stress",
    )
    lc1_unity = Calc("Stress unity check",
                     lc1_pstress,
                     funcname="allowable_stress_unity_check",
                     argmap={
                         "sigma": "_pipe_hoop_stress",
                         "allowable": "ys",
                         "df": "design_factor",
                     })
    # lc2 = Premise("LoadCase2, pressure 20 bar.", basecase)
    # lc3 = Premise("LoadCase3, pressure 25 bar.", basecase,
    #                 parameters={
    #                     "P": 25 * 10**5,  # pipe internal pressure in Pa
    #                 }    )
    lc2 = basecase.add_child(lc1.copy())
    lc2.name = "LoadCase2, pressure 20 bar."
    lc2.P = 20 * 10**5
    lc3 = basecase.add_child(lc1.copy())
    lc3.name = "LoadCase3, pressure 25 bar."
    lc3.P = 25 * 10**5

    for _n in basecase:
        if callable(_n):
            _n()

    basecase.savefile(study_file)

if OPEN_EXISTING_STUDY:
    print(f"Open Existing study from `pflacs` file «{study_file}».")
    #print("locals()", locals())