w-geo

w-geo

new w-geo()

Source:

Members

(static) calcLiquefaction

Description:
  • 液化分析

    Unit Test: Github

Source:

液化分析

Unit Test: Github

Example
let rowsIn = `[{"sampleId":"S-1","depthStart":"0","depthEnd":"3.5","depth":"1.75","N60":"8","w":"20.8","GS":"2.7","e":"0.86","LL":"32.5","PI":"11.4","soilClassification":"CL","D50":"","D10":"","FC":"76.09999847","rd":"14.21150662","PGA":"0.612","Mw":"7.6","waterLevelUsual":"0","waterLevelDesign":"0"},...]`
rowsIn = JSON.parse(rowsIn)
// console.log('rowsIn',rowsIn)

let rowsOut = calcLiquefaction.calc('SPT', rowsIn)
// console.log('rowsOut',rowsOut)

fs.writeFileSync('./rowsIn.json', JSON.stringify(rowsIn), 'utf8')
fs.writeFileSync('./rowsOut.json', JSON.stringify(rowsOut), 'utf8')

// let mat = w.ltdtkeysheads2mat(rowsOut)
// w.downloadExcelFileFromData('./mat.xlsx', 'mat', mat)

Methods

(static) calcDepthByDepthStartEnd(rows, optopt) → {Array}

Description:
  • 由樣本起訖深度反算中點深度

    Unit Test: Github

Source:
Example
let rows
let rs

rows = [
    {
        depthStart: 0,
        depthEnd: 3,
    },
    {
        depthStart: 3,
        depthEnd: 13,
    },
    {
        depthStart: 13,
        depthEnd: 20,
    },
]
rs = calcDepthByDepthStartEnd(rows)
console.log(rs)
// => [
//   { depthStart: 0, depthEnd: 3, depth: 1.5 },
//   { depthStart: 3, depthEnd: 13, depth: 8 },
//   { depthStart: 13, depthEnd: 20, depth: 16.5 }
// ]

rows = [
    {
        depthStart: 0,
        depthEnd: 3,
    },
    {
        depthStart: 13,
        depthEnd: 20,
    },
]
rs = calcDepthByDepthStartEnd(rows)
console.log(rs)
// => [
//   { depthStart: 0, depthEnd: 3, depth: 1.5 },
//   { depthStart: 13, depthEnd: 20, depth: 16.5 }
// ]

rows = [
    {
        ds: 0,
        de: 3,
    },
    {
        ds: 3,
        de: 13,
    },
    {
        ds: 13,
        de: 20,
    },
]
rs = calcDepthByDepthStartEnd(rows, { keyDepthStart: 'ds', keyDepthEnd: 'de', keyDepth: 'dc' })
console.log(rs)
// => [
//   { ds: 0, de: 3, dc: 1.5 },
//   { ds: 3, de: 13, dc: 8 },
//   { ds: 13, de: 20, dc: 16.5 }
// ]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepthStart String <optional>
'depthStart'

輸入起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入結束深度欄位鍵值字串,預設'depthEnd'

keyDepth String <optional>
'depth'

輸入欲儲存之中點深度欄位鍵值字串,預設'depth'

Returns:

回傳添加起訖深度的數據陣列

Type
Array

(static) calcDepthStartEndByConnect(rows, optopt) → {Array}

Description:
  • 調整各樣本起訖深度成為各層互相接續狀態

    Unit Test: Github

Source:
Example
let rows
let rs

rows = [
    {
        depthStart: 0,
        depthEnd: 4,
    },
    {
        depthStart: 6,
        depthEnd: 10,
    },
    {
        depthStart: 11,
        depthEnd: 15,
    },
]
rs = calcDepthStartEndByConnect(rows)
console.log(rs)
// => [
//   { depthStart: 0, depthEnd: 5 },
//   { depthStart: 5, depthEnd: 10.5 },
//   { depthStart: 10.5, depthEnd: 15 }
// ]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
    },
    {
        depthStart: 4,
        depthEnd: 15,
    },
]
try {
    rs = calcDepthStartEndByConnect(rows)
}
catch (err) {
    rs = err.toString()
}
console.log(rs)
// => Error: 第 0 樣本之結束深度depthEnd[5]大於第 1 樣本之起點深度depthStart[4]

rows = [
    {
        depthStart: '0',
        depthEnd: '4',
    },
    {
        depthStart: '6',
        depthEnd: '10',
    },
]
rs = calcDepthStartEndByConnect(rows)
console.log(rs)
// => [ { depthStart: '0', depthEnd: 5 }, { depthStart: 5, depthEnd: '10' } ]

rows = [
    {
        depthStart: '0',
        depthEnd: 'abc',
    },
    {
        depthStart: 'abc',
        depthEnd: '10',
    },
]
try {
    rs = calcDepthStartEndByConnect(rows)
}
catch (err) {
    rs = err.toString()
}
console.log(rs)
// => Error: 第 0 樣本結束深度depthEnd[abc]非有效數字, 第 1 樣本起始深度depthStart[abc]非有效數字

rows = [
    {
        top_depth: 0,
        bottom_depth: 4,
    },
    {
        top_depth: 6,
        bottom_depth: 10,
    },
]
rs = calcDepthStartEndByConnect(rows, { keyDepthStart: 'top_depth', keyDepthEnd: 'bottom_depth' })
console.log(rs)
// => [
//   { top_depth: 0, bottom_depth: 5 },
//   { top_depth: 5, bottom_depth: 10 }
// ]

rows = [
    {
        depthStart: 0,
        depthEnd: 4,
    },
    {
        depthStart: 6,
        depthEnd: 10,
    },
    {
        depthStart: 11,
        depthEnd: 15,
    },
]
rs = calcDepthStartEndByConnect(rows, { depthEndMax: 20 })
console.log(rs)
// => [
//   { depthStart: 0, depthEnd: 5 },
//   { depthStart: 5, depthEnd: 10.5 },
//   { depthStart: 10.5, depthEnd: 20 }
// ]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepthStart String <optional>
'depthStart'

輸入欲儲存之起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入欲儲存之結束深度欄位鍵值字串,預設'depthEnd'

depthEndMax Number <optional>
null

輸入最大結束深度數字,若最深樣本的結束深度若小於depthEndMax,則自動給予depthEndMax,預設null

Returns:

回傳群組化後添加起訖深度與所屬原數據的陣列

Type
Array

(static) calcDepthStartEndByDepth(rows, optopt) → {Array}

Description:
  • 由樣本中點深度反算各樣本起訖深度,注意樣本添加起訖深度可能因最淺樣本起始深度最大為0,以及最深樣本可被修改為depthEndMax,故各樣本中點深度不一定是起訖深度之平均值

    Unit Test: Github

Source:
Example
let rows
let rs

rows = [
    {
        depth: 0,
    },
    {
        depth: 6,
    },
    {
        depth: 20,
    },
]
rs = calcDepthStartEndByDepth(rows)
console.log(rs)
// => [
//   { depth: 0, depthStart: 0, depthEnd: 3 },
//   { depth: 6, depthStart: 3, depthEnd: 13 },
//   { depth: 20, depthStart: 13, depthEnd: 20 }
// ]

rows = [
    {
        depth: 4,
    },
    {
        depth: 6,
    },
    {
        depth: 20,
    },
]
rs = calcDepthStartEndByDepth(rows)
console.log(rs)
// => [
//   { depth: 4, depthStart: 0, depthEnd: 5 },
//   { depth: 6, depthStart: 5, depthEnd: 13 },
//   { depth: 20, depthStart: 13, depthEnd: 20 }
// ]

rows = [
    {
        depth: 4,
    },
    {
        depth: 6,
    },
    {
        depth: 20,
    },
]
rs = calcDepthStartEndByDepth(rows, { depthEndMax: 25 })
console.log(rs)
// => [
//   { depth: 4, depthStart: 0, depthEnd: 5 },
//   { depth: 6, depthStart: 5, depthEnd: 13 },
//   { depth: 20, depthStart: 13, depthEnd: 25 }
// ]

rows = [
    {
        depth: 4,
    },
    {
        depth: 6,
    },
    {
        depth: 20,
    },
]
rs = calcDepthStartEndByDepth(rows, { depthEndMax: 15 })
console.log(rs)
// => [
//   { depth: 4, depthStart: 0, depthEnd: 5 },
//   { depth: 6, depthStart: 5, depthEnd: 13 },
//   { depth: 20, depthStart: 13, depthEnd: 20 }
// ]

rows = [
    {
        dc: 4,
    },
    {
        dc: 6,
    },
    {
        dc: 20,
    },
]
rs = calcDepthStartEndByDepth(rows, { keyDepth: 'dc', keyDepthStart: 'ds', keyDepthEnd: 'de' })
console.log(rs)
// => [
//   { dc: 4, ds: 0, de: 5 },
//   { dc: 6, ds: 5, de: 13 },
//   { dc: 20, ds: 13, de: 20 }
// ]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入中點深度欄位鍵值字串,預設'depth'

keyDepthStart String <optional>
'depthStart'

輸入欲儲存之起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入欲儲存之結束深度欄位鍵值字串,預設'depthEnd'

depthEndMax Number <optional>
null

輸入最大結束深度數字,若最深樣本的結束深度若小於depthEndMax,則自動給予depthEndMax,預設null

Returns:

回傳添加起訖深度的數據陣列

Type
Array

(static) calcDepthStartEndByGroup(rows, optopt) → {Array}

Description:
  • 由樣本指定鍵值作為群組代號,並依照樣本中點深度提取各群組之起訖深度

    Unit Test: Github

Source:
Example
let rows
let rs

rows = [
    {
        depth: 0,
        group: 'a',
    },
    {
        depth: 6,
        group: 'b',
    },
    {
        depth: 20,
        group: 'c',
    },
]
rs = calcDepthStartEndByGroup(rows)
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "group": "a",
//     "depthStart": 0,
//     "depthEnd": 3,
//     "rows": [
//       {
//         "depth": 0,
//         "group": "a",
//         "depthStart": 0,
//         "depthEnd": 3
//       }
//     ]
//   },
//   {
//     "group": "b",
//     "depthStart": 3,
//     "depthEnd": 13,
//     "rows": [
//       {
//         "depth": 6,
//         "group": "b",
//         "depthStart": 3,
//         "depthEnd": 13
//       }
//     ]
//   },
//   {
//     "group": "c",
//     "depthStart": 13,
//     "depthEnd": 20,
//     "rows": [
//       {
//         "depth": 20,
//         "group": "c",
//         "depthStart": 13,
//         "depthEnd": 20
//       }
//     ]
//   }
// ]

rows = [
    {
        depth: 2,
        group: 'a',
    },
    {
        depth: 6,
        group: 'b',
    },
    {
        depth: 20,
        group: 'c',
    },
]
rs = calcDepthStartEndByGroup(rows, { depthEndMax: 25 })
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "group": "a",
//     "depthStart": 0,
//     "depthEnd": 4,
//     "rows": [
//       {
//         "depth": 2,
//         "group": "a",
//         "depthStart": 0,
//         "depthEnd": 4
//       }
//     ]
//   },
//   {
//     "group": "b",
//     "depthStart": 4,
//     "depthEnd": 13,
//     "rows": [
//       {
//         "depth": 6,
//         "group": "b",
//         "depthStart": 4,
//         "depthEnd": 13
//       }
//     ]
//   },
//   {
//     "group": "c",
//     "depthStart": 13,
//     "depthEnd": 25,
//     "rows": [
//       {
//         "depth": 20,
//         "group": "c",
//         "depthStart": 13,
//         "depthEnd": 25
//       }
//     ]
//   }
// ]

rows = [
    {
        depth: 0,
        group: 'a',
    },
    {
        depth: 2,
        group: 'a',
    },
    {
        depth: 4,
        group: 'b',
    },
    {
        depth: 6,
        group: 'b',
    },
    {
        depth: 8,
        group: 'b',
    },
    {
        depth: 10,
        group: 'c',
    },
    {
        depth: 12,
        group: 'b',
    },
    {
        depth: 14,
        group: 'c',
    },
    {
        depth: 16,
        group: 'b',
    },
    {
        depth: 18,
        group: 'b',
    },
    {
        depth: 30,
        group: 'd',
    },
]
rs = calcDepthStartEndByGroup(rows)
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "group": "a",
//     "depthStart": 0,
//     "depthEnd": 3,
//     "rows": [
//       {
//         "depth": 0,
//         "group": "a",
//         "depthStart": 0,
//         "depthEnd": 1
//       },
//       {
//         "depth": 2,
//         "group": "a",
//         "depthStart": 1,
//         "depthEnd": 3
//       }
//     ]
//   },
//   {
//     "group": "b",
//     "depthStart": 3,
//     "depthEnd": 9,
//     "rows": [
//       {
//         "depth": 4,
//         "group": "b",
//         "depthStart": 3,
//         "depthEnd": 5
//       },
//       {
//         "depth": 6,
//         "group": "b",
//         "depthStart": 5,
//         "depthEnd": 7
//       },
//       {
//         "depth": 8,
//         "group": "b",
//         "depthStart": 7,
//         "depthEnd": 9
//       }
//     ]
//   },
//   {
//     "group": "c",
//     "depthStart": 9,
//     "depthEnd": 11,
//     "rows": [
//       {
//         "depth": 10,
//         "group": "c",
//         "depthStart": 9,
//         "depthEnd": 11
//       }
//     ]
//   },
//   {
//     "group": "b",
//     "depthStart": 11,
//     "depthEnd": 13,
//     "rows": [
//       {
//         "depth": 12,
//         "group": "b",
//         "depthStart": 11,
//         "depthEnd": 13
//       }
//     ]
//   },
//   {
//     "group": "c",
//     "depthStart": 13,
//     "depthEnd": 15,
//     "rows": [
//       {
//         "depth": 14,
//         "group": "c",
//         "depthStart": 13,
//         "depthEnd": 15
//       }
//     ]
//   },
//   {
//     "group": "b",
//     "depthStart": 15,
//     "depthEnd": 24,
//     "rows": [
//       {
//         "depth": 16,
//         "group": "b",
//         "depthStart": 15,
//         "depthEnd": 17
//       },
//       {
//         "depth": 18,
//         "group": "b",
//         "depthStart": 17,
//         "depthEnd": 24
//       }
//     ]
//   },
//   {
//     "group": "d",
//     "depthStart": 24,
//     "depthEnd": 30,
//     "rows": [
//       {
//         "depth": 30,
//         "group": "d",
//         "depthStart": 24,
//         "depthEnd": 30
//       }
//     ]
//   }
// ]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入中點深度欄位鍵值字串,預設'depth'

keyGroup String <optional>
'group'

輸入群組代號欄位鍵值字串,預設'group'

keyDepthStart String <optional>
'depthStart'

輸入欲儲存之起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入欲儲存之結束深度欄位鍵值字串,預設'depthEnd'

depthEndMax Number <optional>
null

輸入最大結束深度數字,若最深樣本的結束深度若小於depthEndMax,則自動給予depthEndMax,預設null

Returns:

回傳群組化後添加起訖深度與所屬原數據的陣列

Type
Array

(static) calcVerticalStress(rows, optopt) → {Array}

Description:
  • 計算樣本數據垂直總應力與有效應力

    Unit Test: Github

