Skip to content

Instantly share code, notes, and snippets.

@rs38
Last active December 27, 2022 22:33
Show Gist options
  • Save rs38/812cce4da5d9937bee7fe522dea9a1b0 to your computer and use it in GitHub Desktop.
Save rs38/812cce4da5d9937bee7fe522dea9a1b0 to your computer and use it in GitHub Desktop.
CoC Fahrwiderstände visualsieren
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
}
},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"#poly: 0.01851,1.6,211\n",
"\n",
"curve = [0.01851,1.6,211] # 2474 kg Turbo\n",
"curveRoll = [0.0,1.6,211] # nur Roll\n",
"curveLu = [0.01851,0.0,0.0] # nur Luft\n",
"curve4S = [0.01737,1.6,192.1] # Prüfmasse 2334kg Taycan 4s kleine Batterie\n",
"curveModelY = [0.02658, 1.059,163.04] #2211kg 255er 19\"\n",
"curvePanaGTS = [0.03036, 1.7, 212.6] # Panamera GTS\n",
"x = [x for x in np.linspace(0,250,251)]\n",
"\n",
"r = [np.polyval(curve, i) for i in x]\n",
"rroll = [np.polyval(curveRoll, i) for i in x]\n",
"rlu = [np.polyval(curveLu, i) for i in x]\n",
"r4s = [np.polyval(curve4S, i) for i in x]\n",
"rmy = [np.polyval(curveModelY, i) for i in x]\n",
"\n",
"y = [y/36 for y in r]\n",
"yr = [y/36 for y in rroll]\n",
"y4s = [y/36 for y in r4s]\n",
"yl = [y/36 for y in rlu]\n",
"ymy = [y/36 for y in rmy]\n",
"\n",
"eta = 0.85 #90%\n",
"fix = 0.55 #~ 1 kW ständiger Verbrauch für ECUs etc.\n",
"\n",
"plt.plot(x,y, label=\"Taycan Turbo 20 \")\n",
"y = [(r*(1/eta))+((100/v)*fix) for v,r in zip(x,y)]\n",
"\n",
"plt.grid(True)\n",
"#add title\n",
"plt.title(\"Fahrwiderstand/Verbrauch\")\n",
"#add x and y labels\n",
"\n",
"plt.xlabel(\"km/h\")\n",
"\n",
"#show legend for plot \n",
"\n",
"plt.plot(x,y, 'r--' ,label=\"Taycan Turbo 20 real \")\n",
"plt.plot(x,yr, label=\"Taycan Rollwiderstand\") #\"Taycan 4S 19 kl. Akku\")\n",
"plt.plot(x,yl, label=\"Taycan Luftwiderstand\") #\"Taycan 4S 19 kl. Akku\")\n",
"plt.plot(x,ymy, label=\"Model Y LR 19\") #Panamera GTS 21\" )\n",
"plt.legend() \n",
"\n",
"plt.ylabel(\"kWh/100km\")\n",
"# change plot size\n",
"plt.rcParams[\"figure.figsize\"] = (12,12)\n",
"# grid granularity\n",
"plt.yticks(np.arange(0, 60, 2))\n",
"plt.ylim(0,44)\n",
"plt.xlim(5,200)\n",
"\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"eta=0.9 #90%\n",
"fix = 1 #1 kW\n",
"\n",
"y = [r*eta+((100/v)*fix) for v,r in zip(x,y)]\n",
"y4s = [y*eta for y in y4s]\n",
"ymy = [y*eta for y in ymy]\n",
"y\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"[x1+y1 for x1, y1 in zip(x, y)]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.10.9"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "a7085bc572327b70119356b92d91b03dcc8faec7d9473c1710c277a3b78b5c61"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
import numpy as np
import matplotlib.pyplot as plt
#poly: 0.01851,1.6,211
curve = [0.01851,1.6,211] # 2474 kg Turbo
curveRoll = [0.0,1.6,211] # nur Roll
curveLu = [0.01851,0.0,0.0] # nur Luft
curve4S = [0.01737,1.6,192.1] # Prüfmasse 2334kg Taycan 4s kleine Batterie
curveModelY = [0.02658, 1.059,163.04] #2211kg 255er 19"
curvePanaGTS = [0.03036, 1.7, 212.6] # Panamera GTS
x = [x for x in np.linspace(0,250,251)]
r = [np.polyval(curve, i) for i in x]
rroll = [np.polyval(curveRoll, i) for i in x]
rlu = [np.polyval(curveLu, i) for i in x]
r4s = [np.polyval(curve4S, i) for i in x]
rmy = [np.polyval(curveModelY, i) for i in x]
y = [y/36 for y in r]
yr = [y/36 for y in rroll]
y4s = [y/36 for y in r4s]
yl = [y/36 for y in rlu]
ymy = [y/36 for y in rmy]
eta = 0.85 #90%
fix = 0.55 #~ 1 kW ständiger Verbrauch für ECUs etc.
plt.plot(x,y, label="Taycan Turbo 20 ")
y = [(r*(1/eta))+((100/v)*fix) for v,r in zip(x,y)]
plt.grid(True)
#add title
plt.title("Fahrwiderstand/Verbrauch")
#add x and y labels
plt.xlabel("km/h")
#show legend for plot
plt.plot(x,y, 'r--' ,label="Taycan Turbo 20 real ")
plt.plot(x,yr, label="Taycan Rollwiderstand") #"Taycan 4S 19 kl. Akku")
plt.plot(x,yl, label="Taycan Luftwiderstand") #"Taycan 4S 19 kl. Akku")
plt.plot(x,ymy, label="Model Y LR 19") #Panamera GTS 21" )
plt.legend()
plt.ylabel("kWh/100km")
# change plot size
plt.rcParams["figure.figsize"] = (12,12)
# grid granularity
plt.yticks(np.arange(0, 60, 2))
plt.ylim(0,44)
plt.xlim(5,200)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment