Skip to content

Instantly share code, notes, and snippets.

@glemaitre
Created November 10, 2020 17:09
Show Gist options
  • Save glemaitre/db20edb50f1d372d5e402594859e1a01 to your computer and use it in GitHub Desktop.
Save glemaitre/db20edb50f1d372d5e402594859e1a01 to your computer and use it in GitHub Desktop.
import numpy as np
import pandas as pd
def calcul_chute_tension(
Ib=1, S=1.5, Un=400, L=0.1, metal="cuivre", phi=np.arccos(0.85)
):
Ib = np.asarray(Ib)
S = np.asarray(S)
R_const = 22.5 if metal == "cuivre" else 36
R = (S < 500).astype(np.float64) * R_const
X = (S > 50).astype(np.float64) * 0.08
results = {}
for i in Ib:
delta_Un = np.sqrt(3) * i * L * (R / S * np.cos(phi) + X * np.sin(phi))
delta_Un_perc = 100 * delta_Un / Un
results[i] = delta_Un_perc
results = pd.DataFrame(results, index=S)
results.columns = results.columns.rename("Ib")
results.index = results.index.rename("S")
return results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment