#include "wire.h" #include "QDebug" Wire::Wire() : activeWireData(copper[0]), activeWire(wireMaterials[Copper]), systemVoltage(0.0), peakPower(0.0), wireLength(0.0) { } void Wire::setActiveWireType(int wire) { activeWire = wireMaterials[wire]; } void Wire::setWireLength(float length) { wireLength = length; } void Wire::setSystemVoltage(double voltage) { systemVoltage = voltage; } void Wire::setPeakSystemPower(double power) { peakPower = power; } void Wire::calculate() { float current = peakPower/systemVoltage; int count = 0; switch (std::distance(wireMaterials, std::find(wireMaterials,wireMaterials+sizeof(wireMaterials),activeWire))) { case Copper: { while(current < copper[count].maxCurrent) { activeWireData = copper[count]; count++; } break; } case Aluminum: { break; } case Silver: { break; } case Gold: { break; } case Tin: { break; } } qDebug() << activeWireData.AWG; emit calculation(); } QString Wire::gauge() { return activeWireData.AWG; } double Wire::weight() { return (wireLength * activeWireData.weight)/1000.0; } double Wire::peakCurrent() { return peakPower/systemVoltage; }