@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(viewMainFeeder.getBtnAdd())) { loadRegister(); } else if (e.getSource().equals(viewMainFeeder.getBtnClose())) { viewMainFeeder.dispose(); } else if (e.getSource().equals(viewMainFeeder.getBtnCalculateCurrentCapacity())) { this.calculate_conductor(); } else if (e.getSource().equals(viewMainFeeder.getBtnCalculateBreakdown())) { this.calculate_breakDownVoltage(); } else if (e.getSource().equals(viewMainFeeder.getCmbPhases())) { this.fill_combos_voltages(); } }
/** Método para calcular el conductor. */ private void calculate_conductor() { if (!viewMainFeeder.getrBtnAir().isSelected() && !viewMainFeeder.getrBtnGround().isSelected()) { MessagesStructure.Warning( MessagesStructure.format( 200, messages.getProperty(Messages.RUSH_NO_FOUND), MessagesStructure.justify)); viewMainFeeder.getrBtnGround().requestFocus(); } else { caliberPhaseFound = MethodsForCalculationsGlobal.calculateCaliberForMainFeeder( viewMainFeeder.getPotency_total(), (Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem(), (Material) viewMainFeeder.getCmbMaterial().getSelectedItem(), (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), 2); caliberNeutralFound = MethodsForCalculationsGlobal.calculateCaliberForMainFeeder( viewMainFeeder.getNeutral_total(), (Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem(), (Material) viewMainFeeder.getCmbMaterial().getSelectedItem(), (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), 2); conductorForPhase = MethodsForCalculationsGlobal.calculateNumberConductorForPhase( MethodsForCalculationsGlobal.intensity( viewMainFeeder.getPotency_total(), ((Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem()).getVoltage(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), 2), 475); conductorForNeutral = MethodsForCalculationsGlobal.calculateNumberConductorForPhase( MethodsForCalculationsGlobal.intensity( viewMainFeeder.getNeutral_total(), ((Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem()).getVoltage(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), 2), 475); caliberPipeline = MethodsForCalculationsGlobal.calculate_pipeline( caliberPhaseFound.getCaliber(), null, null, (Phase) viewMainFeeder.getCmbPhases().getSelectedItem(), viewMainFeeder.getCmbPipeline().getSelectedItem().toString()); caliberPipelineNeutral = MethodsForCalculationsGlobal.calculate_pipeline( caliberNeutralFound.getCaliber(), null, null, new Phase(0, TypePhases.SINGLE_PHASE_TWO_THREAD.getPhase()), viewMainFeeder.getCmbPipeline().getSelectedItem().toString()); intensityDesignFound = MethodsForCalculationsIluminariaPowerPoint.calculate_instensity_design( new Calibers( 0, (Material) viewMainFeeder.getCmbMaterial().getSelectedItem(), (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem(), null, caliberPhaseFound.getCaliber())); breakerPhaseFound = MethodsForCalculationsGlobal.find_breaker_main_feeder( conductorForPhase * intensityDesignFound.getIntensity(), new Intensity( 0, null, MethodsForCalculationsGlobal.intensity( viewMainFeeder.getPotency_total(), ((Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem()).getVoltage(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), 2))); calibersHearthFound = MethodsForCalculationsGlobal.calculate_calibersHearth( viewMainFeeder.getPotency_total(), (Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), 2); if (caliberPhaseFound == null) { MessagesStructure.Warning( MessagesStructure.format( 200, messages.getProperty(Messages.CALIBER_NO_FOUND), MessagesStructure.justify)); } else { viewMainFeeder.getCmbCaliber().setSelectedItem(caliberPhaseFound.getCaliber()); viewMainFeeder.getCmbCalibersNeutral().setSelectedItem(caliberNeutralFound.getCaliber()); if (((Material) viewMainFeeder.getCmbMaterial().getSelectedItem()) .getName() .equals(TypeMaterials.COOPER.getMaterial())) { viewMainFeeder .getLblCaliberPhase() .setText( "3 Cables" + " #" + caliberPhaseFound.getCaliber().getName() + " Cu " + MethodsForCalculationsGlobal.typeCaliber( typeCaliber, (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem()) + " " + "3x" + breakerPhaseFound.getCapacity()); viewMainFeeder .getLblCaliberNeutral() .setText( "2 Cables" + " #" + caliberNeutralFound.getCaliber().getName() + " Cu " + MethodsForCalculationsGlobal.typeCaliber( typeCaliber, (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem())); } else if (((Material) viewMainFeeder.getCmbMaterial().getSelectedItem()) .getName() .equals(TypeMaterials.ALUMINIUM.getMaterial())) { viewMainFeeder .getLblCaliberPhase() .setText( "3 Cables" + " #" + caliberPhaseFound.getCaliber().getName() + " Al " + MethodsForCalculationsGlobal.typeCaliber( typeCaliber, (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem()) + " " + "3x" + breakerPhaseFound.getCapacity()); viewMainFeeder .getLblCaliberNeutral() .setText( "2 Cables" + " #" + caliberNeutralFound.getCaliber().getName() + " Al " + MethodsForCalculationsGlobal.typeCaliber( typeCaliber, (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem())); } if (calibersHearthFound == null) { viewMainFeeder.getLblCaliberEarth().setText("No aplica"); } else { viewMainFeeder .getLblCaliberEarth() .setText( "1 Cable " + calibersHearthFound.getCaliber().getName() + " " + MethodsForCalculationsGlobal.typeCaliber( typeCaliber, (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem())); } viewMainFeeder.getBtnCalculateBreakdown().doClick(); } } } // Fin del método.