Source:
Example
let waterLevelUsual
let waterLevelDesign
let rows
let rowsNew

waterLevelUsual = 0
waterLevelDesign = 0
rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        rsat: 18, //kN/m3
    },
    {
        depthStart: 5,
        depthEnd: 10,
        rsat: 18, //kN/m3
    },
    {
        depthStart: 10,
        depthEnd: 20,
        rsat: 18, //kN/m3
    },
]
rowsNew = calcVerticalStress(rows, { waterLevelUsual, waterLevelDesign, unitSvSvp: 'kPa' })
console.log(rowsNew, (18 - 9.81) * 15) //地下 15(m) 處之垂直有效應力為 122.85(kN/m2)
// => [
//   {
//     depthStart: 0,
//     depthEnd: 5,
//     rsat: 18,
//     waterLevelUsual: 0,
//     waterLevelDesign: 0,
//     sv: 45,
//     svpUsual: 20.474999999999998,
//     svpDesign: 20.474999999999998,
//     depth: 2.5
//   },
//   {
//     depthStart: 5,
//     depthEnd: 10,
//     rsat: 18,
//     waterLevelUsual: 0,
//     waterLevelDesign: 0,
//     sv: 135,
//     svpUsual: 61.425,
//     svpDesign: 61.425,
//     depth: 7.5
//   },
//   {
//     depthStart: 10,
//     depthEnd: 20,
//     rsat: 18,
//     waterLevelUsual: 0,
//     waterLevelDesign: 0,
//     sv: 270,
//     svpUsual: 122.85,
//     svpDesign: 122.85,
//     depth: 15
//   }
// ] 122.85

waterLevelUsual = 0
waterLevelDesign = 0
rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        rsat: 18, //kN/m3
    },
    {
        depthStart: 5,
        depthEnd: 10,
        rsat: 19, //kN/m3
    },
    {
        depthStart: 10,
        depthEnd: 20,
        rsat: 20, //kN/m3
    },
]
rowsNew = calcVerticalStress(rows, { waterLevelUsual, waterLevelDesign, unitSvSvp: 'kPa' })
console.log(rowsNew, (19 - 9.81) * 15) //地下 15(m) 處之垂直有效應力為 137.85(kN/m2)
// => [
//   {
//     depthStart: 0,
//     depthEnd: 5,
//     rsat: 18,
//     waterLevelUsual: 0,
//     waterLevelDesign: 0,
//     sv: 45,
//     svpUsual: 20.474999999999998,
//     svpDesign: 20.474999999999998,
//     depth: 2.5
//   },
//   {
//     depthStart: 5,
//     depthEnd: 10,
//     rsat: 19,
//     waterLevelUsual: 0,
//     waterLevelDesign: 0,
//     sv: 137.5,
//     svpUsual: 63.925,
//     svpDesign: 63.925,
//     depth: 7.5
//   },
//   {
//     depthStart: 10,
//     depthEnd: 20,
//     rsat: 20,
//     waterLevelUsual: 0,
//     waterLevelDesign: 0,
//     sv: 285,
//     svpUsual: 137.85,
//     svpDesign: 137.85,
//     depth: 15
//   }
// ] 137.85

waterLevelUsual = 20
waterLevelDesign = 20
rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        rd: 18, //kN/m3
    },
    {
        depthStart: 5,
        depthEnd: 10,
        rd: 18, //kN/m3
    },
    {
        depthStart: 10,
        depthEnd: 20,
        rd: 18, //kN/m3
    },
]
rowsNew = calcVerticalStress(rows, { waterLevelUsual, waterLevelDesign, unitSvSvp: 'kPa' })
console.log(rowsNew, (18) * 15) //地下 15(m) 處之垂直總應力與垂直有效應力為 270(kN/m2)
// => [
//   {
//     depthStart: 0,
//     depthEnd: 5,
//     rd: 18,
//     waterLevelUsual: 20,
//     waterLevelDesign: 20,
//     sv: 45,
//     svpUsual: 45,
//     svpDesign: 45,
//     depth: 2.5
//   },
//   {
//     depthStart: 5,
//     depthEnd: 10,
//     rd: 18,
//     waterLevelUsual: 20,
//     waterLevelDesign: 20,
//     sv: 135,
//     svpUsual: 135,
//     svpDesign: 135,
//     depth: 7.5
//   },
//   {
//     depthStart: 10,
//     depthEnd: 20,
//     rd: 18,
//     waterLevelUsual: 20,
//     waterLevelDesign: 20,
//     sv: 270,
//     svpUsual: 270,
//     svpDesign: 270,
//     depth: 15
//   }
// ] 270

waterLevelUsual = 3
waterLevelDesign = 3
rows = [
    {
        depthStart: 0,
        depthEnd: 3,
        rd: 18, //kN/m3
    },
    {
        depthStart: 3,
        depthEnd: 11,
        rsat: 20, //kN/m3
    },
]
rowsNew = calcVerticalStress(rows, { waterLevelUsual, waterLevelDesign, unitSvSvp: 'kPa' })
console.log(rowsNew, 18 * 3 + (20 * 4 - 9.81 * 4)) //地下 7(m) 處之垂直有效應力為 94.76(kN/m2)
// => [
//   {
//     depthStart: 0,
//     depthEnd: 3,
//     rd: 18,
//     waterLevelUsual: 3,
//     waterLevelDesign: 3,
//     sv: 27,
//     svpUsual: 27,
//     svpDesign: 27,
//     depth: 1.5
//   },
//   {
//     depthStart: 3,
//     depthEnd: 11,
//     rsat: 20,
//     waterLevelUsual: 3,
//     waterLevelDesign: 3,
//     sv: 134,
//     svpUsual: 94.75999999999999,
//     svpDesign: 94.75999999999999,
//     depth: 7
//   }
// ] 94.75999999999999

waterLevelUsual = 3
waterLevelDesign = 3
rows = [
    {
        depthStart: 0,
        depthEnd: 1,
        rd: 18, //kN/m3
    },
    {
        depthStart: 1,
        depthEnd: 5,
        rd: 18, //kN/m3
        rsat: 20, //kN/m3
    },
    {
        depthStart: 5,
        depthEnd: 9,
        rsat: 20, //kN/m3
    },
]
rowsNew = calcVerticalStress(rows, { waterLevelUsual, waterLevelDesign, unitSvSvp: 'kPa' })
console.log(rowsNew, 18 * 3 + (20 * 4 - 9.81 * 4)) //地下 7(m) 處之垂直有效應力為 94.76(kN/m2)
// => [
//   {
//     depthStart: 0,
//     depthEnd: 1,
//     rd: 18,
//     waterLevelUsual: 3,
//     waterLevelDesign: 3,
//     sv: 9,
//     svpUsual: 9,
//     svpDesign: 9,
//     depth: 0.5
//   },
//   {
//     depthStart: 1,
//     depthEnd: 5,
//     rd: 18,
//     rsat: 20,
//     waterLevelUsual: 3,
//     waterLevelDesign: 3,
//     sv: 56,
//     svpUsual: 56,
//     svpDesign: 56,
//     depth: 3
//   },
//   {
//     depthStart: 5,
//     depthEnd: 9,
//     rsat: 20,
//     waterLevelUsual: 3,
//     waterLevelDesign: 3,
//     sv: 134,
//     svpUsual: 94.75999999999999,
//     svpDesign: 94.75999999999999,
//     depth: 7
//   }
// ] 94.75999999999999

