refine material structure for yield strength and get data as entered

This commit is contained in:
2019-02-10 20:45:55 +01:00
parent 9e0ccab871
commit dd8b70334e
3 changed files with 30 additions and 20 deletions

View File

@@ -16,7 +16,9 @@
"T": ["20-25", "°C"],
"rho": [2.66, "g/cm³"],
"E": [70, "GPa"],
"R_p02": ["110-130", "MPa"],
"Yield strength": {
"R_p02": ["110-130", "MPa"]
},
"R_m": ["230-290", "MPa"],
"Elongation": {
"A_5": ["10-15", "%"]

View File

@@ -32,9 +32,13 @@
"T": "Reference temperature",
"rho": "Density",
"E": "Young modulus, module of elasticity",
"R_p": "Yield strength R_p (R_e), R_{p0.2}",
"R_p02": "Yield strength R_p (R_e), R_{p0.2}",
"R_m": "Ultimate tensile strength R_m",
"Yield strength": {
"R_s": "it is detectable only when the material has the yield phenomenon (it does not exist for the cold drawn and the stainless steels)",
"R_p": "it is detectable on cold drawn and stainless steel, in place of R_s",
"R_p02": "load corresponding to a no proportional charge equal to a 0.2% of length L_0",
"R_p10": "load corresponding to a no proportional charge equal to a 1% of length L_0"
},
"R_m": "Ultimate tensile strength; it is the ratio between the maximum applied force and the original cross-sectional area of the specimen",
"Elongation": {
"A": "permanent elongation of length L_0, expressed in per cent of length L_0",
"A_0": "permanent elongation for proportional specimens with length L_0 equal to 100 mm (used for diameter lower than 4 mm)",
@@ -109,7 +113,9 @@
"T": ["20-25", "°C"],
"rho": [2.66, "g/cm³"],
"E": [70, "GPa"],
"R_p02": ["110-130", "MPa"],
"Yield strength": {
"R_p02": ["110-130", "MPa"]
},
"R_m": ["230-290", "MPa"],
"Elongation": {
"A_5": ["10-15", "%"]

View File

@@ -180,9 +180,9 @@ def main():
parser_get.add_argument('-E', '--E', dest='const_collection',
action='append_const', const="E",
help='get Young\'s modulus, module of elasticity')
parser_get.add_argument('-R', '--R_p02', dest='const_collection',
action='append_const', const="R_p02",
help='get yield strength R_e, R_{p0.2}')
parser_get.add_argument('-R', '--R_p', dest='const_collection',
action='append_const', const="R_p",
help='get yield strength R_p')
parser_get.add_argument('--R_m', dest='const_collection',
action='append_const', const="R_m",
help='get ultimate tensile strength R_m')
@@ -207,18 +207,20 @@ def main():
if args.const_collection:
data = load_material(args.materialname)
if args.debug:
print("data: " + data)
if "rho" in args.const_collection:
#args.const_collection.append("rho(T)")
#f args.debug:
# print(args)
print_quantity(data['Mechanical Properties']['rho'])
if "E" in args.const_collection:
print_quantity(data['Mechanical Properties']['E'])
if "R_p02" in args.const_collection:
print_quantity(data['Mechanical Properties']['R_p02'])
if "R_m" in args.const_collection:
print_quantity(data['Mechanical Properties']['R_m'])
print("data:")
print_material(data)
for element in args.const_collection: # iter the way it is been entered as args
if element == "rho":
print_quantity(data['Mechanical Properties']['rho'])
elif element == "E":
print_quantity(data['Mechanical Properties']['E'])
elif element == "R_p":
if len(data['Mechanical Properties']['Yield strength']) == 1:
print_quantity(next(iter(data['Mechanical Properties']['Yield strength'].values())))
else:
print_quantity(data['Mechanical Properties']['Yield strength'])
elif element == "R_m":
print_quantity(data['Mechanical Properties']['R_m'])
elif args.search:
search_list = [element for element in args.search.split(',')]