output formatting

master
sp9unb 2022-10-15 12:52:51 +02:00
rodzic 63c146fed6
commit 79cf1380e1
2 zmienionych plików z 30 dodań i 34 usunięć

Wyświetl plik

@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"id": "6ea87a15-f571-4611-8487-5b7556e2ef45",
"metadata": {
"extensions": {
@ -68,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 3,
"id": "d075a994-76bb-46f7-bdfb-cc6ef449dc43",
"metadata": {
"extensions": {
@ -107,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 25,
"id": "2f3b63fd-d5ea-40b6-a2f9-b31c84cfef36",
"metadata": {
"extensions": {
@ -129,7 +129,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9d3ec588fb884df5b8c6e42dad1615a0",
"model_id": "d8b847f39e5f4582b7392e58279f0843",
"version_major": 2,
"version_minor": 0
},
@ -137,7 +137,7 @@
"VBox(children=(FloatSlider(value=2.0, description='Width [m]:', layout=Layout(width='500px'), max=5.0, min=0.1…"
]
},
"execution_count": 3,
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
@ -150,35 +150,37 @@
" with out: \n",
" # Volume\n",
" volume = width * height * depth\n",
" print( \"Volume: {:.2f} [m3]\".format(volume)) \n",
" print( \"{:<20}{:>6.1f} [m3]\".format(\"Volume:\",volume)) \n",
" # Area\n",
" area = 2 * (width * height + width * depth + height * depth)\n",
" print( \"Area: {:.2f} [m2]\".format(area)) \n",
" print( \"{:<20}{:>6.1f} [m2]\".format(\"Area:\",area)) \n",
" # Coating density (protective film for painting): 300g / 4x5m = 15g/m2 \n",
" coatingWeight = coatDens * area\n",
" print( \"Coating weight: {:.2f} [g]\".format(coatingWeight)) \n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Coating weight:\",coatingWeight)) \n",
" # adhesive tape density : average 2g/m \n",
" tapeLength = 2 * width + 2 * depth + 4 * height\n",
" tapeWeight = tapeDens * tapeLength\n",
" print( \"Adh.tape length: {:.2f} [m]\".format(tapeLength)) \n",
" print( \"Adh.tape weight: {:.2f} [g]\".format(tapeWeight)) \n",
" print( \"{:<20}{:>6.1f} [m]\".format(\"Adh.tape length:\",tapeLength)) \n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Adh.tape weight:\",tapeWeight)) \n",
" totalWeight = coatingWeight + tapeWeight\n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Total ball. weight:\",totalWeight))\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",
" print( \"{:<20}{:>6.1f} [g/m3]\".format(\"Lift/volume:\",lift)) \n",
" # Total lift force lift * volume \n",
" totalLiftForce = lift * volume\n",
" print( \"Total lift force: {:.2f} [g]\".format(totalLiftForce)) \n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Total lift force:\",totalLiftForce)) \n",
" # Free lift force totalLiftForce - coatingWeight \n",
" freeLiftForce = totalLiftForce - coatingWeight - tapeWeight - payloadWeight\n",
" freeLiftForce = totalLiftForce - totalWeight - payloadWeight\n",
" if freeLiftForce < 0:\n",
" color = 'red'\n",
" else:\n",
" color = None\n",
" print( \"Free lift force:\", colored(\"{:.2f} [g]\".format(freeLiftForce),color)) \n",
" print( colored(\"{:<20}{:>6.1f} [g]\".format(\"Free lift force:\",freeLiftForce),color)) \n",
"\n",
"\n",
" geometry=BoxBufferGeometry(\n",

Wyświetl plik

@ -143,7 +143,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"id": "2f3b63fd-d5ea-40b6-a2f9-b31c84cfef36",
"metadata": {
"extensions": {
@ -179,7 +179,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e68f02b1e1c548d482d0e63bb21611dc",
"model_id": "0fb51f22550140339b0a47adcd7d8f9f",
"version_major": 2,
"version_minor": 0
},
@ -187,7 +187,7 @@
"VBox(children=(IntSlider(value=3, description='Segment num:', layout=Layout(width='500px'), max=12, min=3, sty…"
]
},
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
@ -199,35 +199,37 @@
" with out: \n",
" # Volume\n",
" vol = volume(width,heightB,heightT,num)\n",
" print( \"Volume: {:.2f} [m3]\".format(vol)) \n",
" print( \"{:<20}{:>6.1f} [m3]\".format(\"Volume:\",vol)) \n",
" # Area\n",
" area = surface_area(width,heightB,heightT,num)\n",
" print( \"Area: {:.2f} [m2]\".format(area)) \n",
" print( \"{:<20}{:>6.1f} [m2]\".format(\"Area:\",area)) \n",
" # Coating density (from: protective film for painting): 300g / 4x5m = 15g/m2 \n",
" coatingWeight = coatDens * area\n",
" print( \"Coating weight: {:.2f} [g]\".format(coatingWeight)) \n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Coating weight:\",coatingWeight)) \n",
" # adhesive tape density : average 2g/m \n",
" tapeLength = num * ( edge_len(outradius(width,num),heightT) + edge_len(outradius(width,num),heightB) )\n",
" tapeWeight = tapeDens * tapeLength\n",
" print( \"Adh.tape length: {:.2f} [m]\".format(tapeLength)) \n",
" print( \"Adh.tape weight: {:.2f} [g]\".format(tapeWeight)) \n",
" print( \"{:<20}{:>6.1f} [m]\".format(\"Adh.tape length:\",tapeLength)) \n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Adh.tape weight:\",tapeWeight)) \n",
" totalWeight = coatingWeight + tapeWeight\n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Total ball. weight:\",totalWeight)) \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",
" print( \"{:<20}{:>6.1f} [g/m3]\".format(\"Lift/volume:\",lift)) \n",
" # Total lift force lift * volume \n",
" totalLiftForce = lift * vol\n",
" print( \"Total lift force: {:.2f} [g]\".format(totalLiftForce)) \n",
" print( \"{:<20}{:>6.1f} [g]\".format(\"Total lift force:\",totalLiftForce)) \n",
" # Free lift force totalLiftForce - coatingWeight \n",
" freeLiftForce = totalLiftForce - coatingWeight - tapeWeight - payloadWeight\n",
" freeLiftForce = totalLiftForce - totalWeight - payloadWeight\n",
" if freeLiftForce < 0:\n",
" color = 'red'\n",
" else:\n",
" color = None\n",
" print( \"Free lift force:\", colored(\"{:.2f} [g]\".format(freeLiftForce),color)) \n",
" print( colored(\"{:<20}{:>6.1f} [g]\".format(\"Free lift force:\",freeLiftForce),color)) \n",
"\n",
" \n",
"# coating geometry \n",
@ -309,14 +311,6 @@
"\n",
"widgets.VBox([num, width, heightT, heightB, airTemp, hotAirTemp, coatDens,tapeDens,payloadWeight, w])\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0c7663e8-418e-47a9-9c2b-33d787f109ff",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {