# *********** Calculate Torque and shear stress of an I-profile 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 x4 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, constH1, constH2 and constTs (don't erase the ; at the line end). Run the script.
# ******************************************************************************************
# Berechnet Drehmoment und schubspannung eines I-Profils aus der Dehnung eines DMS, dessen Messgitter im Winkel
# von 45 zur Lngsachse liegt und in der Mitte angebracht ist
# x1 ist die Schubspannung, x4 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, constH1, constH2 und constTs (nicht das ; lschen).

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

# 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;
#constH2: inner height in mm / Innere Hhe in mm
constH2= 140;
#constTs: thickness in mm / Dicke des Mittestegs in mm
constTs=10;

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

# x2, x3: intermediate values
#other thickness needed:
x2= (constH1-constH2)/2;
x3= 2*ch1 * ((constE/2) /(1+constV));
# x4: Torque I profile
IF(x2>constTs){x4= (1.3*x3 / 3) * (2 * constB * x2 + constH2 * constTs) / (x2*1.0E9)};
ELIF(x2<=constTs){x4= (1.3*x3 / 3) * (2 * constB * x2 + constH2 * constTs) / (constTs*1.0E9)};
ENDIF;