コード例 #1
0
ファイル: test_core.py プロジェクト: e-albuquerque/lamprop
def test_lamina():  # {{{1
    f = fiber(230000, 0.30, -0.41e-6, 1.76, 'T300')
    r = resin(2900, 0.36, 41.4e-6, 1.15, 'Epikote04908')
    la = lamina(f, r, 100, 0, 0.5)
    areclose(
        (la.E1, la.E2, la.G12, la.ν12, la.αx, la.αy, la.ρ),
        (116450.0, 10980.86, 3198.53, 0.33, 1.106e-07, 4.14e-05, 1.455)
    )
    areclose(
        (la.Q̅11, la.Q̅12, la.Q̅16, la.Q̅22, la.Q̅26, la.Q̅66),
        (117658.22, 3661.28, 0.0, 11094.79, 0.0, 3198.53)
    )
コード例 #2
0
ファイル: test_parser.py プロジェクト: rsmith-nl/lamprop
def test_extended3():  # {{{1
    f = fiber(240000, 0.2, -0.2e-6, 1.76, "carbon")
    r = resin(3000, 0.3, 20e-6, 1.2, "resin")
    layers = [
        lamina(f, r, 300, 0, 0.50),
        "pw 200 45",
        lamina(f, r, 100, 45, 0.40),
        lamina(f, r, 100, -45, 0.40),
        "symmetry",
    ]
    extended = _extended(layers)
    assert len(extended) == 5
    assert isinstance(extended[0], str) and extended[0] == "pw 200 45"
    assert isinstance(extended[3], str) and extended[3] == "unknown"
コード例 #3
0
def test_good_lamina():  # {{{1
    directives = [(1, 'l: 200 0 carbon'), (2, 'l: 302 -23.2 0.3 carbon'),
                  (3, 'l: 200 0 test 3'), (4, 'l: 302 -23.2 0.3 test 3')]
    fdict = {
        'carbon': fiber(240000, 0.2, -0.2e-6, 1.76, 'carbon'),
        'test 3': fiber(240000, 0.2, -0.2e-6, 1.76, 'test 3')
    }
    r = resin(3000, 0.3, 20e-6, 1.2, 'resin')
    lamina = []
    for d in directives:
        newlamina = _get_lamina(d, fdict, r, 0.5)
        if newlamina:
            lamina.append(newlamina)
    assert len(lamina) == 4
コード例 #4
0
ファイル: test_parser.py プロジェクト: rsmith-nl/lamprop
def test_good_lamina():  # {{{1
    directives = [
        (1, "l: 200 0 carbon"),
        (2, "l: 302 -23.2 0.3 carbon"),
        (3, "l: 200 0 test 3"),
        (4, "l: 302 -23.2 0.3 test 3"),
    ]
    fdict = {
        "carbon": fiber(240000, 0.2, -0.2e-6, 1.76, "carbon"),
        "test 3": fiber(240000, 0.2, -0.2e-6, 1.76, "test 3"),
    }
    r = resin(3000, 0.3, 20e-6, 1.2, "resin")
    layers = []
    for d in directives:
        newlamina = _get_lamina(d, fdict, r, 0.5)
        if newlamina:
            layers.append(newlamina)
    assert len(layers) == 4
コード例 #5
0
ファイル: test_core.py プロジェクト: e-albuquerque/lamprop
#
# Author: R.F. Smith <*****@*****.**>
# Created: 2015-04-05 23:36:32 +0200
# Last modified: 2020-12-27T13:35:31+0100
"""Test for lamprop types"""

import sys
import math
# Inserting the path is needed to make sure that the module here is loaded,
# not an installed version!
sys.path.insert(1, '.')

from lp.core import fiber, resin, lamina, laminate  # noqa

hf = fiber(233000, 0.2, -0.54e-6, 1.76, "Hyer's carbon fiber")
hr = resin(4620, 0.36, 41.4e-6, 1.1, "Hyer's resin")


def areclose(a, b):
    for x, y in zip(a, b):
        assert math.isclose(x, y, rel_tol=0.01)


def test_lamina():  # {{{1
    f = fiber(230000, 0.30, -0.41e-6, 1.76, 'T300')
    r = resin(2900, 0.36, 41.4e-6, 1.15, 'Epikote04908')
    la = lamina(f, r, 100, 0, 0.5)
    areclose(
        (la.E1, la.E2, la.G12, la.ν12, la.αx, la.αy, la.ρ),
        (116450.0, 10980.86, 3198.53, 0.33, 1.106e-07, 4.14e-05, 1.455)
    )