Search in sources :

Example 81 with Foundation

use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.

the class MainFrame method getDailyEnergyAnalysisForSelectionMenuItem.

private JMenuItem getDailyEnergyAnalysisForSelectionMenuItem() {
    if (dailyEnergyAnalysisForSelectionMenuItem == null) {
        dailyEnergyAnalysisForSelectionMenuItem = new JMenuItem("Daily Energy Analysis for Selected Part...");
        dailyEnergyAnalysisForSelectionMenuItem.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(final ActionEvent e) {
                if (EnergyPanel.getInstance().checkCity()) {
                    if (EnergyPanel.getInstance().adjustCellSize()) {
                        return;
                    }
                    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
                    if (selectedPart instanceof Window || selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door || selectedPart instanceof SolarPanel || selectedPart instanceof Rack || selectedPart instanceof Foundation) {
                        new EnergyDailyAnalysis().show("Daily Energy for Selected Part");
                    } else {
                        JOptionPane.showMessageDialog(MainFrame.this, "You must select a building part first.", "No Selection", JOptionPane.INFORMATION_MESSAGE);
                    }
                }
            }
        });
    }
    return dailyEnergyAnalysisForSelectionMenuItem;
}
Also used : Window(org.concord.energy3d.model.Window) Wall(org.concord.energy3d.model.Wall) ActionEvent(java.awt.event.ActionEvent) Door(org.concord.energy3d.model.Door) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) ActionListener(java.awt.event.ActionListener) SolarPanel(org.concord.energy3d.model.SolarPanel) EnergyDailyAnalysis(org.concord.energy3d.simulation.EnergyDailyAnalysis) Foundation(org.concord.energy3d.model.Foundation) JMenuItem(javax.swing.JMenuItem) HousePart(org.concord.energy3d.model.HousePart)

Example 82 with Foundation

use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.

the class EnergyPanel method compute.

public void compute(final UpdateRadiation updateRadiation) {
    if (!computeEnabled) {
        return;
    }
    computingStartMillis = System.currentTimeMillis();
    EventQueue.invokeLater(new // must run this Swing UI update in the event queue to avoid a possible deadlock
    Runnable() {

        @Override
        public void run() {
            // TODO: There got to be a better way to do this.
            updateWeatherData();
            ((Component) SceneManager.getInstance().getCanvas()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        }
    });
    final boolean doCompute = updateRadiation == UpdateRadiation.ALWAYS || (SceneManager.getInstance().getSolarHeatMap() && (!alreadyRenderedHeatmap || autoRecomputeEnergy));
    if (!doCompute && computing) {
        cancel();
        return;
    }
    SceneManager.getTaskManager().update(new Callable<Object>() {

        @Override
        public Object call() throws Exception {
            computing = true;
            computeRequest = false;
            cancel = false;
            try {
                if (doCompute) {
                    alreadyRenderedHeatmap = true;
                    computeNow();
                    if (!cancel) {
                        SceneManager.getInstance().getSolarLand().setVisible(Scene.getInstance().getSolarMapForLand());
                        SceneManager.getInstance().refresh();
                    } else if (!autoRecomputeEnergy) {
                        turnOffCompute();
                    }
                } else {
                    turnOffCompute();
                }
            } catch (final Throwable e) {
                e.printStackTrace();
                BugReporter.report(e);
                return null;
            } finally {
                EventQueue.invokeLater(new Runnable() {

                    @Override
                    public void run() {
                        ((Component) SceneManager.getInstance().getCanvas()).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                    }
                });
            }
            EventQueue.invokeLater(new // must run this Swing UI update in the event queue to avoid a possible deadlock
            Runnable() {

                @Override
                public void run() {
                    progress(0);
                    if (SceneManager.getInstance().getSolarHeatMap()) {
                        final HousePart p = SceneManager.getInstance().getSelectedPart();
                        if (p instanceof Foundation) {
                            final Foundation f = (Foundation) p;
                            switch(f.getProjectType()) {
                                case Foundation.TYPE_BUILDING:
                                    Util.setSilently(buildingTabbedPane, buildingDailyEnergyGraph);
                                    buildingDailyEnergyGraph.addGraph(f);
                                    TimeSeriesLogger.getInstance().logAnalysis(buildingDailyEnergyGraph);
                                    MainApplication.addEvent(new AnalysisEvent(Scene.getURL(), System.currentTimeMillis(), buildingDailyEnergyGraph.getClass().getSimpleName(), buildingDailyEnergyGraph.getData()));
                                    break;
                                case Foundation.TYPE_PV_PROJECT:
                                    Util.setSilently(pvProjectTabbedPane, pvProjectDailyEnergyGraph);
                                    pvProjectDailyEnergyGraph.addGraph(f);
                                    TimeSeriesLogger.getInstance().logAnalysis(pvProjectDailyEnergyGraph);
                                    MainApplication.addEvent(new AnalysisEvent(Scene.getURL(), System.currentTimeMillis(), pvProjectDailyEnergyGraph.getClass().getSimpleName(), pvProjectDailyEnergyGraph.getData()));
                                    break;
                                case Foundation.TYPE_CSP_PROJECT:
                                    Util.setSilently(cspProjectTabbedPane, cspProjectDailyEnergyGraph);
                                    cspProjectDailyEnergyGraph.addGraph(f);
                                    TimeSeriesLogger.getInstance().logAnalysis(cspProjectDailyEnergyGraph);
                                    MainApplication.addEvent(new AnalysisEvent(Scene.getURL(), System.currentTimeMillis(), cspProjectDailyEnergyGraph.getClass().getSimpleName(), cspProjectDailyEnergyGraph.getData()));
                                    break;
                            }
                        }
                    }
                    computing = false;
                }
            });
            return null;
        }
    });
}
Also used : AnalysisEvent(org.concord.energy3d.agents.AnalysisEvent) Foundation(org.concord.energy3d.model.Foundation) Component(java.awt.Component) CancellationException(java.util.concurrent.CancellationException) HousePart(org.concord.energy3d.model.HousePart)

Example 83 with Foundation

use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.

the class CspProjectCostGraph method calculateCost.

private void calculateCost() {
    landSum = 0;
    collectorSum = 0;
    receiverSum = 0;
    if (foundation.hasSolarReceiver()) {
        receiverSum = CspProjectCost.getPartCost(foundation);
    } else {
        landSum = CspProjectCost.getPartCost(foundation);
        final List<Mirror> mirrors = foundation.getHeliostats();
        if (!mirrors.isEmpty()) {
            final ArrayList<Foundation> towers = new ArrayList<Foundation>();
            for (final Mirror m : mirrors) {
                if (m.getReceiver() != null) {
                    if (!towers.contains(m.getReceiver())) {
                        towers.add(m.getReceiver());
                    }
                }
            }
            if (!towers.isEmpty()) {
                for (final Foundation tower : towers) {
                    receiverSum += CspProjectCost.getPartCost(tower);
                }
            }
        } else {
            final List<FresnelReflector> reflectors = foundation.getFresnelReflectors();
            if (!reflectors.isEmpty()) {
                final ArrayList<Foundation> absorbers = new ArrayList<Foundation>();
                for (final FresnelReflector r : reflectors) {
                    if (r.getReceiver() != null) {
                        if (!absorbers.contains(r.getReceiver())) {
                            absorbers.add(r.getReceiver());
                        }
                    }
                }
                if (!absorbers.isEmpty()) {
                    for (final Foundation absorber : absorbers) {
                        receiverSum += CspProjectCost.getPartCost(absorber);
                    }
                }
            }
        }
    }
    for (final HousePart p : Scene.getInstance().getParts()) {
        if (p.getTopContainer() == foundation) {
            if (p instanceof SolarCollector) {
                // assuming that sensor doesn't cost anything
                collectorSum += CspProjectCost.getPartCost(p);
            }
        }
    }
    totalCost = landSum + collectorSum + receiverSum;
}
Also used : FresnelReflector(org.concord.energy3d.model.FresnelReflector) SolarCollector(org.concord.energy3d.model.SolarCollector) ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 84 with Foundation

use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.

the class Scene method upgradeSceneToNewVersion.

private void upgradeSceneToNewVersion() {
    if (textureMode == null) {
        textureMode = TextureMode.Full;
        for (final HousePart p : parts) {
            if (p instanceof Roof) {
                ((Roof) p).setOverhangLength(0.2);
            }
        }
    }
    if (version < 1) {
        for (final HousePart part : parts) {
            if (part instanceof Foundation) {
                ((Foundation) part).scaleHouseForNewVersion(10);
            }
        }
        cameraLocation = cameraLocation.multiply(10, null);
        setAnnotationScale(1.0);
    }
    version = currentVersion;
}
Also used : Roof(org.concord.energy3d.model.Roof) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart)

Example 85 with Foundation

use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.

the class Scene method paste.

public void paste() {
    if (copyBuffer == null) {
        return;
    }
    if (copyBuffer instanceof Foundation) {
        return;
    }
    if (SceneManager.getInstance().getSolarHeatMap()) {
        EnergyPanel.getInstance().updateRadiationHeatMap();
    }
    final HousePart c = copyBuffer.copy(true);
    if (c == null) {
        return;
    }
    add(c, true);
    copyBuffer = c;
    SceneManager.getInstance().setSelectedPart(c);
    SceneManager.getInstance().getUndoManager().addEdit(new PastePartCommand(c));
    EnergyPanel.getInstance().update();
}
Also used : Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) PastePartCommand(org.concord.energy3d.undo.PastePartCommand)

Aggregations

Foundation (org.concord.energy3d.model.Foundation)174 HousePart (org.concord.energy3d.model.HousePart)153 Rack (org.concord.energy3d.model.Rack)47 SolarPanel (org.concord.energy3d.model.SolarPanel)45 Window (org.concord.energy3d.model.Window)39 ActionEvent (java.awt.event.ActionEvent)38 ActionListener (java.awt.event.ActionListener)38 Roof (org.concord.energy3d.model.Roof)38 Wall (org.concord.energy3d.model.Wall)37 ArrayList (java.util.ArrayList)35 JDialog (javax.swing.JDialog)35 JMenuItem (javax.swing.JMenuItem)33 Mirror (org.concord.energy3d.model.Mirror)32 FresnelReflector (org.concord.energy3d.model.FresnelReflector)27 Door (org.concord.energy3d.model.Door)24 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)24 Tree (org.concord.energy3d.model.Tree)24 Vector3 (com.ardor3d.math.Vector3)22 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)22 ParabolicDish (org.concord.energy3d.model.ParabolicDish)22