# *********** Calculate shear strain and axial force of a cylindric tube/rod from axial Strain. ch1: Strain in m/m **************
# Strain measured by strain gauge
# Output x1 is the shear strain in m/m and x2 is the force in N
# 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). For massive rod, set constDi= 0;
# Run the script.
# ******************************************************************************************
# Berechnet Axialkraft und Querdehnung eines zylindrischen Rohres/Stabes aus der Lngsdehung
# x1 ist die Querdehnung in m/m, x2 Axialkraft in N
# 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). Fuer massiven Stab: constDi= 0; setzen.

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

# 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 strain in m*10^-6/m / Ausgang x1: Querdehnung in m*10^-6/m
# $t_strain = -1 * $strain * $pr;
x1= ch1 * -1 * constV;

constPI=3.1415926;
#x2: force in N / Axialkraft in N
x2= ch1 * constE * constPI*(((constDa^2)-(constDi^2))/4)*1.0E-6;