/** Método para llenar los combos con Voltages. */ public void fill_combos_voltages() { voltagesFound = ServiceVoltage.find_voltages(); if (voltagesFound != null) { viewMainFeeder.getCmbVoltage().removeAllItems(); for (Voltage voltage : voltagesFound) { if (((Phase) viewMainFeeder.getCmbPhases().getSelectedItem()) .getName() .equalsIgnoreCase(TypePhases.SINGLE_PHASE_TWO_THREAD.getPhase()) && voltage.getVoltage() < 200) { viewMainFeeder.getCmbVoltage().addItem(voltage); } else if ((((Phase) viewMainFeeder.getCmbPhases().getSelectedItem()) .getName() .equalsIgnoreCase(TypePhases.SINGLE_PHASE_THREE_THREAD.getPhase()) || ((Phase) viewMainFeeder.getCmbPhases().getSelectedItem()) .getName() .equalsIgnoreCase(TypePhases.PHASE_FOUR_THREAD.getPhase())) && voltage.getVoltage() >= 200) { viewMainFeeder.getCmbVoltage().addItem(voltage); } } viewMainFeeder.getCmbVoltage().setSelectedIndex(0); } else { MessagesStructure.Warning( MessagesStructure.format( 200, messages.getProperty(Messages.VOLTAGES_NO_FOUND), MessagesStructure.justify)); viewMainFeeder.dispose(); } } // Fin del método
/** Método para llenar los combos con Fases. */ public void fill_combos_phases() { phasesFound = ServicePhase.find_phases(); if (phasesFound != null) { for (Phase phase : phasesFound) { if (phase.getName().equalsIgnoreCase(TypePhases.PHASE_FOUR_THREAD.getPhase())) { viewMainFeeder.getCmbPhases().addItem(phase); } } viewMainFeeder.getCmbPhases().setSelectedIndex(0); } else { MessagesStructure.Warning( MessagesStructure.format( 200, messages.getProperty(Messages.PHASES_NO_FOUND), MessagesStructure.justify)); viewMainFeeder.dispose(); } } // Fin del método
@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 probar los conductores por caída de voltaje. private void calculate_breakDownVoltage() { if (caliberPhaseFound == null || caliberNeutralFound == null || calibersHearthFound == null) { MessagesStructure.Warning( MessagesStructure.format( 200, messages.getProperty(Messages.AREA_CAPACITY_INTENSITY_NO_FOUND), MessagesStructure.justify)); } else { if (MethodsForCalculationsGlobal.validate_caliber( (Caliber) viewMainFeeder.getCmbCaliber().getSelectedItem()) && MethodsForCalculationsGlobal.validate_caliber( (Caliber) viewMainFeeder.getCmbCalibersNeutral().getSelectedItem())) { resistance = calculate_resistance(TypeOfBranchCircuitInArea.ILUMINARIA); reactance = calculate_reactance(TypeOfBranchCircuitInArea.ILUMINARIA); if (resistance != null) { breakdownVoltage = MethodsForCalculationsGlobal.breakdownVoltage( viewMainFeeder.getPotency_total(), Double.valueOf(viewMainFeeder.getJspLength().getValue().toString()), ((Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem()).getVoltage(), reactance.getValue().getValour(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), resistance.getValue().getValour(), Double.valueOf(viewMainFeeder.getJspAngle().getValue().toString())); viewMainFeeder.getLblBreakdownVoltage().setText(String.valueOf(breakdownVoltage) + " %"); caliberSelected = (Caliber) viewMainFeeder.getCmbCaliber().getSelectedItem(); intensityDesignFound = MethodsForCalculationsIluminariaPowerPoint.calculate_instensity_design( new Calibers( 0, (Material) viewMainFeeder.getCmbMaterial().getSelectedItem(), (Temperature) viewMainFeeder.getCmbTemperature().getSelectedItem(), null, caliberSelected)); breakerPhasePersistFound = 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))); resistance = calculate_resistance(TypeOfBranchCircuitInArea.NEUTRAL); reactance = calculate_reactance(TypeOfBranchCircuitInArea.NEUTRAL); if (resistance != null) { breakdownVoltage = MethodsForCalculationsGlobal.breakdownVoltage( viewMainFeeder.getNeutral_total(), Double.valueOf(viewMainFeeder.getJspLength().getValue().toString()), ((Voltage) viewMainFeeder.getCmbVoltage().getSelectedItem()).getVoltage(), reactance.getValue().getValour(), Double.valueOf(viewMainFeeder.getJspPowerFactor().getValue().toString()), resistance.getValue().getValour(), Double.valueOf(viewMainFeeder.getJspAngle().getValue().toString())); viewMainFeeder .getLblBreakdownVoltageNeutral() .setText(String.valueOf(breakdownVoltage) + " %"); caliberSelectedNeutral = (Caliber) viewMainFeeder.getCmbCalibersNeutral().getSelectedItem(); caliberPhase = viewMainFeeder.getLblCaliberPhase().getText(); caliberPhase = caliberPhase.replace( "#" + caliberPhaseFound.getCaliber().getName(), "#" + caliberSelected.getName()); caliberPhase = caliberPhase.replace( "3x" + breakerPhaseFound.getCapacity(), "3x" + breakerPhasePersistFound.getCapacity()); caliberNeutral = viewMainFeeder.getLblCaliberNeutral().getText(); caliberNeutral = caliberNeutral.replace( "#" + caliberNeutralFound.getCaliber().getName(), "#" + caliberSelectedNeutral.getName()); caliberHearth = viewMainFeeder.getLblCaliberEarth().getText(); caliberPipeline = MethodsForCalculationsGlobal.calculate_pipeline( caliberSelected, null, null, (Phase) viewMainFeeder.getCmbPhases().getSelectedItem(), viewMainFeeder.getCmbPipeline().getSelectedItem().toString()); caliberPipelineNeutral = MethodsForCalculationsGlobal.calculate_pipeline( caliberSelectedNeutral, null, null, new Phase(0, TypePhases.SINGLE_PHASE_TWO_THREAD.getPhase()), viewMainFeeder.getCmbPipeline().getSelectedItem().toString()); } } } } } // Fin del método.
/** 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.