waterLevelUsual = 3
waterLevelDesign = 0
rows = [
    {
        depthStart: 0,
        depthEnd: 1,
        rd: 18, //kN/m3
        rsat: 20, //kN/m3
    },
    {
        depthStart: 1,
        depthEnd: 5,
        rd: 18, //kN/m3
        rsat: 20, //kN/m3
    },
    {
        depthStart: 5,
        depthEnd: 9,
        rsat: 20, //kN/m3
    },
]
rowsNew = calcVerticalStress(rows, { waterLevelUsual, waterLevelDesign, unitSvSvp: 'kPa' })
console.log(rowsNew, 18 * 3 + (20 * 4 - 9.81 * 4), (20 - 9.81) * 7) //地下 7(m) 處之常時垂直有效應力為 94.76(kN/m2), 設計垂直有效應力為 71.33(kN/m2)
// => [
//   {
//     depthStart: 0,
//     depthEnd: 1,
//     rd: 18,
//     rsat: 20,
//     waterLevelUsual: 3,
//     waterLevelDesign: 0,
//     sv: 9,
//     svpUsual: 9,
//     svpDesign: 5.095,
//     depth: 0.5
//   },
//   {
//     depthStart: 1,
//     depthEnd: 5,
//     rd: 18,
//     rsat: 20,
//     waterLevelUsual: 3,
//     waterLevelDesign: 0,
//     sv: 56,
//     svpUsual: 56,
//     svpDesign: 30.57,
//     depth: 3
//   },
//   {
//     depthStart: 5,
//     depthEnd: 9,
//     rsat: 20,
//     waterLevelUsual: 3,
//     waterLevelDesign: 0,
//     sv: 134,
//     svpUsual: 94.75999999999999,
//     svpDesign: 71.33,
//     depth: 7
//   }
// ] 94.75999999999999 71.33
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart,單位m)與結束深度(depthEnd,單位m),位於地下水位以上之樣本需提供乾單位重(rd,單位kN/m3),位於地下水位以下之樣本需提供飽和單位重(rsat,單位kN/m3),若地下水位位於該樣本起訖深度內,則需同時提供乾單位重與飽和單位重

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入中點深度欄位鍵值字串,預設'depth'

keyDepthStart String <optional>
'depthStart'

輸入起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入結束深度欄位鍵值字串,預設'depthEnd'

waterLevelUsual Number <optional>
0

輸入常時地下水位數字,單位m,預設0

waterLevelDesign Number <optional>
0

輸入設計地下水位數字,單位m,預設0

Returns:

回傳計算後數據陣列

Type
Array

(static) checkDepth(rows, optopt) → {Array}

Description:
  • 檢核樣本數據內深度是否有效與連續

    Unit Test: Github

Source:
Example
let rows
let errs

rows = [
    {
        depth: 0,
    },
    {
        depth: 5,
    },
    {
        depth: 10,
    },
]
errs = checkDepth(rows)
console.log(errs)
// => []

rows = [
    {
        depth: 0,
    },
    {
        depth: 10,
    },
]
errs = checkDepth(rows)
console.log(errs)
// => []

rows = [
    {
        depth: '0',
    },
    {
        depth: '5',
    },
]
errs = checkDepth(rows)
console.log(errs)
// => []

rows = [
    {
        depth: '0',
    },
    {
        depth: 'abc',
    },
]
errs = checkDepth(rows)
console.log(errs)
// => [ '第 1 樣本中點深度depth[abc]非有效數字' ]

rows = [
    {
        center_depth: 0,
    },
    {
        center_depth: 5,
    },
]
errs = checkDepth(rows, { keyDepth: 'center_depth' })
console.log(errs)
// => []
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入深度欄位鍵值字串,預設'depth'

Returns:

回傳錯誤訊息陣列

Type
Array

(static) checkDepthStartEnd(rows, optopt) → {Array}

Description:
  • 檢核樣本數據內起訖深度是否有效與連續

    Unit Test: Github

Source:
Example
let rows
let errs

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
    },
    {
        depthStart: 5,
        depthEnd: 10,
    },
    {
        depthStart: 10,
        depthEnd: 20,
    },
]
errs = checkDepthStartEnd(rows)
console.log(errs)
// => []

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
    },
    {
        depthStart: 10,
        depthEnd: 20,
    },
]
errs = checkDepthStartEnd(rows)
console.log(errs)
// => [ '第 1 樣本結束深度depthEnd[5]不等於第 2 個樣本起始深度depthStart[10]' ]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
    },
    {
        depthStart: 10,
        depthEnd: 20,
    },
]
errs = checkDepthStartEnd(rows, { stateConn: 'overlap' })
console.log(errs)
// => []

rows = [
    {
        depthStart: '0',
        depthEnd: '5',
    },
    {
        depthStart: '5',
        depthEnd: '10',
    },
]
errs = checkDepthStartEnd(rows)
console.log(errs)
// => []

rows = [
    {
        depthStart: '0',
        depthEnd: 'abc',
    },
    {
        depthStart: 'abc',
        depthEnd: '10',
    },
]
errs = checkDepthStartEnd(rows)
console.log(errs)
// => [
//     '第 0 樣本起始非有效數字: depthStart[0], depthEnd[abc]',
//     '第 1 樣本起始非有效數字: depthStart[abc], depthEnd[10]'
// ]

rows = [
    {
        top_depth: 0,
        bottom_depth: 5,
    },
    {
        top_depth: 5,
        bottom_depth: 10,
    },
]
errs = checkDepthStartEnd(rows, { keyDepthStart: 'top_depth', keyDepthEnd: 'bottom_depth' })
console.log(errs)
// => []
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepthStart String <optional>
'depthStart'

輸入起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入結束深度欄位鍵值字串,預設'depthEnd'

Returns:

回傳錯誤訊息陣列

Type
Array

(static) complementDepthData(rows, keyDepth, keyValue, keysValueCmp, optopt) → {Array}

Description:
  • 數據急墜段偵測與處理

    Unit Test: Github

Source:
Example
let rows = [
    {
        'depth(m)': 0,
        'qc(MPa)': 0,
        'fs(MPa)': 0,
        'u2(MPa)': 0,
    },
    {
        'depth(m)': 0.1,
        'qc(MPa)': 0.12,
        'fs(MPa)': 0.02,
        'u2(MPa)': 0.05,
    },
]

let keyDepth = 'depth(m)'
let keyValue = 'qc(MPa)'
let keysValueCmp = ['qc(MPa)', 'fs(MPa)', 'u2(MPa)']

let rsFill = complementDepthData(rows, keyDepth, keyValue, keysValueCmp, { cmpMode: 'linear-fill' })

let rsCut = complementDepthData(rows, keyDepth, keyValue, keysValueCmp, { cmpMode: 'cut' })
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含深度(depth,單位m)與任意數值

keyDepth String

輸入深度欄位字串

keyValue String

輸入偵測數值欄位字串

keysValueCmp Array

輸入偵測數值與連帶處理欄位陣列

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
searchLen Number <optional>
0.5

輸入偵測有效深度範圍數字,單位m,預設0.5

beforeSearchMode String <optional>
'no'

輸入偵測急墜段時之往上提取起始點方式字串,可選'all'、'no'、'peak'、'half-closed-value'、'double-closed-value'、'closed-value',預設'no'

afterSearchMode String <optional>
'all'

輸入偵測急墜段時之往下提取結束點方式字串,可選'all'、'no'、'peak'、'half-closed-value'、'double-closed-value'、'closed-value',預設'all'

cmpMode String <optional>
'linear-fill'

輸入偵測急墜段並標註起訖點時之處理方式字串,可選'linear-fill'、'cut',預設'linear-fill'

Returns:

回傳計算後數據陣列

Type
Array

(static) groupByDepthStartEnd(rows, depthStartAndEnds, optopt) → {Array}

Description:
  • 由指定起訖深度陣列,針對各樣本之中點深度群組化,各群儲存所屬的樣本陣列

    Unit Test: Github

Source:
Example
let rows
let ranges
let rs

