# -*- coding: iso-8859-1 -*-
#
#-------------------------------------------------------------------------------
# Code_Saturne version 1.3
# ------------------------
#
#
# This file is part of the Code_Saturne User Interface, element of the
# Code_Saturne CFD tool.
#
# Copyright (C) 1998-2007 EDF S.A., France
#
# contact: saturne-support@edf.fr
#
# The Code_Saturne User Interface is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
#
# The Code_Saturne User Interface is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Code_Saturne Kernel; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA
#
#-------------------------------------------------------------------------------
"""
This module defines the coal combustion thermal flow modelling management.
This module contains the following classes and function:
- CoalCombustionModel
- CoalCombustionView
- PageText
- CoalCombustionTestCase
"""
#-------------------------------------------------------------------------------
# Library modules import
#-------------------------------------------------------------------------------
import sys, unittest
import Tix
from Tkconstants import *
#-------------------------------------------------------------------------------
# Application modules import
#-------------------------------------------------------------------------------
from Base.Common import *
import Base.Toolbox as Tool
import Base.Dialog as Dialog
import Base.TkPage as TkPage
import Pages.CoalThermoChemistry as CoalThermoChemistry
import Pages.IdentityAndPathes as IdentityAndPathes
from Base.XMLvariables import Variables
from Pages.FluidCharacteristics import FluidCharacteristicsModel
import Pages.BoundConditions as BoundConditions
#-------------------------------------------------------------------------------
# Coal combustion model class
#-------------------------------------------------------------------------------
class CoalCombustionModel(Variables):
"""
"""
def __init__(self, case):
"""
Constructor.
"""
self.case = case
nModels = self.case.xmlGetNode('thermophysical_models')
self.node_lagr = self.case.xmlGetNode('lagrangian', 'model')
self.node_turb = nModels.xmlGetNode('turbulence', 'model')
self.node_gas = nModels.xmlInitNode('gas_combustion', 'model')
self.node_coal = nModels.xmlInitNode('pulverized_coal', 'model')
self.node_joule = nModels.xmlInitNode('joule_effect', 'model')
self.node_therm = nModels.xmlInitNode('thermal_scalar', 'model')
self.coalCombustionModel = ('off', 'coal_homo', 'coal_lagr')
def createModel (self) :
model = CoalThermoChemistry.CoalThermoChemistryModel("dp_FCP", self.case)
self.createModelScalars(model)
self.createModelProperties(model)
def defaultCoalCombustionValues(self):
"""
Return in a dictionnary which contains default values.
"""
default = {}
default['model'] = "off"
return default
def getAllCoalCombustionModels(self):
"""
Return all defined coal combustion models in a tuple.
"""
return self.coalCombustionModel
def coalCombustionModelsList(self):
"""
Create a tuple with the coal combustion models allowed
by the analysis features.
"""
coalCombustionList = self.coalCombustionModel
if self.node_lagr and self.node_lagr['model'] != 'off':
coalCombustionList = ('off', 'coal_homo')
if self.node_turb['model'] not in ('k-epsilon',
'k-epsilon-PL',
'Rij-epsilon',
'Rij-SSG',
'v2f-phi',
'k-omega-SST'):
coalCombustionList = ('off',)
return coalCombustionList
def setCoalCombustionModel(self, model):
"""
Update the coal combustion model markup from the XML document.
"""
if model not in self.coalCombustionModelsList():
msg = "The model " + model + " is not in the coal combustion models list"
raise ValueError, msg
if model == 'off':
self.node_coal['model'] = 'off'
else:
self.node_gas['model'] = 'off'
self.node_coal['model'] = model
self.node_joule['model'] = 'off'
self.node_therm['model'] = 'off'
self.setCoalCombustionDensity(model)
def setCoalCombustionDensity(self, model):
"""
Update the coal combustion model markup from the XML document.
"""
mdl = FluidCharacteristicsModel(self.case)
if model == 'off':
w = mdl.node_density.xmlGetDouble('initial_value')
if w == None:
v = mdl.defaultFluidCharacteristicsValues()['density']
mdl.node_density.xmlSetData('initial_value',v)
mdl.setChoiceNode(mdl.node_density, 'constant')
mdl.node_density.xmlInitNode('listing_printing', status='off')
mdl.node_density.xmlInitNode('postprocessing_recording', status='off')
v = mdl.defaultFluidCharacteristicsValues()['thermal_conductivity']
mdl.node_cond.xmlSetData('initial_value',v)
mdl.setChoiceNode(mdl.node_cond, 'constant')
mdl.node_cond.xmlInitNode('listing_printing', status='off')
mdl.node_cond.xmlInitNode('postprocessing_recording', status='off')
else:
mdl.setChoiceNode(mdl.node_density, 'variable')
mdl.node_density.xmlRemoveChild('initial_value')
mdl.node_density.xmlRemoveChild('listing_printing')
mdl.node_density.xmlRemoveChild('postprocessing_recording')
mdl.node_cond.xmlRemoveNode()
def getCoalCombustionModel(self):
"""
Return the current coal combustion model.
"""
model = self.node_coal['model']
if model not in self.coalCombustionModelsList():
model = self.defaultCoalCombustionValues()['model']
self.setCoalCombustionModel(model)
else:
self.setCoalCombustionDensity(model)
return model
def createModelScalars(self , thermoChemistryModel):
"""
Enables model scalar
"""
coalsNumber = thermoChemistryModel.getCoals().getCoalNumber()
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
#
# delete old scalars
#self.deleteAllModelScalars(self.node_coal)
#
# add new scalars
baseNames = ["XCK_CP", "XCH_CP", "NP_CP", "ENT_CP"]
for baseName in baseNames:
for classe in range(0,classesNumber):
name = '%s%2.2i' % (baseName, classe+1)
self.setNewModelScalar(self.node_coal, name)
baseNames = [ "Fr_MV1", "Fr_MV2"]
for baseName in baseNames:
for coal in range(0,coalsNumber):
name = '%s%2.2i' % (baseName, coal+1)
self.setNewModelScalar(self.node_coal, name)
self.setNewModelScalar(self.node_coal, "Enthalpy")
self.setNewModelScalar(self.node_coal, "Fr_HET")
self.setNewModelScalar(self.node_coal, "Var_AIR")
def createCoalModelScalars(self , thermoChemistryModel ):
"""
Enables model scalar
"""
coalsNumber = thermoChemistryModel.getCoals().getCoalNumber()
coalClassesNumber = thermoChemistryModel.getCoals().getClassesNumberList()[coalsNumber - 1]
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
#
# add new scalars
baseNames = ["XCK_CP", "XCH_CP", "NP_CP", "ENT_CP"]
for baseName in baseNames:
for classe in range(classesNumber - coalClassesNumber, classesNumber):
name = '%s%2.2i' % (baseName, classe+1)
self.setNewModelScalar(self.node_coal, name)
baseNames = [ "Fr_MV1", "Fr_MV2"]
for baseName in baseNames:
name = '%s%2.2i' % (baseName, coalsNumber)
self.setNewModelScalar(self.node_coal, name)
def createModelProperties(self, thermoChemistryModel):
"""
Create model properties
"""
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
#
# delete old properties
#self.deleteAllModelProperties(self.node_coal)
#
# create new properties
self.setNewProperty(self.node_coal, "XM")
baseNames = ["Temp_CP", "Rho_CP", "Dia_CK", "Ga_DCH",
"Ga_DV1", "Ga_DV2", "Ga_HET", "Frm_CP"]
for baseName in baseNames:
for classe in range(0,classesNumber):
name = '%s%2.2i' % (baseName, classe+1)
self.setNewProperty(self.node_coal, name)
self.setNewProperty(self.node_coal, "Temp_GAZ")
self.setNewProperty(self.node_coal, "ROM_GAZ")
self.setNewProperty(self.node_coal, "YM_CHx1m")
self.setNewProperty(self.node_coal, "YM_CHx2m")
self.setNewProperty(self.node_coal, "YM_CO")
self.setNewProperty(self.node_coal, "YM_O2")
self.setNewProperty(self.node_coal, "YM_CO2")
self.setNewProperty(self.node_coal, "YM_H2O")
self.setNewProperty(self.node_coal, "YM_N2")
self.setNewProperty(self.node_coal, "ntLuminance_4PI")
def createCoalModelProperties(self, thermoChemistryModel):
"""
Create model properties
"""
coalsNumber = thermoChemistryModel.getCoals().getCoalNumber()
coalClassesNumber = thermoChemistryModel.getCoals().getClassesNumberList()[coalsNumber-1]
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
#
# delete old properties
#self.deleteAllModelProperties(self.node_coal)
#
# create new properties
baseNames = ["Temp_CP", "Rho_CP", "Dia_CK", "Ga_DCH",
"Ga_DV1", "Ga_DV2", "Ga_HET", "Frm_CP"]
for baseName in baseNames:
for classe in range(classesNumber - coalClassesNumber, classesNumber):
name = '%s%2.2i' % (baseName, classe+1)
self.setNewProperty(self.node_coal, name)
def deleteCoalModelProperties(self, thermoChemistryModel, coalNumber):
"""
delete model properties
"""
classMin = 0
for coal in range(0, coalNumber):
classMin += thermoChemistryModel.getCoals().getClassesNumberList()[coal]
classMax = classMin + thermoChemistryModel.getCoals().getClassesNumberList()[coalNumber]
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
baseNames = ["Temp_CP", "Rho_CP", "Dia_CK", "Ga_DCH",
"Ga_DV1", "Ga_DV2", "Ga_HET", "Frm_CP"]
#
# Remove coal classes
nodeList = self.node_coal.xmlGetNodeList('property')
if nodeList != None:
for node in nodeList :
nameNode =node['name']
for baseName in baseNames:
for classe in range(classMin, classMax):
name = '%s%2.2i' % (baseName, classe+1)
if ( nameNode == name):
node.xmlRemoveNode()
#
# Rename other classes
nodeList = self.node_coal.xmlGetNodeList('property')
delta = classMax - classMin
if nodeList != None:
for node in nodeList:
try:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(classMax+1, classesNumber+1):
name = '%s%2.2i' % (oldName[:-2], oldNum-delta)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
except:
pass
def deleteCoalModelScalars(self, thermoChemistryModel, coalNumber):
"""
delete model scalars
"""
classMin = 0
for coal in range(0, coalNumber):
classMin += thermoChemistryModel.getCoals().getClassesNumberList()[coal]
classMax = classMin + thermoChemistryModel.getCoals().getClassesNumberList()[coalNumber]
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
coalsNumber = thermoChemistryModel.getCoals().getCoalNumber()
baseNames = ["XCK_CP", "XCH_CP", "NP_CP", "ENT_CP"]
#
# Remove coal classes
nodeList = self.node_coal.xmlGetNodeList('scalar', 'name')
if nodeList != None:
for node in nodeList :
nameNode = node['name']
for baseName in baseNames:
for classe in range(classMin, classMax):
name = '%s%2.2i' % (baseName, classe+1)
if (nameNode == name):
node.xmlRemoveNode()
#
# Rename other classes
nodeList = self.node_coal.xmlGetNodeList('scalar')
delta = classMax - classMin
if nodeList != None:
for node in nodeList:
try:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(classMax+1, classesNumber+1):
name = '%s%2.2i' % (oldName[:-2], oldNum-delta)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
except:
pass
#
# Remove coal scalars
baseNames = [ "Fr_MV1", "Fr_MV2"]
nodeList = self.node_coal.xmlGetNodeList('scalar')
if nodeList != None:
for node in nodeList :
nameNode = node['name']
for baseName in baseNames:
name = '%s%2.2i' % (baseName, coalNumber+1)
if (nameNode == name):
node.xmlRemoveNode()
#
# Rename other coals
nodeList = self.node_coal.xmlGetNodeList('scalar')
if nodeList != None:
for node in nodeList:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(coalNumber+1, coalsNumber+1):
name = '%s%2.2i' % (oldName[:-2], oldNum-1)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
def deleteClassModelScalars(self, thermoChemistryModel, coalNumber, classeNumber):
"""
delete model scalars
"""
classNum = 0
if (coalNumber >= 1) :
for coal in range(0, coalNumber - 1):
classNum += thermoChemistryModel.getCoals().getClassesNumberList()[coal]
classNum += classeNumber
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
baseNames = ["XCK_CP", "XCH_CP", "NP_CP", "ENT_CP"]
#
# Remove coal classes
nodeList = self.node_coal.xmlGetNodeList('scalar')
if nodeList != None:
for node in nodeList :
nodeName = node['name']
for baseName in baseNames:
name = '%s%2.2i' % (baseName, classNum+1)
if (nodeName == name):
node.xmlRemoveNode()
#
# Rename other classes
nodeList = self.node_coal.xmlGetNodeList('scalar')
if nodeList != None:
for node in nodeList:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(classNum + 1, classesNumber + 1):
name = '%s%2.2i' % (oldName[:-2], oldNum-1)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
def deleteClassModelProperties(self, thermoChemistryModel, coalNumber, classeNumber):
"""
delete model scalars
"""
classNum = 0
for coal in range(0, coalNumber):
classNum += thermoChemistryModel.getCoals().getClassesNumberList()[coal]
classNum += classeNumber
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
baseNames = ["Temp_CP", "Rho_CP", "Dia_CK", "Ga_DCH",
"Ga_DV1", "Ga_DV2", "Ga_HET", "Frm_CP"]
#
# Remove coal classes
nodeList = self.node_coal.xmlGetNodeList('property')
if nodeList != None:
for node in nodeList :
nodeName = node['name']
for baseName in baseNames:
name = '%s%2.2i' % (baseName, classNum+1)
if (nodeName == name):
node.xmlRemoveNode()
#
# Rename other classes
nodeList = self.node_coal.xmlGetNodeList('property')
if nodeList != None:
for node in nodeList:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(classNum + 1, classesNumber + 1):
name = '%s%2.2i' % (oldName[:-2], oldNum-1)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
def createClassModelProperties(self, thermoChemistryModel, coalNumber):
"""
Create model properties
"""
classNum = 0
for coal in range(0, coalNumber):
classNum += thermoChemistryModel.getCoals().getClassesNumberList()[coal]
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
#
# delete old properties
#self.deleteAllModelProperties(self.node_coal)
#
# create new properties
baseNames = ["Temp_CP", "Rho_CP", "Dia_CK", "Ga_DCH",
"Ga_DV1", "Ga_DV2", "Ga_HET", "Frm_CP"]
#
# Rename other classes
nodeList = self.node_coal.xmlGetNodeList('property')
if nodeList != None:
for node in nodeList:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(classNum, classesNumber + 1):
name = '%s%2.2i' % (oldName[:-2], oldNum + 1)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
#
# create new properties
for i in range(len(baseNames)):
name = '%s%2.2i' % (baseNames[i], classNum)
self.setNewProperty(self.node_coal, name)
def createClassModelScalars(self, thermoChemistryModel, coalNumber):
"""
Create model properties
"""
classNum = 0
for coal in range(0, coalNumber):
classNum += thermoChemistryModel.getCoals().getClassesNumberList()[coal]
classesNumber = sum(thermoChemistryModel.getCoals().getClassesNumberList())
#
# delete old properties
#self.deleteAllModelProperties(self.node_coal)
#
# create new properties
baseNames = ["XCK_CP", "XCH_CP", "NP_CP", "ENT_CP"]
#
# Rename other classes
nodeList = self.node_coal.xmlGetNodeList('scalar')
if nodeList != None:
for node in nodeList:
oldName = node['name']
if oldName[:-2] in baseNames :
oldNum = int(oldName[-2:])
if oldNum in range(classNum, classesNumber + 1):
name = '%s%2.2i' % (oldName[:-2], oldNum+1)
node['name'] = name
if node['label'] == oldName:
node['label'] = name
#
# create new scalars
for i in range(len(baseNames)):
name = '%s%2.2i' % (baseNames[i], classNum)
self.setNewModelScalar(self.node_coal, name)
#
#-------------------------------------------------------------------------------
# Main view class
#-------------------------------------------------------------------------------
class Hlist:
def __init__(self, stbar, parent):
self.parent = parent
self.stbar = stbar
self.h = None
self.entriesNumber = 0
self.currentEntry = None
self.t = PageText()
self.entriesNumber = 0
def cancelSelection(self, Entries):
"""
Fonction for the Popup Menu.
Blank the selection.
"""
self.h.hlist.selection_clear()
self.currentEntry = None
## def eraseEntries(self, Entries):
## for entry in Entries:
## entry.delete(0,END)
def _make_style(self):
"""
Define beautyfull style in order to display columns in the Hlist.
"""
self.style={}
self.style['header'] = Tix.DisplayStyle(Tix.TEXT,
refwindow=self.parent,
anchor=CENTER,
padx=5, pady=2,
font=fB)
self.style['valb'] = Tix.DisplayStyle(Tix.TEXT,
refwindow=self.parent,
padx=5,
selectforeground='#fefefe',
font=fB)
self.style['val'] = Tix.DisplayStyle(Tix.TEXT,
refwindow=self.parent,
anchor=CENTER,
padx=5,
selectforeground='#fefefe',
font=fN)
def Init(self):
pass
class CoalsHlist(Hlist):
def __init__(self, stbar, parent, parentBox, funcSelect, funcCreate, funcCancel):
Hlist.__init__(self,stbar, parent)
self.h = Tix.ScrolledHList(parent, options='hlist.columns 1 hlist.header 1 ' )
self.h.config(scrollbar="auto ",width=100, height=90)
Hlist._make_style(self)
self.h.hlist.config(selectmode='single',
browsecmd=funcSelect,
bg=wm['hlistbackground'])
self.h.hsb.config(width=10, bd=1)
self.h.vsb.config(width=10, bd=1)
self.h.pack(expand=1, fill=BOTH, padx=10, pady=10, side=LEFT)
# Create the headers
#
self.h.hlist.header_create(0, itemtype=Tix.TEXT, text=self.t.NUMBER,
style=self.style['header'])
# Let configure the appearance of the Hlist subwidget
#
self.h.hlist.config(separator='.', width=25, height=5, drawbranch=0, indent=10)
# Create the mouse selection instance
#
self.box = Tix.ButtonBox(parentBox, orientation=VERTICAL, relief=FLAT)
self.box.add('create', text=self.t.CREATE)
self.box.create.bind('<Button-1>', funcCreate)
self.box.add('erase', text=self.t.ERASE)
self.box.erase.bind('<Button-1>',funcCancel)
self.box.grid(row=0, column=2, rowspan=4, padx=15, pady=2, sticky=W)
def areaInfo(self):
"""
Return info from the argument entry.
"""
# Here we must call the tk function directly without passing in
# Tix.py, because of a bug in tix8.1 in the Hlist.item_cget function
#
h = self.h.hlist
number = h.tk.call(h, 'item', 'cget', self.currentEntry, 0, '-text')
return number
def Init(self, model):
"""
Method for the _initializeWidgets method.
"""
self.cancelSelection(self.currentEntry)
try:
self.h.hlist.delete_all()
except:
pass
CoalsNumber = model.getCoals().getNumber()
for number in range(0,CoalsNumber):
self.insertHlist(number + 1)
def insertHlist(self, number):
"""
Create the item Hlist associated with the new boundary definition.
"""
self.stbar.busy()
#self.entriesNumber += 1
# if not label: label = "label" + "_" + repr(entriesNumber)
name = 'item' + repr(number)
#name = 'item' + repr(self.entriesNumber)
self.h.hlist.add(name, itemtype=Tix.TEXT, text = self.t.COAL+" "+str(number),
style=self.style['valb'])
self.stbar.idle()
return number
class ClassesHlist(Hlist):
def __init__(self, stbar, parent, funcSelect):
Hlist.__init__(self, stbar, parent)
self.h = Tix.ScrolledHList(self.parent, options='hlist.columns 3 hlist.header 1 ' )
self.h.config(scrollbar="auto +y", width=190, height=150)
self._make_style()
self.h.hlist.config(selectmode='single',
browsecmd=funcSelect,
bg=wm['hlistbackground'])
self.h.hsb.config(width=10, bd=1)
self.h.vsb.config(width=10, bd=1)
self.h.pack(expand=1, fill=BOTH, padx=10, pady=10, side=TOP)
# Create the headers
#
self.h.hlist.header_create(0, itemtype=Tix.TEXT, text=self.t.NUMBER,
style=self.style['header'])
self.h.hlist.header_create(1, itemtype=Tix.TEXT, text=self.t.CLASSDIAM,
style=self.style['header'])
self.h.hlist.column_width(2,0)
# Let configure the appearance of the Hlist subwidget
#
self.h.hlist.config(separator='.', width=25, height=5, drawbranch=0, indent=10)
def areaInfo(self):
"""
Return info from the argument entry.
"""
# Here we must call the tk function directly without passing in
# Tix.py, because of a bug in tix8.1 in the Hlist.item_cget function
#
h = self.h.hlist
number = h.tk.call(h, 'item', 'cget', self.currentEntry, 0, '-text')
initDiameter = h.tk.call(h, 'item', 'cget', self.currentEntry, 1, '-text')
return number, initDiameter
def Init(self, coal, entry ):
"""
Method for the _initializeWidgets method.
"""
self.cancelSelection(self.currentEntry)
entry.delete(0, END)
try:
self.h.hlist.delete_all()
except:
pass
ClassesNumber = coal.getClassesNumber()
initDiameters = coal.getInitDiameterClasses()
for number in range(0,ClassesNumber):
self.insertHlist(number + 1, initDiameters[number] )
def insertHlist(self, number, initialDiameter):
"""
Create the item Hlist associated with the new boundary definition.
"""
self.stbar.busy()
#self.entriesNumber += 1
name = 'item' + repr(number)
self.h.hlist.add(name, itemtype=Tix.TEXT, text = self.t.CLASS+" "+str(number),
style=self.style['valb'])
self.h.hlist.item_create(name, 1, itemtype=Tix.TEXT,
text = str(initialDiameter),
style = self.style['val'])
self.stbar.idle()
return number
def createHlist(self, event = None):
pass
class CoalCombustionView(TkPage.Page):
"""
Class to open coal combustion Page.
"""
def _dependsPages(self, name):
"""
Construction of the list of dependencies Pages.
"""
pass
def _tkControlVariables(self):
"""
Tkinter variables declaration.
"""
self.coal_combustion = Tix.StringVar()
self.classDiameter = Tix.DoubleVar()
self.CComposition = Tix.DoubleVar()
self.HComposition = Tix.DoubleVar()
self.OComposition = Tix.DoubleVar()
self.CCompositionCoke = Tix.DoubleVar()
self.HCompositionCoke = Tix.DoubleVar()
self.OCompositionCoke = Tix.DoubleVar()
self.PCIType = Tix.StringVar()
self.typeReact = Tix.StringVar()
self.PCI = Tix.DoubleVar()
self.PCICoke = Tix.DoubleVar()
self.CP = Tix.DoubleVar()
self.Density = Tix.DoubleVar()
self.AshesRatio = Tix.DoubleVar()
self.AshesEnthalpy = Tix.DoubleVar()
self.AshesCP = Tix.DoubleVar()
self.Y1 = Tix.DoubleVar()
self.Y2 = Tix.DoubleVar()
self.A1 = Tix.DoubleVar()
self.A2 = Tix.DoubleVar()
self.E1 = Tix.DoubleVar()
self.E2 = Tix.DoubleVar()
self.preExpoCst = Tix.DoubleVar()
self.activEnergy = Tix.DoubleVar()
self.autoY1 = Tix.StringVar()
self.autoY2 = Tix.StringVar()
def getIY1(self, event=None):
self.stbar.busy()
stat = self.autoY1.get()
if stat == "on":
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setIY1CH(0)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
else :
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setIY1CH(1)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.ActiveWidgetIY1(stat)
self.stbar.idle()
def getIY2(self, event=None):
self.stbar.busy()
stat = self.autoY2.get()
if stat == "on":
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setIY2CH(0)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
else :
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setIY2CH(1)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.ActiveWidgetIY2(stat)
self.stbar.idle()
def _pageControl(self):
"""
Instantiate the lagrangian modelling class.
"""
self.model = CoalCombustionModel(self.case)
self.bdModel = BoundConditions.BoundaryConditionsModel(self.case)
self.coalThermoChModel = CoalThermoChemistry.CoalThermoChemistryModel("dp_FCP",self.case)
##coal = self.coalThermoChModel.getCoals().getCoal(1)
self.coalNumber = 0
###
### Attention voir comment creer un charbon quand il n'y a pas de fichier dp_FCP !
####
t = PageText()
self.typePCIList = {'sec': t.SEC ,
'pur': t.PUR }
self.typeReactList = {'0.5': t.REACTORDER05 ,
'1': t.REACTORDER1 }
self.selectedEntryNb1p1h = None
def putCoalCombustionModel(self, event=None):
"""
"""
self.model.setCoalCombustionModel(self.coal_combustion.get())
def getPCIType(self, event=None):
"""
Return the selected type of boundary condition. Whatever the language,
type is allways in ('wall','inlet','outlet','symmetry').
"""
typePCI = self.PCIType.get()
for key in self.typePCIList.keys():
if key == typePCI :
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
if key == "sec" :
coal.setDry(1)
elif key == "pur":
coal.setDry(0)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
return typePCI
def getReactType(self, event=None):
"""
Return the selected type of boundary condition. Whatever the language,
type is allways in ('wall','inlet','outlet','symmetry').
"""
typeReact = self.typeReact.get()
for key in self.typeReactList.keys():
if self.typeReactList[key] == typeReact :
typeReact = key
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
if key == "0.5" :
coal.setIOCHET(0)
else:
coal.setIOCHET(1)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
return typeReact
def selectH2(self, entry=None):
"""
Browsecmd:
Every single Clik on the Button1 of the mouse send TWO signal to the GUI
the first one when man push the button, and the second one when the
button gets back.
Command:
Every double-Click and Return send only ONE signal to the GUI.
"""
self.H2.selectedEntry = self.H2.h.hlist.info_selection()
if not self.H2.selectedEntry:
self.nbp1e1.delete(0,END)
elif self.H2.currentEntry != self.H2.selectedEntry:
self.H2.currentEntry = self.H2.selectedEntry
number, initDiameter = self.H2.areaInfo()
self.nbp1e1.delete(0,END)
self.nbp1e1.insert(0,initDiameter)
self.nbp1e1.icursor(END)
def selectH1(self, entry=None):
"""
Browsecmd:
Every single Clik on the Button1 of the mouse send TWO signal to the GUI
the first one when man push the button, and the second one when the
button gets back.
Command:
Every double-Click and Return send only ONE signal to the GUI.
"""
#self.coalThermoChModel.save()
self.H1.selectedEntry = self.H1.h.hlist.info_selection()
if not self.H1.selectedEntry:
return
elif self.H1.currentEntry != self.H1.selectedEntry:
self.H1.currentEntry = self.H1.selectedEntry
h = self.H1.h
coals = self.coalThermoChModel.getCoals()
number = self.H1.areaInfo()
self.coalNumber = int(number.split()[1])
coal = coals.getCoal(self.coalNumber)
if len(self.H1.currentEntry) == 1:
#
# Classes
self.nbp1box.create.bind('<Button-1>', self.createH2)
self.nbp1box.create.configure(state=NORMAL)
self.nbp1box.erase.bind('<Button-1>', self.cancelH2)
self.nbp1box.erase.configure(state=NORMAL)
self.H2.Init(coal,self.nbp1e1)
if coal.getClassesNumber() >= 10:
self.nbp1box.create.unbind('<Button-1>')
self.nbp1box.create.configure(state=DISABLED)
if coal.getClassesNumber() <= 1:
self.nbp1box.erase.unbind('<Button-1>')
self.nbp1box.erase.configure(state=DISABLED)
#
# General (composition)
self.nbp2e1.delete(0,END)
self.nbp2e1.insert(0,coal.getCDryComposition())
self.nbp2e1.icursor(END)
self.nbp2e2.delete(0,END)
self.nbp2e2.insert(0,coal.getHDryComposition())
self.nbp2e2.icursor(END)
self.nbp2e3.delete(0,END)
self.nbp2e3.insert(0,coal.getODryComposition())
self.nbp2e3.icursor(END)
self.nbp2e4.delete(0,END)
self.nbp2e4.insert(0,coal.getPCIValue())
self.nbp2e4.icursor(END)
self.nbp2e5.delete(0,END)
self.nbp2e5.insert(0,coal.getThermalCapacity())
self.nbp2e5.icursor(END)
self.nbp2e6.delete(0,END)
self.nbp2e6.insert(0,coal.getDensity())
self.nbp2e6.icursor(END)
#
# Coke
self.nbp3e1.delete(0,END)
self.nbp3e1.insert(0,coal.getCDryCompositionCoke())
self.nbp3e1.icursor(END)
self.nbp3e2.delete(0,END)
self.nbp3e2.insert(0,coal.getHDryCompositionCoke())
self.nbp3e2.icursor(END)
self.nbp3e3.delete(0,END)
self.nbp3e3.insert(0,coal.getODryCompositionCoke())
self.nbp3e3.icursor(END)
self.nbp3e4.delete(0,END)
self.nbp3e4.insert(0,coal.getPCICokeValue())
self.nbp3e4.icursor(END)
#
# Ashes
self.nbp4e1.delete(0,END)
self.nbp4e1.insert(0,coal.getAshesRatio())
self.nbp4e1.icursor(END)
self.nbp4e2.delete(0,END)
self.nbp4e2.insert(0,coal.getAshesFormingEnthalpy())
self.nbp4e2.icursor(END)
self.nbp4e3.delete(0,END)
self.nbp4e3.insert(0,coal.getAshesThermalCapacity())
self.nbp4e3.icursor(END)
#
# Devolatilisation
stat = self.coalThermoChModel.getCoals().getCoal(self.coalNumber).getIY1CH()
if stat == 0 :
bstat = "on"
else:
bstat = "off"
self.autoY1.set(bstat)
self.ActiveWidgetIY1(bstat)
self.nbp5e1.delete(0,END)
self.nbp5e1.insert(0,coal.getY1CH())
self.nbp5e1.icursor(END)
stat = self.coalThermoChModel.getCoals().getCoal(self.coalNumber).getIY2CH()
if stat == 0 :
bstat = "on"
else:
bstat = "off"
self.autoY2.set(bstat)
self.ActiveWidgetIY2(bstat)
self.nbp5e2.delete(0,END)
self.nbp5e2.insert(0,coal.getY2CH())
self.nbp5e2.icursor(END)
self.nbp5e3.delete(0,END)
self.nbp5e3.insert(0,coal.getA1CH())
self.nbp5e3.icursor(END)
self.nbp5e4.delete(0,END)
self.nbp5e4.insert(0,coal.getA2CH())
self.nbp5e4.icursor(END)
self.nbp5e5.delete(0,END)
self.nbp5e5.insert(0,coal.getE1CH())
self.nbp5e5.icursor(END)
self.nbp5e6.delete(0,END)
self.nbp5e6.insert(0,coal.getE2CH())
self.nbp5e6.icursor(END)
#
# Combustion heterogene
self.nbp6e1.delete(0,END)
self.nbp6e1.insert(0,coal.getAHETCH())
self.nbp6e1.icursor(END)
self.nbp6e2.delete(0,END)
self.nbp6e2.insert(0,coal.getEHETCH())
self.nbp6e2.icursor(END)
IOCHET = coal.getIOCHET()
if IOCHET == 0:
key = "0.5"
else:
key = "1"
self.typeReact.set(self.typeReactList[key])
Dry = coal.getDry()
if Dry == 0:
key = "pur"
## else:
elif Dry == 1:
key = "sec"
## self.PCIType.set(self.typePCIList[key])
self.PCIType.set(key)
def cancelH1(self, event = None):
""" cancel a coal"""
self.stbar.busy()
self.H1.selectedEntry = self.H1.h.hlist.info_selection()
if not self.H1.selectedEntry:
return
snumber = self.H1.areaInfo()
number = int(snumber.split()[1])
# update Scalars and properties
self.model.deleteCoalModelScalars(self.coalThermoChModel, number - 1)
self.model.deleteCoalModelProperties(self.coalThermoChModel, number - 1)
# update boundary conditions (1/2)
self.bdModel.deleteCoalFlow(number-1, self.coalThermoChModel.getCoals().getNumber())
self.coalThermoChModel.getCoals().deleteCoal(number)
self.H1.Init(self.coalThermoChModel)
self.coalThermoChModel.save()
self.H1.box.create.configure(state=NORMAL)
self.H1.box.create.bind('<Button-1>', self.createH1)
if self.coalThermoChModel.getCoals().getNumber() <= 1:
self.H1.box.erase.configure(state=DISABLED)
self.H1.box.erase.unbind('<Button-1>')
#First coal is selected
first = 'item' + repr(1)
last = first
self.H1.h.hlist.selection_set(first, last)
self.selectH1()
self.stbar.idle()
def cancelH2(self, event = None):
""" cancel a class diameter"""
self.stbar.busy()
self.H2.selectedEntry = self.H2.h.hlist.info_selection()
if not self.H2.selectedEntry:
return
snumber, initDiameter = self.H2.areaInfo()
number = int(snumber.split()[1])
self.model.deleteClassModelProperties(self.coalThermoChModel, self.coalNumber, number - 1)
self.model.deleteClassModelScalars(self.coalThermoChModel, self.coalNumber, number - 1)
# update boundary conditions (1/2)
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
self.bdModel.deleteClassRatio(self.coalNumber, number - 1, coal.getClassesNumber())
self.bdModel.updateRatio(self.coalNumber)
coal.cancelInitDiameterClasses(number)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.H2.Init(coal,self.nbp1e1)
self.coalThermoChModel.save()
#self.model.createModelScalars(self.coalThermoChModel)
self.nbp1box.create.configure(state=NORMAL)
self.nbp1box.create.bind('<Button-1>', self.createH2)
if self.coalThermoChModel.getCoals().getCoal(self.coalNumber).getClassesNumber() <= 1:
self.nbp1box.erase.configure(state=DISABLED)
self.nbp1box.erase.unbind('<Button-1>')
first = 'item' + repr(1)
last = first
self.H2.h.hlist.selection_set(first, last)
self.selectH2()
self.stbar.idle()
def editH2(self, event = None):
""" update a class diameter"""
self.stbar.busy()
t = PageText()
self.H2.selectedEntry = self.H2.h.hlist.info_selection()
if not self.H2.selectedEntry:
return
snumber, oldDiameter = self.H2.areaInfo()
number = int(snumber.split()[1])
newDiameter = self.classDiameter.get()
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.updateInitDiameterClasses(number, newDiameter)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.H2.Init(coal,self.nbp1e1)
self.coalThermoChModel.save()
self.stbar.idle()
def createH1(self, event = None):
""" create a new coal"""
self.stbar.busy()
t = PageText()
# update model
coal = CoalThermoChemistry.Coal()
self.coalThermoChModel.getCoals().addCoal(coal)
self.H1.Init(self.coalThermoChModel)
self.coalThermoChModel.save()
# update Properties and scalars
self.model.createCoalModelProperties(self.coalThermoChModel)
self.model.createCoalModelScalars(self.coalThermoChModel)
# update Buttons
if self.coalThermoChModel.getCoals().getNumber() >= 3:
self.H1.box.create.configure(state=DISABLED)
self.H1.box.create.unbind('<Button-1>')
self.H1.box.erase.bind('<Button-1>', self.cancelH1)
self.H1.box.erase.configure(state=NORMAL)
# Coal created is selected
first = 'item' + repr(self.coalThermoChModel.getCoals().getNumber())
last = first
self.H1.h.hlist.selection_set(first, last)
self.selectH1()
self.stbar.idle()
def createH2(self, event = None):
""" create a new class"""
self.stbar.busy()
t = PageText()
try:
diameter = self.classDiameter.get()
except:
return
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.addInitDiameterClasses(diameter)
classesNb = coal.getClassesNumber()
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.H2.Init(coal,self.nbp1e1)
self.coalThermoChModel.save()
self.model.createClassModelScalars( self.coalThermoChModel, self.coalNumber)
self.model.createClassModelProperties(self.coalThermoChModel, self.coalNumber)
self.nbp1box.erase.configure(state=NORMAL)
self.nbp1box.erase.bind('<Button-1>', self.cancelH2)
if self.coalThermoChModel.getCoals().getCoal(self.coalNumber).getClassesNumber() >= 10:
self.nbp1box.create.configure(state=DISABLED)
self.nbp1box.create.unbind('<Button-1>')
# Coal created is selected
first = 'item' + repr(self.coalThermoChModel.getCoals().getCoal(self.coalNumber).getClassesNumber())
last = first
self.H2.h.hlist.selection_set(first, last)
self.selectH2()
self.stbar.idle()
def _createWidgets(self):
"""
Create the Page layout.
"""
t = PageText()
##lf = Tix.LabelFrame(self.myPage, bd=2,
## label=t.COALCOMBUSTION, relief=FLAT)
##lf.label.config(font=fT)
##lf.pack(side=TOP, fill=X, padx=10, pady=10)
#
########################################################
# NoteBook Page 1 Coals
########################################################
lf = Tix.LabelFrame(self.myPage, bd=2, label=t.COALSLIST, relief=FLAT)
lf.label.config(font=fT)
lf.pack(side=TOP)
self.w1 = Tix.Frame(lf.frame, relief=FLAT)
self.w1.pack(side=TOP)
self.w2 = Tix.Frame(self.w1, relief=FLAT)
self.w2.pack(side=RIGHT)
self.H1 = CoalsHlist(self.stbar, self.w1, self.w2, self.selectH1, self.createH1, self.cancelH1)
# Separator
#
s1 = Tix.Frame(lf.frame, height=2, bd=2, relief=SUNKEN)
s1.pack(side=TOP, fill=X)
nb = Tix.NoteBook(lf.frame)
nb.pack(expand=1, side=TOP, fill=BOTH)
#
# NoteBook
# ********
nb.nbframe.config(background=self.bg, backpagecolor=self.bg)
nb.nbframe.config(focuscolor=self.bg, inactivebackground=wm['inactivebackground'])
nb.nbframe.config(relief=RAISED)
nb.nbframe.config(font=fT, tabpadx='10', tabpady='2')
nb.add('page1', anchor='center', label=t.CLASSES )
nb.add('page2', anchor='center', label=t.GENERAL )
nb.add('page3', anchor='center', label=t.COKE )
nb.add('page4', anchor='center', label=t.ASHES )
nb.add('page5', anchor='center', label=t.DEVOLA )
nb.add('page6', anchor='center', label=t.COMBUSTION )
#
# NoteBook Page 1 Classes
# ************************
nbp1lf1 = Tix.LabelFrame(nb.page1, bd=2, label=t.CLASSES, relief=FLAT)
nbp1lf1.label.config(font=fT)
nbp1lf1.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp1w1 = Tix.Frame(nbp1lf1.frame, relief=FLAT)
self.nbp1w1.pack(side=TOP, padx=10, pady=10)
self.nbp1w2 = Tix.Frame(nbp1lf1.frame, relief=FLAT)
self.nbp1w2.pack(side=TOP, fill=X, pady=10)
self.H2 = ClassesHlist(self.stbar, self.nbp1w1, self.selectH2)
nbp1l1 = Tix.Label(self.nbp1w2, text=t.CLASSDIAM)
nbp1l1.grid(row=1, column=0, padx=3, pady=5, sticky=E)
self.nbp1e1 = Tix.Entry(self.nbp1w2, bd=2, width=15, textvariable=self.classDiameter)
self.nbp1e1.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp1box = Tix.ButtonBox(self.nbp1w2, orientation=VERTICAL, relief=FLAT)
self.nbp1box.add('create', text=t.CREATE)
self.nbp1box.create.bind('<Button-1>',TkPage.Callback(self.createH2))
self.nbp1box.add('modify', text=t.MODIFY)
self.nbp1box.modify.bind('<Button-1>',TkPage.Callback(self.editH2))
self.nbp1box.add('erase', text=t.ERASE)
self.nbp1box.erase.bind('<Button-1>',TkPage.Callback(self.cancelH2))
self.nbp1box.grid(row=0, column=2, rowspan=4, padx=15, pady=2, sticky=W)
#
# NoteBook Page 2 Général
# *************************
nbp2f1 = Tix.LabelFrame(nb.page2, bd=2, label=t.COMPOSITION, relief=FLAT)
nbp2f1.label.config(font=fT)
nbp2f1.pack(side=TOP , fill=X, padx=10, pady=10)
self.nbp2w1 = Tix.Frame(nbp2f1.frame, relief=FLAT)
self.nbp2w1.pack(side=TOP, padx=10, pady=10)
nbp2l1 = Tix.Label(self.nbp2w1, text=t.CCOMPOSITION)
nbp2l1.grid(row=1, column=0, padx=3, pady=5, sticky=E)
self.nbp2e1 = Tix.Entry(self.nbp2w1, bd=2, width=15, textvariable=self.CComposition)
self.nbp2e1.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp2e1.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp2e1.bind("<<Event>>",TkPage.Callback(self.getCComposition))
nbp2l2 = Tix.Label(self.nbp2w1, text=t.PERCENT)
nbp2l2.grid(row=1, column=2, padx=3, pady=5, sticky=E)
nbp2l3 = Tix.Label(self.nbp2w1, text=t.HCOMPOSITION)
nbp2l3.grid(row=2, column=0, padx=3, pady=5, sticky=E)
self.nbp2e2 = Tix.Entry(self.nbp2w1, bd=2, width=15, textvariable=self.HComposition)
self.nbp2e2.grid(row=2, column=1, padx=5, pady=5, sticky=W)
self.nbp2e2.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp2e2.bind("<<Event>>",TkPage.Callback(self.getHComposition))
nbp2l4 = Tix.Label(self.nbp2w1, text=t.PERCENT)
nbp2l4.grid(row=2, column=2, padx=3, pady=5, sticky=E)
nbp2l5 = Tix.Label(self.nbp2w1, text=t.OCOMPOSITION)
nbp2l5.grid(row=3, column=0, padx=3, pady=5, sticky=E)
self.nbp2e3 = Tix.Entry(self.nbp2w1, bd=2, width=15, textvariable=self.OComposition)
self.nbp2e3.grid(row=3, column=1, padx=5, pady=5, sticky=W)
self.nbp2e3.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp2e3.bind("<<Event>>",TkPage.Callback(self.getOComposition))
nbp2l6 = Tix.Label(self.nbp2w1, text=t.PERCENT)
nbp2l6.grid(row=3, column=2, padx=3, pady=5, sticky=E)
nbp2f2 = Tix.LabelFrame(nb.page2, bd=2, label=t.PROPERTIES, relief=FLAT)
nbp2f2.label.config(font=fT)
nbp2f2.pack(side=TOP, fill=X, padx=10, pady=10)
nbp2w2 = Tix.Frame(nbp2f2.frame, relief=FLAT)
nbp2w2.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp2b1 = Tix.OptionMenu(nbp2w2, options='menubutton.width 10')
self.nbp2b1.menubutton.config(bd=2, relief=RAISED)
self.nbp2b1.grid(row=1, column=3, padx=0, pady=5, sticky=W)
for key in self.typePCIList.keys():
## self.nbp2b1.add_command(self.typePCIList[key], label=self.typePCIList[key])
self.nbp2b1.add_command(key, label=self.typePCIList[key])
self.nbp2b1.config(variable=self.PCIType, command=self.getPCIType)
self.nbp2e4 = Tix.Entry(nbp2w2, bd=2, width=15, textvariable=self.PCI)
self.nbp2e4.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp2e4.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp2e4.bind("<<Event>>",TkPage.Callback(self.getPCI))
nbp2l7 = Tix.Label(nbp2w2, text=t.PCI)
nbp2l7.grid(row=1, column=0, padx=3, pady=5, sticky=E)
nbp2l8 = Tix.Label(nbp2w2, text=t.PCIUNIT)
nbp2l8.grid(row=1, column=2, padx=3, pady=5, sticky=E)
self.nbp2e5 = Tix.Entry(nbp2w2, bd=2, width=15, textvariable=self.CP)
self.nbp2e5.grid(row=2, column=1, padx=5, pady=5, sticky=W)
self.nbp2e5.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp2e5.bind("<<Event>>",TkPage.Callback(self.getThermalCapacity))
nbp2l9 = Tix.Label(nbp2w2, text=t.CP)
nbp2l9.grid(row=2, column=0, padx=3, pady=5, sticky=E)
nbp2l10 = Tix.Label(nbp2w2, text=t.CPUNIT)
nbp2l10.grid(row=2, column=2, padx=3, pady=5, sticky=E)
self.nbp2e6 = Tix.Entry(nbp2w2, bd=2, width=15, textvariable=self.Density)
self.nbp2e6.grid(row=3, column=1, padx=5, pady=5, sticky=W)
self.nbp2e6.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp2e6.bind("<<Event>>",TkPage.Callback(self.getDensity))
nbp2l11 = Tix.Label(nbp2w2, text=t.DENSITY)
nbp2l11.grid(row=3, column=0, padx=3, pady=5, sticky=E)
nbp2l12 = Tix.Label(nbp2w2, text=t.DENSITYUNIT)
nbp2l12.grid(row=3, column=2, padx=3, pady=5, sticky=E)
#
# NoteBook Page 3 Coke
# ***********************
nbp3lf1 = Tix.LabelFrame(nb.page3, bd=2, label=t.COMPOSITION, relief=FLAT)
nbp3lf1.label.config(font=fT)
nbp3lf1.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp3w1 = Tix.Frame(nbp3lf1.frame, relief=FLAT)
self.nbp3w1.pack(side=TOP, padx=10, pady=10)
nbp3l1 = Tix.Label(self.nbp3w1, text=t.CCOMPOSITION)
nbp3l1.grid(row=1, column=0, padx=3, pady=5, sticky=E)
self.nbp3e1 = Tix.Entry(self.nbp3w1, bd=2, width=15, textvariable=self.CCompositionCoke)
self.nbp3e1.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp3e1.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp3e1.bind("<<Event>>",TkPage.Callback(self.getCCompositionCoke))
nbp3l2 = Tix.Label(self.nbp3w1, text=t.PERCENT)
nbp3l2.grid(row=1, column=2, padx=3, pady=5, sticky=E)
nbp3l3 = Tix.Label(self.nbp3w1, text=t.HCOMPOSITION)
nbp3l3.grid(row=2, column=0, padx=3, pady=5, sticky=E)
self.nbp3e2 = Tix.Entry(self.nbp3w1, bd=2, width=15, textvariable=self.HCompositionCoke)
self.nbp3e2.grid(row=2, column=1, padx=5, pady=5, sticky=W)
self.nbp3e2.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp3e2.bind("<<Event>>",TkPage.Callback(self.getHCompositionCoke))
nbp3l4 = Tix.Label(self.nbp3w1, text=t.PERCENT)
nbp3l4.grid(row=2, column=2, padx=3, pady=5, sticky=E)
nbp3l5 = Tix.Label(self.nbp3w1, text=t.OCOMPOSITION)
nbp3l5.grid(row=3, column=0, padx=3, pady=5, sticky=E)
self.nbp3e3 = Tix.Entry(self.nbp3w1, bd=2, width=15, textvariable=self.OCompositionCoke)
self.nbp3e3.grid(row=3, column=1, padx=5, pady=5, sticky=W)
self.nbp3e3.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp3e3.bind("<<Event>>",TkPage.Callback(self.getOCompositionCoke))
nbp3l6 = Tix.Label(self.nbp3w1, text=t.PERCENT)
nbp3l6.grid(row=3, column=2, padx=3, pady=5, sticky=E)
nbp3lf2 = Tix.LabelFrame(nb.page3, bd=2, label=t.PROPERTIES, relief=FLAT)
nbp3lf2.label.config(font=fT)
nbp3lf2.pack(side=TOP, fill=X, padx=10, pady=10)
nbp3w2 = Tix.Frame(nbp3lf2.frame, relief=FLAT)
nbp3w2.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp3e4 = Tix.Entry(nbp3w2, bd=2, width=15, textvariable=self.PCICoke)
self.nbp3e4.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp3e4.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp3e4.bind("<<Event>>",TkPage.Callback(self.getPCICoke))
nbp3l7 = Tix.Label(nbp3w2, text=t.PCI)
nbp3l7.grid(row=1, column=0, padx=3, pady=5, sticky=E)
nbp3l8 = Tix.Label(nbp3w2, text=t.PCIUNIT)
nbp3l8.grid(row=1, column=2, padx=3, pady=5, sticky=E)
#
# NoteBook Page 4 Ashes
# *************************
nbp4lf1 = Tix.LabelFrame(nb.page4, bd=2, label=t.PROPERTIES, relief=FLAT)
nbp4lf1.label.config(font=fT)
nbp4lf1.pack(side=TOP, fill=X, padx=10, pady=10)
nbp4w1 = Tix.Frame(nbp4lf1.frame, relief=FLAT)
nbp4w1.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp4e1 = Tix.Entry(nbp4w1, bd=2, width=15, textvariable=self.AshesRatio)
self.nbp4e1.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp4e1.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp4e1.bind("<<Event>>",TkPage.Callback(self.getAshesRatio))
nbp4l1 = Tix.Label(nbp4w1, text=t.ASHESRATIO)
nbp4l1.grid(row=1, column=0, padx=3, pady=5, sticky=E)
nbp4l2 = Tix.Label(nbp4w1, text=t.PERCENT)
nbp4l2.grid(row=1, column=2, padx=3, pady=5, sticky=E)
self.nbp4e2 = Tix.Entry(nbp4w1, bd=2, width=15, textvariable=self.AshesEnthalpy)
self.nbp4e2.grid(row=2, column=1, padx=5, pady=5, sticky=W)
self.nbp4e2.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp4e2.bind("<<Event>>",TkPage.Callback(self.getAshesFormingEnthalpy))
nbp4l3 = Tix.Label(nbp4w1, text=t.ASHESENTHALPY)
nbp4l3.grid(row=2, column=0, padx=3, pady=5, sticky=E)
nbp4l4 = Tix.Label(nbp4w1, text=t.PCIUNIT)
nbp4l4.grid(row=2, column=2, padx=3, pady=5, sticky=E)
self.nbp4e3 = Tix.Entry(nbp4w1, bd=2, width=15, textvariable=self.AshesCP)
self.nbp4e3.grid(row=3, column=1, padx=5, pady=5, sticky=W)
self.nbp4e3.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp4e3.bind("<<Event>>",TkPage.Callback(self.getAshesThermalCapacity))
nbp4l5 = Tix.Label(nbp4w1, text=t.ASHESCP)
nbp4l5.grid(row=3, column=0, padx=3, pady=5, sticky=E)
nbp4l6 = Tix.Label(nbp4w1, text=t.CPUNIT)
nbp4l6.grid(row=3, column=2, padx=3, pady=5, sticky=E)
#
# NoteBook Page 5 Kobayashi
# ***************************
nbp5lf1 = Tix.LabelFrame(nb.page5, bd=2, label=t.KOBAYASHIMODEL, relief=FLAT)
nbp5lf1.label.config(font=fT)
nbp5lf1.pack(side=TOP, fill=X, padx=10, pady=10)
nbp5w1 = Tix.Frame(nbp5lf1.frame, relief=FLAT)
nbp5w1.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp5e1 = Tix.Entry(nbp5w1, bd=2, width=15, textvariable=self.Y1)
self.nbp5e1.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp5e1.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e1.bind("<<Event>>",TkPage.Callback(self.getY1CH))
self.nbp5l1 = Tix.Label(nbp5w1, text=t.Y1COEFF)
self.nbp5l1.grid(row=1, column=0, padx=3, pady=5, sticky=E)
self.nbp5l2 = Tix.Label(nbp5w1, text=t.AUTOMATCOMPUTE)
self.nbp5l2.grid(row=1, column=3, padx=3, pady=5, sticky=E)
self.nbp5b1 = Tix.Checkbutton(nbp5w1, width=8, onvalue="on", offvalue="off",
variable=self.autoY1, command=self.getIY1)
self.nbp5b1.grid(row=1, column=4, padx=0, pady=5, sticky=W)
self.nbp5e2 = Tix.Entry(nbp5w1, bd=2, width=15, textvariable=self.Y2)
self.nbp5e2.grid(row=2, column=1, padx=5, pady=5, sticky=W)
self.nbp5e2.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e2.bind("<<Event>>",TkPage.Callback(self.getY2CH))
self.nbp5l3 = Tix.Label(nbp5w1, text=t.Y2COEFF)
self.nbp5l3.grid(row=2, column=0, padx=3, pady=5, sticky=E)
self.nbp5l4 = Tix.Label(nbp5w1, text=t.AUTOMATCOMPUTE)
self.nbp5l4.grid(row=2, column=3, padx=3, pady=5, sticky=E)
self.nbp5b2 = Tix.Checkbutton(nbp5w1, width=8, onvalue="on", offvalue="off",
variable=self.autoY2, command=self.getIY2)
self.nbp5b2.grid(row=2, column=4)
self.nbp5e3 = Tix.Entry(nbp5w1, bd=2, width=15, textvariable=self.A1)
self.nbp5e3.grid(row=3, column=1, padx=5, pady=5, sticky=W)
self.nbp5e3.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e3.bind("<<Event>>",TkPage.Callback(self.getA1CH))
nbp5l5 = Tix.Label(nbp5w1, text=t.A1FACTOR)
nbp5l5.grid(row=3, column=0, padx=3, pady=5, sticky=E)
nbp5l6 = Tix.Label(nbp5w1, text=t.S1)
nbp5l6.grid(row=3, column=2, padx=3, pady=5, sticky=E)
self.nbp5e4 = Tix.Entry(nbp5w1, bd=2, width=15, textvariable=self.A2)
self.nbp5e4.grid(row=4, column=1, padx=5, pady=5, sticky=W)
self.nbp5e4.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e4.bind("<<Event>>",TkPage.Callback(self.getA2CH))
nbp5l7 = Tix.Label(nbp5w1, text=t.A2FACTOR)
nbp5l7.grid(row=4, column=0, padx=3, pady=5, sticky=E)
nbp5l8 = Tix.Label(nbp5w1, text=t.S1)
nbp5l8.grid(row=4, column=2, padx=3, pady=5, sticky=E)
self.nbp5e5 = Tix.Entry(nbp5w1, bd=2, width=15, textvariable=self.E1)
self.nbp5e5.grid(row=5, column=1, padx=5, pady=5, sticky=W)
self.nbp5e5.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e5.bind("<<Event>>",TkPage.Callback(self.getE1CH))
nbp5l9 = Tix.Label(nbp5w1, text=t.E1FACTOR)
nbp5l9.grid(row=5, column=0, padx=3, pady=5, sticky=E)
nbp5l10 = Tix.Label(nbp5w1, text=t.E1UNIT)
nbp5l10.grid(row=5, column=2, padx=3, pady=5, sticky=E)
self.nbp5e6 = Tix.Entry(nbp5w1, bd=2, width=15, textvariable=self.E2)
self.nbp5e6.grid(row=6, column=1, padx=5, pady=5, sticky=W)
self.nbp5e6.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e6.bind("<<Event>>",TkPage.Callback(self.getE2CH))
nbp5l11 = Tix.Label(nbp5w1, text=t.E2FACTOR)
nbp5l11.grid(row=6, column=0, padx=3, pady=5, sticky=E)
nbp5l12 = Tix.Label(nbp5w1, text=t.E1UNIT)
nbp5l12.grid(row=6, column=2, padx=3, pady=5, sticky=E)
# NoteBook Page 5 Combustion
# ****************************
#
nbp6lf1 = Tix.LabelFrame(nb.page6, bd=2, label=t.PARAMETERS, relief=FLAT)
nbp6lf1.label.config(font=fT)
nbp6lf1.pack(side=TOP, fill=X, padx=10, pady=10)
nbp6w1 = Tix.Frame(nbp6lf1.frame, relief=FLAT)
nbp6w1.pack(side=TOP, fill=X, padx=10, pady=10)
nbp6w2 = Tix.Frame(nbp6lf1.frame, relief=FLAT)
nbp6w2.pack(side=TOP, fill=X, padx=10, pady=10)
self.nbp6e1 = Tix.Entry(nbp6w1, bd=2, width=15, textvariable=self.preExpoCst)
self.nbp6e1.grid(row=1, column=1, padx=5, pady=5, sticky=W)
self.nbp6e1.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp6e1.bind("<<Event>>",TkPage.Callback(self.getPreExpoCst))
nbp6l1 = Tix.Label(nbp6w1, text=t.CONST)
nbp6l1.grid(row=1, column=0, padx=3, pady=5, sticky=E)
nbp6l2 = Tix.Label(nbp6w1, text=t.CONSTUNIT)
nbp6l2.grid(row=1, column=4, padx=3, pady=5, sticky=E)
self.nbp6e2 = Tix.Entry(nbp6w1, bd=2, width=15, textvariable=self.activEnergy)
self.nbp6e2.grid(row=2, column=1, padx=5, pady=5, sticky=W)
self.nbp6e2.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp6e2.bind("<<Event>>",TkPage.Callback(self.getActivEnergy))
nbp6l3 = Tix.Label(nbp6w1, text=t.ACTENERGY)
nbp6l3.grid(row=2, column=0, padx=3, pady=5, sticky=E)
nbp6l4 = Tix.Label(nbp6w1, text=t.ACTENERGYUNIT)
nbp6l4.grid(row=2, column=4, padx=3, pady=5, sticky=E)
self.nbp6b1 = Tix.OptionMenu(nbp6w2, options='menubutton.width 20')
self.nbp6b1.menubutton.config(bd=2, relief=RAISED)
self.nbp6b1.config(variable=self.typeReact, command=self.getReactType)
#self.nbp6b1.grid(row=3, column=1, padx=10, pady=5, sticky=W)
self.nbp6b1.pack(side=TOP)
for key in self.typeReactList.keys():
self.nbp6b1.add_command(self.typeReactList[key], label=self.typeReactList[key])
def _initializeWidgets(self):
"""
Extract resquested informations from XML document.
This informations are used to initialize the widgets.
For this page default values of all widgets are necessary
included in the XML file.
"""
self.H1.Init(self.coalThermoChModel)
if self.coalThermoChModel.getCoals().getNumber() >= 3:
self.H1.box.create.unbind('<Button-1>')
self.H1.box.create.configure(state=DISABLED)
if self.coalThermoChModel.getCoals().getNumber() <= 1:
self.H1.box.erase.unbind('<Button-1>')
self.H1.box.erase.configure(state=DISABLED)
## try:
first = 'item' + repr(1)
last = first
self.H1.h.hlist.selection_set(first, last)
self.selectH1()
## except:
## pass
def getCComposition(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp2e1, self.CComposition):
composition = float(self.CComposition.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setCDryComposition(composition)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getHComposition(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp2e2, self.HComposition):
composition = float(self.HComposition.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setHDryComposition(composition)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getOComposition(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp2e3, self.OComposition):
composition = float(self.OComposition.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setODryComposition(composition)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getPCI(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp2e4, self.PCI):
PCI = float(self.PCI.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setPCIValue(PCI)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getThermalCapacity(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp2e5, self.CP):
CP = float(self.CP.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setThermalCapacity(CP)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getDensity(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp2e6, self.Density):
density = float(self.Density.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setDensity(density)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getCCompositionCoke(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp3e1, self.CCompositionCoke):
composition = float(self.CCompositionCoke.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setCDryCompositionCoke(composition)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getHCompositionCoke(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp3e2, self.HCompositionCoke):
composition = float(self.HCompositionCoke.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setHDryCompositionCoke(composition)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getOCompositionCoke(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp3e3, self.OCompositionCoke):
composition = float(self.OCompositionCoke.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setODryCompositionCoke(composition)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getPCICoke(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp3e4, self.PCICoke):
PCICoke = float(self.PCICoke.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setPCICokeValue(PCICoke)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getAshesRatio(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp4e1, self.AshesRatio):
ashesRatio = float(self.AshesRatio.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setAshesRatio(ashesRatio)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getAshesFormingEnthalpy(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp4e2, self.AshesEnthalpy):
ashesFormingEnthalpy = float(self.AshesEnthalpy.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setAshesFormingEnthalpy(ashesFormingEnthalpy)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getAshesThermalCapacity(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp4e3, self.AshesCP):
ashesThermalCapacity = float(self.AshesCP.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setAshesThermalCapacity(ashesThermalCapacity)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getY1CH(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp5e1, self.Y1):
Y1CH = float(self.Y1.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setY1CH(Y1CH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getY2CH(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp5e2, self.Y2):
Y2CH = float(self.Y2.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setY2CH(Y2CH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getA1CH(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp5e3, self.A1):
A1CH = float(self.A1.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setA1CH(A1CH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getA2CH(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp5e4, self.A2):
A2CH = float(self.A2.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setA2CH(A2CH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getE1CH(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp5e5, self.E1):
E1CH = float(self.E1.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setE1CH(E1CH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getE2CH(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp5e6, self.E2):
E2CH = float(self.E2.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setE2CH(E2CH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getPreExpoCst(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp6e1, self.preExpoCst):
AHETCH = float(self.preExpoCst.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setAHETCH(AHETCH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
self.coalThermoChModel.save()
self.stbar.idle()
def getActivEnergy(self, event=None):
self.stbar.busy()
if self.check2.hasType(self.nbp6e2, self.activEnergy):
EHETCH = float(self.activEnergy.get())
coal = self.coalThermoChModel.getCoals().getCoal(self.coalNumber)
coal.setEHETCH(EHETCH)
self.coalThermoChModel.getCoals().updateCoal(self.coalNumber,coal)
# A deplacer pour ne le faire qu'une fois a la fer
self.coalThermoChModel.save()
self.stbar.idle()
def ActiveWidgetIY1(self, stat) :
if stat == 'on':
self.nbp5e1.config(state=DISABLED, fg='grey')
self.nbp5e1.unbind("<<Event>>")
self.nbp5l1.config(fg='grey')
else :
self.nbp5e1.config(state=NORMAL, fg='black')
self.nbp5e1.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e1.bind("<<Event>>",TkPage.Callback(self.getY1CH))
self.nbp5l1.config(fg='black')
def ActiveWidgetIY2(self, stat) :
if stat == 'on':
self.nbp5e2.config(state=DISABLED, fg='grey')
self.nbp5e2.unbind("<<Event>>")
self.nbp5l3.config(fg='grey')
else :
self.nbp5e2.config(state=NORMAL, fg='black')
self.nbp5e2.event_add("<<Event>>", "<Return>", "<Leave>", "<FocusOut>")
self.nbp5e2.bind("<<Event>>",TkPage.Callback(self.getY2CH))
self.nbp5l3.config(fg='black')
#-------------------------------------------------------------------------------
# Text and messages for this page
#-------------------------------------------------------------------------------
class PageText:
"""
Storage of all texts and mess²gages for this page.
"""
def __init__(self):
# 1) Texts
#
if Tool.GuiParam.lang == 'fr':
self.COAL = "Charbon"
self.CLASS = "Classe"
self.KEYWORD = "Mots clé Code_Saturne : "
self.COALCOMBUSTION = "Combustion du charbon pulvérisé"
self.COALS = "Caractéristiques des charbons"
self.COALSLIST = "Liste des charbons"
self.SPECIES = "Caractéristiques des espèces"
self.SPECIESLIST = "Liste des espèces"
self.LABEL = "Label"
self.CREATE = "Ajouter"
self.ERASE = "Supprimer"
self.MODIFY = "Modifier"
self.ASHES = "Cendres"
self.CLASSES = "Classes"
self.DEVOLA = "Dévolatilisation"
self.COMBUSTION = "Combustion hétérogène"
self.GENERAL = "Composition et propriétés"
self.CLASSDIAM = "Diamètre initial"
self.NUMBER = "Numéro"
self.COKE = "Coke"
self.CCOMPOSITION = "Composition C sur sec"
self.HCOMPOSITION = "Composition H sur sec"
self.OCOMPOSITION = "Composition O sur sec"
self.COMPOSITION = "Composition"
self.PCI = "PCI"
self.PCIUNIT = "J/kg"
self.ASHESRATIO = "Taux de cendres en masse"
self.ASHESENTHALPY = "Enthalpie de formation des cendres"
self.ASHESCP = "CP des cendres"
self.KOBAYASHI = "Coefficient stoechiométriques"
self.KOBAYASHIMODEL = "Modèle de Kobayashi"
self.CKOBAYASHI = "Calcul automatique"
self.Y1COEFF = "Coefficient stoechiométrique Y1"
self.Y2COEFF = "Coefficient stoechiométrique Y2"
self.AUTOMATCOMPUTE = "Calcul automatique"
self.A1FACTOR = "Facteur pre-exponentielle A1"
self.A2FACTOR = "Facteur pre-exponentielle A2"
self.E1FACTOR = "Energie d'activation E1"
self.E2FACTOR = "Energie d'activation E2"
self.SEC = "sur Sec"
self.PUR = "sur Pur"
self.PERCENT = "%"
self.PROPERTIES = "Propriétés"
self.CP = "Cp"
self.CPUNIT = "J/kg/K"
self.DENSITY = "Masse volumique"
self.DENSITYUNIT = "kg/m3"
self.S1 = "s-1"
self.E1UNIT = "J/mol"
self.PARAMETERS = "Paramètres"
self.CONST = "Constante pre-exponentielle"
self.CONSTUNIT = "kg/m2/s/atm"
self.ACTENERGY = "Energie d'activation"
self.ACTENERGYUNIT = "kcal/mol"
self.REACTORDER05 = "Odre de la réaction 0.5"
self.REACTORDER1 = "Odre de la réaction 1"
else:
self.COAL = "Coal"
self.CLASS = "Class"
self.KEYWORD = "Code_Saturne key words: "
self.COALCOMBUSTION = "Pulverized coal combustion"
self.COALS = "Coals properties"
self.COALSLIST = "Coals list"
self.SPECIES = "Species properties"
self.SPECIESLIST = "Species list"
self.LABEL = "Label"
self.CREATE = "Create"
self.MODIFY = "Modify"
self.ASHES = "Ashes"
self.ERASE = "Erase"
self.CLASSES = "Classes"
self.DEVOLA = "Devolatilisation"
self.COMBUSTION = "Heterogeneous combustion"
self.GENERAL = "Composition and properties"
self.CLASSDIAM = "Initial diameter"
self.NUMBER = "Number"
self.COKE = "Coke"
self.CCOMPOSITION = "Composition C sur sec"
self.HCOMPOSITION = "Composition H sur sec"
self.OCOMPOSITION = "Composition O sur sec"
self.COMPOSITION = "Composition"
self.PCI = "PCI"
self.PCIUNIT = "J/kg"
self.ASHESRATIO = "Taux de cendres en masse"
self.ASHESENTHALPY = "Enthalpie de formation des cendres"
self.ASHESCP = "CP des cendres"
self.KOBAYASHI = "Coefficient stoechiométriques"
self.KOBAYASHIMODEL = "Kobayashi model"
self.CKOBAYASHI = "Automatic computation"
self.Y1COEFF = "Coefficient stoechiométrique Y1"
self.Y2COEFF = "Coefficient stoechiométrique Y2"
self.AUTOMATCOMPUTE = "Automatic computation"
self.A1FACTOR = "Facteur pre-exponentielle A1"
self.A2FACTOR = "Facteur pre-exponentielle A2"
self.E1FACTOR = "Energie d'activation E1"
self.E2FACTOR = "Energie d'activation E2"
self.SEC = "sur Sec"
self.PUR = "sur Pur"
self.PERCENT = "%"
self.PROPERTIES = "Properties"
self.CP = "Cp"
self.CPUNIT = "K/kg/K"
self.DENSITY = "Density"
self.DENSITYUNIT = "kg/m3"
self.S1 = "s-1"
self.E1UNIT = "J/mol"
self.PARAMETERS = "Parameters"
self.CONST = "pre-exponentielle constant"
self.CONSTUNIT = "kg/m2/s/atm"
self.ACTENERGY = "Energie d'activation"
self.ACTENERGYUNIT = "kcal/mol"
self.REACTORDER05 = "Odre de la réaction 0.5"
self.REACTORDER1 = "Odre de la réaction 1"
# 2) Messages
#
if Tool.GuiParam.lang == 'fr':
self.MSG_COAL = "Sélectionner un modèle"
else:
self.MSG_COAL = "Select a model"
#-------------------------------------------------------------------------------
# Coal combustion test case
#-------------------------------------------------------------------------------
class CoalCombustionTestCase(unittest.TestCase):
"""
"""
def setUp(self):
"""
This method is executed before all "check" methods.
"""
from Base.XMLengine import Case
self.case = Case()
def tearDown(self):
"""
This method is executed after all "check" methods.
"""
del self.case
def checkCoalCombustionInstantiation(self):
"""
Check whether the CoalCombustionModel class could be instantiated
"""
model = None
model = CoalCombustionModel(self.case)
assert model != None, 'Could not instantiate CoalCombustionModel'
def suite():
testSuite = unittest.makeSuite(CoalCombustionTestCase, "check")
return testSuite
def runTest():
runner = unittest.TextTestRunner()
runner.run(suite())
#-------------------------------------------------------------------------------
# End
#-------------------------------------------------------------------------------
syntax highlighted by Code2HTML, v. 0.9.1