Java Code Examples for org.apache.commons.math3.complex.Complex#equals()

The following examples show how to use org.apache.commons.math3.complex.Complex#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LFTest.java    From DeepMachineLearning with Apache License 2.0 6 votes vote down vote up
public void seeBusCodeAndQLimit() throws InterpssException {

		String baseCasePath = "testdata/cases/ieee14.ieee";
		
		IpssCorePlugin.init();
		
		AclfNetwork net = CorePluginFactory
							.getFileAdapter(IpssFileAdapter.FileFormat.IEEECDF)
							.load(baseCasePath)
							.getAclfNet();
		
		for (int i=0; i<net.getNoBus(); ++i) {
			String report = new String("");
			
			report += " Bus "+i+" code = "+net.getBusList().get(i).getGenCode().getName();
			report += "\t==GenPV?: "+net.getBusList().get(i).getGenCode().getName().equals("GenPV")+Complex.equals(net.getBusList().get(i).getLoadPQ(), Complex.ZERO);
			report += "\tGenQ = " + net.getBusList().get(i).getGenQ();
			report += "\tLoadQ = " + net.getBusList().get(i).getLoadQ();
			report += "\tminQ, maxQ = " + net.getBusList().get(i).getQGenLimit().getMin()+", "
						+net.getBusList().get(i).getQGenLimit().getMax();
			report += "\tVLimit"+net.getBusList().get(i).getVLimit().getMin()+", "+net.getBusList().get(i).getVLimit().getMax();
			
			System.out.println(report);
		}
	}
 
Example 2
Source File: LinkData.java    From powsybl-core with Mozilla Public License 2.0 5 votes vote down vote up
static Complex kronAntenna(Complex y11, Complex y12, Complex y21, Complex y22, boolean isOpenFrom) {
    Complex ysh = Complex.ZERO;

    if (isOpenFrom) {
        if (!y11.equals(Complex.ZERO)) {
            ysh = y22.subtract(y21.multiply(y12).divide(y11));
        }
    } else {
        if (!y22.equals(Complex.ZERO)) {
            ysh = y11.subtract(y12.multiply(y21).divide(y22));
        }
    }
    return ysh;
}
 
Example 3
Source File: PVCG2.java    From DeepMachineLearning with Apache License 2.0 4 votes vote down vote up
public PVCG2(RefInfo refInfo) {
	super(refInfo);
	long startTime = System.currentTimeMillis();
	this.methodName = NAME;
	System.out.print("[REPORT] new "+methodName+"...");
	
	c = new VoltageGenCondition(false);//isThVMethod
	noBus = ref.getNoBus();
	swingNo = ref.getSwingNo();
	busType = new int[noBus];
	pf = new double[noBus];
	
	random = new Random();
	
	EList<AclfBus> busList = ref.getNet().getBusList();
	for (int i=0; i<noBus; ++i) {
		AclfBus bus = busList.get(i);
		String genCode = bus.getGenCode().getName();
		if (genCode.equals("Swing")) {//ƽ��ڵ�
			this.busType[i] = PVCG2.SWING;
			this.swingNo = i;
		}else if (genCode.equals("GenPV")) {//��PV�ڵ�
			if (Complex.equals(bus.getLoadPQ(), Complex.ZERO)) {
				if (bus.getGenP() == 0) {
					this.busType[i] = PVCG2.ONLY_PM;//�������
				}else {
					this.busType[i] = PVCG2.ONLY_PV;//�ǵ������PV
				}
			}else {
				this.busType[i] = PVCG2.PV_AND_PQ;//��PQ��PV
			}
		}else if (genCode.equals("GenPQ")) {
			if (bus.getGenP() == 0 && bus.getGenQ() == 0 && bus.getLoadP() == 0 && bus.getLoadQ() == 0) {
				this.busType[i] = PVCG2.CONNECT;//����ڵ�
			}else {
				this.busType[i] = PVCG2.NORMAL_PQ;//����PQ�ڵ�
			}
		}
	}
	
	calpf();

	//report
	System.out.println(" ...ready. Need to input parameter: "+PARA_NEEDED);
	addInitTime(startTime);
}
 
Example 4
Source File: PVConditionGenerator.java    From DeepMachineLearning with Apache License 2.0 4 votes vote down vote up
public PVConditionGenerator(RefInfo refInfo) {
	super(refInfo);
	long startTime = System.currentTimeMillis();
	this.methodName = NAME;
	System.out.print("[REPORT] new "+methodName+"...");
	
	c = new VoltageGenCondition(false);//isThVMethod
	noBus = ref.getNoBus();
	swingNo = ref.getSwingNo();
	busType = new int[noBus];
	pbase = new double[noBus];
	vbase = new double[noBus];
	dp = new double[noBus];
	dv = new double[noBus];
	
	random = new Random();
	
	EList<AclfBus> busList = ref.getNet().getBusList();
	for (int i=0; i<noBus; ++i) {
		AclfBus bus = busList.get(i);
		String genCode = bus.getGenCode().getName();
		if (genCode.equals("Swing")) {//ƽ��ڵ�
			this.busType[i] = PVConditionGenerator.SWING;
			this.swingNo = i;
		}else if (genCode.equals("GenPV")) {//��PV�ڵ�
			if (Complex.equals(bus.getLoadPQ(), Complex.ZERO)) {
				if (bus.getGenP() == 0) {
					this.busType[i] = PVConditionGenerator.ONLY_PM;//�������
				}else {
					this.busType[i] = PVConditionGenerator.ONLY_PV;//�ǵ������PV
				}
			}else {
				this.busType[i] = PVConditionGenerator.PV_AND_PQ;//��PQ��PV
			}
		}else if (genCode.equals("GenPQ")) {
			if (bus.getGenP() == 0 && bus.getGenQ() == 0 && bus.getLoadP() == 0 && bus.getLoadQ() == 0)
				this.busType[i] = PVConditionGenerator.CONNECT;//����ڵ�
			}else
				this.busType[i] = PVConditionGenerator.NORMAL_PQ;//����PQ�ڵ�
		pbase[i] = bus.getGenP() - bus.getLoadP();
		vbase[i] = bus.getVoltage().abs();
	}
	
	calDp();
	calDv();

	//report
	System.out.println(" ...ready. Need to input parameter: "+PARA_NEEDED);
	addInitTime(startTime);
}