Source: functions_bs7671.js

  1. "use strict";
  2. /**
  3. * Returns the recommend CSA (mm2) of a multi core cable installed in air in accordance with BS 7671.
  4. * @param {number} cableId cableId for which to look up the CSA.
  5. * @param {number} Ib Ib design current of the circuit, A.
  6. * @param {number} pf pf power factor (= 1 for d.c. circuits).
  7. * @param {number} In In rated current setting of a protective device, A.
  8. * @param {number} phase phase configuration:see =phases().
  9. * @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
  10. * @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
  11. * @param {number} noCircuits noCircuits number of independent cable circuits running together.
  12. * @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
  13. * @param {number} airTemperature airTemperature ambient temperature of the air, °C.
  14. * @param {boolean} header header optional parameter, will display header row if set to true
  15. * @return CSA (mm2), Capacity (A), CableDetailID
  16. * @customfunction
  17. */
  18. function bs7671AirMultiCoreCSA(cableId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
  19. var json = httpGetCall("library/cables/" + cableId + "/details/mm");
  20. var cableDetails = JSON.parse(json);
  21. var cableDetailId = cableDetails[0].CableDetailID; // get the first cableDetail to try with capacity routine
  22. var flags_bs7671 = "000000";
  23. json = httpGetCall("bs7671/air/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
  24. secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
  25. var data = JSON.parse(json);
  26. var result = dataItemArray([data.Suggested],enDataType.cableCapacity,header);
  27. return result;
  28. }
  29. /**
  30. * Returns the sustained capacity (A) of a multi core cable installed in air in accordance with BS 7671.
  31. * @param {number} cableDetailId cableDetailId for which to look up the CSA.
  32. * @param {number} Ib Ib design current of the circuit, A.
  33. * @param {number} pf pf power factor (= 1 for d.c. circuits).
  34. * @param {number} In In rated current setting of a protective device, A.
  35. * @param {number} phase phase configuration:see =phases().
  36. * @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
  37. * @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
  38. * @param {number} noCircuits noCircuits number of independent cable circuits running together.
  39. * @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
  40. * @param {number} airTemperature airTemperature ambient temperature of the air, °C.
  41. * @param {boolean} header header optional parameter, will display header row if set to true
  42. * @return CSA (mm2), Capacity (A), CableDetailID
  43. * @customfunction
  44. */
  45. function bs7671AirMultiCoreCapacity(cableDetailId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
  46. var flags_bs7671 = "000000";
  47. json = httpGetCall("bs7671/air/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
  48. secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
  49. var data = JSON.parse(json);
  50. var result = dataItemArray([data.Actual],enDataType.cableCapacity,header);
  51. return result;
  52. }
  53. /**
  54. * Returns the recommend CSA (mm2) of a single core cable installed in air in accordance with BS 7671.
  55. * @param {number} cableId cableId for which to look up the CSA.
  56. * @param {number} Ib Ib design current of the circuit, A.
  57. * @param {number} pf pf power factor (= 1 for d.c. circuits).
  58. * @param {number} In In rated current setting of a protective device, A.
  59. * @param {number} phase phase configuration:see =phases().
  60. * @param {number} configurationID configurationID: see configurations().
  61. * @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
  62. * @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
  63. * @param {number} noCircuits noCircuits number of independent cable circuits running together.
  64. * @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
  65. * @param {number} airTemperature airTemperature ambient temperature of the air, °C.
  66. * @param {boolean} header header optional parameter, will display header row if set to true
  67. * @return CSA (mm2), Capacity (A), CableDetailID
  68. * @customfunction
  69. */
  70. function bs7671AirSingleCoreCSA(cableId, Ib, pf, In, phase, configurationID, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
  71. var json = httpGetCall("library/cables/" + cableId + "/details/mm");
  72. var cableDetails = JSON.parse(json);
  73. var cableDetailId = cableDetails[0].CableDetailID; // get the first cableDetail to try with capacity routine
  74. var flags_bs7671 = "000000";
  75. json = httpGetCall("bs7671/air/singlecore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" + configurationID + "/" +
  76. secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
  77. var data = JSON.parse(json);
  78. var result = dataItemArray([data.Suggested],enDataType.cableCapacity,header);
  79. return result;
  80. }
  81. /**
  82. * Returns the sustained current capacity of a single core cable installed in air in accordance with BS 7671.
  83. * @param {number} cableDetailId cableDetailId for which to look up the sustained capacity.
  84. * @param {number} Ib Ib design current of the circuit, A.
  85. * @param {number} pf pf power factor (= 1 for d.c. circuits).
  86. * @param {number} In In rated current setting of a protective device, A.
  87. * @param {number} phase phase configuration:see =phases().
  88. * @param {number} configurationID configurationID: see configurations().
  89. * @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
  90. * @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
  91. * @param {number} noCircuits noCircuits number of independent cable circuits running together.
  92. * @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
  93. * @param {number} airTemperature airTemperature ambient temperature of the air, °C.
  94. * @return CSA (mm2), Capacity, CableDetailID
  95. * @customfunction
  96. */
  97. function bs7671AirSingleCoreCapacity(cableDetailId, Ib, pf, In, phase, configurationID, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
  98. var flags_bs7671 = "000000";
  99. json = httpGetCall("bs7671/air/singlecore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" + configurationID + "/" +
  100. secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
  101. var data = JSON.parse(json);
  102. var result = dataItemArray([data.Actual],enDataType.cableCapacity,header);
  103. return result;
  104. }
  105. /**
  106. * Returns the recommend CSA (mm2) of a multi core cable installed in ground in accordance with BS 7671.
  107. * @param {number} cableId cableId for which to look up the CSA.
  108. * @param {number} Ib Ib design current of the circuit, A.
  109. * @param {number} pf pf power factor (= 1 for d.c. circuits).
  110. * @param {number} In In rated current setting of a protective device, A.
  111. * @param {number} phase phase configuration:see =phases().
  112. * @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
  113. * @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
  114. * @param {number} noCircuits noCircuits number of independent cable circuits running together.
  115. * @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
  116. * @param {number} groundTemperature groundTemperature ambient temperature of the soil, °C.
  117. * @param {number} depth depth buried cable depth, M
  118. * @param {number} soilThermalResistivity soilThermalResistivity soil thermal resistivity of ground (cable are buried in), K.m/W
  119. * @param {boolean} header header optional parameter, will display header row if set to true
  120. * @return CSA (mm2), Capacity (A), CableDetailID
  121. * @customfunction
  122. */
  123. function bs7671BuriedMultiCoreCSA(cableId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, groundTemperature, depth, soilThermalResistivity, header) {
  124. var json = httpGetCall("library/cables/" + cableId + "/details/mm");
  125. var cableDetails = JSON.parse(json);
  126. var cableDetailId = cableDetails[0].CableDetailID; // get the first cableDetail to try with capacity routine
  127. var flags_bs7671 = "000000";
  128. json = httpGetCall("bs7671/buried/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
  129. secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" +
  130. groundTemperature + "/" + depth + "/" + soilThermalResistivity + "/" + flags_bs7671);
  131. var data = JSON.parse(json);
  132. var result = dataItemArray([data.Suggested],enDataType.cableCapacity,header);
  133. return result;
  134. }
  135. /**
  136. * Returns the capacity (A) of a multi core cable installed in ground in accordance with BS 7671.
  137. * @param {number} cableDetailId cableDetailId for which to look up the CSA.
  138. * @param {number} Ib Ib design current of the circuit, A.
  139. * @param {number} pf pf power factor (= 1 for d.c. circuits).
  140. * @param {number} In In rated current setting of a protective device, A.
  141. * @param {number} phase phase configuration:see =phases().
  142. * @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
  143. * @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
  144. * @param {number} noCircuits noCircuits number of independent cable circuits running together.
  145. * @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
  146. * @param {number} groundTemperature groundTemperature ambient temperature of the soil, °C.
  147. * @param {number} depth depth buried cable depth, M
  148. * @param {number} soilThermalResistivity soilThermalResistivity soil thermal resistivity of ground (cable are buried in), K.m/W
  149. * @param {boolean} header header optional parameter, will display header row if set to true
  150. * @return CSA (mm2), Capacity (A), CableDetailID
  151. * @customfunction
  152. */
  153. function bs7671BuriedMultiCoreCapacity(cableDetailId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, groundTemperature, depth, soilThermalResistivity, header) {
  154. var flags_bs7671 = "000000";
  155. json = httpGetCall("bs7671/buried/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
  156. secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" +
  157. groundTemperature + "/" + depth + "/" + soilThermalResistivity + "/" + flags_bs7671);
  158. var data = JSON.parse(json);
  159. var result = dataItemArray([data.Actual],enDataType.cableCapacity,header);
  160. return result;
  161. }
  162. /**
  163. * Returns a list of BS 7671 primary installation methods for a given a cable id and phase.
  164. * ID, Description, ReferenceMethod, Buried.
  165. * @param {number} cableId cableId for which to look up the installation methods.
  166. * @param {number} phase Phase configuration:see =phases().
  167. * @param {boolean} header header optional parameter, will display header row if set to true
  168. * @return ID, Description, ReferenceMethod, Buried
  169. * @customfunction
  170. */
  171. function bs7671PrimaryMethods(cableId, phase, header) {
  172. var json = httpGetCall("bs7671/primary/" + cableId + "/" + phase);
  173. var data = JSON.parse(json);
  174. var result = dataItemArray(data,enDataType.bs7671Primary,header);
  175. return result;
  176. }
  177. /**
  178. * Returns a list of BS 7671 secondary installation methods for a given a cable id, primaryID and phase.
  179. * ID, Description, ReferenceMethod, Buried, ScConfig (allowable single core configurations).
  180. * @param {number} cableId cableId for which to look up the installation methods.
  181. * @param {number} primaryID primaryID for which to look up the installation methods.
  182. * @param {number} phase Phase configuration:see =phases().
  183. * @param {boolean} header header optional parameter, will display header row if set to true
  184. * @return ID,primaryID, Description, ScConfig
  185. * @customfunction
  186. */
  187. function bs7671SecondaryMethods(cableId, primaryID, phase, header) {
  188. var json = httpGetCall("bs7671/secondary/" + cableId + "/" + primaryID + "/" + phase);
  189. var data = JSON.parse(json);
  190. var result = dataItemArray(data,enDataType.bs7671Secondary,header);
  191. return result;
  192. }