Exemplo n.º 1
0
    def OnEstimateDataButton(self, event):
#------------------------------------------------------------------------------		
#   Generate new porposal copying from existing alternative
#------------------------------------------------------------------------------		
        if self.checkOK == False:
            showMessage(_U("First You have to run the basic check and eliminate possible conflicts in redundant data"))
            return
            
        popup =  DialogOK(self,_U("confirm data estimation"),\
                          _U("\nTake care: running data estimate will automatically estimate missing data.")+\
                          _U("\nAlternatively you can also manually add estimated data to the questionnaire and rerun basic check")+\
                          _U("\nDo You want to continue ?"))
        if popup.ShowModal() == wx.ID_OK:
            nc = self.mod.basicCheck(estimate=True)
            self.display()

            if nc > 0:
                self.cf = conflictFrame(self)
                self.cf.Show()

        event.Skip()
Exemplo n.º 2
0
    def OnBasicCheckButton(self, event):
#------------------------------------------------------------------------------		
#   Generate new alterantive proposal
#------------------------------------------------------------------------------		

        popup =  DialogOK(self,_U("confirm basic check"),\
                          _U("\nTake care: running the check will invalidate existing alternative proposals")+\
                          _U("\nDo You want to continue ?"))
        if popup.ShowModal() == wx.ID_OK:

            Status.prj.copyQuestionnaire()

            nc = self.mod.basicCheck()
            self.display()

            if nc > 0:
                self.checkOK = False
                self.cf = conflictFrame(self)
                self.cf.Show()
            else:
                self.checkOK = True
            
        event.Skip()