rows = [
    {
        depth: 0,
    },
    {
        depth: 1,
    },
    {
        depth: 3,
    },
    {
        depth: 10,
    },
]
ranges = [
    {
        depthStart: 0,
        depthEnd: 1,
    },
    {
        depthStart: 1,
        depthEnd: 4,
    },
]
rs = groupByDepthStartEnd(rows, ranges)
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 1,
//     "rows": [
//       {
//         "depth": 0
//       },
//       {
//         "depth": 1
//       }
//     ]
//   },
//   {
//     "depthStart": 1,
//     "depthEnd": 4,
//     "rows": [
//       {
//         "depth": 3
//       }
//     ]
//   }
// ]

rows = [
    {
        depth: 0,
    },
    {
        depth: 1,
    },
    {
        depth: 3,
    },
    {
        depth: 10,
    },
]
ranges = [
    {
        depthStart: 0,
        depthEnd: 3,
    },
    {
        depthStart: 1,
        depthEnd: 5,
    },
]
try {
    rs = groupByDepthStartEnd(rows, ranges)
}
catch (err) {
    rs = err.toString()
}
console.log(rs)
// => Error: 第 1 樣本結束深度depthEnd[3]大於第 2 個樣本起始深度depthStart[1]

rows = [
    {
        depth: 0,
    },
    {
        depth: 1,
    },
    {
        depth: 3,
    },
    {
        depth: 10,
    },
]
ranges = [
    {
        depthStart: 0,
        depthEnd: 2,
    },
    {
        depthStart: 5,
        depthEnd: 10,
    },
]
rs = groupByDepthStartEnd(rows, ranges)
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 2,
//     "rows": [
//       {
//         "depth": 0
//       },
//       {
//         "depth": 1
//       }
//     ]
//   },
//   {
//     "depthStart": 5,
//     "depthEnd": 10,
//     "rows": [
//       {
//         "depth": 10
//       }
//     ]
//   }
// ]

rows = [
    {
        depth: 0,
    },
    {
        depth: 1,
    },
    {
        depth: 3,
    },
    {
        depth: 10,
    },
]
ranges = [
    {
        depthStart: 0,
        depthEnd: 10,
    },
]
rs = groupByDepthStartEnd(rows, ranges)
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 10,
//     "rows": [
//       {
//         "depth": 0
//       },
//       {
//         "depth": 1
//       },
//       {
//         "depth": 3
//       },
//       {
//         "depth": 10
//       }
//     ]
//   }
// ]

rows = [
    {
        dc: 0,
    },
    {
        dc: 1,
    },
    {
        dc: 3,
    },
    {
        dc: 10,
    },
]
ranges = [
    {
        ds: 0,
        de: 1,
    },
    {
        ds: 1,
        de: 4,
    },
]
rs = groupByDepthStartEnd(rows, ranges, { keyDepth: 'dc', keyDepthStart: 'ds', keyDepthEnd: 'de' })
console.log(JSON.stringify(rs, null, 2))
// => [
//   {
//     "ds": 0,
//     "de": 1,
//     "rows": [
//       {
//         "dc": 0
//       },
//       {
//         "dc": 1
//       }
//     ]
//   },
//   {
//     "ds": 1,
//     "de": 4,
//     "rows": [
//       {
//         "dc": 3
//       }
//     ]
//   }
// ]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含深度(depth),深度單位為m

depthStartAndEnds Array | Object

輸入欲提取數據的起訖深度陣列或物件,為物件時需有至少需包含起始深度(depthStart)與結束深度(depthEnd),為陣列時則須由前述物件組成之陣列,深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入中點深度欄位鍵值字串,預設'depth'

keyGroup String <optional>
'group'

輸入群組代號欄位鍵值字串,預設'group'

keyDepthStart String <optional>
'depthStart'

輸入欲儲存之起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入欲儲存之結束深度欄位鍵值字串,預設'depthEnd'

Returns:

回傳群組化後添加起訖深度與所屬原數據的陣列

Type
Array

(static) mergeByDepthStartEnd(rows, optopt) → {Array}

Description:
  • 基於各樣本之起訖深度與指定欄位值進行合併

    Unit Test: Github

Source:
Example
let rows
let rows

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        value: 'a',
        ext: 12.3,
    },
    {
        depthStart: 5,
        depthEnd: 7,
        value: 'b',
        ext: 12.4,
    },
    {
        depthStart: 7,
        depthEnd: 11,
        value: 'b',
        ext: 2.5,
    },
    {
        depthStart: 11,
        depthEnd: 15,
        value: 'a',
        ext: 2.3,
    },
]
rows = mergeByDepthStartEnd(rows)
console.log(JSON.stringify(rows, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 5,
//     "value": "a",
//     "ext": 12.3
//   },
//   {
//     "depthStart": 5,
//     "depthEnd": 11,
//     "value": "b",
//     "ext": 2.5
//   },
//   {
//     "depthStart": 11,
//     "depthEnd": 15,
//     "value": "a",
//     "ext": 2.3
//   }
// ]

rows = [
    {
        ds: 0,
        de: 5,
        value: 'a',
        ext: 12.3,
    },
    {
        ds: 5,
        de: 7,
        value: 'b',
        ext: 12.4,
    },
    {
        ds: 7,
        de: 11,
        value: 'b',
        ext: 2.5,
    },
    {
        ds: 11,
        de: 15,
        value: 'a',
        ext: 2.3,
    },
]
rows = mergeByDepthStartEnd(rows, { keyDepthStart: 'ds', keyDepthEnd: 'de' })
console.log(JSON.stringify(rows, null, 2))
// => [
//   {
//     "ds": 0,
//     "de": 5,
//     "value": "a",
//     "ext": 12.3
//   },
//   {
//     "ds": 5,
//     "de": 11,
//     "value": "b",
//     "ext": 2.5
//   },
//   {
//     "ds": 11,
//     "de": 15,
//     "value": "a",
//     "ext": 2.3
//   }
// ]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        data: 'a',
        ext: 12.3,
    },
    {
        depthStart: 5,
        depthEnd: 7,
        data: 'b',
        ext: 12.4,
    },
    {
        depthStart: 7,
        depthEnd: 11,
        data: 'b',
        ext: 2.5,
    },
    {
        depthStart: 11,
        depthEnd: 15,
        data: 'a',
        ext: 2.3,
    },
]
rows = mergeByDepthStartEnd(rows, { keyValue: 'data' })
console.log(JSON.stringify(rows, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 5,
//     "data": "a",
//     "ext": 12.3
//   },
//   {
//     "depthStart": 5,
//     "depthEnd": 11,
//     "data": "b",
//     "ext": 2.5
//   },
//   {
//     "depthStart": 11,
//     "depthEnd": 15,
//     "data": "a",
//     "ext": 2.3
//   }
// ]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        value: 'a',
        ext: 12.3,
    },
    {
        depthStart: 5,
        depthEnd: 7,
        value: 'b',
        ext: 12.4,
    },
    {
        depthStart: 7,
        depthEnd: 11,
        value: 'b',
        ext: 2.5,
    },
    {
        depthStart: 11,
        depthEnd: 15,
        value: 'b',
        ext: 2.3,
    },
    {
        depthStart: 15,
        depthEnd: 18,
        value: 'a',
        ext: 7.9,
    },
]
rows = mergeByDepthStartEnd(rows, {
    funMerge: (v0, v1) => {
        return {
            // depthStart: null,
            // depthEnd: null,
            value: v1.value,
            ext: v1.ext,
            _v0: v0,
            _v1: v1,
        }
    }
})
console.log(JSON.stringify(rows, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 5,
//     "value": "a",
//     "ext": 12.3
//   },
//   {
//     "value": "b",
//     "ext": 2.3,
//     "_v0": {
//       "value": "b",
//       "ext": 2.5,
//       "_v0": {
//         "depthStart": 5,
//         "depthEnd": 7,
//         "value": "b",
//         "ext": 12.4
//       },
//       "_v1": {
//         "depthStart": 7,
//         "depthEnd": 11,
//         "value": "b",
//         "ext": 2.5
//       },
//       "depthStart": 5,
//       "depthEnd": 11
//     },
//     "_v1": {
//       "depthStart": 11,
//       "depthEnd": 15,
//       "value": "b",
//       "ext": 2.3
//     },
//     "depthStart": 5,
//     "depthEnd": 15
//   },
//   {
//     "depthStart": 15,
//     "depthEnd": 18,
//     "value": "a",
//     "ext": 7.9
//   }
// ]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        value: 'a',
        ext: 12.3,
    },
    {
        depthStart: 5,
        depthEnd: 7,
        value: 'b',
        ext: 12.4,
    },
    {
        depthStart: 7,
        depthEnd: 11,
        value: 'b',
        ext: 2.5,
    },
    {
        depthStart: 11,
        depthEnd: 15,
        value: 'b',
        ext: 2.3,
    },
    {
        depthStart: 15,
        depthEnd: 18,
        value: 'a',
        ext: 7.9,
    },
]
rows = mergeByDepthStartEnd(rows, { typeMerge: 'up' })
console.log(JSON.stringify(rows, null, 2))
// => [
//   {
//     "depthStart": 0,
//     "depthEnd": 5,
//     "value": "a",
//     "ext": 12.3
//   },
//   {
//     "depthStart": 5,
//     "depthEnd": 15,
//     "value": "b",
//     "ext": 12.4
//   },
//   {
//     "depthStart": 15,
//     "depthEnd": 18,
//     "value": "a",
//     "ext": 7.9
//   }
// ]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepthStart String <optional>
'depthStart'

