Search in sources :

Example 16 with FresnelReflector

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

the class SetPartSizeCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    if (part instanceof Mirror) {
        final Mirror m = (Mirror) part;
        newWidth = m.getMirrorWidth();
        newHeight = m.getMirrorHeight();
        m.setMirrorWidth(oldWidth);
        m.setMirrorHeight(oldHeight);
    } else if (part instanceof ParabolicTrough) {
        final ParabolicTrough t = (ParabolicTrough) part;
        newWidth = t.getApertureWidth();
        newHeight = t.getTroughLength();
        newModuleLength = t.getModuleLength();
        t.setApertureWidth(oldWidth);
        t.setTroughLength(oldHeight);
        t.setModuleLength(oldModuleLength);
    } else if (part instanceof ParabolicDish) {
        final ParabolicDish d = (ParabolicDish) part;
        newWidth = d.getRimRadius();
        d.setRimRadius(oldWidth);
    } else if (part instanceof FresnelReflector) {
        final FresnelReflector r = (FresnelReflector) part;
        newWidth = r.getModuleWidth();
        newHeight = r.getLength();
        newModuleLength = r.getModuleLength();
        r.setModuleWidth(oldWidth);
        r.setLength(oldHeight);
        r.setModuleLength(oldModuleLength);
    } else if (part instanceof Rack) {
        final Rack r = (Rack) part;
        newWidth = r.getRackWidth();
        newHeight = r.getRackHeight();
        r.setRackWidth(oldWidth);
        r.setRackHeight(oldHeight);
    } else if (part instanceof Window) {
        final Window w = (Window) part;
        newWidth = w.getWindowWidth();
        newHeight = w.getWindowHeight();
        w.setWindowWidth(oldWidth);
        w.setWindowHeight(oldHeight);
        w.getContainer().draw();
    } else if (part instanceof Door) {
        final Door d = (Door) part;
        newWidth = d.getDoorWidth();
        newHeight = d.getDoorHeight();
        d.setDoorWidth(oldWidth);
        d.setDoorHeight(oldHeight);
        d.getContainer().draw();
    }
    part.draw();
    SceneManager.getInstance().refresh();
}
Also used : ParabolicDish(org.concord.energy3d.model.ParabolicDish) Window(org.concord.energy3d.model.Window) Rack(org.concord.energy3d.model.Rack) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Mirror(org.concord.energy3d.model.Mirror) Door(org.concord.energy3d.model.Door)

Example 17 with FresnelReflector

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

the class MovePartCommand method move.

private void move(final Vector3 v) {
    SceneManager.getInstance().setSelectedPart(part);
    SceneManager.getTaskManager().update(new Callable<Object>() {

        @Override
        public Object call() throws Exception {
            if (part == null) {
                for (final HousePart p : Scene.getInstance().getParts()) {
                    if (p instanceof Foundation) {
                        ((Foundation) p).move(v, p.getGridSize());
                    }
                }
            } else if (part instanceof Foundation) {
                final Foundation f = (Foundation) part;
                if (f.isGroupMaster()) {
                    final List<Foundation> g = Scene.getInstance().getFoundationGroup(f);
                    for (final Foundation x : g) {
                        x.move(v, part.getGridSize());
                    }
                } else {
                    f.move(v, part.getGridSize());
                }
            } else if (part instanceof Window) {
                final Window w = (Window) part;
                w.move(v);
                w.draw();
            } else if (part instanceof SolarPanel) {
                final SolarPanel s = (SolarPanel) part;
                s.move(v, part.getGridSize());
                s.draw();
            } else if (part instanceof Rack) {
                final Rack r = (Rack) part;
                r.move(v, part.getGridSize());
                r.draw();
            } else if (part instanceof Mirror) {
                final Mirror m = (Mirror) part;
                m.move(v, part.getGridSize());
                m.draw();
            } else if (part instanceof ParabolicTrough) {
                final ParabolicTrough t = (ParabolicTrough) part;
                t.move(v, part.getGridSize());
                t.draw();
            } else if (part instanceof ParabolicDish) {
                final ParabolicDish d = (ParabolicDish) part;
                d.move(v, part.getGridSize());
                d.draw();
            } else if (part instanceof FresnelReflector) {
                final FresnelReflector f = (FresnelReflector) part;
                f.move(v, part.getGridSize());
                f.draw();
            }
            return null;
        }
    });
}
Also used : Window(org.concord.energy3d.model.Window) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) CannotUndoException(javax.swing.undo.CannotUndoException) CannotRedoException(javax.swing.undo.CannotRedoException) ParabolicDish(org.concord.energy3d.model.ParabolicDish) Rack(org.concord.energy3d.model.Rack) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 18 with FresnelReflector

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

