//TODO this needs to be updated if actual values are used in the distribution system
private Complex getFeederLoadVA(String sourceBusId) {
		Bus3Phase sourceBus = (Bus3Phase) this.net.getBus(sourceBusId);
		Complex3x1 vabc_1 = sourceBus.get3PhaseVotlages();
		Complex3x1 currInj3Phase = new Complex3x1();
		for(Branch bra: sourceBus.getConnectedPhysicalBranchList()){
			if(bra.isActive()){
				Branch3Phase acLine = (Branch3Phase) bra;
				Complex3x1 Isource = null;
				if(bra.getFromBus().getId().equals(sourceBus.getId())){
					Bus3Phase toBus = (Bus3Phase) bra.getToBus();
					Complex3x1 vabc_2 = toBus.get3PhaseVotlages();
					Complex3x3 Yft = acLine.getYftabc();
					Complex3x3 Yff = acLine.getYffabc();
					Isource = Yff.multiply(vabc_1).add(Yft.multiply(vabc_2));
					currInj3Phase = currInj3Phase.subtract(Isource );
				}
				else{
					Bus3Phase fromBus = (Bus3Phase) bra.getFromBus();
					Complex3x1 vabc_2 = fromBus.get3PhaseVotlages();
					Complex3x3 Ytf = acLine.getYtfabc();
					Complex3x3 Ytt = acLine.getYttabc();
					Isource = Ytt.multiply(vabc_1).add(Ytf.multiply(vabc_2));
					currInj3Phase = currInj3Phase.subtract(Isource);
				}
			}
		}
		//TODO this needs to be updated if actual values are used in the distribution system
		double distVABase = this.net.getBaseMva()*1.0E6;
		Bus3Phase sourceBus3Ph = (Bus3Phase) sourceBus; 
		// from distribution to transmission
		Complex totalPower = sourceBus3Ph.get3PhaseVotlages().dotProduct(currInj3Phase.conjugate()).divide(3.0).multiply(distVABase);
		return totalPower.multiply(-1.0);
	}
}
}
//TODO this needs to be updated if actual values are used in the distribution system
double distVABase = this.net.getBaseMva()*1.0E6;
Bus3Phase sourceBus3Ph = (Bus3Phase) sourceBus;
else{
Bus3Phase fromBus = (Bus3Phase) bra.getFromBus();
Complex3x1 vabc_2 = fromBus.get3PhaseVotlages();
Complex3x3 Ytf = acLine.getYtfabc();
Complex3x3 Ytt = acLine.getYttabc();
Isource = Ytt.multiply(vabc_1).add(Ytf.multiply(vabc_2));
currInj3Phase = currInj3Phase.subtract(Isource);
}
}
}
//TODO this needs to be updated if actual values are used in the distribution system
double distVABase = this.net.getBaseMva()*1.0E6;
Bus3Phase sourceBus3Ph = (Bus3Phase) sourceBus;
// from distribution to transmission
Complex totalPower = sourceBus3Ph.get3PhaseVotlages().dotProduct(currInj3Phase.conjugate()).divide(3.0).multiply(distVABase);
return totalPower.multiply(-1.0);
}
Branch3Phase acLine = (Branch3Phase) bra;
Complex3x1 Isource = null;
if(bra.getFromBus().getId().equals(sourceBus.getId())){
Bus3Phase toBus = (Bus3Phase) bra.getToBus();
Complex3x1 vabc_2 = toBus.get3PhaseVotlages();
Complex3x3 Yft = acLine.getYftabc();
Complex3x3 Yff = acLine.getYffabc();
Isource = Yff.multiply(vabc_1).add(Yft.multiply(vabc_2));
currInj3Phase = currInj3Phase.subtract(Isource );
}
else{
Bus3Phase fromBus = (Bus3Phase) bra.getFromBus();
Complex3x1 vabc_2 = fromBus.get3PhaseVotlages();
Complex3x3 Ytf = acLine.getYtfabc();
Complex3x3 Ytt = acLine.getYttabc();
Isource = Ytt.multiply(vabc_1).add(Ytf.multiply(vabc_2));
currInj3Phase = currInj3Phase.subtract(Isource);
}
}
}
//TODO this needs to be updated if actual values are used in the distribution system
double distVABase = this.net.getBaseMva()*1.0E6;
Bus3Phase sourceBus3Ph = (Bus3Phase) sourceBus;
// from distribution to transmission
Complex totalPower = sourceBus3Ph.get3PhaseVotlages().dotProduct(currInj3Phase.conjugate()).divide(3.0).multiply(distVABase);
return totalPower.multiply(-1.0);
}