master
SP9UNB 2022-10-12 10:21:16 +02:00
rodzic b83c487bfc
commit 48aceedf19
1 zmienionych plików z 63 dodań i 50 usunięć

Wyświetl plik

@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 29,
"id": "2f3b63fd-d5ea-40b6-a2f9-b31c84cfef36",
"metadata": {
"extensions": {
@ -129,41 +129,46 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "68aa2b284295445fbd69f50a344827cc",
"model_id": "b0fd2ea17df240dab9321a1d81ca8da9",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"interactive(children=(FloatSlider(value=2.0, description='Width [m]:', layout=Layout(width='500px'), max=5.0, …"
"VBox(children=(FloatSlider(value=2.0, description='Width [m]:', layout=Layout(width='500px'), max=5.0, min=0.1…"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "display_data"
"output_type": "execute_result"
}
],
"source": [
"def f(width,height,depth,airTemp,hotAirTemp,coatDens):\n",
" \n",
" \n",
" out=widgets.Output(layout={'margin': '10px 10px 10px 10px'}) \n",
" with out: \n",
" print(\"\\n\")\n",
"# Volume\n",
" # Volume\n",
" volume = width * height * depth\n",
" print( \"Volume: {:.2f} [m3]\".format(volume)) \n",
"# Area\n",
" # Area\n",
" area = 2 * (width * height + width * depth + height * depth)\n",
" print( \"Area: {:.2f} [m2]\".format(area)) \n",
"# Coating density (protective film for painting): 300g / 4x5m = 15g/m2 \n",
" # Coating density (protective film for painting): 300g / 4x5m = 15g/m2 \n",
" coatingWeight = coatDens * area\n",
" print( \"Coating weight: {:.2f} [g]\".format(coatingWeight)) \n",
"# Lift per volume g/m3 \n",
"# airDens = dens_temp_func( airTemp )\n",
"# hotAirDens = dens_temp_func( hotAirTemp ) \n",
" # Lift per volume g/m3 \n",
" # airDens = dens_temp_func( airTemp )\n",
" # hotAirDens = dens_temp_func( hotAirTemp ) \n",
" airDens = airDensity( airTemp )\n",
" hotAirDens = airDensity( hotAirTemp ) \n",
" lift = airDens - hotAirDens\n",
" print( \"Lift: {:.2f} [g/m3]\".format(lift)) \n",
"# Total lift force lift * volume \n",
" # Total lift force lift * volume \n",
" totalLiftForce = lift * volume\n",
" print( \"Total lift force: {:.2f} [g]\".format(totalLiftForce)) \n",
"# Free lift force totalLiftForce - coatingWeight \n",
" # Free lift force totalLiftForce - coatingWeight \n",
" freeLiftForce = totalLiftForce - coatingWeight\n",
" if freeLiftForce < 0:\n",
" color = 'red'\n",
@ -172,6 +177,7 @@
" print( \"Free lift force:\", colored(\"{:.2f} [g]\".format(freeLiftForce),color)) \n",
" print(\"\\n\")\n",
"\n",
" \n",
" box = Mesh(geometry=BoxBufferGeometry(\n",
" width=width, \n",
" height=height, \n",
@ -193,7 +199,10 @@
" clearOpacity=1.0,\n",
" clearColor='#62a0ea',\n",
" controls=[OrbitControls(controlling=c)])\n",
" return renderer\n",
" \n",
" display(widgets.HBox([renderer, out])) \n",
"# return renderer\n",
"\n",
"\n",
"#display(HTML('''<style>\n",
"# .widget-label { min-width: 25ex !important; }\n",
@ -202,23 +211,27 @@
"layout=Layout(width='500px')\n",
"style = {'description_width': 'initial'}\n",
" \n",
"widgets.interact(f, \n",
" width=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Width [m]:',readout_format='.1f',layout=layout,style=style), \n",
" height=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Height [m]:',readout_format='.1f',layout=layout,style=style), \n",
" depth=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Depth [m]:',readout_format='.1f',layout=layout,style=style),\n",
" airTemp=widgets.FloatSlider(min=-40, max=35, step=1.0, value=10.0, description='Air temp.[°C]:',readout_format='.0f',layout=layout,style=style), \n",
" hotAirTemp=widgets.FloatSlider(min=-40, max=55, step=1.0, value=35.0, description='Hot air temp.[°C]:',readout_format='.0f',layout=layout,style=style),\n",
" coatDens=widgets.FloatSlider(min=1, max=50, step=1.0, value=15.0, description='Coating density [g/m2]:',readout_format='.0f',layout=layout,style=style) \n",
" );\n"
"width=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Width [m]:',readout_format='.1f',layout=layout,style=style) \n",
"height=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Height [m]:',readout_format='.1f',layout=layout,style=style) \n",
"depth=widgets.FloatSlider(min=0.1, max=5.0, step=0.1, value=2.0, description='Depth [m]:',readout_format='.1f',layout=layout,style=style)\n",
"airTemp=widgets.FloatSlider(min=-40, max=35, step=1.0, value=10.0, description='Air temp.[°C]:',readout_format='.0f',layout=layout,style=style) \n",
"hotAirTemp=widgets.FloatSlider(min=-40, max=55, step=1.0, value=35.0, description='Hot air temp.[°C]:',readout_format='.0f',layout=layout,style=style)\n",
"coatDens=widgets.FloatSlider(min=1, max=50, step=1.0, value=15.0, description='Coating density [g/m2]:',readout_format='.0f',layout=layout,style=style) \n",
"\n",
"\n",
"w = widgets.interactive_output(f, {\n",
" 'width' : width,\n",
" 'height' : height,\n",
" 'depth' : depth,\n",
" 'airTemp' : airTemp,\n",
" 'hotAirTemp' : hotAirTemp,\n",
" 'coatDens' : coatDens\n",
" }\n",
" )\n",
"\n",
"\n",
"widgets.VBox([width, height, depth, airTemp, hotAirTemp, coatDens, w])\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f57a4d40-ce23-4f32-941a-e085689fa6cf",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {