Skip to content

Commit

Permalink
secPipe(円形鋼管の断面性能)関数を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
st-func committed Feb 15, 2024
1 parent 20e45ac commit 1a8efcc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/functions/functions.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { secBuildBox, secBuildH } from "./functions";
import { secBuildBox, secBuildH, secPipe } from "./functions";

test("Build-BOX", () => {
expect(secBuildBox("A", 1000, 800, 19, 25)).toBeCloseTo(76100.0, 9);
Expand All @@ -21,3 +21,14 @@ test("ビルドH", () => {
expect(secBuildH("IY", 1200, 400, 19, 25)).toBeCloseTo(9312218750.0, 5);
expect(secBuildH("IZ", 1200, 400, 19, 25)).toBeCloseTo(267323987.5, 6);
});

test("secPipe", () => {
expect(secPipe("A", 508, 9)).toBeCloseTo(1.41088926072718e4, 8);
expect(secPipe("ZY", 508, 9)).toBeCloseTo(1.72946416752188e6, 6);
expect(secPipe("ZZ", 508, 9)).toBeCloseTo(1.72946416752188e6, 6);
expect(secPipe("m", 508, 9)).toBeCloseTo(1.10754806967083e2, 10);
expect(secPipe("iY", 508, 9)).toBeCloseTo(1.76451834787854e2, 10);
expect(secPipe("iZ", 508, 9)).toBeCloseTo(1.76451834787854e2, 10);
expect(secPipe("IY", 508, 9)).toBeCloseTo(4.39283898550558e8, 4);
expect(secPipe("IZ", 508, 9)).toBeCloseTo(4.39283898550558e8, 4);
});
16 changes: 15 additions & 1 deletion src/functions/functions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SecBuildBox, SecBuildH, SecPropertyType, SecSteel, Unit } from "@st-func/st-func-ts";
import { SecBuildBox, SecBuildH, SecPipe, SecPropertyType, SecSteel, Unit } from "@st-func/st-func-ts";
/**
* 文字列をenumのpropertyTypeに変換する
* @param propertyType 文字列の断面性能タイプ
Expand Down Expand Up @@ -92,3 +92,17 @@ export function secBuildH(propertyType: string, a: number, b: number, t1: number
secBuildH.setDimensions(Unit.input(a, "mm"), Unit.input(b, "mm"), Unit.input(t1, "mm"), Unit.input(t2, "mm"));
return getSecSteelProperty(propertyType, secBuildH);
}

/**
* 円形鋼管の断面性能
* @customfunction secPipe secPipe
* @param propertyType 表示したい断面性能のタイプ
* @param d 直径 D
* @param t 板厚 t
* @returns 断面性能
*/
export function secPipe(propertyType: string, d: number, t: number): number {
const secPipe: SecPipe = new SecPipe();
secPipe.setDimensions(Unit.input(d, "mm"), Unit.input(t, "mm"));
return getSecSteelProperty(propertyType, secPipe);
}

0 comments on commit 1a8efcc

Please sign in to comment.