@atmaticai/agent-tools 1.0.3 → 1.1.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.
- package/dist/a2a/index.d.mts +169 -0
- package/dist/a2a/index.d.ts +169 -0
- package/dist/a2a/index.js +6012 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/a2a/index.mjs +5934 -0
- package/dist/a2a/index.mjs.map +1 -0
- package/dist/archive/index.d.mts +1 -0
- package/dist/archive/index.d.ts +1 -0
- package/dist/archive/index.js +90 -0
- package/dist/archive/index.js.map +1 -0
- package/dist/archive/index.mjs +80 -0
- package/dist/archive/index.mjs.map +1 -0
- package/dist/cli.js +4441 -164
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +4408 -161
- package/dist/cli.mjs.map +1 -1
- package/dist/color/index.d.mts +1 -0
- package/dist/color/index.d.ts +1 -0
- package/dist/color/index.js +347 -0
- package/dist/color/index.js.map +1 -0
- package/dist/color/index.mjs +336 -0
- package/dist/color/index.mjs.map +1 -0
- package/dist/crypto/index.d.mts +1 -0
- package/dist/crypto/index.d.ts +1 -0
- package/dist/crypto/index.js +116 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/index.mjs +108 -0
- package/dist/crypto/index.mjs.map +1 -0
- package/dist/csv/index.d.mts +1 -0
- package/dist/csv/index.d.ts +1 -0
- package/dist/csv/index.js +371 -0
- package/dist/csv/index.js.map +1 -0
- package/dist/csv/index.mjs +348 -0
- package/dist/csv/index.mjs.map +1 -0
- package/dist/datetime/index.d.mts +1 -0
- package/dist/datetime/index.d.ts +1 -0
- package/dist/datetime/index.js +234 -0
- package/dist/datetime/index.js.map +1 -0
- package/dist/datetime/index.mjs +224 -0
- package/dist/datetime/index.mjs.map +1 -0
- package/dist/diff/index.d.mts +2 -0
- package/dist/diff/index.d.ts +2 -0
- package/dist/diff/index.js +84 -0
- package/dist/diff/index.js.map +1 -0
- package/dist/diff/index.mjs +78 -0
- package/dist/diff/index.mjs.map +1 -0
- package/dist/excel/index.d.mts +1 -0
- package/dist/excel/index.d.ts +1 -0
- package/dist/excel/index.js +163 -0
- package/dist/excel/index.js.map +1 -0
- package/dist/excel/index.mjs +153 -0
- package/dist/excel/index.mjs.map +1 -0
- package/dist/image/index.d.mts +1 -0
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +123 -0
- package/dist/image/index.js.map +1 -0
- package/dist/image/index.mjs +107 -0
- package/dist/image/index.mjs.map +1 -0
- package/dist/index--vbnYfdE.d.mts +142 -0
- package/dist/index--vbnYfdE.d.ts +142 -0
- package/dist/index-7FZQloN-.d.mts +62 -0
- package/dist/index-7FZQloN-.d.ts +62 -0
- package/dist/index-7XgaTVH5.d.mts +93 -0
- package/dist/index-7XgaTVH5.d.ts +93 -0
- package/dist/index-7bvFmh45.d.mts +87 -0
- package/dist/index-7bvFmh45.d.ts +87 -0
- package/dist/index-BDZcIVCU.d.mts +53 -0
- package/dist/index-BDZcIVCU.d.ts +53 -0
- package/dist/index-BKeYao0B.d.mts +320 -0
- package/dist/index-BKeYao0B.d.ts +320 -0
- package/dist/index-BN00EnUU.d.mts +55 -0
- package/dist/index-BN00EnUU.d.ts +55 -0
- package/dist/index-BZDcrPs-.d.mts +316 -0
- package/dist/index-BZDcrPs-.d.ts +316 -0
- package/dist/index-CQ1EukC4.d.mts +59 -0
- package/dist/index-CQ1EukC4.d.ts +59 -0
- package/dist/index-CgRVnFOt.d.mts +91 -0
- package/dist/index-CgRVnFOt.d.ts +91 -0
- package/dist/index-Dh47fgVS.d.mts +216 -0
- package/dist/index-Dh47fgVS.d.ts +216 -0
- package/dist/index-DjBDZzuj.d.mts +54 -0
- package/dist/index-DjBDZzuj.d.ts +54 -0
- package/dist/index-FFrvmr-n.d.mts +50 -0
- package/dist/index-FFrvmr-n.d.ts +50 -0
- package/dist/index-QWC8yIgW.d.mts +106 -0
- package/dist/index-QWC8yIgW.d.ts +106 -0
- package/dist/index-fJD8SORm.d.mts +61 -0
- package/dist/index-fJD8SORm.d.ts +61 -0
- package/dist/index-pPy_XDQU.d.mts +56 -0
- package/dist/index-pPy_XDQU.d.ts +56 -0
- package/dist/index-rwh9hdD9.d.mts +68 -0
- package/dist/index-rwh9hdD9.d.ts +68 -0
- package/dist/index-uXdkAfea.d.mts +93 -0
- package/dist/index-uXdkAfea.d.ts +93 -0
- package/dist/index.d.mts +25 -5
- package/dist/index.d.ts +25 -5
- package/dist/index.js +5195 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5145 -145
- package/dist/index.mjs.map +1 -1
- package/dist/json/index.d.mts +1 -0
- package/dist/json/index.d.ts +1 -0
- package/dist/json/index.js +599 -0
- package/dist/json/index.js.map +1 -0
- package/dist/json/index.mjs +552 -0
- package/dist/json/index.mjs.map +1 -0
- package/dist/markdown/index.d.mts +1 -0
- package/dist/markdown/index.d.ts +1 -0
- package/dist/markdown/index.js +151 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/markdown/index.mjs +139 -0
- package/dist/markdown/index.mjs.map +1 -0
- package/dist/math/index.d.mts +1 -0
- package/dist/math/index.d.ts +1 -0
- package/dist/math/index.js +247 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/index.mjs +240 -0
- package/dist/math/index.mjs.map +1 -0
- package/dist/pdf/index.d.mts +1 -0
- package/dist/pdf/index.d.ts +1 -0
- package/dist/pdf/index.js +628 -0
- package/dist/pdf/index.js.map +1 -0
- package/dist/pdf/index.mjs +598 -0
- package/dist/pdf/index.mjs.map +1 -0
- package/dist/physics/index.d.mts +1 -0
- package/dist/physics/index.d.ts +1 -0
- package/dist/physics/index.js +467 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/index.mjs +435 -0
- package/dist/physics/index.mjs.map +1 -0
- package/dist/regex/index.d.mts +1 -0
- package/dist/regex/index.d.ts +1 -0
- package/dist/regex/index.js +93 -0
- package/dist/regex/index.js.map +1 -0
- package/dist/regex/index.mjs +88 -0
- package/dist/regex/index.mjs.map +1 -0
- package/dist/settings/index.d.mts +41 -0
- package/dist/settings/index.d.ts +41 -0
- package/dist/settings/index.js +150 -0
- package/dist/settings/index.js.map +1 -0
- package/dist/settings/index.mjs +143 -0
- package/dist/settings/index.mjs.map +1 -0
- package/dist/sql/index.d.mts +1 -0
- package/dist/sql/index.d.ts +1 -0
- package/dist/sql/index.js +146 -0
- package/dist/sql/index.js.map +1 -0
- package/dist/sql/index.mjs +139 -0
- package/dist/sql/index.mjs.map +1 -0
- package/dist/structural/index.d.mts +1 -0
- package/dist/structural/index.d.ts +1 -0
- package/dist/structural/index.js +608 -0
- package/dist/structural/index.js.map +1 -0
- package/dist/structural/index.mjs +588 -0
- package/dist/structural/index.mjs.map +1 -0
- package/dist/text/index.d.mts +1 -0
- package/dist/text/index.d.ts +1 -0
- package/dist/text/index.js +250 -0
- package/dist/text/index.js.map +1 -0
- package/dist/text/index.mjs +242 -0
- package/dist/text/index.mjs.map +1 -0
- package/dist/xml/index.d.mts +1 -0
- package/dist/xml/index.d.ts +1 -0
- package/dist/xml/index.js +188 -0
- package/dist/xml/index.js.map +1 -0
- package/dist/xml/index.mjs +180 -0
- package/dist/xml/index.mjs.map +1 -0
- package/package.json +138 -6
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/structural/stress.ts
|
|
4
|
+
function normalStress(force, area) {
|
|
5
|
+
if (area <= 0) throw new Error("Area must be positive");
|
|
6
|
+
const stress = force / area;
|
|
7
|
+
return { force, area, stress, unit: "Pa" };
|
|
8
|
+
}
|
|
9
|
+
function shearStress(force, area) {
|
|
10
|
+
if (area <= 0) throw new Error("Area must be positive");
|
|
11
|
+
const stress = force / area;
|
|
12
|
+
return { force, area, stress, unit: "Pa" };
|
|
13
|
+
}
|
|
14
|
+
function strain(deltaLength, originalLength) {
|
|
15
|
+
if (originalLength <= 0) throw new Error("Original length must be positive");
|
|
16
|
+
const s = deltaLength / originalLength;
|
|
17
|
+
return { deltaLength, originalLength, strain: s, unit: "dimensionless" };
|
|
18
|
+
}
|
|
19
|
+
function youngsModulus(stress, strainVal) {
|
|
20
|
+
if (strainVal === 0) throw new Error("Strain must be non-zero");
|
|
21
|
+
const E = stress / strainVal;
|
|
22
|
+
return { stress, strain: strainVal, youngsModulus: E, unit: "Pa" };
|
|
23
|
+
}
|
|
24
|
+
function factorOfSafety(ultimateStress, workingStress) {
|
|
25
|
+
if (workingStress === 0) throw new Error("Working stress must be non-zero");
|
|
26
|
+
if (ultimateStress < 0) throw new Error("Ultimate stress must be non-negative");
|
|
27
|
+
if (workingStress < 0) throw new Error("Working stress must be positive");
|
|
28
|
+
const fos = ultimateStress / workingStress;
|
|
29
|
+
return { ultimateStress, workingStress, factorOfSafety: fos };
|
|
30
|
+
}
|
|
31
|
+
function hoopStress(pressure, radius, thickness) {
|
|
32
|
+
if (pressure < 0) throw new Error("Pressure must be non-negative");
|
|
33
|
+
if (radius <= 0) throw new Error("Radius must be positive");
|
|
34
|
+
if (thickness <= 0) throw new Error("Thickness must be positive");
|
|
35
|
+
const hoop = pressure * radius / thickness;
|
|
36
|
+
const longitudinal = pressure * radius / (2 * thickness);
|
|
37
|
+
return { pressure, radius, thickness, hoopStress: hoop, longitudinalStress: longitudinal, unit: "Pa" };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/structural/beams.ts
|
|
41
|
+
function simplySupported(length, load, loadType, E, I, loadPosition) {
|
|
42
|
+
if (length <= 0) throw new Error("Length must be positive");
|
|
43
|
+
if (load < 0) throw new Error("Load must be non-negative");
|
|
44
|
+
let reactionLeft;
|
|
45
|
+
let reactionRight;
|
|
46
|
+
let maxMoment;
|
|
47
|
+
let maxShear;
|
|
48
|
+
let maxDeflection = null;
|
|
49
|
+
const L = length;
|
|
50
|
+
const P = load;
|
|
51
|
+
switch (loadType) {
|
|
52
|
+
case "point-center": {
|
|
53
|
+
reactionLeft = P / 2;
|
|
54
|
+
reactionRight = P / 2;
|
|
55
|
+
maxMoment = P * L / 4;
|
|
56
|
+
maxShear = P / 2;
|
|
57
|
+
if (E && I) {
|
|
58
|
+
maxDeflection = P * L * L * L / (48 * E * I);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
case "point-custom": {
|
|
63
|
+
const a = loadPosition ?? L / 2;
|
|
64
|
+
if (a < 0 || a > L) throw new Error("Load position must be between 0 and length");
|
|
65
|
+
const b = L - a;
|
|
66
|
+
reactionLeft = P * b / L;
|
|
67
|
+
reactionRight = P * a / L;
|
|
68
|
+
maxMoment = P * a * b / L;
|
|
69
|
+
maxShear = Math.max(reactionLeft, reactionRight);
|
|
70
|
+
if (E && I) {
|
|
71
|
+
maxDeflection = P * a * b * (a + 2 * b) * Math.sqrt(3 * a * (a + 2 * b)) / (27 * E * I * L);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case "uniform": {
|
|
76
|
+
const w = P / L;
|
|
77
|
+
reactionLeft = P / 2;
|
|
78
|
+
reactionRight = P / 2;
|
|
79
|
+
maxMoment = w * L * L / 8;
|
|
80
|
+
maxShear = P / 2;
|
|
81
|
+
if (E && I) {
|
|
82
|
+
maxDeflection = 5 * w * L * L * L * L / (384 * E * I);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case "triangular": {
|
|
87
|
+
const wMax = 2 * P / L;
|
|
88
|
+
reactionLeft = P / 3;
|
|
89
|
+
reactionRight = 2 * P / 3;
|
|
90
|
+
const xMax = L / Math.sqrt(3);
|
|
91
|
+
maxMoment = wMax * xMax * xMax * xMax / (6 * L) + reactionLeft * xMax - wMax * xMax * xMax / (6 * L);
|
|
92
|
+
maxMoment = wMax * L * L / (9 * Math.sqrt(3));
|
|
93
|
+
maxShear = 2 * P / 3;
|
|
94
|
+
if (E && I) {
|
|
95
|
+
maxDeflection = P * L * L * L / (60 * E * I);
|
|
96
|
+
}
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(`Unknown load type: ${loadType}. Use: point-center, point-custom, uniform, triangular`);
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
length,
|
|
104
|
+
load,
|
|
105
|
+
loadType,
|
|
106
|
+
reactionLeft,
|
|
107
|
+
reactionRight,
|
|
108
|
+
maxMoment,
|
|
109
|
+
maxShear,
|
|
110
|
+
maxDeflection,
|
|
111
|
+
momentUnit: "N\xB7m",
|
|
112
|
+
shearUnit: "N",
|
|
113
|
+
deflectionUnit: maxDeflection !== null ? "m" : null
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function cantilever(length, load, loadType, E, I, loadPosition) {
|
|
117
|
+
if (length <= 0) throw new Error("Length must be positive");
|
|
118
|
+
if (load < 0) throw new Error("Load must be non-negative");
|
|
119
|
+
let reactionForce;
|
|
120
|
+
let reactionMoment;
|
|
121
|
+
let maxMoment;
|
|
122
|
+
let maxShear;
|
|
123
|
+
let maxDeflection = null;
|
|
124
|
+
const L = length;
|
|
125
|
+
const P = load;
|
|
126
|
+
switch (loadType) {
|
|
127
|
+
case "point-end": {
|
|
128
|
+
reactionForce = P;
|
|
129
|
+
reactionMoment = P * L;
|
|
130
|
+
maxMoment = P * L;
|
|
131
|
+
maxShear = P;
|
|
132
|
+
if (E && I) {
|
|
133
|
+
maxDeflection = P * L * L * L / (3 * E * I);
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case "point-custom": {
|
|
138
|
+
const a = loadPosition ?? L;
|
|
139
|
+
if (a < 0 || a > L) throw new Error("Load position must be between 0 and length");
|
|
140
|
+
reactionForce = P;
|
|
141
|
+
reactionMoment = P * a;
|
|
142
|
+
maxMoment = P * a;
|
|
143
|
+
maxShear = P;
|
|
144
|
+
if (E && I) {
|
|
145
|
+
maxDeflection = P * a * a * (3 * L - a) / (6 * E * I);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "uniform": {
|
|
150
|
+
const w = P / L;
|
|
151
|
+
reactionForce = P;
|
|
152
|
+
reactionMoment = w * L * L / 2;
|
|
153
|
+
maxMoment = w * L * L / 2;
|
|
154
|
+
maxShear = P;
|
|
155
|
+
if (E && I) {
|
|
156
|
+
maxDeflection = w * L * L * L * L / (8 * E * I);
|
|
157
|
+
}
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
default:
|
|
161
|
+
throw new Error(`Unknown load type: ${loadType}. Use: point-end, point-custom, uniform`);
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
length,
|
|
165
|
+
load,
|
|
166
|
+
loadType,
|
|
167
|
+
reactionForce,
|
|
168
|
+
reactionMoment,
|
|
169
|
+
maxMoment,
|
|
170
|
+
maxShear,
|
|
171
|
+
maxDeflection,
|
|
172
|
+
momentUnit: "N\xB7m",
|
|
173
|
+
shearUnit: "N",
|
|
174
|
+
deflectionUnit: maxDeflection !== null ? "m" : null
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// src/structural/columns.ts
|
|
179
|
+
var K_FACTORS = {
|
|
180
|
+
"pinned-pinned": 1,
|
|
181
|
+
"fixed-free": 2,
|
|
182
|
+
"fixed-pinned": 0.7,
|
|
183
|
+
"fixed-fixed": 0.5
|
|
184
|
+
};
|
|
185
|
+
function eulerBuckling(E, I, length, endCondition) {
|
|
186
|
+
if (E <= 0) throw new Error("Elastic modulus must be positive");
|
|
187
|
+
if (I <= 0) throw new Error("Moment of inertia must be positive");
|
|
188
|
+
if (length <= 0) throw new Error("Length must be positive");
|
|
189
|
+
const K = K_FACTORS[endCondition];
|
|
190
|
+
if (K === void 0) {
|
|
191
|
+
throw new Error(`Unknown end condition: ${endCondition}. Use: pinned-pinned, fixed-free, fixed-pinned, fixed-fixed`);
|
|
192
|
+
}
|
|
193
|
+
const Le = K * length;
|
|
194
|
+
const Pcr = Math.PI * Math.PI * E * I / (Le * Le);
|
|
195
|
+
return {
|
|
196
|
+
elasticModulus: E,
|
|
197
|
+
momentOfInertia: I,
|
|
198
|
+
length,
|
|
199
|
+
endCondition,
|
|
200
|
+
effectiveLengthFactor: K,
|
|
201
|
+
effectiveLength: Le,
|
|
202
|
+
criticalLoad: Pcr,
|
|
203
|
+
unit: "N"
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function slendernessRatio(effectiveLength, radiusOfGyration) {
|
|
207
|
+
if (effectiveLength <= 0) throw new Error("Effective length must be positive");
|
|
208
|
+
if (radiusOfGyration <= 0) throw new Error("Radius of gyration must be positive");
|
|
209
|
+
const ratio = effectiveLength / radiusOfGyration;
|
|
210
|
+
let classification;
|
|
211
|
+
if (ratio < 30) {
|
|
212
|
+
classification = "short";
|
|
213
|
+
} else if (ratio <= 120) {
|
|
214
|
+
classification = "intermediate";
|
|
215
|
+
} else {
|
|
216
|
+
classification = "long";
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
effectiveLength,
|
|
220
|
+
radiusOfGyration,
|
|
221
|
+
slendernessRatio: ratio,
|
|
222
|
+
classification
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// src/structural/sections.ts
|
|
227
|
+
function rectangleSection(width, height) {
|
|
228
|
+
if (width <= 0) throw new Error("Width must be positive");
|
|
229
|
+
if (height <= 0) throw new Error("Height must be positive");
|
|
230
|
+
const area = width * height;
|
|
231
|
+
const Ixx = width * height * height * height / 12;
|
|
232
|
+
const Iyy = height * width * width * width / 12;
|
|
233
|
+
const Sx = width * height * height / 6;
|
|
234
|
+
const Sy = height * width * width / 6;
|
|
235
|
+
const rx = height / Math.sqrt(12);
|
|
236
|
+
const ry = width / Math.sqrt(12);
|
|
237
|
+
return { width, height, area, Ixx, Iyy, Sx, Sy, rx, ry };
|
|
238
|
+
}
|
|
239
|
+
function circularSection(diameter) {
|
|
240
|
+
if (diameter <= 0) throw new Error("Diameter must be positive");
|
|
241
|
+
const r2 = diameter / 2;
|
|
242
|
+
const area = Math.PI * r2 * r2;
|
|
243
|
+
const I = Math.PI * diameter * diameter * diameter * diameter / 64;
|
|
244
|
+
const S = Math.PI * diameter * diameter * diameter / 32;
|
|
245
|
+
const r = diameter / 4;
|
|
246
|
+
return { diameter, area, I, S, r };
|
|
247
|
+
}
|
|
248
|
+
function hollowCircularSection(outerDiameter, innerDiameter) {
|
|
249
|
+
if (outerDiameter <= 0) throw new Error("Outer diameter must be positive");
|
|
250
|
+
if (innerDiameter < 0) throw new Error("Inner diameter must be non-negative");
|
|
251
|
+
if (innerDiameter >= outerDiameter) throw new Error("Inner diameter must be less than outer diameter");
|
|
252
|
+
const D = outerDiameter;
|
|
253
|
+
const d = innerDiameter;
|
|
254
|
+
const area = Math.PI / 4 * (D * D - d * d);
|
|
255
|
+
const I = Math.PI / 64 * (D * D * D * D - d * d * d * d);
|
|
256
|
+
const S = Math.PI / (32 * D) * (D * D * D * D - d * d * d * d);
|
|
257
|
+
const r = Math.sqrt(I / area);
|
|
258
|
+
return { outerDiameter, innerDiameter, area, I, S, r };
|
|
259
|
+
}
|
|
260
|
+
function iBeamSection(flangeWidth, flangeThickness, webHeight, webThickness) {
|
|
261
|
+
if (flangeWidth <= 0) throw new Error("Flange width must be positive");
|
|
262
|
+
if (flangeThickness <= 0) throw new Error("Flange thickness must be positive");
|
|
263
|
+
if (webHeight <= 0) throw new Error("Web height must be positive");
|
|
264
|
+
if (webThickness <= 0) throw new Error("Web thickness must be positive");
|
|
265
|
+
const totalHeight = webHeight + 2 * flangeThickness;
|
|
266
|
+
const flangeArea = flangeWidth * flangeThickness;
|
|
267
|
+
const webArea = webHeight * webThickness;
|
|
268
|
+
const area = 2 * flangeArea + webArea;
|
|
269
|
+
const IxxWeb = webThickness * webHeight * webHeight * webHeight / 12;
|
|
270
|
+
const IxxFlangeSelf = flangeWidth * flangeThickness * flangeThickness * flangeThickness / 12;
|
|
271
|
+
const flangeCenterDist = (webHeight + flangeThickness) / 2;
|
|
272
|
+
const IxxFlangeParallel = flangeArea * flangeCenterDist * flangeCenterDist;
|
|
273
|
+
const Ixx = IxxWeb + 2 * (IxxFlangeSelf + IxxFlangeParallel);
|
|
274
|
+
const IyyFlanges = 2 * (flangeThickness * flangeWidth * flangeWidth * flangeWidth) / 12;
|
|
275
|
+
const IyyWeb = webHeight * webThickness * webThickness * webThickness / 12;
|
|
276
|
+
const Iyy = IyyFlanges + IyyWeb;
|
|
277
|
+
const Sx = 2 * Ixx / totalHeight;
|
|
278
|
+
const Sy = 2 * Iyy / flangeWidth;
|
|
279
|
+
const rx = Math.sqrt(Ixx / area);
|
|
280
|
+
const ry = Math.sqrt(Iyy / area);
|
|
281
|
+
return {
|
|
282
|
+
flangeWidth,
|
|
283
|
+
flangeThickness,
|
|
284
|
+
webHeight,
|
|
285
|
+
webThickness,
|
|
286
|
+
totalHeight,
|
|
287
|
+
area,
|
|
288
|
+
Ixx,
|
|
289
|
+
Iyy,
|
|
290
|
+
Sx,
|
|
291
|
+
Sy,
|
|
292
|
+
rx,
|
|
293
|
+
ry
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// src/structural/soils.ts
|
|
298
|
+
function bearingCapacityFactors(frictionAngleDeg) {
|
|
299
|
+
const phi = frictionAngleDeg * Math.PI / 180;
|
|
300
|
+
const tan45half = Math.tan(Math.PI / 4 + phi / 2);
|
|
301
|
+
const Nq = tan45half * tan45half * Math.exp(Math.PI * Math.tan(phi));
|
|
302
|
+
let Nc;
|
|
303
|
+
if (frictionAngleDeg === 0) {
|
|
304
|
+
Nc = 5.14;
|
|
305
|
+
} else {
|
|
306
|
+
Nc = (Nq - 1) / Math.tan(phi);
|
|
307
|
+
}
|
|
308
|
+
const Ngamma = 2 * (Nq + 1) * Math.tan(phi);
|
|
309
|
+
return { Nc, Nq, Ngamma };
|
|
310
|
+
}
|
|
311
|
+
function terzaghiBearing(cohesion, depth, unitWeight, frictionAngle, foundationType) {
|
|
312
|
+
if (cohesion < 0) throw new Error("Cohesion must be non-negative");
|
|
313
|
+
if (depth < 0) throw new Error("Depth must be non-negative");
|
|
314
|
+
if (unitWeight <= 0) throw new Error("Unit weight must be positive");
|
|
315
|
+
if (frictionAngle < 0 || frictionAngle > 50) throw new Error("Friction angle must be between 0 and 50 degrees");
|
|
316
|
+
const { Nc, Nq, Ngamma } = bearingCapacityFactors(frictionAngle);
|
|
317
|
+
let sc;
|
|
318
|
+
let sgamma;
|
|
319
|
+
switch (foundationType) {
|
|
320
|
+
case "strip":
|
|
321
|
+
sc = 1;
|
|
322
|
+
sgamma = 1;
|
|
323
|
+
break;
|
|
324
|
+
case "square":
|
|
325
|
+
sc = 1.3;
|
|
326
|
+
sgamma = 0.8;
|
|
327
|
+
break;
|
|
328
|
+
case "circular":
|
|
329
|
+
sc = 1.3;
|
|
330
|
+
sgamma = 0.6;
|
|
331
|
+
break;
|
|
332
|
+
default:
|
|
333
|
+
throw new Error(`Unknown foundation type: ${foundationType}. Use: strip, square, circular`);
|
|
334
|
+
}
|
|
335
|
+
const bearingCapacity = cohesion * Nc * sc + unitWeight * depth * Nq + 0.5 * unitWeight * 1 * Ngamma * sgamma;
|
|
336
|
+
return {
|
|
337
|
+
cohesion,
|
|
338
|
+
depth,
|
|
339
|
+
unitWeight,
|
|
340
|
+
frictionAngle,
|
|
341
|
+
foundationType,
|
|
342
|
+
bearingCapacity,
|
|
343
|
+
Nc,
|
|
344
|
+
Nq,
|
|
345
|
+
Ngamma,
|
|
346
|
+
unit: "Pa"
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function lateralEarthPressure(unitWeight, height, frictionAngle, pressureType) {
|
|
350
|
+
if (unitWeight <= 0) throw new Error("Unit weight must be positive");
|
|
351
|
+
if (height <= 0) throw new Error("Height must be positive");
|
|
352
|
+
if (frictionAngle < 0 || frictionAngle > 50) throw new Error("Friction angle must be between 0 and 50 degrees");
|
|
353
|
+
const phi = frictionAngle * Math.PI / 180;
|
|
354
|
+
let coefficient;
|
|
355
|
+
switch (pressureType) {
|
|
356
|
+
case "active":
|
|
357
|
+
coefficient = Math.pow(Math.tan(Math.PI / 4 - phi / 2), 2);
|
|
358
|
+
break;
|
|
359
|
+
case "passive":
|
|
360
|
+
coefficient = Math.pow(Math.tan(Math.PI / 4 + phi / 2), 2);
|
|
361
|
+
break;
|
|
362
|
+
case "at-rest":
|
|
363
|
+
coefficient = 1 - Math.sin(phi);
|
|
364
|
+
break;
|
|
365
|
+
default:
|
|
366
|
+
throw new Error(`Unknown pressure type: ${pressureType}. Use: active, passive, at-rest`);
|
|
367
|
+
}
|
|
368
|
+
const pressureAtBase = coefficient * unitWeight * height;
|
|
369
|
+
const totalForce = 0.5 * pressureAtBase * height;
|
|
370
|
+
return {
|
|
371
|
+
unitWeight,
|
|
372
|
+
height,
|
|
373
|
+
frictionAngle,
|
|
374
|
+
pressureType,
|
|
375
|
+
coefficient,
|
|
376
|
+
pressureAtBase,
|
|
377
|
+
totalForce,
|
|
378
|
+
pressureUnit: "Pa",
|
|
379
|
+
forceUnit: "N/m"
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function settlement(load, area, elasticModulus, thickness) {
|
|
383
|
+
if (load < 0) throw new Error("Load must be non-negative");
|
|
384
|
+
if (area <= 0) throw new Error("Area must be positive");
|
|
385
|
+
if (elasticModulus <= 0) throw new Error("Elastic modulus must be positive");
|
|
386
|
+
if (thickness <= 0) throw new Error("Thickness must be positive");
|
|
387
|
+
const stress = load / area;
|
|
388
|
+
const settl = stress * thickness / elasticModulus;
|
|
389
|
+
return {
|
|
390
|
+
load,
|
|
391
|
+
area,
|
|
392
|
+
elasticModulus,
|
|
393
|
+
thickness,
|
|
394
|
+
stress,
|
|
395
|
+
settlement: settl,
|
|
396
|
+
unit: "m"
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/structural/materials.ts
|
|
401
|
+
var MATERIALS = [
|
|
402
|
+
{
|
|
403
|
+
name: "ASTM A36 Steel",
|
|
404
|
+
category: "steel",
|
|
405
|
+
E: 2e11,
|
|
406
|
+
fy: 25e7,
|
|
407
|
+
fu: 4e8,
|
|
408
|
+
density: 7850,
|
|
409
|
+
poissonsRatio: 0.26,
|
|
410
|
+
thermalExpansion: 12e-6,
|
|
411
|
+
Eunit: "Pa",
|
|
412
|
+
fyUnit: "Pa",
|
|
413
|
+
fuUnit: "Pa",
|
|
414
|
+
densityUnit: "kg/m\xB3",
|
|
415
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "ASTM A992 Steel",
|
|
419
|
+
category: "steel",
|
|
420
|
+
E: 2e11,
|
|
421
|
+
fy: 345e6,
|
|
422
|
+
fu: 45e7,
|
|
423
|
+
density: 7850,
|
|
424
|
+
poissonsRatio: 0.26,
|
|
425
|
+
thermalExpansion: 12e-6,
|
|
426
|
+
Eunit: "Pa",
|
|
427
|
+
fyUnit: "Pa",
|
|
428
|
+
fuUnit: "Pa",
|
|
429
|
+
densityUnit: "kg/m\xB3",
|
|
430
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
name: "Stainless Steel 304",
|
|
434
|
+
category: "steel",
|
|
435
|
+
E: 193e9,
|
|
436
|
+
fy: 215e6,
|
|
437
|
+
fu: 515e6,
|
|
438
|
+
density: 7930,
|
|
439
|
+
poissonsRatio: 0.29,
|
|
440
|
+
thermalExpansion: 173e-7,
|
|
441
|
+
Eunit: "Pa",
|
|
442
|
+
fyUnit: "Pa",
|
|
443
|
+
fuUnit: "Pa",
|
|
444
|
+
densityUnit: "kg/m\xB3",
|
|
445
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
name: "Aluminum 6061-T6",
|
|
449
|
+
category: "aluminum",
|
|
450
|
+
E: 689e8,
|
|
451
|
+
fy: 276e6,
|
|
452
|
+
fu: 31e7,
|
|
453
|
+
density: 2700,
|
|
454
|
+
poissonsRatio: 0.33,
|
|
455
|
+
thermalExpansion: 236e-7,
|
|
456
|
+
Eunit: "Pa",
|
|
457
|
+
fyUnit: "Pa",
|
|
458
|
+
fuUnit: "Pa",
|
|
459
|
+
densityUnit: "kg/m\xB3",
|
|
460
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
name: "Aluminum 2024-T3",
|
|
464
|
+
category: "aluminum",
|
|
465
|
+
E: 731e8,
|
|
466
|
+
fy: 345e6,
|
|
467
|
+
fu: 483e6,
|
|
468
|
+
density: 2780,
|
|
469
|
+
poissonsRatio: 0.33,
|
|
470
|
+
thermalExpansion: 232e-7,
|
|
471
|
+
Eunit: "Pa",
|
|
472
|
+
fyUnit: "Pa",
|
|
473
|
+
fuUnit: "Pa",
|
|
474
|
+
densityUnit: "kg/m\xB3",
|
|
475
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
name: "Concrete C20/25",
|
|
479
|
+
category: "concrete",
|
|
480
|
+
E: 3e10,
|
|
481
|
+
fy: 2e7,
|
|
482
|
+
fu: 25e6,
|
|
483
|
+
density: 2400,
|
|
484
|
+
poissonsRatio: 0.2,
|
|
485
|
+
thermalExpansion: 1e-5,
|
|
486
|
+
Eunit: "Pa",
|
|
487
|
+
fyUnit: "Pa",
|
|
488
|
+
fuUnit: "Pa",
|
|
489
|
+
densityUnit: "kg/m\xB3",
|
|
490
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
name: "Concrete C30/37",
|
|
494
|
+
category: "concrete",
|
|
495
|
+
E: 33e9,
|
|
496
|
+
fy: 3e7,
|
|
497
|
+
fu: 37e6,
|
|
498
|
+
density: 2400,
|
|
499
|
+
poissonsRatio: 0.2,
|
|
500
|
+
thermalExpansion: 1e-5,
|
|
501
|
+
Eunit: "Pa",
|
|
502
|
+
fyUnit: "Pa",
|
|
503
|
+
fuUnit: "Pa",
|
|
504
|
+
densityUnit: "kg/m\xB3",
|
|
505
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
name: "Concrete C40/50",
|
|
509
|
+
category: "concrete",
|
|
510
|
+
E: 35e9,
|
|
511
|
+
fy: 4e7,
|
|
512
|
+
fu: 5e7,
|
|
513
|
+
density: 2400,
|
|
514
|
+
poissonsRatio: 0.2,
|
|
515
|
+
thermalExpansion: 1e-5,
|
|
516
|
+
Eunit: "Pa",
|
|
517
|
+
fyUnit: "Pa",
|
|
518
|
+
fuUnit: "Pa",
|
|
519
|
+
densityUnit: "kg/m\xB3",
|
|
520
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: "Douglas Fir",
|
|
524
|
+
category: "timber",
|
|
525
|
+
E: 124e8,
|
|
526
|
+
fy: 36e6,
|
|
527
|
+
fu: 52e6,
|
|
528
|
+
density: 530,
|
|
529
|
+
poissonsRatio: 0.29,
|
|
530
|
+
thermalExpansion: 36e-7,
|
|
531
|
+
Eunit: "Pa",
|
|
532
|
+
fyUnit: "Pa",
|
|
533
|
+
fuUnit: "Pa",
|
|
534
|
+
densityUnit: "kg/m\xB3",
|
|
535
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: "Southern Pine",
|
|
539
|
+
category: "timber",
|
|
540
|
+
E: 137e8,
|
|
541
|
+
fy: 41e6,
|
|
542
|
+
fu: 59e6,
|
|
543
|
+
density: 560,
|
|
544
|
+
poissonsRatio: 0.33,
|
|
545
|
+
thermalExpansion: 36e-7,
|
|
546
|
+
Eunit: "Pa",
|
|
547
|
+
fyUnit: "Pa",
|
|
548
|
+
fuUnit: "Pa",
|
|
549
|
+
densityUnit: "kg/m\xB3",
|
|
550
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
name: "Copper C11000",
|
|
554
|
+
category: "other",
|
|
555
|
+
E: 13e10,
|
|
556
|
+
fy: 69e6,
|
|
557
|
+
fu: 22e7,
|
|
558
|
+
density: 8940,
|
|
559
|
+
poissonsRatio: 0.33,
|
|
560
|
+
thermalExpansion: 173e-7,
|
|
561
|
+
Eunit: "Pa",
|
|
562
|
+
fyUnit: "Pa",
|
|
563
|
+
fuUnit: "Pa",
|
|
564
|
+
densityUnit: "kg/m\xB3",
|
|
565
|
+
thermalExpansionUnit: "1/\xB0C"
|
|
566
|
+
}
|
|
567
|
+
];
|
|
568
|
+
function getMaterial(name) {
|
|
569
|
+
const lower = name.toLowerCase();
|
|
570
|
+
const found = MATERIALS.find((m) => m.name.toLowerCase().includes(lower));
|
|
571
|
+
if (!found) {
|
|
572
|
+
const available = MATERIALS.map((m) => m.name).join(", ");
|
|
573
|
+
throw new Error(`Material "${name}" not found. Available: ${available}`);
|
|
574
|
+
}
|
|
575
|
+
return { ...found };
|
|
576
|
+
}
|
|
577
|
+
function listMaterials(category) {
|
|
578
|
+
if (!category) return MATERIALS.map((m) => ({ ...m }));
|
|
579
|
+
const lower = category.toLowerCase();
|
|
580
|
+
const filtered = MATERIALS.filter((m) => m.category.toLowerCase() === lower);
|
|
581
|
+
if (filtered.length === 0) {
|
|
582
|
+
const categories = [...new Set(MATERIALS.map((m) => m.category))].join(", ");
|
|
583
|
+
throw new Error(`No materials found in category "${category}". Available categories: ${categories}`);
|
|
584
|
+
}
|
|
585
|
+
return filtered.map((m) => ({ ...m }));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
exports.cantilever = cantilever;
|
|
589
|
+
exports.circularSection = circularSection;
|
|
590
|
+
exports.eulerBuckling = eulerBuckling;
|
|
591
|
+
exports.factorOfSafety = factorOfSafety;
|
|
592
|
+
exports.getMaterial = getMaterial;
|
|
593
|
+
exports.hollowCircularSection = hollowCircularSection;
|
|
594
|
+
exports.hoopStress = hoopStress;
|
|
595
|
+
exports.iBeamSection = iBeamSection;
|
|
596
|
+
exports.lateralEarthPressure = lateralEarthPressure;
|
|
597
|
+
exports.listMaterials = listMaterials;
|
|
598
|
+
exports.normalStress = normalStress;
|
|
599
|
+
exports.rectangleSection = rectangleSection;
|
|
600
|
+
exports.settlement = settlement;
|
|
601
|
+
exports.shearStress = shearStress;
|
|
602
|
+
exports.simplySupported = simplySupported;
|
|
603
|
+
exports.slendernessRatio = slendernessRatio;
|
|
604
|
+
exports.strain = strain;
|
|
605
|
+
exports.terzaghiBearing = terzaghiBearing;
|
|
606
|
+
exports.youngsModulus = youngsModulus;
|
|
607
|
+
//# sourceMappingURL=index.js.map
|
|
608
|
+
//# sourceMappingURL=index.js.map
|