# *********** Calculate Torque and shear stress of round tube from Strain. ch1: Strain in m/m **************
# Strain measured by strain gauge, whose strain gauge is sesitive in 45 angle to the axis
# Output x1 is the shear stress and x3 is the torque.
# Usage: - make sure ch1 measures the strain in m/m, correctly parametrized. May change ch1 in formula below to other input channel.
# -Set the parameters constE, constV, constDa and constDi (don't erase the ; at the line end). Run the script.
# ******************************************************************************************
# Berechnet Drehmoment und schubspannung eines runden Rohres oder runden Vollstabes aus der Dehnung eines DMS, dessen Messgitter im Winkel
# von 45 zur Lngsachse liegt
# x1 ist die Schubspannung, x3 das Drehmoment
# Verwendung: Stellen Sie sicher, dass ch1 die Dehnung in m/m korrekt misst. GGf. zu anderem Eingangskanal ndern (ch2 usw).
# - Setzen Sie die Parameter constE, constV, constDa und constDi (nicht das ; lschen).

# https://www.me-systeme.de/de/support/kalkulator/drehmoment1

# elastic modulus of the tube material / Elastizittsmodul des Rohrmaterials
constE= 73000;
# poissons ratio of the tube material / relatives Querkontraktions-Modul des Rohrmaterials
constV= 0.34;
#outer diameter in mm / Aussendurchmesser in mm
constDa= 200;
#inner diameter in mm. For a massive rod, set to 0  / Innendurchmesser in mm. Bei Vollrundstab: auf 0 setzen
constDi= 160;

# Output x1: shear stress in N/mm / Ausgang x1: Schubspannung in N/mm
x1= ((constE/2) /(1+constV))*ch1*2.0E-6;

constPI=3.1415926;
#   Intermediate value: polar section modulus /  polares Widerstandsmoment gegen Torsion Wp fr Voll- und Hohlzylinder in m:
x2 = constPI * (((constDa/1000)^4) - ((constDi/1000)^4)) / (16 * (constDa/1000));

#  // 10E-6 * N/mm² * m³ = 10E-6 * 10E-6 N/m² * m³ = Nm
#  $torque = $gamma * $gmod * $wt; // Mt = gamma G Wt
# x3: Torque round tube
x3= 2*ch1 * ((constE /2) /(1+constV)) * x2;