def test_insulation(): """Test combined weight of pipe and insulation with no contents""" # parameter L = 10 * 12 app = App() mdl = Model('simple') # properties Pipe.from_file('pipe1', '10', '40') Insulation.from_file('insul1', 'minwool', 3) Material.from_file('mat1', 'A53A', 'B31.1') B31167('B31.1') pt10 = Point(10) run20 = Run(20, L) anc10 = Anchor('anc10', 10) anc10.apply([run20]) app.elements.select() dw = Weight('dw', 1) dw.apply() lc1 = LoadCase('lc1', 'sus', [Weight], [1]) mdl.analyze() assert compare(lc1.reactions[pt10].fy, -521.3947)
def app(): app = App() mdl = Model('simple') # properties Material.from_file('MAT1', 'A53A', 'B31.1') return app
def app(): app = App() points = app.points mdl = Model('sifs') mdl.settings.vertical = "z" Pipe.from_file('pipe1', '3.5', '40') Material.from_file('mat1', 'A53A', 'B31.1') B31167('code1') Point(10) run20 = Run(20, 5 * 12) Run(30, 5 * 12) points(20).activate() Run(40, 0, 0, 5 * 12) anc10 = Anchor('anc10', 10) anc10.apply([run20]) app.elements.select() # select all # loads W1 = Weight('W1', 1) W1.apply() # to selected elements # loadcase L1 = LoadCase('L1', 'sus', [Weight], [1]) app.models('sifs').analyze() pt30 = app.points(30) dy, dz, rx = 1, 2, 3 assert compare(L1.movements[pt30][dz], -0.20901) return app
def app(): # parameter L = 10 * 12 app = App() Model('simple') # properties Pipe.from_file('PIPE1', '10', '40') Material.from_file('MAT1', 'A53A', 'B31.1') # geometry Point(10) run15 = Run(15, L / 2) run20 = Run(20, L / 2) # code b311 = B31167('B311') b311.apply([run15, run20]) return app
def app(): app = App() mdl = Model('loads') mdl.settings.vertical = "z" Pipe.from_file('pipe1', '10', '40') Material.from_file('mat1', 'A53A', 'B31.1') B31167('code1') Point(10) run20 = Run(20, 0, 0, 10 * 12) Run(30, 0, 15 * 12) Run(40, 0, 0, -50 * 12) run50 = Run(50, 0, 25 * 12) anc10 = Anchor('anc10', 10) anc10.apply([run20]) anc50 = Anchor('anc50', 50) anc50.apply([run50]) app.elements.select() # select all return app
def main(): parser = argparse.ArgumentParser( prog="PSI", formatter_class=argparse.RawTextHelpFormatter, description=__doc__, # epilog=LICENSE, usage=argparse.SUPPRESS) parser.add_argument("-V", "--version", action="version", version="%(prog)s " + VERSION, help="show version number and exit") parser.add_argument("-i", "--interactive", dest="is_interactive", action="store_true", help="enter interactive mode after running script") parser.add_argument("file", metavar="FILE", nargs="?", help="run program from script file") # parse arguments args = parser.parse_args() cwd = os.path.abspath(os.curdir) if args.file: basename, ext = os.path.splitext(os.path.basename(args.file)) if ext == ".inp": outfile = os.path.join(cwd, basename + ".out") errfile = os.path.join(cwd, basename + ".err") else: raise IOError("Invalid file type or extension") # setup loggers setup_logger(outfile, errfile) app = App() # print("starting the gui application") num_lines = sum(1 for line in open(args.file, "r")) with open(args.file, "r") as fp: null = open(os.devnull, "w") bar = tqdm(fp, total=num_lines) header = ("PSI Analysis and Design\n" "Version: %s \n" "Design Codes: All Codes\n\n" "Input File: %s \n" % (VERSION, args.file)) bar.write(header) bar.set_description("Processing...") for lno, line in enumerate(bar, 1): # suppress all superfluous output by interp with redirect_stdout(null): try: app.interp.push(line) # catch all errors except: app.interp.showtraceback() break if lno == num_lines: bar.set_description("Done!") else: time.sleep(0.00001) if args.is_interactive: app.run() else: # print("starting the shell") outfile = os.path.join(cwd, "file.out") errfile = os.path.join(cwd, "file.err") setup_logger(outfile, errfile) App().run()
# suppress all superfluous output by interp with redirect_stdout(null): try: app.interp.push(line) # catch all errors except: app.interp.showtraceback() break if lno == num_lines: bar.set_description("Done!") else: time.sleep(0.00001) if args.is_interactive: app.run() else: # print("starting the shell") outfile = os.path.join(cwd, "file.out") errfile = os.path.join(cwd, "file.err") setup_logger(outfile, errfile) App().run() if __name__ == "__main__": App().run()