輸入欲儲存之起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入欲儲存之結束深度欄位鍵值字串,預設'depthEnd'

keyValue String <optional>
'value'

輸入指定偵測欄位鍵值字串,預設'value'

saveFromInds Boolean <optional>
false

輸入是否儲存合併來源指標布林值,預設false

keyInd String <optional>
'ind'

輸入標記來源指標欄位字串,預設'ind'

keyFromInds String <optional>
'fromInds'

輸入儲存來源指標欄位字串,預設'fromInds'

typeDetect String <optional>
'fromInds'

輸入偵測合併機制字串,可選'sequence'、'iterate',前者代表一次性偵測合併,後者代表迭代多次偵測合併,預設'sequence'

funMerge function <optional>
null

輸入字定義合併函數,輸入為v0與v1上下兩土層參數物件,回傳合併後參數物件,預設null

typeMerge String <optional>
'down'

輸入合併方向字串,可選'down'、'up',前者代表以下層土層參數為主,後者以上層土層參數為主,預設'down'

Returns:

回傳合併後的數據陣列

Type
Array

(static) relaPlasticityParams(LLopt, PIopt, PLopt) → {Object}

Description:
  • 計算土壤塑性參數:液限LL、塑限PL、塑性指數PI之間互相轉換,至少3給2才能反推全部

    Unit Test: Github

Source:
Example
let LL = 24 //%
let PI = 14 //%
let PL = 10 //%
let r

try {
    r = relaPlasticityParams(LL, null, null)
}
catch (e) {
    r = e.toString()
}
console.log('LL', r)
// => LL { LL: 24, PL: null, PI: null }

try {
    r = relaPlasticityParams(null, PI, null)
    console.log('PI', r)
}
catch (e) {
    r = e.toString()
}
// => PI { LL: null, PL: null, PI: 14 }

try {
    r = relaPlasticityParams(null, null, PL)
}
catch (e) {
    r = e.toString()
}
console.log('PL', r)
// => PL { LL: null, PL: 10, PI: null }

try {
    r = relaPlasticityParams(LL, PI, null)
}
catch (e) {
    r = e.toString()
}
console.log('LL,PI', r)
// => LL,PI { LL: 24, PL: 10, PI: 14 }

try {
    r = relaPlasticityParams(LL, null, PL)
}
catch (e) {
    r = e.toString()
}
console.log('LL,PL', r)
// => LL,PL { LL: 24, PL: 10, PI: 14 }

try {
    r = relaPlasticityParams(null, PI, PL)
}
catch (e) {
    r = e.toString()
}
console.log('PI,PL', r)
// => PI,PL { LL: 24, PL: 10, PI: 14 }

try {
    r = relaPlasticityParams(LL, PI, PL)
}
catch (e) {
    r = e.toString()
}
console.log('LL,PI,PL', r)
// => LL,PI,PL { LL: 24, PL: 10, PI: 14 }

try {
    r = relaPlasticityParams(2, PI, PL)
}
catch (e) {
    r = e.toString()
}
console.log('2,PI,PL', r)
// => 2,PI,PL {
//   LL: 2,
//   PL: 10,
//   PI: 14,
//   err: '液限[2]<=塑限[10], 反算出塑限[-12]<=0, 反算出塑性指數[-8]<=0, 輸入液限[2]與反算出液限[24]差距過大'
// }

try {
    r = relaPlasticityParams(32, PI, PL)
}
catch (e) {
    r = e.toString()
}
console.log('32,PI,PL', r)
// => 32,PI,PL {
//   LL: 32,
//   PL: 10,
//   PI: 14,
//   err: '輸入塑限[10]與反算出塑限[18]差距過大, 輸入塑性指數[14]與反算出塑性指數[22]差距過大, 輸入液限[32]與反算出液限[24]差距過大'
// }
Parameters:
Name Type Attributes Default Description
LL Number <optional>
null

輸入液限數字,單位%,預設null

PI Number <optional>
null

輸入塑性指數數字,單位%,預設null

PL Number <optional>
null

輸入塑限數字,單位%,預設null

Returns:

回傳物件,含鍵值LL、PI、PL

Type
Object

(static) relaPorousParams(rdopt, rsatopt, GSopt, eopt, optopt) → {Object}

Description:
  • 計算岩土孔隙參數:乾單位重rd、飽和單位重rsat、比重GS、孔隙比e之間互相轉換,至少4給2才能反推全部

    Unit Test: Github

Source:
Example
let GS = 2.7
let e = 0.86
let rd = 14.240322580645163 //kN/m3
let rsat = 18.776129032258066 //kN/m3
let r

let coreFuncs = relaPorousParams(null, null, null, null, { returnFuncs: true }).coreFuncs

console.log('rd get_rd_from_GS_e', coreFuncs.get_rd_from_GS_e(GS, e))
// => rd get_rd_from_GS_e 14.240322580645163

console.log('rd get_rd_from_rsat_e', coreFuncs.get_rd_from_rsat_e(rsat, e))
// => rd get_rd_from_rsat_e 14.240322580645163

console.log('rd get_rd_from_rsat_GS', coreFuncs.get_rd_from_rsat_GS(rsat, GS))
// => rd get_rd_from_rsat_GS 14.240322580645161

console.log('rsat get_rsat_from_GS_e', coreFuncs.get_rsat_from_GS_e(GS, e))
// => rsat get_rsat_from_GS_e 18.776129032258066

console.log('rsat get_rsat_from_rd_e', coreFuncs.get_rsat_from_rd_e(rd, e))
// => rsat get_rsat_from_rd_e 18.776129032258066

console.log('rsat get_rsat_from_rd_GS', coreFuncs.get_rsat_from_rd_GS(rd, GS))
// => rsat get_rsat_from_rd_GS 18.77612903225807

console.log('e get_e_from_GS_rd', coreFuncs.get_e_from_GS_rd(GS, rd))
// => e get_e_from_GS_rd 0.8599999999999999

