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);
	}
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);
				}
			}
		}
	
		double distVABase = this.net.getBaseMva()*1.0E6;
		Bus3Phase sourceBus3Ph = (Bus3Phase) sourceBus; 
	
		Complex totalPower = sourceBus3Ph.get3PhaseVotlages().dotProduct(currInj3Phase.conjugate()).divide(3.0).multiply(distVABase);
		return totalPower.multiply(-1.0);
	}
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); } } } double distvabase = this.net.getbasemva()*1.0e6; bus3phase sourcebus3ph = (bus3phase) sourcebus; complex totalpower = sourcebus3ph.get3phasevotlages().dotproduct(currinj3phase.conjugate()).divide(3.0).multiply(distvabase); return totalpower.multiply(-1.0); }