Exemplo n.º 3
0
def autoRun(parent):
    # ------------------------------------------------------------------------------
    #   calls the functions necessary for writing the report
    # ------------------------------------------------------------------------------

    logTrack("Control (autoRun): starting")

    # ..............................................................................
    # If there's no data, there's nothing to do ...

    if Status.StatusQ == 0:
        logError("Control (autoRun): sorry, but SOME data have to be filled in before starting")

    # ..............................................................................
    # Consistency check ...

    if Status.StatusCC == 0:
        logMessage("Control (autoRun): starting consistency check")

        showMessage("Control (autoRun): first we start consistency check")

        Status.prj.copyQuestionnaire()
        nc = Status.mod.moduleCC.basicCheck()

        if nc > 0:
            checkOK = False
            if Status.UserInteractionLevel in ["semi-automatic", "interactive"]:
                Status.mod.moduleCC.updatePanel()
                cf = conflictFrame(parent)
                cf.Show()
            else:
                showMessage(
                    "Control (autoRun): data conflicts detected.\n"
                    + "Don't know yet what to do in this case, as I'm in automatic mode"
                )
            Status.main.tree.SelectItem(Status.main.qCC, select=True)

        nc = Status.mod.moduleCC.basicCheck(estimate=True)

        if nc > 0:
            checkOK = False
            if Status.UserInteractionLevel in ["semi-automatic", "interactive"]:
                Status.mod.moduleCC.updatePanel()
                cf = conflictFrame(parent)
                cf.Show()
            else:
                showMessage(
                    "Control (autoRun): data conflicts detected.\n"
                    + "Don't know yet what to do in this case, as I'm in automatic mode"
                )
            Status.main.tree.SelectItem(Status.main.qCC, select=True)

        else:
            checkOK = True
            showMessage(
                "Control (autoRun): congratulations. data are consistent.\n"
                + "now let's continue calculating some energy balances"
            )

            Status.prj.setActiveAlternative(0, checked=True)
            Status.mod.moduleEA.update()
            Status.main.tree.SelectItem(Status.main.qEA4a, select=True)

    else:
        logTrack("Control (autoRun): project already checked")

    Status.mod.moduleEA.update()
    Status.main.tree.SelectItem(Status.main.qEA4b, select=True)

    if Status.NoOfAlternatives >= 5:
        showMessage(
            "You already have a lot of alternative proposals in your study"
            + "Delete some of them and then call me again ..."
        )
        return

    # ..............................................................................
    # Benchmarking

    pass  # for the future

    # ..............................................................................
    # Now let's create some alternative proposals

    # ..............................................................................
    # Alternative proposal 1: Heat recovery only

    ret = askConfirmation(
        "First let's test the remaining heat recovery potential (Alternative 1)\n"
        + "The result will be used as base for system optimisation"
    )

    if ret == wx.ID_NO:
        ret = askConfirmation("Do You want to interrupt the auto-design ?")
        if ret == wx.ID_YES:
            return

    shortName = "Heat recovery (HR)"
    description = "EINSTEIN default design of heat recovery system"
    basedOn = 0

    Status.prj.createNewAlternative(basedOn, shortName, description)

    if Status.HRTool == "PE2":
        Status.mod.moduleHR.runHRDesign()
    else:
        Status.mod.moduleHR.runHRModule()

    # Finally check the boiler dimensioning for the remaining heat demand
    #    Status.mod.moduleBB.designAssistant()

    Status.mod.moduleEA.update()
    Status.main.tree.SelectItem(Status.main.qEA4b, select=True)

    # ..............................................................................
    # Alternative proposal 2: Heat recovery + solar system

    ret = askConfirmation("Now let's try to install a solar system (Alternative 2)\n")

    if ret == wx.ID_NO:
        ret = askConfirmation("Do You want to interrupt the auto-design ?")
        if ret == wx.ID_YES:
            return

    shortName = "Solar thermal"
    description = "EINSTEIN default design of a solar thermal system"
    basedOn = 1

    Status.prj.createNewAlternative(basedOn, shortName, description)

    Status.mod.moduleHR.runHRModule()

    Status.mod.moduleST.initPanel()
    Status.mod.moduleST.updatePanel()
    Status.int.GData.update({"ST Config": [50.0, "<any>", 300.0]})
    Status.mod.moduleST.setUserDefinedPars()
    Status.mod.moduleST.designAssistant1()

    Status.mod.moduleST.updatePanel()

    Status.mod.moduleBB.initPanel()  # preparation sequence of HP Module
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleBB.designAssistant()
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleEA.update()
    Status.main.tree.SelectItem(Status.main.qST, select=True)

    # ..............................................................................
    # Alternative proposal 3: Heat recovery + heat pump

    ret = askConfirmation("Now let's try to install a heat pump (Alternative 3)\n")

    if ret == wx.ID_NO:
        ret = askConfirmation("Do You want to interrupt the auto-design ?")
        if ret == wx.ID_YES:
            return

    shortName = "Heat pump"
    description = "EINSTEIN default design of a heat pump based system"
    basedOn = 1

    Status.prj.createNewAlternative(basedOn, shortName, description)

    Status.mod.moduleHP.initPanel()  # preparation sequence of HP Module
    Status.mod.moduleHP.updatePanel()

    (mode, HPList) = Status.mod.moduleHP.designAssistant1()

    if len(HPList) > 0:
        HPId = HPList[0]  # in automatic mode just take first in the list
        logMessage(_("Control (autoRun): %s possible HP models found") % len(HPList))
    else:
        HPId = -1
        logMessage(_("Control (autoRun): no heat pump application possible"))

    Status.mod.moduleHP.designAssistant2(HPId)
    Status.mod.moduleHP.updatePanel()

    # Finally check the boiler dimensioning for the remaining heat demand

    Status.mod.moduleBB.initPanel()  # preparation sequence of HP Module
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleBB.designAssistant()
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleEA.update()
    Status.main.tree.SelectItem(Status.main.qHP, select=True)

    # ..............................................................................
    # Alternative proposal 4: New boiler cascade

    ret = askConfirmation("Now let's try to install a new boiler cascade (Alternative 4)\n")

    if ret == wx.ID_NO:
        ret = askConfirmation("Do You want to interrupt the auto-design ?")
        if ret == wx.ID_YES:
            return

    shortName = "Boiler cascade"
    description = "EINSTEIN default design of a new boiler cascade"
    basedOn = 1

    Status.prj.createNewAlternative(basedOn, shortName, description)

    Status.mod.moduleBB.initPanel()  # preparation sequence of HP Module
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleBB.designAssistant()
    Status.mod.moduleBB.updatePanel()

    # Finally check the boiler dimensioning for the remaining heat demand

    #    Status.mod.moduleBB.designAssistant()

    Status.mod.moduleEA.update()
    Status.main.tree.SelectItem(Status.main.qBB, select=True)

    # ..............................................................................
    # Alternative proposal 5: And now lets mix up everything

    ret = askConfirmation("Now let's try to combine everything (Alternative 5)\n")

    if ret == wx.ID_NO:
        ret = askConfirmation("Do You want to interrupt the auto-design ?")
        if ret == wx.ID_YES:
            return

    shortName = "EINSTEIN Super Mix"
    description = "EINSTEIN default design of a new boiler cascade"
    basedOn = 3

    Status.prj.createNewAlternative(basedOn, shortName, description)

    Status.mod.moduleST.initPanel()
    Status.mod.moduleST.updatePanel()
    Status.int.GData.update({"ST Config": [50.0, "<any>", 300.0]})
    Status.mod.moduleST.setUserDefinedPars()
    Status.mod.moduleST.designAssistant1()

    Status.mod.moduleST.updatePanel()

    Status.mod.moduleBB.initPanel()  # preparation sequence of HP Module
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleBB.designAssistant()
    Status.mod.moduleBB.updatePanel()

    Status.mod.moduleEA.update()
    #    Status.main.tree.SelectItem(Status.main.qEA3, select=True)

    # ..............................................................................
    # End of the journey

    Status.main.tree.SelectItem(Status.main.qCS1, select=True)

    showMessage("We arrived at the end of the journey\n" + "Have a look on the results ...")