Skip to content

Commit

Permalink
SecBuildHにプロパティと初期化用メソッドを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
st-func committed Feb 13, 2024
1 parent f67abe6 commit 38bbece
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 25 deletions.
64 changes: 39 additions & 25 deletions src/sec/build-h.test.ts
@@ -1,55 +1,69 @@
import { SecBuildH } from "./build-h";
import { SecPropertyType } from "../constant";

const H = new SecBuildH();
H.a = 1.2;
H.b = 0.4;
H.t1 = 0.019;
H.t2 = 0.025;

test("SecBuildH.setDimensions", () => {
const secBuildH = new SecBuildH();
secBuildH.setDimensions(H.a, H.b, H.t1, H.t2);
expect(secBuildH.a).toBe(H.a);
expect(secBuildH.b).toBe(H.b);
expect(secBuildH.t1).toBe(H.t1);
expect(secBuildH.t2).toBe(H.t2);
expect(secBuildH.name).toBe("BH-1200x400x19x25");
});

test("ビルドHのA", () => {
const H = 1.2;
const B = 0.4;
const T1 = 0.019;
const T2 = 0.025;
const A = 4.185e-2;
expect(SecBuildH.area(H, B, T1, T2)).toBe(A);
expect(SecBuildH.property(SecPropertyType.Area, H, B, T1, T2)).toBe(A);
expect(SecBuildH.area(H.a, H.b, H.t1, H.t2)).toBe(A);
expect(SecBuildH.property(SecPropertyType.Area, H.a, H.b, H.t1, H.t2)).toBe(
A
);
});

test("ビルドHの単位質量", () => {
const H = 1.2;
const B = 0.4;
const T1 = 0.019;
const T2 = 0.025;
const M = 328.5225;
expect(SecBuildH.property(SecPropertyType.MassPerMetre, H, B, T1, T2)).toBe(
M
);
expect(
SecBuildH.property(SecPropertyType.MassPerMetre, H.a, H.b, H.t1, H.t2)
).toBe(M);
});

test("ビルドHのIy", () => {
const H = 1.2;
const B = 0.4;
const T1 = 0.019;
const T2 = 0.025;
const IY = 9.31221875e-3;
const NUM_DIGITS = 17;
expect(SecBuildH.secondMomentOfAreaY(H, B, T1, T2)).toBeCloseTo(
expect(SecBuildH.secondMomentOfAreaY(H.a, H.b, H.t1, H.t2)).toBeCloseTo(
IY,
NUM_DIGITS
);
expect(
SecBuildH.property(SecPropertyType.SecondMomentOfAreaY, H, B, T1, T2)
SecBuildH.property(
SecPropertyType.SecondMomentOfAreaY,
H.a,
H.b,
H.t1,
H.t2
)
).toBeCloseTo(IY, NUM_DIGITS);
});

test("ビルドHのIz", () => {
const H = 1.2;
const B = 0.4;
const T1 = 0.019;
const T2 = 0.025;
const IZ = 2.673239875e-4;
const NUM_DIGITS = 18;
expect(SecBuildH.secondMomentOfAreaZ(H, B, T1, T2)).toBeCloseTo(
expect(SecBuildH.secondMomentOfAreaZ(H.a, H.b, H.t1, H.t2)).toBeCloseTo(
IZ,
NUM_DIGITS
);
expect(
SecBuildH.property(SecPropertyType.SecondMomentOfAreaZ, H, B, T1, T2)
SecBuildH.property(
SecPropertyType.SecondMomentOfAreaZ,
H.a,
H.b,
H.t1,
H.t2
)
).toBeCloseTo(IZ, NUM_DIGITS);
});
32 changes: 32 additions & 0 deletions src/sec/build-h.ts
@@ -1,9 +1,41 @@
import { SecPropertyType } from "../constant";
import { SecSteel } from "./steel";
import { Unit } from "../unit";
/**
* 組立H形鋼
*/
export class SecBuildH {
/** 形状名 */
name: string = "";
/** 成 A */
a: number = 0.0;
/** フランジ幅 B */
b: number = 0.0;
/** ウェブ厚 t1 */
t1: number = 0.0;
/** フランジ厚 t2 */
t2: number = 0.0;

/**
* 寸法により初期化し、nameも設定する
* @param a 成A
* @param b フランジ幅 B
* @param t1 ウェブ厚 t1
* @param t2 フランジ厚 t2
*/
setDimensions(a: number, b: number, t1: number, t2: number) {
this.a = a;
this.b = b;
this.t1 = t1;
this.t2 = t2;
const scale: number = Unit.output(1.0, "mm");
a *= scale;
b *= scale;
t1 *= scale;
t2 *= scale;
this.name = `BH-${a}x${b}x${t1}x${t2}`;
}

/**
* 組立H形鋼の断面積
* @param a 成 A
Expand Down

0 comments on commit 38bbece

Please sign in to comment.