console.log('e get_e_from_rd_rsat', coreFuncs.get_e_from_rd_rsat(rd, rsat))
// => e get_e_from_rd_rsat 0.8599999999999998

console.log('e get_e_from_GS_rsat', coreFuncs.get_e_from_GS_rsat(GS, rsat))
// => e get_e_from_GS_rsat 0.86

console.log('GS get_GS_from_rd_e', coreFuncs.get_GS_from_rd_e(rd, e))
// => GS get_GS_from_rd_e 2.7

console.log('GS get_GS_from_rd_rsat', coreFuncs.get_GS_from_rd_rsat(rd, rsat))
// => GS get_GS_from_rd_rsat 2.6999999999999997

console.log('GS get_GS_from_rsat_e', coreFuncs.get_GS_from_rsat_e(rsat, e))
// => GS get_GS_from_rsat_e 2.7

r = relaPorousParams(rd, rsat, null, null)
console.log('rd,rsat', r)
// => rd,rsat {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.8599999999999998
// }

r = relaPorousParams(rd, null, GS, null)
console.log('rd,GS', r)
// => rd,GS {
//     rd: 14.240322580645163,
//     rsat: 18.77612903225807,
//     GS: 2.7,
//     e: 0.8599999999999999
// }

r = relaPorousParams(rd, null, null, e)
console.log('rd,e', r)
// => rd,e {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.86
// }

r = relaPorousParams(null, rsat, GS, null)
console.log('rsat,GS', r)
// => rsat,GS {
//     rd: 14.240322580645161,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.8600000000000001
// }

r = relaPorousParams(null, rsat, null, e)
console.log('rsat,e', r)
// => rsat,e {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.86
// }

r = relaPorousParams(null, null, GS, e)
console.log('GS,e', r)
// => GS,e {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.86
// }

r = relaPorousParams(rd, rsat, GS, null)
console.log('rd,rsat,GS', r)
// => rd,rsat,GS {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.8599999999999999
// }

r = relaPorousParams(rd, rsat, null, e)
console.log('rd,rsat,e', r)
// => rd,rsat,e {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.86
// }

r = relaPorousParams(rd, null, GS, e)
console.log('rd,GS,e', r)
// => rd,GS,e {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.86
// }

r = relaPorousParams(null, rsat, GS, e)
console.log('rsat,GS,e', r)
// => rsat,GS,e {
//     rd: 14.240322580645163,
//     rsat: 18.776129032258066,
//     GS: 2.7,
//     e: 0.86
// }

try {
    r = relaPorousParams(13.9, null, GS, e)
}
catch (e) {
    r = e.toString()
}
console.log('GS,e', r)
// => GS,e {
//   rd: 13.9,
//   rsat: 18.776129032258066,
//   GS: 2.7,
//   e: 0.86,
//   err: '輸入孔隙比[0.86]與反算出孔隙比[0.9055395683453238]差距過大'
// }
Parameters:
Name Type Attributes Default Description
rd Number <optional>
null

輸入乾單位重數字,單位kN/m3,預設null

rsat Number <optional>
null

輸入飽和單位重數字,單位kN/m3,預設null

GS Number <optional>
null

輸入比重數字,無單位,預設null

e Number <optional>
null

輸入孔隙比數字,無單位,預設null

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
returnFuncs Boolean <optional>
false

輸入是否回傳函數布林值,預設false

Returns:

回傳物件,含鍵值rd、rsat、GS、e

Type
Object

(static) sepDepthStartEndByDepth(rows, optopt) → {Array}

Description:
  • 通過指定樣本(例如中點)深度對各樣本起訖深度進行分切

    Unit Test: Github

Source:
Example
let rows
let points
let r

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        data: 'abc',
    },
    {
        depthStart: 5,
        depthEnd: 10,
        data: 'def',
    },
]
points = [{ depth: 2.5 }]
r = sepDepthStartEndByDepth(rows, points)
console.log(r)
// => [
//  { depthStart: 0, depthEnd: 2.5, data: 'abc' },
//  { depthStart: 2.5, depthEnd: 5, data: 'abc' },
//  { depthStart: 5, depthEnd: 10, data: 'def' }
//]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        data: 'abc',
    },
    {
        depthStart: 5,
        depthEnd: 10,
        data: 'def',
    },
]
points = [{ depth: 0 }]
r = sepDepthStartEndByDepth(rows, points)
console.log(r)
// => [
//  { depthStart: 0, depthEnd: 5, data: 'abc' },
//  { depthStart: 5, depthEnd: 10, data: 'def' }
//]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        data: 'abc',
    },
    {
        depthStart: 5,
        depthEnd: 10,
        data: 'def',
    },
]
points = [{ depth: 5 }]
r = sepDepthStartEndByDepth(rows, points)
console.log(r)
// => [
//  { depthStart: 0, depthEnd: 5, data: 'abc' },
//  { depthStart: 5, depthEnd: 10, data: 'def' }
//]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        data: 'abc',
    },
    {
        depthStart: 5,
        depthEnd: 10,
        data: 'def',
    },
]
points = [{ depth: -1 }]
r = sepDepthStartEndByDepth(rows, points)
console.log(r)
// => [
//  { depthStart: 0, depthEnd: 5, data: 'abc' },
//  { depthStart: 5, depthEnd: 10, data: 'def' }
//]

rows = [
    {
        depthStart: 0,
        depthEnd: 5,
        data: 'abc',
    },
    {
        depthStart: 5,
        depthEnd: 10,
        data: 'def',
    },
]
points = [{ depth: 11 }]
r = sepDepthStartEndByDepth(rows, points)
console.log(r)
// => [
//  { depthStart: 0, depthEnd: 5, data: 'abc' },
//  { depthStart: 5, depthEnd: 10, data: 'def' }
//]

rows = [
    {
        top_depth: 0,
        bottom_depth: 5,
        data: 'abc',
    },
    {
        top_depth: 5,
        bottom_depth: 10,
        data: 'def',
    },
]
points = [{ center_depth: 5.5 }]
r = sepDepthStartEndByDepth(rows, points, { keyDepthStart: 'top_depth', keyDepthEnd: 'bottom_depth', keyDepth: 'center_depth' })
console.log(r)
// => [
//  { top_depth: 0, bottom_depth: 5, data: 'abc' },
//  { top_depth: 5, bottom_depth: 5.5, data: 'def' },
//  { top_depth: 5.5, bottom_depth: 10, data: 'def' }
//]
Parameters:
Name Type Attributes Default Description
rows Array

輸入數據陣列,各數據為物件,至少需包含起始深度(depthStart)與結束深度(depthEnd),深度單位為m

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入中點深度欄位鍵值字串,預設'depth'

keyDepthStart String <optional>
'depthStart'

輸入欲儲存之起始深度欄位鍵值字串,預設'depthStart'

keyDepthEnd String <optional>
'depthEnd'

輸入欲儲存之結束深度欄位鍵值字串,預設'depthEnd'

Returns:

回傳添加起訖深度的數據陣列

Type
Array

(static) smoothDepthByKey(rows, key, optopt) → {Array}

Description:
  • 平滑化含深度與指定欄位之樣本陣列

    Unit Test: Github

Source:
Example
待補充
Parameters:
Name Type Attributes Default Description
rows Array

輸入物件陣列

key String

輸入欲平滑之欄位鍵名稱字串

opt Object <optional>
{}

輸入設定物件,預設{}

Properties
Name Type Attributes Default Description
keyDepth String <optional>
'depth'

輸入深度欄位鍵名稱字串,預設'depth'

methodSmooth String <optional>
'average'

輸入平滑化方法字串,可選'average'、'averageIn95'、'maxCount',預設'average'

ranger Object <optional>
{}

輸入提取窗形方式之設定物件,預設{}

