Exemplo n.º 1
0
class TestMethods(unittest.TestCase):
    Test = pz.uniaxialTensileTest()
    Test.loadExample()
    Test.changeUnits()

    def test_1_stressEng(self):
        self.Test.calcStressEng()
        self.assertAlmostEqual(self.Test.stressEng[100], 1.0)

    def test_2_strainEng(self):
        self.Test.calcStrainEng()
        self.assertAlmostEqual(self.Test.strainEng[100], 0.001)

    def test_3_stressTrue(self):
        self.Test.calcStressTrue()
        self.assertAlmostEqual(self.Test.stressTrue[100], 1.001)

    def test_4_strainTrue(self):
        self.Test.calcStrainTrue()
        self.assertAlmostEqual(self.Test.strainTrue[100], 0.0009995)

    def test_5_elasticModulus(self):
        self.Test.calcElasticModulus(strain0=0.01, strain1=0.02)
        self.assertAlmostEqual(self.Test.YoungsModulus, 1000)

    def test_6_RP02(self):
        self.Test.calcRP02()
        self.assertAlmostEqual(self.Test.stressRP02, 100.0)

    def test_7_linearLimit(self):
        self.Test.calcLinearLimit()
        self.assertAlmostEqual(self.Test.stressLinLimit, 100.0)

    def test_8_toughness(self):
        self.Test.calcToughnessModulus()
        self.assertAlmostEqual(self.Test.ToughnessModulus, 5.0)

    def test_9_resilience(self):
        self.Test.calcResilienceModulus()
        self.assertAlmostEqual(self.Test.ResilienceModulus, 5.0)
Exemplo n.º 2
0
import pyZiagn
Test5 = pyZiagn.uniaxialTensileTest(length0=75,
                                    Area0=20.73)  #if uCrosshead lenght0=33
Test5.Title = "Test5"
Test5.TestMachine = "unibz MTS E0.10 upper"
Test5.dataSets = ["uCrosshead", "Force", "t", "uExtensometer"]
Test5.importTestData("data/5D.txt")
Test5.disp = -Test5.uExtensometer
Test5.disp = Test5.uCrosshead
Test5.changeUnits()
Test5.plotForceDisp()
#Test5.cutData("disp", 3.7)
#Test5.smoothForce()
Test5.plotForceDisp()
Test5.calcStressEng()
Test5.calcStrainEng()
Test5.plotStressStrainEng()
Test5.calcStressTrue()
Test5.calcStrainTrue()
Test5.plotStressStrainTrue()
Test5.plotStressStrainEngTrue()
Test5.calcElasticModulus(strain0=0.0000, strain1=0.001)
Test5.zeroStrain()
Test5.calcRP02()
Test5.calcLinearLimit()
Test5.calcStressUltimate()
Test5.calcLength()
Test5.calcArea()
Test5.calcBreak()
Test5.plotStressStrainEngAll()
print(Test5.stressUltimate)
Exemplo n.º 3
0
import pyZiagn
import matplotlib.pyplot as plt

TestData = "1-5.txt"
Area0 = 21.35
length0 = 33
dispCutOff = 1.75
TestName = TestData
Test4 = pyZiagn.uniaxialTensileTest(length0, Area0=Area0, Title=TestName[:-4])
Test4.importTestData("data/"+TestData)
Test4.changeUnits()
Test4.cutData("disp", dispCutOff)
Test4.smoothForce()
Test4.calcStressEng()
Test4.calcStrainEng()
Test4.calcStressTrue()
Test4.calcStrainTrue()
Test4.calcStressUltimate()
Test4.calcLength()
Test4.calcArea()
Test4.calcElasticModulus(strain0=0.0001, strain1=0.0005)
Test4.calcRP02()
Test4.calcLinearLimit()
Test4.zeroStrain()
Test4.calcToughnessModulus()
Test4.approxRambergOsgood()
Test4.approxHockettSherby()
Test4.approxGhosh()
Test4.plotStressStrainTruePlastic()
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(7, 5))
plt.plot(Test4.strainTrue, Test4.stressTrue, label="true stress-strain")
Exemplo n.º 4
0
import pyZiagn
Test2 = pyZiagn.uniaxialTensileTest(length0=30, Area0=30)
Test2.Title = "Test2"
Test2.importTestData("data/Example2.txt")
Test2.changeUnits()
Test2.cutData("disp", 1.97)
Test2.smoothForce()
Test2.plotForceDisp()
Test2.calcStressEng()
Test2.calcStrainEng()
Test2.plotStressStrainEng()
Test2.calcStressTrue()
Test2.calcStrainTrue()
Test2.plotStressStrainTrue()
Test2.plotStressStrainEngTrue()
Test2.calcElasticModulus(strain0=0.0000, strain1=0.001)
Test2.zeroStrain()
Test2.calcRP02()
Test2.calcLinearLimit()
Test2.calcStressUltimate()
Test2.calcLength()
Test2.calcArea()
Test2.plotStressStrainEngAll()
print(Test2.stressUltimate)
print(Test2.stressEng[-1])
print(Test2.stressRP02)
print(Test2.stressLinLimit)
print(Test2.YoungsModulus)
Exemplo n.º 5
0
length0 = [33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33]
dispCutOff = [2.15, 1.38, 1.38, 2.0, 1.75,
              1.95, 1.83, 1.97, 2.1, 2.07,
              3.8, 1.22, 1.95, 1.2, 1.55]
OnlyGood = False
if OnlyGood:
    NotAll = [     1,      3,  4,
                   6,           ]
    TestList = [TestList[i] for i in NotAll]
    Area0 = [Area0[i] for i in NotAll]
    length0 = [length0[i] for i in NotAll]
    dispCutOff = [dispCutOff[i] for i in NotAll]
TestName = TestList
Test = [[]]*len(TestList)
for i in range(len(TestList)):
    Test[i] = pyZiagn.uniaxialTensileTest(length0=length0[i], Area0=Area0[i],
                                          Title=TestName[i][:-4])
    Test[i].importTestData("data/"+TestList[i])
    Test[i].changeUnits()
    Test[i].plotForceDisp()
    Test[i].cutData("disp", dispCutOff[i])
    Test[i].smoothForce()
    Test[i].plotForceDispSmoothRaw()
    Test[i].calcStressEng()
    Test[i].calcStrainEng()
    Test[i].calcStressTrue()
    Test[i].calcStrainTrue()
    Test[i].calcStressUltimate()
    Test[i].calcLength()
    Test[i].calcArea()
    Test[i].calcElasticModulus(strain0=0.0001, strain1=0.0005)
    Test[i].zeroStrain()
Exemplo n.º 6
0
import pyZiagn
print("Test of package")
Test1 = pyZiagn.uniaxialTensileTest()
Test1.Title = "Test1"
Test1.loadExample()
Test1.changeUnits()
Test1.plotForceDisp()