-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Validation EU Designation\n", | ||
"\n", | ||
"All HEA, HEB, HEM, IPE section designations are supported.\n", | ||
"\n", | ||
"The reference values are obtained from [Beam Dimensions](https://beamdimensions.com/)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 21, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from io import StringIO\n", | ||
"from pandas import read_csv\n", | ||
"\n", | ||
"\n", | ||
"section_table = read_csv(\n", | ||
" StringIO(\"\"\"\n", | ||
"designation,h,b,tw,tf,hi,A,Iy,Iz\n", | ||
"HEA100,96,100,5,8,80,21.2,349.2,133.8\n", | ||
"HEA120,114,120,5,8,98,25.3,606.2,230.9\n", | ||
"HEA140,133,140,5.5,8.5,116,31.4,1033,389.3\n", | ||
"HEA160,152,160,6,9,134,38.8,1673,615.6\n", | ||
"HEA180,171,180,6,9.5,152,45.3,2510,924.6\n", | ||
"HEA200,190,200,6.5,10,170,53.8,3692,1336\n", | ||
"HEA220,210,220,7,11,188,64.3,5410,1955\n", | ||
"HEA240,230,240,7.5,12,206,76.8,7763,2769\n", | ||
"HEA260,250,260,7.5,12.5,225,86.8,10450,3668\n", | ||
"HEA280,270,280,8,13,244,97.3,13670,4763\n", | ||
"HEA300,290,300,8.5,14,262,112.5,18260,6310\n", | ||
"HEA320,310,300,9,15.5,279,124.4,22930,6985\n", | ||
"HEA340,330,300,9.5,16.5,297,133.5,27690,7436\n", | ||
"HEA360,350,300,10,17.5,315,142.8,33090,7887\n", | ||
"HEA400,390,300,11,19,352,159,45070,8564\n", | ||
"HEA450,440,300,11.5,21,398,178,63720,9465\n", | ||
"HEA500,490,300,12,23,444,197.5,86970,10370\n", | ||
"HEA550,540,300,12.5,24,492,211.8,111900,10820\n", | ||
"HEA600,590,300,13,25,540,226.5,141200,11270\n", | ||
"HEA650,640,300,13.5,26,588,241.6,175200,11720\n", | ||
"HEA700,690,300,14.5,27,636,260.5,215300,12180\n", | ||
"HEA800,790,300,15,28,734,285.8,303400,12640\n", | ||
"HEA900,890,300,16,30,830,320.5,422100,13550\n", | ||
"HEA1000,990,300,16.5,31,928,346.8,553800,14000\n", | ||
"HEB100,100,100,6,10,80,26,449.5,167.3\n", | ||
"HEB120,120,120,6.5,11,98,34,864.4,317.5\n", | ||
"HEB140,140,140,7,12,116,43,1509,549.7\n", | ||
"HEB160,160,160,8,13,134,54.3,2492,889.2\n", | ||
"HEB180,180,180,8.5,14,152,65.3,3831,1363\n", | ||
"HEB200,200,200,9,15,170,78.1,5696,2003\n", | ||
"HEB220,220,220,9.5,16,188,91,8091,2843\n", | ||
"HEB240,240,240,10,17,206,106,11260,3923\n", | ||
"HEB260,260,260,10,17.5,225,118.4,14920,5135\n", | ||
"HEB280,280,280,10.5,18,244,131.4,19270,6595\n", | ||
"HEB300,300,300,11,19,262,149.1,25170,8563\n", | ||
"HEB320,320,300,11.5,20.5,279,161.3,30820,9239\n", | ||
"HEB340,340,300,12,21.5,297,170.9,36660,9690\n", | ||
"HEB360,360,300,12.5,22.5,315,180.6,43190,10140\n", | ||
"HEB400,400,300,13.5,24,352,197.8,57680,10820\n", | ||
"HEB450,450,300,14,26,398,218,79890,11720\n", | ||
"HEB500,500,300,14.5,28,444,238.6,107200,12620\n", | ||
"HEB550,550,300,15,29,492,254.1,136700,13080\n", | ||
"HEB600,600,300,15.5,30,540,270,171000,13530\n", | ||
"HEB650,650,300,16,31,588,286.3,210600,13980\n", | ||
"HEB700,700,300,17,32,636,306.4,256900,14440\n", | ||
"HEB800,800,300,17.5,33,734,334.2,359100,14900\n", | ||
"HEB900,900,300,18.5,35,830,371.3,494100,15820\n", | ||
"HEB1000,1000,300,19,36,928,400,644700,16280\n", | ||
"HEM100,120,106,12,20,80,53.2,1143,399.2\n", | ||
"HEM120,140,126,12.5,21,98,66.4,2018,702.8\n", | ||
"HEM140,160,146,13,22,116,80.6,3291,1144\n", | ||
"HEM160,180,166,14,23,134,97.1,5098,1759\n", | ||
"HEM180,200,186,14.5,24,152,113.3,7483,2580\n", | ||
"HEM200,220,206,15,25,170,131.3,10640,3651\n", | ||
"HEM220,240,226,15.5,26,188,149.4,14600,5012\n", | ||
"HEM240,270,248,18,32,206,199.6,24290,8153\n", | ||
"HEM260,290,268,18,33,225,219.6,31310,10450\n", | ||
"HEM280,310,288,18.5,33,244,240.2,39550,13160\n", | ||
"HEM300,340,310,21,39,262,303.1,59200,19400\n", | ||
"HEM320,359,309,21,40,279,312,68130,19710\n", | ||
"HEM340,377,309,21,40,297,315.8,76370,19710\n", | ||
"HEM360,395,308,21,40,315,318.8,84870,19520\n", | ||
"HEM400,432,307,21,40,352,325.8,104100,19340\n", | ||
"HEM450,478,307,21,40,398,335.4,131500,19340\n", | ||
"HEM500,524,306,21,40,444,344.3,161900,19150\n", | ||
"HEM550,572,306,21,40,492,354.4,198000,19160\n", | ||
"HEM600,620,305,21,40,540,363.7,237400,18980\n", | ||
"HEM650,668,305,21,40,588,373.7,281700,18980\n", | ||
"HEM700,716,304,21,40,636,383,329300,18800\n", | ||
"HEM800,814,303,21,40,734,404.3,442600,18630\n", | ||
"HEM900,910,302,21,40,830,423.6,570400,18450\n", | ||
"HEM1000,1008,302,21,40,928,444.2,722300,18460\n", | ||
"IPE80,80,46,3.8,5.2,69.6,7.6,80,8.5\n", | ||
"IPE100,100,55,4.1,5.7,88.6,10.3,171,15.9\n", | ||
"IPE120,120,64,4.4,6.3,107.4,13.2,318,27.7\n", | ||
"IPE140,140,73,4.7,6.9,126.2,16.4,541,44.9\n", | ||
"IPE160,160,82,5,7.4,145.2,20.1,869,68.3\n", | ||
"IPE180,180,91,5.3,8,164,23.9,1317,101\n", | ||
"IPE200,200,100,5.6,8.5,183,28.5,1943,142\n", | ||
"IPE220,220,110,5.9,9.2,201.6,33.4,2772,205\n", | ||
"IPE240,240,120,6.2,9.8,220.4,39.1,3892,284\n", | ||
"IPE270,270,135,6.6,10.2,249.6,45.9,5790,420\n", | ||
"IPE300,300,150,7.1,10.7,278.6,53.8,8356,604\n", | ||
"IPE330,330,160,7.5,11.5,307,62.6,11770,788\n", | ||
"IPE360,360,170,8,12.7,334.6,72.7,16270,1043\n", | ||
"IPE400,400,180,8.6,13.5,373,84.5,23130,1318\n", | ||
"IPE450,450,190,9.4,14.6,420.8,98.8,33740,1676\n", | ||
"IPE500,500,200,10.2,16,468,115.5,48200,2142\n", | ||
"IPE550,550,210,11.1,17.2,515.6,134.4,67120,2668\n", | ||
"IPE600,600,220,12,19,562,156,92080,3387\n", | ||
"\"\"\")\n", | ||
")\n", | ||
"\n", | ||
"\n", | ||
"def get_properties(designation: str):\n", | ||
" section = section_table[section_table[\"designation\"] == designation]\n", | ||
" return (\n", | ||
" 1e2 * section[\"A\"].values[0],\n", | ||
" 1e4 * section[\"Iy\"].values[0],\n", | ||
" 1e4 * section[\"Iz\"].values[0],\n", | ||
" )" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 22, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import subprocess\n", | ||
"import tempfile\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"\n", | ||
"template = \"\"\"\n", | ||
"node 1 0 0 0\n", | ||
"\n", | ||
"material Elastic1D 1 1\n", | ||
"\n", | ||
"section EU3D $designation$ 1 1 1\n", | ||
"\n", | ||
"element SingleSection3D 1 1 1\n", | ||
"\n", | ||
"displacement 1 0 1 1 1\n", | ||
"displacement 2 0 1 2 1\n", | ||
"displacement 3 0 1 3 1\n", | ||
"\n", | ||
"step static 1 1\n", | ||
"set ini_step_size 1\n", | ||
"\n", | ||
"analyze\n", | ||
"\n", | ||
"peek node 1\n", | ||
"\n", | ||
"exit\n", | ||
"\"\"\"\n", | ||
"\n", | ||
"\n", | ||
"all_results = {}\n", | ||
"\n", | ||
"\n", | ||
"def validate(designation: str):\n", | ||
" def run_analysis():\n", | ||
" with tempfile.NamedTemporaryFile() as fp:\n", | ||
" with open(fp.name, \"w\") as f:\n", | ||
" f.write(template.replace(\"$designation$\", designation))\n", | ||
"\n", | ||
" result = (\n", | ||
" subprocess.check_output([\"suanpan\", \"-nu\", \"-nc\", \"-f\", fp.name])\n", | ||
" .decode(\"utf-8\")\n", | ||
" .splitlines()\n", | ||
" )\n", | ||
"\n", | ||
" for i, line in enumerate(result):\n", | ||
" if line.startswith(\"Resistance\"):\n", | ||
" return [float(x) for x in result[i + 1].split()]\n", | ||
"\n", | ||
" if result := run_analysis():\n", | ||
" all_results[designation] = [\n", | ||
" x / y for x, y in zip(result, get_properties(designation))\n", | ||
" ]\n", | ||
"\n", | ||
"\n", | ||
"for _, row in section_table.iterrows():\n", | ||
" validate(row[\"designation\"])" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"fig = plt.figure(figsize=(15, 10), tight_layout=True)\n", | ||
"\n", | ||
"\n", | ||
"def plot(title, index):\n", | ||
" values = [x[index] for x in all_results.values()]\n", | ||
" min_value = min(values)\n", | ||
" max_value = max(values)\n", | ||
" colors = [\"red\" if abs(x - 1) > 0.05 else \"green\" for x in values]\n", | ||
" ax = fig.add_subplot(3, 1, index + 1)\n", | ||
" ax.bar(all_results.keys(), values, color=colors)\n", | ||
" ax.set_ylabel(\"Numerical/Analytical\")\n", | ||
" ax.set_xlabel(\"Section\")\n", | ||
" ax.set_ybound(min_value - 0.02, max_value + 0.01)\n", | ||
" ax.set_xlim(-1, len(all_results))\n", | ||
" ax.grid()\n", | ||
"\n", | ||
" for i, v in enumerate(values):\n", | ||
" ax.text(\n", | ||
" i, min_value - 0.01, f\"{v:.3f}\", horizontalalignment=\"center\", rotation=90\n", | ||
" )\n", | ||
"\n", | ||
" ax.set_title(title)\n", | ||
" ax.set_xticks(ax.get_xticks())\n", | ||
" ax.set_xticklabels(ax.get_xticklabels(), rotation=90)\n", | ||
"\n", | ||
"\n", | ||
"plot(\"EU Area\", 0)\n", | ||
"plot(\"EU Strong Axis Moment of Inertia\", 1)\n", | ||
"plot(\"EU Weak Axis Moment of Inertia\", 2)\n", | ||
"\n", | ||
"fig.savefig(\"EU.pdf\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": ".venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.12.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.