"use strict";
/**
* Returns the recommend CSA (mm2) of a multi core cable installed in air in accordance with BS 7671.
* @param {number} cableId cableId for which to look up the CSA.
* @param {number} Ib Ib design current of the circuit, A.
* @param {number} pf pf power factor (= 1 for d.c. circuits).
* @param {number} In In rated current setting of a protective device, A.
* @param {number} phase phase configuration:see =phases().
* @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
* @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
* @param {number} noCircuits noCircuits number of independent cable circuits running together.
* @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
* @param {number} airTemperature airTemperature ambient temperature of the air, °C.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return CSA (mm2), Capacity (A), CableDetailID
* @customfunction
*/
function bs7671AirMultiCoreCSA(cableId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
var json = httpGetCall("library/cables/" + cableId + "/details/mm");
var cableDetails = JSON.parse(json);
var cableDetailId = cableDetails[0].CableDetailID; // get the first cableDetail to try with capacity routine
var flags_bs7671 = "000000";
json = httpGetCall("bs7671/air/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
var data = JSON.parse(json);
var result = dataItemArray([data.Suggested],enDataType.cableCapacity,header);
return result;
}
/**
* Returns the sustained capacity (A) of a multi core cable installed in air in accordance with BS 7671.
* @param {number} cableDetailId cableDetailId for which to look up the CSA.
* @param {number} Ib Ib design current of the circuit, A.
* @param {number} pf pf power factor (= 1 for d.c. circuits).
* @param {number} In In rated current setting of a protective device, A.
* @param {number} phase phase configuration:see =phases().
* @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
* @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
* @param {number} noCircuits noCircuits number of independent cable circuits running together.
* @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
* @param {number} airTemperature airTemperature ambient temperature of the air, °C.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return CSA (mm2), Capacity (A), CableDetailID
* @customfunction
*/
function bs7671AirMultiCoreCapacity(cableDetailId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
var flags_bs7671 = "000000";
json = httpGetCall("bs7671/air/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
var data = JSON.parse(json);
var result = dataItemArray([data.Actual],enDataType.cableCapacity,header);
return result;
}
/**
* Returns the recommend CSA (mm2) of a single core cable installed in air in accordance with BS 7671.
* @param {number} cableId cableId for which to look up the CSA.
* @param {number} Ib Ib design current of the circuit, A.
* @param {number} pf pf power factor (= 1 for d.c. circuits).
* @param {number} In In rated current setting of a protective device, A.
* @param {number} phase phase configuration:see =phases().
* @param {number} configurationID configurationID: see configurations().
* @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
* @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
* @param {number} noCircuits noCircuits number of independent cable circuits running together.
* @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
* @param {number} airTemperature airTemperature ambient temperature of the air, °C.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return CSA (mm2), Capacity (A), CableDetailID
* @customfunction
*/
function bs7671AirSingleCoreCSA(cableId, Ib, pf, In, phase, configurationID, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
var json = httpGetCall("library/cables/" + cableId + "/details/mm");
var cableDetails = JSON.parse(json);
var cableDetailId = cableDetails[0].CableDetailID; // get the first cableDetail to try with capacity routine
var flags_bs7671 = "000000";
json = httpGetCall("bs7671/air/singlecore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" + configurationID + "/" +
secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
var data = JSON.parse(json);
var result = dataItemArray([data.Suggested],enDataType.cableCapacity,header);
return result;
}
/**
* Returns the sustained current capacity of a single core cable installed in air in accordance with BS 7671.
* @param {number} cableDetailId cableDetailId for which to look up the sustained capacity.
* @param {number} Ib Ib design current of the circuit, A.
* @param {number} pf pf power factor (= 1 for d.c. circuits).
* @param {number} In In rated current setting of a protective device, A.
* @param {number} phase phase configuration:see =phases().
* @param {number} configurationID configurationID: see configurations().
* @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
* @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
* @param {number} noCircuits noCircuits number of independent cable circuits running together.
* @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
* @param {number} airTemperature airTemperature ambient temperature of the air, °C.
* @return CSA (mm2), Capacity, CableDetailID
* @customfunction
*/
function bs7671AirSingleCoreCapacity(cableDetailId, Ib, pf, In, phase, configurationID, secondaryMethodID, inParallel, noCircuits, circuitSpacing, airTemperature, header) {
var flags_bs7671 = "000000";
json = httpGetCall("bs7671/air/singlecore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" + configurationID + "/" +
secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" + airTemperature + "/" + flags_bs7671);
var data = JSON.parse(json);
var result = dataItemArray([data.Actual],enDataType.cableCapacity,header);
return result;
}
/**
* Returns the recommend CSA (mm2) of a multi core cable installed in ground in accordance with BS 7671.
* @param {number} cableId cableId for which to look up the CSA.
* @param {number} Ib Ib design current of the circuit, A.
* @param {number} pf pf power factor (= 1 for d.c. circuits).
* @param {number} In In rated current setting of a protective device, A.
* @param {number} phase phase configuration:see =phases().
* @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
* @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
* @param {number} noCircuits noCircuits number of independent cable circuits running together.
* @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
* @param {number} groundTemperature groundTemperature ambient temperature of the soil, °C.
* @param {number} depth depth buried cable depth, M
* @param {number} soilThermalResistivity soilThermalResistivity soil thermal resistivity of ground (cable are buried in), K.m/W
* @param {boolean} header header optional parameter, will display header row if set to true
* @return CSA (mm2), Capacity (A), CableDetailID
* @customfunction
*/
function bs7671BuriedMultiCoreCSA(cableId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, groundTemperature, depth, soilThermalResistivity, header) {
var json = httpGetCall("library/cables/" + cableId + "/details/mm");
var cableDetails = JSON.parse(json);
var cableDetailId = cableDetails[0].CableDetailID; // get the first cableDetail to try with capacity routine
var flags_bs7671 = "000000";
json = httpGetCall("bs7671/buried/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" +
groundTemperature + "/" + depth + "/" + soilThermalResistivity + "/" + flags_bs7671);
var data = JSON.parse(json);
var result = dataItemArray([data.Suggested],enDataType.cableCapacity,header);
return result;
}
/**
* Returns the capacity (A) of a multi core cable installed in ground in accordance with BS 7671.
* @param {number} cableDetailId cableDetailId for which to look up the CSA.
* @param {number} Ib Ib design current of the circuit, A.
* @param {number} pf pf power factor (= 1 for d.c. circuits).
* @param {number} In In rated current setting of a protective device, A.
* @param {number} phase phase configuration:see =phases().
* @param {number} secondaryMethodID secondaryMethodID secondary installation method ID.
* @param {number} inParallel inParallel number of cables in parallel supplying a single circuit.
* @param {number} noCircuits noCircuits number of independent cable circuits running together.
* @param {number} circuitSpacing circuitSpacing spacing between independent cable circuits (see noCircuits), m.
* @param {number} groundTemperature groundTemperature ambient temperature of the soil, °C.
* @param {number} depth depth buried cable depth, M
* @param {number} soilThermalResistivity soilThermalResistivity soil thermal resistivity of ground (cable are buried in), K.m/W
* @param {boolean} header header optional parameter, will display header row if set to true
* @return CSA (mm2), Capacity (A), CableDetailID
* @customfunction
*/
function bs7671BuriedMultiCoreCapacity(cableDetailId, Ib, pf, In, phase, secondaryMethodID, inParallel, noCircuits, circuitSpacing, groundTemperature, depth, soilThermalResistivity, header) {
var flags_bs7671 = "000000";
json = httpGetCall("bs7671/buried/multicore/" + cableDetailId + "/" + Ib + "/" + pf + "/" + In + "/" + phase + "/" +
secondaryMethodID +"/" + inParallel + "/" + noCircuits + "/" + circuitSpacing + "/" +
groundTemperature + "/" + depth + "/" + soilThermalResistivity + "/" + flags_bs7671);
var data = JSON.parse(json);
var result = dataItemArray([data.Actual],enDataType.cableCapacity,header);
return result;
}
/**
* Returns a list of BS 7671 primary installation methods for a given a cable id and phase.
* ID, Description, ReferenceMethod, Buried.
* @param {number} cableId cableId for which to look up the installation methods.
* @param {number} phase Phase configuration:see =phases().
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, Description, ReferenceMethod, Buried
* @customfunction
*/
function bs7671PrimaryMethods(cableId, phase, header) {
var json = httpGetCall("bs7671/primary/" + cableId + "/" + phase);
var data = JSON.parse(json);
var result = dataItemArray(data,enDataType.bs7671Primary,header);
return result;
}
/**
* Returns a list of BS 7671 secondary installation methods for a given a cable id, primaryID and phase.
* ID, Description, ReferenceMethod, Buried, ScConfig (allowable single core configurations).
* @param {number} cableId cableId for which to look up the installation methods.
* @param {number} primaryID primaryID for which to look up the installation methods.
* @param {number} phase Phase configuration:see =phases().
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID,primaryID, Description, ScConfig
* @customfunction
*/
function bs7671SecondaryMethods(cableId, primaryID, phase, header) {
var json = httpGetCall("bs7671/secondary/" + cableId + "/" + primaryID + "/" + phase);
var data = JSON.parse(json);
var result = dataItemArray(data,enDataType.bs7671Secondary,header);
return result;
}