the class CspProjectDailyEnergyGraph method updateGraph.

public void updateGraph() {
    if (base == null) {
        return;
    }
    graph.clearData();
    final List<ParabolicTrough> troughs = base.getParabolicTroughs();
    if (!troughs.isEmpty()) {
        // favor parabolic troughs if there are also mirrors or Fresnel reflectors
        for (int i = 0; i < 24; i++) {
            SolarRadiation.getInstance().computeEnergyAtHour(i);
            double output = 0;
            for (final ParabolicTrough t : troughs) {
                output += t.getSolarPotentialNow() * t.getSystemEfficiency();
            }
            graph.addData("Solar", output);
        }
    } else {
        final List<ParabolicDish> dishes = base.getParabolicDishes();
        if (!dishes.isEmpty()) {
            for (int i = 0; i < 24; i++) {
                SolarRadiation.getInstance().computeEnergyAtHour(i);
                double output = 0;
                for (final ParabolicDish d : dishes) {
                    output += d.getSolarPotentialNow() * d.getSystemEfficiency();
                }
                graph.addData("Solar", output);
            }
        } else {
            final List<FresnelReflector> fresnels = base.getFresnelReflectors();
            if (!fresnels.isEmpty()) {
                for (int i = 0; i < 24; i++) {
                    SolarRadiation.getInstance().computeEnergyAtHour(i);
                    double output = 0;
                    for (final FresnelReflector r : fresnels) {
                        output += r.getSolarPotentialNow() * r.getSystemEfficiency();
                    }
                    graph.addData("Solar", output);
                }
            } else {
                final List<Mirror> mirrors = base.getHeliostats();
                if (!mirrors.isEmpty()) {
                    for (int i = 0; i < 24; i++) {
                        SolarRadiation.getInstance().computeEnergyAtHour(i);
                        double output = 0;
                        for (final Mirror m : mirrors) {
                            output += m.getSolarPotentialNow() * m.getSystemEfficiency();
                        }
                        graph.addData("Solar", output);
                    }
                }
            }
        }
    }
    repaint();
}
Also used : ParabolicDish(org.concord.energy3d.model.ParabolicDish) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Mirror(org.concord.energy3d.model.Mirror)

Example 19 with FresnelReflector

use of org.concord.energy3d.model.FresnelReflector 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 20 with FresnelReflector

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

the class Scene method removeAllFresnelReflectors.

public void removeAllFresnelReflectors() {
    final ArrayList<HousePart> reflectors = new ArrayList<HousePart>();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        final Foundation foundation = selectedPart instanceof Foundation ? (Foundation) selectedPart : selectedPart.getTopContainer();
        for (final HousePart part : parts) {
            if (part instanceof FresnelReflector && part.getTopContainer() == foundation) {
                reflectors.add(part);
            }
        }
    } else {
        for (final HousePart part : parts) {
            if (part instanceof FresnelReflector) {
                reflectors.add(part);
            }
        }
    }
    if (reflectors.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no Fresnel reflector to remove.", "No Fresnel Reflector", JOptionPane.INFORMATION_MESSAGE);
        return;
    }
    if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + reflectors.size() + " Fresnel reflectors" + (selectedPart != null ? " on the selected foundation" : "") + "?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
        return;
    }
    final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(reflectors);
    for (final HousePart part : reflectors) {
        remove(part, false);
    }
    redrawAll();
    SceneManager.getInstance().getUndoManager().addEdit(c);
    edited = true;
}
Also used : FresnelReflector(org.concord.energy3d.model.FresnelReflector) ArrayList(java.util.ArrayList) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) RemoveMultiplePartsCommand(org.concord.energy3d.undo.RemoveMultiplePartsCommand)

Aggregations

FresnelReflector (org.concord.energy3d.model.FresnelReflector)48 HousePart (org.concord.energy3d.model.HousePart)32 Foundation (org.concord.energy3d.model.Foundation)25 Mirror (org.concord.energy3d.model.Mirror)21 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)18 ParabolicDish (org.concord.energy3d.model.ParabolicDish)17 Rack (org.concord.energy3d.model.Rack)16 SolarPanel (org.concord.energy3d.model.SolarPanel)14 Window (org.concord.energy3d.model.Window)14 Wall (org.concord.energy3d.model.Wall)12 Door (org.concord.energy3d.model.Door)9 Roof (org.concord.energy3d.model.Roof)9 ArrayList (java.util.ArrayList)8 Calendar (java.util.Calendar)5 JDialog (javax.swing.JDialog)5 SolarCollector (org.concord.energy3d.model.SolarCollector)5 List (java.util.List)4 Human (org.concord.energy3d.model.Human)4 Tree (org.concord.energy3d.model.Tree)4 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)3