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()) basecase = Premise.openfile(study_file)
pflacs_filepath = "very_simple_study.pflacs" def adda(a, b, c=0, d=0, e=0): """Add number b to number a. Optionally also add any of numbers c, d, e to the result. """ print(f"Function `adda` called with arguments a={a} b={b}", end="") if c: print(f" c={c}", end="") if d: print(f" d={d}", end="") if e: print(f" e={e}", end="") print() return a + b + c + d + e def suba(a, b, c, d=0, e=0): """Subtract numbers b and c from number a. Optionally also subtract either or both of numbers d and e from the result. """ print(f"Function `suba` called with arguments a={a} b={b} c={c}", end="") if d: print(f" d={d}", end="") if e: print(f" e={e}", end="") print() return a - b - c - d - e print(f"Open existing study from `pflacs` file «{pflacs_filepath}».") basecase = Premise.openfile(pflacs_filepath) print(basecase.to_texttree())