"use strict";
/**
* Returns a list of cables for a given source id and phase.
* ID, Description, Cores, ConductorMaterial ConductorMaterialId, InsulationMaterial, InsulationMaterialId, ArmourMaterial, ArmourMaterialID.
* @param {number} cableSourceId cableSourceId for which to look up cables for.
* @param {number} phase Phase configuration:see =phases().
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, CableSourceID, Description, Cores, ConductorMaterial, ConductorMaterialId, InsulationMaterial, InsulationMaterialId, ArmourMaterial, ArmourMaterialID
* @customfunction
*/
function cables(cableSourceId, phase, header) {
var json = httpGetCall("library/cables/" + cableSourceId + "/" + phase);
var data = JSON.parse(json);
var result = dataItemArray(data,enDataType.cable,header);
return result;
}
/**
* Returns a cable for a given its id.
* ID, Description, Cores, ConductorMaterial, ConductorMaterialId, InsulationMaterial, InsulationMaterialId, ArmourMaterial, ArmourMaterialID.
* @param {number} cableId cableId database id of the cable.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, CableSourceID, Description, Cores, ConductorMaterial, ConductorMaterialId, InsulationMaterial, InsulationMaterialId, ArmourMaterial, ArmourMaterialID
* @customfunction
*/
function cablesID(cableId,header) {
var json = httpGetCall("library/cables/" + cableId);
var data = JSON.parse(json);
var result = dataItemArray([data],enDataType.cable,header);
return result;
}
/**
* Returns a list of cable details for a given cable id and phase.
* ID, CSA, OverallDiameter(mm), ArmmourCSA.
* @param {number} cableId cableId database id of the cable to get details for.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, CableID, CSA, OverallDiameter(mm), ArmmourCSA.
* @customfunction
*/
function cableDetails(cableId, header) {
var json = httpGetCall("library/cables/" + cableId + "/details/mm");
var data = JSON.parse(json);
var result = dataItemArray(data,enDataType.cableDetail, header);
return result;
}
/**
* Returns cable details given its id.
* ID, CSA, OverallDiameter(mm), ArmmourCSA.
* @param {number} cableDetailId cableDetailId database id of the cable to get details for.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, CableID, CSA, OverallDiameter(mm), ArmmourCSA.
* @customfunction
*/
function cableDetailsID(cableDetailId,header) {
var json = httpGetCall("library/cables/details/" + cableDetailId + "/mm");
var data = JSON.parse(json);
var result = dataItemArray([data],enDataType.cableDetail,header);
return result;
}
/**
* Returns a list of all cable sources. ID, Manufacturer, Description, U3, U0, Udc.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, Manufacturer, Description, U3, U0, Udc
* @customfunction
*/
function cableSources(header) {
var json = httpGetCall("library/sources");
var data = JSON.parse(json);
var result = dataItemArray(data,enDataType.cableSource,header);
return result;
}
/**
* Returns a cable sources for a given id.
* ID, Manufacturer, Description, U3, U0, Udc.
* @param {number} id database id of the cables, V
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, Manufacturer, Description, U3, U0, Udc
* @customfunction
*/
function cableSourcesID(id,header) {
var json = httpGetCall("library/sources/" + id);
var data = JSON.parse(json);
var result = dataItemArray([data],enDataType.cableSource,header);
return result;
}
/**
* Returns a list of all cable sources suitable for use with given voltage and phase.
* ID, Manufacturer, Description, U3, U0, Udc.
* @param {number} voltage System operating voltage, V
* @param {number} phase Phase configuration: 0 - d.c. 1 - single phase a.c. 3 - three phase a.c. 4 - three pahse + neutral a.c.
* @param {boolean} header header optional parameter, will display header row if set to true
* @return ID, Manufacturer, Description, U3, U0, Udc
* @customfunction
*/
function cableSourcesVoltagePhase(voltage, phase,header) {
var json = httpGetCall("library/sources/" + voltage + "/" + phase);
var data = JSON.parse(json);
var result = dataItemArray(data,enDataType.cableSource,header);
return result;
}