Properties
Name Type Attributes Default Description
countHalf Intger <optional>
5

輸入提取上下點數整數,例如給予5代表上下取5點加自己共11點,預設5

depthHalf Number <optional>
0.25

輸入提取上下距離數字,單位m,例如給予0.25代表上下取0.25m共0.5m,預設0.25

Returns:

回傳平滑化後陣列

Type
Array

(static) sptHBF(row) → {Object}

Description:
  • HBF液化分析

Source:
Example
待補充
Parameters:
Name Type Description
row Object

輸入數據物件

Properties
Name Type Attributes Default Description
ver String <optional>
'2012'

輸入版本字串,預設'2012'

noLiqueMode String <optional>
'new'

輸入判斷非液化之土壤分類模式字串,預設'new'

waterLevelDesign Number <optional>
0

輸入設計地下水位數字,單位m,預設0

soilClassification String <optional>
'SW'

輸入USCS土壤分類字串,預設'SW'

depth Number <optional>

輸入樣本所在中點深度數字,單位m

N60 Number <optional>

輸入樣本N60數字

FC Number <optional>

輸入樣本細粒料含量數字,單位%

PI Number

輸入塑性指數數字,單位%

sv Number <optional>

輸入樣本中點深度之垂直總應力數字,單位(kN/m2)

svpUsual Number <optional>

輸入樣本中點深度之常時垂直有效應力數字,單位(kN/m2)

svpDesign Number <optional>

輸入樣本中點深度之設計垂直有效應力數字,係考慮waterLevelDesign計算而得,單位(kN/m2)

PGA Number <optional>

輸入設計地表最大水平加速度數字,單位(g)

Mw Number <optional>

輸入設計地震矩規模數字

Returns:

回傳計算後數據物件

Type
Object

(static) sptNCEER(row) → {Object}

Description:
  • NCEER液化分析

Source:
Example
待補充
Parameters:
Name Type Description
row Object

輸入數據物件

Properties
Name Type Attributes Default Description
noLiqueMode String <optional>
'new'

輸入判斷非液化之土壤分類模式字串,預設'new'

waterLevelDesign Number <optional>
0

輸入設計地下水位數字,單位m,預設0

soilClassification String <optional>
'SW'

輸入USCS土壤分類字串,預設'SW'

depth Number <optional>

輸入樣本所在中點深度數字,單位m

N60 Number <optional>

輸入樣本N60數字

FC Number <optional>

輸入樣本細粒料含量數字,單位%

PI Number

輸入塑性指數數字,單位%

sv Number <optional>

輸入樣本中點深度之垂直總應力數字,單位(kN/m2)

svpUsual Number <optional>

輸入樣本中點深度之常時垂直有效應力數字,單位(kN/m2)

svpDesign Number <optional>

輸入樣本中點深度之設計垂直有效應力數字,係考慮waterLevelDesign計算而得,單位(kN/m2)

PGA Number <optional>

輸入設計地表最大水平加速度數字,單位(g)

Mw Number <optional>

輸入設計地震矩規模數字

Returns:

回傳計算後數據物件

Type
Object

(static) sptNJRA(row) → {Object}

Description:
  • JRA液化分析

Source:
Example
待補充
Parameters:
Name Type Description
row Object

輸入數據物件

Properties
Name Type Attributes Default Description
ver String <optional>
'1996'

輸入版本字串,預設'1996'

noLiqueMode String <optional>
'new'

輸入判斷非液化之土壤分類模式字串,預設'new'

waterLevelDesign Number <optional>
0

輸入設計地下水位數字,單位m,預設0

soilClassification String <optional>
'SW'

輸入USCS土壤分類字串,預設'SW'

vibrationType Number <optional>
1

輸入震動形式數字,1為第一型震動[板塊邊界地震(遠震)],2為第二型震動[內陸直下型地震(近震)],預設1

depth Number <optional>

輸入樣本所在中點深度數字,單位m

N60 Number <optional>

輸入樣本N60數字

FC Number <optional>

輸入樣本細粒料含量數字,單位%

PI Number

輸入塑性指數數字,單位%

D50 Number

輸入累計50%通過粒徑數字,單位mm

D10 Number

輸入累計10%通過粒徑數字,單位mm

sv Number <optional>

輸入樣本中點深度之垂直總應力數字,單位(kN/m2)

svpUsual Number <optional>

輸入樣本中點深度之常時垂直有效應力數字,單位(kN/m2)

svpDesign Number <optional>

輸入樣本中點深度之設計垂直有效應力數字,係考慮waterLevelDesign計算而得,單位(kN/m2)

PGA Number <optional>

輸入設計地表最大水平加速度數字,單位(g)

Returns:

回傳計算後數據物件

Type
Object

(static) sptSeed(row) → {Object}

Description:
  • Seed液化分析

Source:
Example
待補充
Parameters:
Name Type Description
row Object

輸入數據物件

Properties
Name Type Attributes Default Description
noLiqueMode String <optional>
'new'

輸入判斷非液化之土壤分類模式字串,預設'new'

waterLevelDesign Number <optional>
0

輸入設計地下水位數字,單位m,預設0

soilClassification String <optional>
'SW'

輸入USCS土壤分類字串,預設'SW'

depth Number <optional>

輸入樣本所在中點深度數字,單位m

N60 Number <optional>

輸入樣本N60數字

FC Number <optional>

輸入樣本細粒料含量數字,單位%

sv Number <optional>

輸入樣本中點深度之垂直總應力數字,單位(kN/m2)

svpUsual Number <optional>

輸入樣本中點深度之常時垂直有效應力數字,單位(kN/m2)

svpDesign Number <optional>

輸入樣本中點深度之設計垂直有效應力數字,係考慮waterLevelDesign計算而得,單位(kN/m2)

PGA Number <optional>

輸入設計地表最大水平加速度數字,單位(g)

Mw Number <optional>

輸入設計地震矩規模數字

Returns:

回傳計算後數據物件

Type
Object

(static) sptTY(row) → {Object}

Description:
  • TY液化分析

Source:
Example
待補充
Parameters:
Name Type Description
row Object

輸入數據物件

Properties
Name Type Attributes Default Description
ver String <optional>
'1996'

輸入版本字串,預設'1996'

noLiqueMode String <optional>
'new'

輸入判斷非液化之土壤分類模式字串,預設'new'

waterLevelDesign Number <optional>
0

輸入設計地下水位數字,單位m,預設0

soilClassification String <optional>
'SW'

輸入USCS土壤分類字串,預設'SW'

vibrationType Number <optional>
1

輸入震動形式數字,1為第一型震動[板塊邊界地震(遠震)],2為第二型震動[內陸直下型地震(近震)],預設1

depth Number <optional>

輸入樣本所在中點深度數字,單位m

a Number <optional>
0.45

輸入分析設定參數a數字,預設0.45

n Number <optional>
0.45

輸入分析設定參數n數字,預設14

Cr Number <optional>
0.57

輸入分析設定參數Cr數字,預設0.57

Cs Number <optional>
85

輸入分析設定參數Cs數字,預設85

N60 Number <optional>

輸入樣本N60數字

FC Number <optional>

輸入樣本細粒料含量數字,單位%

sv Number <optional>

輸入樣本中點深度之垂直總應力數字,單位(kN/m2)

svpUsual Number <optional>

輸入樣本中點深度之常時垂直有效應力數字,單位(kN/m2)

svpDesign Number <optional>

輸入樣本中點深度之設計垂直有效應力數字,係考慮waterLevelDesign計算而得,單位(kN/m2)

PGA Number <optional>

輸入設計地表最大水平加速度數字,單位(g)

Mw Number <optional>

輸入設計地震矩規模數字

Returns:

回傳計算後數據物件

Type
Object