@theerapat-s28/ts-structural-eng-tools 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +106 -0
  3. package/dist/core/constants/rc.constant.d.ts +2 -0
  4. package/dist/core/constants/rc.constant.js +6 -0
  5. package/dist/core/constants/rc.constant.js.map +1 -0
  6. package/dist/core/errors/rc-design.error.d.ts +11 -0
  7. package/dist/core/errors/rc-design.error.js +24 -0
  8. package/dist/core/errors/rc-design.error.js.map +1 -0
  9. package/dist/core/index.d.ts +7 -0
  10. package/dist/core/index.js +14 -0
  11. package/dist/core/index.js.map +1 -0
  12. package/dist/core/types/output-message.type.d.ts +10 -0
  13. package/dist/core/types/output-message.type.js +3 -0
  14. package/dist/core/types/output-message.type.js.map +1 -0
  15. package/dist/core/types/plate-jacketing.type.d.ts +8 -0
  16. package/dist/core/types/plate-jacketing.type.js +3 -0
  17. package/dist/core/types/plate-jacketing.type.js.map +1 -0
  18. package/dist/core/types/rc-beam.type.d.ts +15 -0
  19. package/dist/core/types/rc-beam.type.js +10 -0
  20. package/dist/core/types/rc-beam.type.js.map +1 -0
  21. package/dist/core/types/unit.type.d.ts +1 -0
  22. package/dist/core/types/unit.type.js +3 -0
  23. package/dist/core/types/unit.type.js.map +1 -0
  24. package/dist/index.d.ts +5 -0
  25. package/dist/index.js +24 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/rc/general.d.ts +21 -0
  28. package/dist/rc/general.js +38 -0
  29. package/dist/rc/general.js.map +1 -0
  30. package/dist/rc/index.d.ts +2 -0
  31. package/dist/rc/index.js +10 -0
  32. package/dist/rc/index.js.map +1 -0
  33. package/dist/rc/rc-beam-design.d.ts +18 -0
  34. package/dist/rc/rc-beam-design.js +181 -0
  35. package/dist/rc/rc-beam-design.js.map +1 -0
  36. package/dist/strengthening/index.d.ts +1 -0
  37. package/dist/strengthening/index.js +6 -0
  38. package/dist/strengthening/index.js.map +1 -0
  39. package/dist/strengthening/rc-beam-steel-plate-jacketing.d.ts +27 -0
  40. package/dist/strengthening/rc-beam-steel-plate-jacketing.js +75 -0
  41. package/dist/strengthening/rc-beam-steel-plate-jacketing.js.map +1 -0
  42. package/dist/utils/index.d.ts +2 -0
  43. package/dist/utils/index.js +9 -0
  44. package/dist/utils/index.js.map +1 -0
  45. package/dist/utils/math.d.ts +17 -0
  46. package/dist/utils/math.js +35 -0
  47. package/dist/utils/math.js.map +1 -0
  48. package/dist/utils/merge-warning.d.ts +9 -0
  49. package/dist/utils/merge-warning.js +15 -0
  50. package/dist/utils/merge-warning.js.map +1 -0
  51. package/package.json +73 -0
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2026, theerapat-s28
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # ts-structural-eng
2
+
3
+ A TypeScript library of structural-engineering helper functions and beam design utilities. Designed to be copied and reused across TypeScript frameworks.
4
+
5
+ ## Quick summary
6
+
7
+ - Package: `ts-structural-eng-tools`
8
+ - Entry: `src/index.ts`
9
+ - Build output: `dist/` (JS + `.d.ts` files)
10
+
11
+ ## Prerequisites
12
+
13
+ - Node.js (v18+ recommended)
14
+ - pnpm
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pnpm install
20
+ ```
21
+
22
+ ## Scripts
23
+
24
+ | Command | Description |
25
+ | ---------------------- | ----------------------------------------------- |
26
+ | `pnpm run dev` | Run the example file with `ts-node` |
27
+ | `pnpm run build` | Compile TypeScript into `dist/` |
28
+ | `pnpm run lint` | Lint source files with ESLint |
29
+ | `pnpm run lint:fix` | Auto-fix lint issues |
30
+ | `pnpm run format` | Format code with Prettier |
31
+ | `pnpm run format:check`| Check formatting without writing |
32
+ | `pnpm run test` | Run unit tests with Vitest |
33
+ | `pnpm run test:watch` | Run tests in watch mode |
34
+
35
+ ## Project layout
36
+
37
+ ```
38
+ src/
39
+ ├── index.ts # Main barrel export
40
+ ├── rc/ # Reinforced concrete design
41
+ │ ├── index.ts # Module exports
42
+ │ ├── general.ts # Concrete properties (beta1, Ec, unit conversion)
43
+ │ └── rc-beam-design.ts # Beam moment capacity (singly/doubly reinforced)
44
+ ├── strengthening/ # Strengthening methods
45
+ │ ├── index.ts
46
+ │ └── rc-beam-steel-plate-jacketing.ts
47
+ ├── core/ # Shared infrastructure
48
+ │ ├── index.ts
49
+ │ ├── constants/ # RC design constants (ACI 318)
50
+ │ ├── errors/ # Custom error classes
51
+ │ └── types/ # Shared type definitions
52
+ └── utils/ # Helper utilities
53
+ ├── index.ts
54
+ ├── math.ts # Quadratic solver, rounding
55
+ └── merge-warning.ts # Warning array merging
56
+ examples/
57
+ └── basic-usage.ts # Example usage of the library
58
+ tests/
59
+ ├── rc/ # Tests for RC module
60
+ └── utils/ # Tests for utilities
61
+ ```
62
+
63
+ ## TypeScript path aliases
64
+
65
+ This project uses `baseUrl` + `paths` for clean imports:
66
+
67
+ ```jsonc
68
+ "paths": {
69
+ "@app-core/*": ["src/core/*"],
70
+ "@app-types/*": ["src/core/types/*"],
71
+ "@app-utils/*": ["src/utils/*"],
72
+ "@app-rc/*": ["src/rc/*"],
73
+ "@app-strg/*": ["src/strengthening/*"]
74
+ }
75
+ ```
76
+
77
+ For runtime resolution, `tsconfig-paths` is registered in the `dev` script.
78
+
79
+ ## API
80
+
81
+ ### RC Beam Design
82
+
83
+ - **`rectBeamMomentCapacity(section)`** — Computes φMn for a rectangular RC beam (singly or doubly reinforced). Returns `phiMn` in kN·m with calculation details and ACI 318-19 warnings.
84
+
85
+ ### Strengthening
86
+
87
+ - **`calculateSteelJacketedBeamMomentCapacity(section, jacketedProperties)`** — Computes φMn for a beam strengthened with steel plate jacketing.
88
+
89
+ ### General Utilities
90
+
91
+ - **`concreteBeta(fc_)`** — ACI 318 β₁ factor
92
+ - **`concreteElasticModulus(fc_)`** — Ec = 4700√f'c (MPa)
93
+ - **`psiToMpa(psi)`** — Unit conversion
94
+
95
+ ## Build
96
+
97
+ ```bash
98
+ pnpm run build
99
+ node dist/index.js
100
+ ```
101
+
102
+ ## Tests
103
+
104
+ ```bash
105
+ pnpm run test
106
+ ```
@@ -0,0 +1,2 @@
1
+ export declare const FLEXURAL_STRENGTH_REDUCTION_FACTOR = 0.9;
2
+ export declare const CONCRETE_ULTIMATE_STRAIN = 0.003;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONCRETE_ULTIMATE_STRAIN = exports.FLEXURAL_STRENGTH_REDUCTION_FACTOR = void 0;
4
+ exports.FLEXURAL_STRENGTH_REDUCTION_FACTOR = 0.9;
5
+ exports.CONCRETE_ULTIMATE_STRAIN = 0.003;
6
+ //# sourceMappingURL=rc.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rc.constant.js","sourceRoot":"","sources":["../../../src/core/constants/rc.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,kCAAkC,GAAG,GAAG,CAAC;AACzC,QAAA,wBAAwB,GAAG,KAAK,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare class RCDesignError extends Error {
2
+ code: number;
3
+ message: string;
4
+ constructor(std?: RCDesignErrorType);
5
+ }
6
+ type RCDesignErrorType = {
7
+ code: number;
8
+ message: string;
9
+ };
10
+ export declare const Errors: Record<string, RCDesignErrorType>;
11
+ export {};
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Errors = exports.RCDesignError = void 0;
4
+ class RCDesignError extends Error {
5
+ constructor(std = { code: 0, message: "Unknown error" }) {
6
+ super(std.message);
7
+ this.code = std.code;
8
+ this.message = std.message;
9
+ Object.setPrototypeOf(this, RCDesignError.prototype);
10
+ }
11
+ }
12
+ exports.RCDesignError = RCDesignError;
13
+ exports.Errors = {
14
+ // 1XX : RC Beam Design Errors
15
+ COMP_STEEL_DISTANCE_OVER_AC: {
16
+ code: 101,
17
+ message: "d' of compressive steel is greater than c, consider using singly reinforced section.",
18
+ },
19
+ TENSILE_STEEL_NOT_YIELDING: {
20
+ code: 102,
21
+ message: "Out of tension controlled region, tensile steel is not yielding.",
22
+ },
23
+ };
24
+ //# sourceMappingURL=rc-design.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rc-design.error.js","sourceRoot":"","sources":["../../../src/core/errors/rc-design.error.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IAItC,YAAY,MAAyB,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE;QACxE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AAVD,sCAUC;AAOY,QAAA,MAAM,GAAsC;IACvD,8BAA8B;IAC9B,2BAA2B,EAAE;QAC3B,IAAI,EAAE,GAAG;QACT,OAAO,EACL,sFAAsF;KACzF;IACD,0BAA0B,EAAE;QAC1B,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,kEAAkE;KAC5E;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type { RectBeamSection, RectSinglyBeamSection, RectDoublyBeamSection, } from "./types/rc-beam.type";
2
+ export { isSinglyReinforced } from "./types/rc-beam.type";
3
+ export type { SteelJacketedProps } from "./types/plate-jacketing.type";
4
+ export type { Warnings, calculationResult } from "./types/output-message.type";
5
+ export type { unit } from "./types/unit.type";
6
+ export { FLEXURAL_STRENGTH_REDUCTION_FACTOR, CONCRETE_ULTIMATE_STRAIN, } from "./constants/rc.constant";
7
+ export { RCDesignError, Errors } from "./errors/rc-design.error";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Errors = exports.RCDesignError = exports.CONCRETE_ULTIMATE_STRAIN = exports.FLEXURAL_STRENGTH_REDUCTION_FACTOR = exports.isSinglyReinforced = void 0;
4
+ var rc_beam_type_1 = require("./types/rc-beam.type");
5
+ Object.defineProperty(exports, "isSinglyReinforced", { enumerable: true, get: function () { return rc_beam_type_1.isSinglyReinforced; } });
6
+ // Constants
7
+ var rc_constant_1 = require("./constants/rc.constant");
8
+ Object.defineProperty(exports, "FLEXURAL_STRENGTH_REDUCTION_FACTOR", { enumerable: true, get: function () { return rc_constant_1.FLEXURAL_STRENGTH_REDUCTION_FACTOR; } });
9
+ Object.defineProperty(exports, "CONCRETE_ULTIMATE_STRAIN", { enumerable: true, get: function () { return rc_constant_1.CONCRETE_ULTIMATE_STRAIN; } });
10
+ // Errors
11
+ var rc_design_error_1 = require("./errors/rc-design.error");
12
+ Object.defineProperty(exports, "RCDesignError", { enumerable: true, get: function () { return rc_design_error_1.RCDesignError; } });
13
+ Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return rc_design_error_1.Errors; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;AAMA,qDAA0D;AAAjD,kHAAA,kBAAkB,OAAA;AAK3B,YAAY;AACZ,uDAGiC;AAF7B,iIAAA,kCAAkC,OAAA;AAClC,uHAAA,wBAAwB,OAAA;AAG5B,SAAS;AACT,4DAAiE;AAAxD,gHAAA,aAAa,OAAA;AAAE,yGAAA,MAAM,OAAA"}
@@ -0,0 +1,10 @@
1
+ type NoteWithReference = {
2
+ reference?: string;
3
+ message: string;
4
+ };
5
+ export type Warnings = Array<NoteWithReference>;
6
+ export type calculationResult = {
7
+ [key: string]: any;
8
+ warnings: Warnings;
9
+ };
10
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=output-message.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-message.type.js","sourceRoot":"","sources":["../../../src/core/types/output-message.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export interface SteelJacketedProps {
2
+ Es: number;
3
+ fy: number;
4
+ topSteelWidth: number;
5
+ topSteelThickness: number;
6
+ bottomSteelWidth: number;
7
+ bottomSteelThickness: number;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=plate-jacketing.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plate-jacketing.type.js","sourceRoot":"","sources":["../../../src/core/types/plate-jacketing.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ export type RectBeamSection = RectSinglyBeamSection | RectDoublyBeamSection;
2
+ export interface RectSinglyBeamSection {
3
+ Es: number;
4
+ fc_: number;
5
+ fy: number;
6
+ As: number;
7
+ b: number;
8
+ h: number;
9
+ d: number;
10
+ }
11
+ export interface RectDoublyBeamSection extends RectSinglyBeamSection {
12
+ As_: number;
13
+ d_: number;
14
+ }
15
+ export declare function isSinglyReinforced(section: RectBeamSection): section is RectSinglyBeamSection;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSinglyReinforced = isSinglyReinforced;
4
+ function isSinglyReinforced(section) {
5
+ return (!("As_" in section) ||
6
+ !("d_" in section) ||
7
+ section.As_ <= 0 ||
8
+ section.d_ <= 0);
9
+ }
10
+ //# sourceMappingURL=rc-beam.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rc-beam.type.js","sourceRoot":"","sources":["../../../src/core/types/rc-beam.type.ts"],"names":[],"mappings":";;AAiBA,gDASC;AATD,SAAgB,kBAAkB,CAChC,OAAwB;IAExB,OAAO,CACL,CAAC,CAAC,KAAK,IAAI,OAAO,CAAC;QACnB,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC;QAClB,OAAO,CAAC,GAAG,IAAI,CAAC;QAChB,OAAO,CAAC,EAAE,IAAI,CAAC,CAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export type unit = "IMPERIAL" | "METRIC" | "SI";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unit.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit.type.js","sourceRoot":"","sources":["../../../src/core/types/unit.type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export { rectBeamMomentCapacity, concreteBeta, concreteElasticModulus, psiToMpa, } from "./rc";
2
+ export { calculateSteelJacketedBeamMomentCapacity } from "./strengthening";
3
+ export type { RectBeamSection, RectSinglyBeamSection, RectDoublyBeamSection, SteelJacketedProps, Warnings, calculationResult, unit, } from "./core";
4
+ export { isSinglyReinforced, FLEXURAL_STRENGTH_REDUCTION_FACTOR, CONCRETE_ULTIMATE_STRAIN, RCDesignError, Errors, } from "./core";
5
+ export { solveQuadratic, roundToDecimalPlaces, mergeWarnings } from "./utils";
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeWarnings = exports.roundToDecimalPlaces = exports.solveQuadratic = exports.Errors = exports.RCDesignError = exports.CONCRETE_ULTIMATE_STRAIN = exports.FLEXURAL_STRENGTH_REDUCTION_FACTOR = exports.isSinglyReinforced = exports.calculateSteelJacketedBeamMomentCapacity = exports.psiToMpa = exports.concreteElasticModulus = exports.concreteBeta = exports.rectBeamMomentCapacity = void 0;
4
+ // RC Beam Design
5
+ var rc_1 = require("./rc");
6
+ Object.defineProperty(exports, "rectBeamMomentCapacity", { enumerable: true, get: function () { return rc_1.rectBeamMomentCapacity; } });
7
+ Object.defineProperty(exports, "concreteBeta", { enumerable: true, get: function () { return rc_1.concreteBeta; } });
8
+ Object.defineProperty(exports, "concreteElasticModulus", { enumerable: true, get: function () { return rc_1.concreteElasticModulus; } });
9
+ Object.defineProperty(exports, "psiToMpa", { enumerable: true, get: function () { return rc_1.psiToMpa; } });
10
+ // Strengthening
11
+ var strengthening_1 = require("./strengthening");
12
+ Object.defineProperty(exports, "calculateSteelJacketedBeamMomentCapacity", { enumerable: true, get: function () { return strengthening_1.calculateSteelJacketedBeamMomentCapacity; } });
13
+ var core_1 = require("./core");
14
+ Object.defineProperty(exports, "isSinglyReinforced", { enumerable: true, get: function () { return core_1.isSinglyReinforced; } });
15
+ Object.defineProperty(exports, "FLEXURAL_STRENGTH_REDUCTION_FACTOR", { enumerable: true, get: function () { return core_1.FLEXURAL_STRENGTH_REDUCTION_FACTOR; } });
16
+ Object.defineProperty(exports, "CONCRETE_ULTIMATE_STRAIN", { enumerable: true, get: function () { return core_1.CONCRETE_ULTIMATE_STRAIN; } });
17
+ Object.defineProperty(exports, "RCDesignError", { enumerable: true, get: function () { return core_1.RCDesignError; } });
18
+ Object.defineProperty(exports, "Errors", { enumerable: true, get: function () { return core_1.Errors; } });
19
+ // Utilities
20
+ var utils_1 = require("./utils");
21
+ Object.defineProperty(exports, "solveQuadratic", { enumerable: true, get: function () { return utils_1.solveQuadratic; } });
22
+ Object.defineProperty(exports, "roundToDecimalPlaces", { enumerable: true, get: function () { return utils_1.roundToDecimalPlaces; } });
23
+ Object.defineProperty(exports, "mergeWarnings", { enumerable: true, get: function () { return utils_1.mergeWarnings; } });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iBAAiB;AACjB,2BAKc;AAJZ,4GAAA,sBAAsB,OAAA;AACtB,kGAAA,YAAY,OAAA;AACZ,4GAAA,sBAAsB,OAAA;AACtB,8FAAA,QAAQ,OAAA;AAGV,gBAAgB;AAChB,iDAA2E;AAAlE,yIAAA,wCAAwC,OAAA;AAajD,+BAMgB;AALd,0GAAA,kBAAkB,OAAA;AAClB,0HAAA,kCAAkC,OAAA;AAClC,gHAAA,wBAAwB,OAAA;AACxB,qGAAA,aAAa,OAAA;AACb,8FAAA,MAAM,OAAA;AAGR,YAAY;AACZ,iCAA8E;AAArE,uGAAA,cAAc,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAAE,sGAAA,aAAa,OAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Returns the ACI 318 beta1 factor for the equivalent rectangular stress block.
3
+ *
4
+ * @param fc_ - Concrete compressive strength in MPa
5
+ * @returns Beta1 factor (clamped between 0.65 and 0.85)
6
+ */
7
+ export declare const concreteBeta: (fc_: number) => number;
8
+ /**
9
+ * Estimates the modulus of elasticity of concrete per ACI 318 (Ec = 4700√f'c).
10
+ *
11
+ * @param fc_ - Concrete compressive strength in MPa
12
+ * @returns Elastic modulus in MPa
13
+ */
14
+ export declare const concreteElasticModulus: (fc_: number) => number;
15
+ /**
16
+ * Converts a pressure value from psi to MPa.
17
+ *
18
+ * @param psi - Value in pounds per square inch
19
+ * @returns Equivalent value in megapascals
20
+ */
21
+ export declare const psiToMpa: (psi: number) => number;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.psiToMpa = exports.concreteElasticModulus = exports.concreteBeta = void 0;
4
+ /**
5
+ * Returns the ACI 318 beta1 factor for the equivalent rectangular stress block.
6
+ *
7
+ * @param fc_ - Concrete compressive strength in MPa
8
+ * @returns Beta1 factor (clamped between 0.65 and 0.85)
9
+ */
10
+ const concreteBeta = (fc_) => {
11
+ if (fc_ <= 28) {
12
+ return 0.85;
13
+ }
14
+ const beta = 0.85 - 0.05 * ((fc_ - 28) / 7);
15
+ return Math.max(beta, 0.65);
16
+ };
17
+ exports.concreteBeta = concreteBeta;
18
+ /**
19
+ * Estimates the modulus of elasticity of concrete per ACI 318 (Ec = 4700√f'c).
20
+ *
21
+ * @param fc_ - Concrete compressive strength in MPa
22
+ * @returns Elastic modulus in MPa
23
+ */
24
+ const concreteElasticModulus = (fc_) => {
25
+ return 4700 * Math.sqrt(fc_);
26
+ };
27
+ exports.concreteElasticModulus = concreteElasticModulus;
28
+ /**
29
+ * Converts a pressure value from psi to MPa.
30
+ *
31
+ * @param psi - Value in pounds per square inch
32
+ * @returns Equivalent value in megapascals
33
+ */
34
+ const psiToMpa = (psi) => {
35
+ return psi / 145.038;
36
+ };
37
+ exports.psiToMpa = psiToMpa;
38
+ //# sourceMappingURL=general.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"general.js","sourceRoot":"","sources":["../../src/rc/general.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE;IAClD,IAAI,GAAG,IAAI,EAAE,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB;AAEF;;;;;GAKG;AACI,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAU,EAAE;IAC5D,OAAO,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC,CAAC;AAFW,QAAA,sBAAsB,0BAEjC;AAEF;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE;IAC9C,OAAO,GAAG,GAAG,OAAO,CAAC;AACvB,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB"}
@@ -0,0 +1,2 @@
1
+ export { rectBeamMomentCapacity } from "./rc-beam-design";
2
+ export { concreteBeta, concreteElasticModulus, psiToMpa } from "./general";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.psiToMpa = exports.concreteElasticModulus = exports.concreteBeta = exports.rectBeamMomentCapacity = void 0;
4
+ var rc_beam_design_1 = require("./rc-beam-design");
5
+ Object.defineProperty(exports, "rectBeamMomentCapacity", { enumerable: true, get: function () { return rc_beam_design_1.rectBeamMomentCapacity; } });
6
+ var general_1 = require("./general");
7
+ Object.defineProperty(exports, "concreteBeta", { enumerable: true, get: function () { return general_1.concreteBeta; } });
8
+ Object.defineProperty(exports, "concreteElasticModulus", { enumerable: true, get: function () { return general_1.concreteElasticModulus; } });
9
+ Object.defineProperty(exports, "psiToMpa", { enumerable: true, get: function () { return general_1.psiToMpa; } });
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rc/index.ts"],"names":[],"mappings":";;;AAAA,mDAA0D;AAAjD,wHAAA,sBAAsB,OAAA;AAC/B,qCAA2E;AAAlE,uGAAA,YAAY,OAAA;AAAE,iHAAA,sBAAsB,OAAA;AAAE,mGAAA,QAAQ,OAAA"}
@@ -0,0 +1,18 @@
1
+ import { RectBeamSection } from "../core/types/rc-beam.type";
2
+ import { Warnings } from "../core/types/output-message.type";
3
+ /**
4
+ * Calculates the nominal moment capacity (φMn) of a rectangular RC beam section.
5
+ *
6
+ * Supports both singly and doubly reinforced sections. Automatically determines
7
+ * the reinforcement configuration from the input and applies ACI 318-19 checks.
8
+ *
9
+ * @param section - Beam cross-section properties (singly or doubly reinforced)
10
+ * @returns Object containing `phiMn` (kN·m), `calculationDetails`, `unit`, and `warnings`
11
+ * @throws {RCDesignError} If the tensile steel does not yield
12
+ */
13
+ export declare const rectBeamMomentCapacity: (section: RectBeamSection) => {
14
+ phiMn: number;
15
+ calculationDetails: any;
16
+ unit: string;
17
+ warnings: Warnings;
18
+ };
@@ -0,0 +1,181 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.rectBeamMomentCapacity = void 0;
37
+ const rc_design_error_1 = require("../core/errors/rc-design.error");
38
+ const MyMath = __importStar(require("../utils/math"));
39
+ const rc_beam_type_1 = require("../core/types/rc-beam.type");
40
+ const RCConstants = __importStar(require("../core/constants/rc.constant"));
41
+ const general_1 = require("./general");
42
+ /**
43
+ * Calculates the nominal moment capacity (φMn) of a rectangular RC beam section.
44
+ *
45
+ * Supports both singly and doubly reinforced sections. Automatically determines
46
+ * the reinforcement configuration from the input and applies ACI 318-19 checks.
47
+ *
48
+ * @param section - Beam cross-section properties (singly or doubly reinforced)
49
+ * @returns Object containing `phiMn` (kN·m), `calculationDetails`, `unit`, and `warnings`
50
+ * @throws {RCDesignError} If the tensile steel does not yield
51
+ */
52
+ const rectBeamMomentCapacity = (section) => {
53
+ const warnings = [];
54
+ const concreteUltimateStrain = RCConstants.CONCRETE_ULTIMATE_STRAIN;
55
+ const steelYieldStrain = section.fy / section.Es;
56
+ const beta1 = (0, general_1.concreteBeta)(section.fc_);
57
+ const Ec = (0, general_1.concreteElasticModulus)(section.fc_);
58
+ const minSteel = Math.max((0.25 * Math.sqrt(section.fc_) * section.b * section.d) / section.fy, (1.4 * section.b * section.d) / section.fy);
59
+ if (section.As < minSteel) {
60
+ // Add a warning if the area of steel is less than the minimum required.
61
+ warnings.push({
62
+ reference: "ACI318-19, 9.6.1.2",
63
+ message: `As (${section.As} mm2) < min required (${minSteel} mm2)`,
64
+ });
65
+ }
66
+ if (section.fy > 550) {
67
+ // Add a warning if the yield strength of steel is greater than 550 MPa.
68
+ warnings.push({
69
+ reference: "ACI318-19, 9.6.1.2",
70
+ message: `fy (${section.fy} MPa) > 550 MPa, consider using high-strength steel.`,
71
+ });
72
+ }
73
+ let Mn;
74
+ let calculationDetails;
75
+ if ((0, rc_beam_type_1.isSinglyReinforced)(section)) {
76
+ // Singly reinforced section
77
+ const result = calculateRectSinglyMn({
78
+ Es: section.Es,
79
+ fy: section.fy,
80
+ fc_: section.fc_,
81
+ As: section.As,
82
+ b: section.b,
83
+ h: section.h,
84
+ d: section.d,
85
+ });
86
+ Mn = result.Mn;
87
+ calculationDetails = result.calculationDetails;
88
+ warnings.push(...result.warnings);
89
+ }
90
+ else {
91
+ // Doubly reinforced section
92
+ const doublySection = section;
93
+ const result = calculateRectDoublyMn({
94
+ Es: doublySection.Es,
95
+ fy: doublySection.fy,
96
+ fc_: doublySection.fc_,
97
+ As: doublySection.As,
98
+ As_: doublySection.As_,
99
+ b: doublySection.b,
100
+ h: doublySection.h,
101
+ d: doublySection.d,
102
+ d_: doublySection.d_,
103
+ });
104
+ Mn = result.Mn;
105
+ calculationDetails = result.calculationDetails;
106
+ warnings.push(...result.warnings);
107
+ }
108
+ // Return the results
109
+ return {
110
+ phiMn: MyMath.roundToDecimalPlaces(RCConstants.FLEXURAL_STRENGTH_REDUCTION_FACTOR * Mn, 2),
111
+ calculationDetails: calculationDetails,
112
+ unit: "kN-m",
113
+ warnings: warnings,
114
+ };
115
+ };
116
+ exports.rectBeamMomentCapacity = rectBeamMomentCapacity;
117
+ const calculateRectSinglyMn = (singlySection) => {
118
+ const { Es, fy, fc_, As, b, h, d } = singlySection;
119
+ const warnings = [];
120
+ const steelYieldStrain = fy / Es;
121
+ const Ac = (As * fy) / (0.85 * fc_);
122
+ const beta1 = (0, general_1.concreteBeta)(fc_);
123
+ const a = Ac / b;
124
+ const c = a / beta1;
125
+ const tensileSteelStrain = (RCConstants.CONCRETE_ULTIMATE_STRAIN * (d - c)) / c;
126
+ if (tensileSteelStrain <
127
+ steelYieldStrain + RCConstants.CONCRETE_ULTIMATE_STRAIN) {
128
+ throw new rc_design_error_1.RCDesignError(rc_design_error_1.Errors.TENSILE_STEEL_NOT_YIELDING);
129
+ }
130
+ const y_ = a / 2;
131
+ return {
132
+ Mn: As * fy * (d - y_) * 0.001 * 0.001, // Convert to kN-m
133
+ calculationDetails: {
134
+ ro: As / (b * d),
135
+ },
136
+ warnings: warnings,
137
+ };
138
+ };
139
+ const calculateRectDoublyMn = (doublySection) => {
140
+ const { Es, fy, fc_, As, As_, b, h, d, d_ } = doublySection;
141
+ const warnings = [];
142
+ const steelYieldStrain = fy / Es;
143
+ const beta1 = (0, general_1.concreteBeta)(fc_);
144
+ // Assume Compression steel is not yielding and tensile steel is yielding.
145
+ // Solving for c using quadratic equation
146
+ const A = 0.85 * fc_ * b * beta1;
147
+ const B = RCConstants.CONCRETE_ULTIMATE_STRAIN * As_ * Es - As * fy;
148
+ const C = -RCConstants.CONCRETE_ULTIMATE_STRAIN * As_ * Es * d_;
149
+ const quadResults = MyMath.solveQuadratic(A, B, C);
150
+ const c = Math.max(...quadResults); // Take the maximum root for c
151
+ const a = c * beta1;
152
+ const tensileSteelStrain = (RCConstants.CONCRETE_ULTIMATE_STRAIN * (d - c)) / c;
153
+ const compressionSteelStrain = (RCConstants.CONCRETE_ULTIMATE_STRAIN * (c - d_)) / c;
154
+ if (tensileSteelStrain <
155
+ steelYieldStrain + RCConstants.CONCRETE_ULTIMATE_STRAIN) {
156
+ throw new rc_design_error_1.RCDesignError(rc_design_error_1.Errors.TENSILE_STEEL_NOT_YIELDING);
157
+ }
158
+ if (d_ > c) {
159
+ throw new rc_design_error_1.RCDesignError(rc_design_error_1.Errors.COMP_STEEL_DISTANCE_OVER_AC);
160
+ }
161
+ const y_ = a / 2;
162
+ const Ac = b * a;
163
+ const fs_ = Es * compressionSteelStrain;
164
+ return {
165
+ Mn: (0.85 * fc_ * Ac * (d - y_) + As_ * fs_ * (d - d_)) * 0.001 * 0.001, // Convert to kN-m
166
+ calculationDetails: {
167
+ c: MyMath.roundToDecimalPlaces(c, 2),
168
+ a: MyMath.roundToDecimalPlaces(a, 2),
169
+ beta1: MyMath.roundToDecimalPlaces(beta1, 3),
170
+ d: d,
171
+ d_: d_,
172
+ As: As,
173
+ As_: As_,
174
+ fs_: MyMath.roundToDecimalPlaces(fs_, 2),
175
+ ro: MyMath.roundToDecimalPlaces(As / (b * d), 6),
176
+ ro_: MyMath.roundToDecimalPlaces(As_ / (b * (h - d_)), 6), // TODO: check if this is correct
177
+ },
178
+ warnings: warnings,
179
+ };
180
+ };
181
+ //# sourceMappingURL=rc-beam-design.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rc-beam-design.js","sourceRoot":"","sources":["../../src/rc/rc-beam-design.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAyE;AACzE,wDAA0C;AAE1C,+DAKsC;AAOtC,6EAA+D;AAE/D,uCAAiE;AAEjE;;;;;;;;;GASG;AACI,MAAM,sBAAsB,GAAG,CAAC,OAAwB,EAAE,EAAE;IACjE,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,sBAAsB,GAAG,WAAW,CAAC,wBAAwB,CAAC;IACpE,MAAM,gBAAgB,GAAG,OAAO,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;IACjD,MAAM,KAAK,GAAG,IAAA,sBAAY,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,EAAE,GAAG,IAAA,gCAAsB,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,EACpE,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,EAAE,CAC3C,CAAC;IAEF,IAAI,OAAO,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC1B,wEAAwE;QACxE,Q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ACN,GAAG,EAAE,GAAG;YACR,GAAG,EAAE,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,CAAC;YACxC,EAAE,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;YAChD,GAAG,EAAE,MAAM,CAAC,oBAAoB,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,iCAAiC;SAC7F;QACD,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export { calculateSteelJacketedBeamMomentCapacity } from "./rc-beam-steel-plate-jacketing";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateSteelJacketedBeamMomentCapacity = void 0;
4
+ var rc_beam_steel_plate_jacketing_1 = require("./rc-beam-steel-plate-jacketing");
5
+ Object.defineProperty(exports, "calculateSteelJacketedBeamMomentCapacity", { enumerable: true, get: function () { return rc_beam_steel_plate_jacketing_1.calculateSteelJacketedBeamMomentCapacity; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/strengthening/index.ts"],"names":[],"mappings":";;;AAAA,iFAA2F;AAAlF,yJAAA,wCAAwC,OAAA"}
@@ -0,0 +1,27 @@
1
+ import { RectBeamSection } from "../core/types/rc-beam.type";
2
+ import { SteelJacketedProps } from "../core/types/plate-jacketing.type";
3
+ import { Warnings } from "../core/types/output-message.type";
4
+ /**
5
+ * Calculates the moment capacity of an RC beam strengthened with steel plate jacketing.
6
+ *
7
+ * Converts steel plate areas into equivalent rebar areas, adjusts the effective depth,
8
+ * and delegates to `rectBeamMomentCapacity` for the actual capacity calculation.
9
+ *
10
+ * @param section - Original beam cross-section properties
11
+ * @param jacketedProperties - Steel plate dimensions, modulus, and yield strength
12
+ * @returns Object containing `phiMn` (kN·m), `calculationDetails`, `unit`, and `warnings`
13
+ */
14
+ export declare const calculateSteelJacketedBeamMomentCapacity: (section: RectBeamSection, jacketedProperties: SteelJacketedProps) => {
15
+ before: {
16
+ phiMn: number;
17
+ calculationDetails: any;
18
+ unit: string;
19
+ warnings: Warnings;
20
+ };
21
+ after: {
22
+ phiMn: number;
23
+ calculationDetails: any;
24
+ unit: string;
25
+ warnings: Warnings;
26
+ };
27
+ };
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calculateSteelJacketedBeamMomentCapacity = void 0;
4
+ const rc_beam_design_1 = require("../rc/rc-beam-design");
5
+ const math_1 = require("../utils/math");
6
+ const rc_beam_type_1 = require("../core/types/rc-beam.type");
7
+ const merge_warning_1 = require("../utils/merge-warning");
8
+ /**
9
+ * Calculates the moment capacity of an RC beam strengthened with steel plate jacketing.
10
+ *
11
+ * Converts steel plate areas into equivalent rebar areas, adjusts the effective depth,
12
+ * and delegates to `rectBeamMomentCapacity` for the actual capacity calculation.
13
+ *
14
+ * @param section - Original beam cross-section properties
15
+ * @param jacketedProperties - Steel plate dimensions, modulus, and yield strength
16
+ * @returns Object containing `phiMn` (kN·m), `calculationDetails`, `unit`, and `warnings`
17
+ */
18
+ const calculateSteelJacketedBeamMomentCapacity = (section, jacketedProperties) => {
19
+ const warnings = [];
20
+ // Calculate the moment capacity of the original (before strengthening) section
21
+ const originalResult = (0, rc_beam_design_1.rectBeamMomentCapacity)(section);
22
+ // Convert steel plate strength to the same as rebar strength
23
+ const n = jacketedProperties.fy / section.fy;
24
+ // Calculate the effective area of the steel plates converted to rebar.
25
+ const plateTopSteelArea = n * jacketedProperties.topSteelWidth * jacketedProperties.topSteelThickness;
26
+ const plateBottomSteelArea = n *
27
+ jacketedProperties.bottomSteelWidth *
28
+ jacketedProperties.bottomSteelThickness;
29
+ let newD = ((jacketedProperties.topSteelThickness + section.d) * section.As +
30
+ (jacketedProperties.topSteelThickness +
31
+ section.h +
32
+ jacketedProperties.bottomSteelThickness / 2) *
33
+ plateBottomSteelArea) /
34
+ (section.As + plateBottomSteelArea);
35
+ let newD_ = undefined;
36
+ let modifiedSection;
37
+ // Check if the section is singly or doubly reinforced
38
+ if ((0, rc_beam_type_1.isSinglyReinforced)(section)) {
39
+ // Singly reinforced section
40
+ modifiedSection = {
41
+ ...section,
42
+ As: section.As + plateBottomSteelArea,
43
+ d: newD,
44
+ };
45
+ }
46
+ else {
47
+ // Doubly reinforced section
48
+ const doublySection = section;
49
+ newD_ =
50
+ ((jacketedProperties.topSteelThickness + doublySection.d_) *
51
+ doublySection.As_ +
52
+ (jacketedProperties.topSteelThickness / 2) * plateTopSteelArea) /
53
+ (doublySection.As_ + plateTopSteelArea);
54
+ modifiedSection = {
55
+ ...doublySection,
56
+ As: doublySection.As + plateBottomSteelArea,
57
+ As_: doublySection.As_ + plateTopSteelArea,
58
+ d: newD,
59
+ d_: newD_,
60
+ };
61
+ }
62
+ newD = (0, math_1.roundToDecimalPlaces)(newD, 3);
63
+ if (newD_ !== undefined) {
64
+ newD_ = (0, math_1.roundToDecimalPlaces)(newD_, 3);
65
+ }
66
+ // Calculate the moment capacity of the modified (after strengthening) section
67
+ let jacketedResult = (0, rc_beam_design_1.rectBeamMomentCapacity)(modifiedSection);
68
+ jacketedResult = { ...jacketedResult, warnings: (0, merge_warning_1.mergeWarnings)(jacketedResult.warnings, warnings) };
69
+ return {
70
+ before: originalResult,
71
+ after: jacketedResult,
72
+ };
73
+ };
74
+ exports.calculateSteelJacketedBeamMomentCapacity = calculateSteelJacketedBeamMomentCapacity;
75
+ //# sourceMappingURL=rc-beam-steel-plate-jacketing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rc-beam-steel-plate-jacketing.js","sourceRoot":"","sources":["../../src/strengthening/rc-beam-steel-plate-jacketing.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAChE,0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GAAG,aAAa,CAAC,EAAE,CAAC;gBACxD,aAAa,CAAC,GAAG;gBACjB,CAAC,kBAAkB,CAAC,iBAAiB,GAAG,CAAC,CAAC,GAAG,iBAAiB,CAAC;gBACjE,CAAC,aAAa,CAAC,GAAG,GAAG,iBAAiB,CAAC,CAAC;QAC1C,eAAe,GAAG;YAChB,GAAG,aAAa;YAChB,EAAE,EAAE,aAAa,CAAC,EAAE,GAAG,oBAAoB;YAC3C,GAAG,EAAE,aAAa,CAAC,GAAG,GAAG,iBAAiB;YAC1C,CAAC,EAAE,IAAI;YACP,EAAE,EAAE,KAAK;SACV,CAAC;IACJ,CAAC;IAED,IAAI,GAAG,IAAA,2BAAoB,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACrC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,KAAK,GAAG,IAAA,2BAAoB,EAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,8EAA8E;IAC9E,IAAI,cAAc,GAAG,IAAA,uCAAsB,EAAC,eAAe,CAAC,CAAC;IAE7D,cAAc,GAAG,EAAE,GAAG,cAAc,EAAE,QAAQ,EAAE,IAAA,6BAAa,EAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC;IAEnG,OAAO;QACL,MAAM,EAAE,cAAc;QACtB,KAAK,EAAE,cAAc;KACtB,CAAC;AACJ,CAAC,CAAC;AArEW,QAAA,wCAAwC,4CAqEnD"}
@@ -0,0 +1,2 @@
1
+ export { solveQuadratic, roundToDecimalPlaces } from "./math";
2
+ export { mergeWarnings } from "./merge-warning";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeWarnings = exports.roundToDecimalPlaces = exports.solveQuadratic = void 0;
4
+ var math_1 = require("./math");
5
+ Object.defineProperty(exports, "solveQuadratic", { enumerable: true, get: function () { return math_1.solveQuadratic; } });
6
+ Object.defineProperty(exports, "roundToDecimalPlaces", { enumerable: true, get: function () { return math_1.roundToDecimalPlaces; } });
7
+ var merge_warning_1 = require("./merge-warning");
8
+ Object.defineProperty(exports, "mergeWarnings", { enumerable: true, get: function () { return merge_warning_1.mergeWarnings; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,+BAA8D;AAArD,sGAAA,cAAc,OAAA;AAAE,4GAAA,oBAAoB,OAAA;AAC7C,iDAAgD;AAAvC,8GAAA,aAAa,OAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Solves the quadratic equation ax² + bx + c = 0.
3
+ *
4
+ * @param a - Coefficient of x²
5
+ * @param b - Coefficient of x
6
+ * @param c - Constant term
7
+ * @returns Array of real roots (empty if discriminant < 0)
8
+ */
9
+ export declare const solveQuadratic: (a: number, b: number, c: number) => number[];
10
+ /**
11
+ * Rounds a number to a specified number of decimal places.
12
+ *
13
+ * @param value - The number to round
14
+ * @param decimalPlaces - Number of decimal places to keep
15
+ * @returns The rounded number
16
+ */
17
+ export declare const roundToDecimalPlaces: (value: number, decimalPlaces: number) => number;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.roundToDecimalPlaces = exports.solveQuadratic = void 0;
4
+ /**
5
+ * Solves the quadratic equation ax² + bx + c = 0.
6
+ *
7
+ * @param a - Coefficient of x²
8
+ * @param b - Coefficient of x
9
+ * @param c - Constant term
10
+ * @returns Array of real roots (empty if discriminant < 0)
11
+ */
12
+ const solveQuadratic = (a, b, c) => {
13
+ const discriminant = b * b - 4 * a * c;
14
+ if (discriminant < 0) {
15
+ return [];
16
+ }
17
+ const sqrtDiscriminant = Math.sqrt(discriminant);
18
+ const root1 = (-b + sqrtDiscriminant) / (2 * a);
19
+ const root2 = (-b - sqrtDiscriminant) / (2 * a);
20
+ return [root1, root2];
21
+ };
22
+ exports.solveQuadratic = solveQuadratic;
23
+ /**
24
+ * Rounds a number to a specified number of decimal places.
25
+ *
26
+ * @param value - The number to round
27
+ * @param decimalPlaces - Number of decimal places to keep
28
+ * @returns The rounded number
29
+ */
30
+ const roundToDecimalPlaces = (value, decimalPlaces) => {
31
+ const factor = Math.pow(10, decimalPlaces);
32
+ return Math.round(value * factor) / factor;
33
+ };
34
+ exports.roundToDecimalPlaces = roundToDecimalPlaces;
35
+ //# sourceMappingURL=math.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACI,MAAM,cAAc,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAY,EAAE;IAC1E,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxB,CAAC,CAAC;AATW,QAAA,cAAc,kBASzB;AAEF;;;;;;GAMG;AACI,MAAM,oBAAoB,GAAG,CAClC,KAAa,EACb,aAAqB,EACb,EAAE;IACV,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAC7C,CAAC,CAAC;AANW,QAAA,oBAAoB,wBAM/B"}
@@ -0,0 +1,9 @@
1
+ import { Warnings } from "../core/types/output-message.type";
2
+ /**
3
+ * Merges two warning arrays into a single combined array.
4
+ *
5
+ * @param existingWarnings - Warnings already accumulated
6
+ * @param newWarnings - Additional warnings to append
7
+ * @returns Combined warning array
8
+ */
9
+ export declare const mergeWarnings: (existingWarnings: Warnings, newWarnings: Warnings) => Warnings;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeWarnings = void 0;
4
+ /**
5
+ * Merges two warning arrays into a single combined array.
6
+ *
7
+ * @param existingWarnings - Warnings already accumulated
8
+ * @param newWarnings - Additional warnings to append
9
+ * @returns Combined warning array
10
+ */
11
+ const mergeWarnings = (existingWarnings, newWarnings) => {
12
+ return [...existingWarnings, ...newWarnings];
13
+ };
14
+ exports.mergeWarnings = mergeWarnings;
15
+ //# sourceMappingURL=merge-warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-warning.js","sourceRoot":"","sources":["../../src/utils/merge-warning.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACI,MAAM,aAAa,GAAG,CAAC,gBAA0B,EAAE,WAAqB,EAAY,EAAE;IAC3F,OAAO,CAAC,GAAG,gBAAgB,EAAE,GAAG,WAAW,CAAC,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@theerapat-s28/ts-structural-eng-tools",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript structural-engineering helper functions and beam design utilities",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./rc": {
13
+ "types": "./dist/rc/index.d.ts",
14
+ "default": "./dist/rc/index.js"
15
+ },
16
+ "./strengthening": {
17
+ "types": "./dist/strengthening/index.d.ts",
18
+ "default": "./dist/strengthening/index.js"
19
+ },
20
+ "./core": {
21
+ "types": "./dist/core/index.d.ts",
22
+ "default": "./dist/core/index.js"
23
+ },
24
+ "./utils": {
25
+ "types": "./dist/utils/index.d.ts",
26
+ "default": "./dist/utils/index.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "dev": "ts-node -r tsconfig-paths/register examples/basic-usage.ts",
36
+ "build": "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
37
+ "prepublishOnly": "pnpm run build",
38
+ "lint": "eslint src/",
39
+ "lint:fix": "eslint src/ --fix",
40
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"examples/**/*.ts\"",
41
+ "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\" \"examples/**/*.ts\"",
42
+ "test": "vitest run",
43
+ "test:watch": "vitest"
44
+ },
45
+ "keywords": [
46
+ "structural-engineering",
47
+ "beam-design",
48
+ "reinforced-concrete",
49
+ "ACI-318",
50
+ "moment-capacity",
51
+ "steel-jacketing",
52
+ "typescript"
53
+ ],
54
+ "author": "",
55
+ "license": "ISC",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/theerapat-s28/ts-structural-eng.git"
59
+ },
60
+ "packageManager": "pnpm@10.18.3",
61
+ "devDependencies": {
62
+ "@eslint/js": "^9.20.0",
63
+ "@types/node": "^24.9.1",
64
+ "eslint": "^9.20.0",
65
+ "prettier": "^3.5.3",
66
+ "ts-node": "^10.9.2",
67
+ "tsc-alias": "^1.8.16",
68
+ "tsconfig-paths": "^4.2.0",
69
+ "typescript": "^5.9.3",
70
+ "typescript-eslint": "^8.25.0",
71
+ "vitest": "^3.0.0"
72
+ }
73
+ }