# *********** Calculate Torque and shear stress of a rectangle rod 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 strainin m/m, correctly parametrized. May change ch1 in formula below to other input channel.
# -Set the parameters constE, constV, constB and constH1 (don't erase the ; at the line end). Run the script.
# ******************************************************************************************
# Berechnet Drehmoment und schubspannung eines rechteckigen 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, constB und constH1 (nicht das ; lschen).

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

# constE: elastic modulus of the tube material / Elastizittsmodul des Rohrmaterials
constE= 73000;
# constV: poissons ratio of the tube material / relatives Querkontraktions-Modul des Rohrmaterials
constV= 0.34;
# constB: width in mm / Breite in mm
constB= 100;
# constH1: heighth in mm / Hhe in mm
constH1= 200;

# 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;
#   // polares Widerstandsmoment gegen Torsion Wp rechteck
x2= (1-(0.63*constB/constH1)+(0.052/((constH1/constB)^5))) /
    (3-(1.95/(1+((constH1/constB)^3)))) *constH1/1000*((constB/1000)^2);

# x3: Torque rectangle
x3= 2*ch1 * ((constE /2) /(1+constV)) * x2;