From d476d2e053f937c0060f696312f301591e4f43ea Mon Sep 17 00:00:00 2001 From: brenda-br Date: Thu, 23 Feb 2023 22:14:39 +0530 Subject: Restructure Code -1 --- src/main/python/OMChem/Heater.py | 79 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/main/python/OMChem/Heater.py (limited to 'src/main/python/OMChem/Heater.py') diff --git a/src/main/python/OMChem/Heater.py b/src/main/python/OMChem/Heater.py new file mode 100644 index 0000000..cf9b8f1 --- /dev/null +++ b/src/main/python/OMChem/Heater.py @@ -0,0 +1,79 @@ +from OMChem.EngStm import EngStm +class Heater(): + counter = 1 + def __init__(self,name='Heater',PressureDrop = None, eff = None): + self.PressureDrop = PressureDrop + self.eff = eff + #self.name = name + self.OM_data_eqn = '' + self.OM_data_init = '' + self.InputStms = None + #self.heatAdd=heatAdd + #self.outT = outT + self.OutputStms = None + self.EngStms = EngStm(name='EngStm'+name) + self.type = 'Heater' + self.mode = None + self.modeVal = None + + self.Prop = { + 'pressDrop':None, + 'eff':None, + 'outT':None, + 'tempInc':None, + 'heatAdd':None, + } + + # new + self.name = name + str(Heater.counter) + self.no_of_input = 1 + self.no_of_output = 1 + Heater.counter += 1 + + def getname(self): + return self.name + + def connect(self,InputStms = None,OutputStms = None): + self.InputStms = InputStms + self.OutputStms = OutputStms + + def modesList(self): + return ["heatAdd","outT","outVapPhasMolFrac","tempInc","enFlo"] + + def paramgetter(self,mode="heatAdd"): + self.mode = mode + dict = {"PressureDrop":None,"eff":None,self.mode:None} + return dict + + def paramsetter(self,dict): + + self.PressureDrop = dict['PressureDrop'] + self.eff = dict['eff'] + self.modeVal = dict[self.mode] + + def OM_Flowsheet_Init(self, addedcomp): + self.OM_data_init = '' + comp_count = len(addedcomp) + self.OM_data_init = self.OM_data_init + 'Simulator.Streams.Energy_Stream '+self.EngStms.name+';\n' + self.OM_data_init = self.OM_data_init + ( + "Simulator.Unit_Operations.Heater " + self.name + "(Nc = " + str(comp_count)) + self.OM_data_init = self.OM_data_init + (",comp = {") + comp = str(addedcomp).strip('[').strip(']') + comp = comp.replace("'", "") + self.OM_data_init = self.OM_data_init + comp + ("},") + self.OM_data_init = self.OM_data_init + 'pressDrop = ' + str(self.PressureDrop) +',' + self.OM_data_init = self.OM_data_init + 'eff = ' + str(self.eff) + ');\n' + return self.OM_data_init + + def OM_Flowsheet_Eqn(self, addedcomp): + self.OM_data_eqn = '' + # self.OM_data_eqn = self.name + '.pressDrop = ' + str(self.PressDrop) + ';\n' + self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.InputStms[0].name + '.outlet,' + self.name + '.inlet' + ');\n') + self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.name + '.outlet,' + self.OutputStms[0].name + '.inlet);\n') + self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.EngStms.name + '.outlet,' + self.name + '.energy);\n') + + if(self.mode =="enFlo"): + self.OM_data_eqn = self.OM_data_eqn + (self.EngStms.name+'.'+self.mode+'='+ self.modeVal + ';\n') + else: + self.OM_data_eqn = self.OM_data_eqn + (self.name+'.'+self.mode+'='+ self.modeVal + ';\n') + return self.OM_data_eqn -- cgit From 2b94618c50110c38cd67564a5b58630aeeb2adc5 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Fri, 24 Feb 2023 11:55:27 +0530 Subject: Fix #62 Remove Redundant Lines --- src/main/python/OMChem/Heater.py | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/main/python/OMChem/Heater.py') diff --git a/src/main/python/OMChem/Heater.py b/src/main/python/OMChem/Heater.py index cf9b8f1..a24253d 100644 --- a/src/main/python/OMChem/Heater.py +++ b/src/main/python/OMChem/Heater.py @@ -4,12 +4,9 @@ class Heater(): def __init__(self,name='Heater',PressureDrop = None, eff = None): self.PressureDrop = PressureDrop self.eff = eff - #self.name = name self.OM_data_eqn = '' self.OM_data_init = '' self.InputStms = None - #self.heatAdd=heatAdd - #self.outT = outT self.OutputStms = None self.EngStms = EngStm(name='EngStm'+name) self.type = 'Heater' @@ -67,7 +64,6 @@ class Heater(): def OM_Flowsheet_Eqn(self, addedcomp): self.OM_data_eqn = '' - # self.OM_data_eqn = self.name + '.pressDrop = ' + str(self.PressDrop) + ';\n' self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.InputStms[0].name + '.outlet,' + self.name + '.inlet' + ');\n') self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.name + '.outlet,' + self.OutputStms[0].name + '.inlet);\n') self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.EngStms.name + '.outlet,' + self.name + '.energy);\n') -- cgit From 7af3526e105cc330422f8742ec5edec1c4a0a98f Mon Sep 17 00:00:00 2001 From: brenda-br Date: Thu, 2 Mar 2023 15:49:11 +0530 Subject: Restructuring Finalized for App Bundling --- src/main/python/OMChem/Heater.py | 75 ---------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/main/python/OMChem/Heater.py (limited to 'src/main/python/OMChem/Heater.py') diff --git a/src/main/python/OMChem/Heater.py b/src/main/python/OMChem/Heater.py deleted file mode 100644 index a24253d..0000000 --- a/src/main/python/OMChem/Heater.py +++ /dev/null @@ -1,75 +0,0 @@ -from OMChem.EngStm import EngStm -class Heater(): - counter = 1 - def __init__(self,name='Heater',PressureDrop = None, eff = None): - self.PressureDrop = PressureDrop - self.eff = eff - self.OM_data_eqn = '' - self.OM_data_init = '' - self.InputStms = None - self.OutputStms = None - self.EngStms = EngStm(name='EngStm'+name) - self.type = 'Heater' - self.mode = None - self.modeVal = None - - self.Prop = { - 'pressDrop':None, - 'eff':None, - 'outT':None, - 'tempInc':None, - 'heatAdd':None, - } - - # new - self.name = name + str(Heater.counter) - self.no_of_input = 1 - self.no_of_output = 1 - Heater.counter += 1 - - def getname(self): - return self.name - - def connect(self,InputStms = None,OutputStms = None): - self.InputStms = InputStms - self.OutputStms = OutputStms - - def modesList(self): - return ["heatAdd","outT","outVapPhasMolFrac","tempInc","enFlo"] - - def paramgetter(self,mode="heatAdd"): - self.mode = mode - dict = {"PressureDrop":None,"eff":None,self.mode:None} - return dict - - def paramsetter(self,dict): - - self.PressureDrop = dict['PressureDrop'] - self.eff = dict['eff'] - self.modeVal = dict[self.mode] - - def OM_Flowsheet_Init(self, addedcomp): - self.OM_data_init = '' - comp_count = len(addedcomp) - self.OM_data_init = self.OM_data_init + 'Simulator.Streams.Energy_Stream '+self.EngStms.name+';\n' - self.OM_data_init = self.OM_data_init + ( - "Simulator.Unit_Operations.Heater " + self.name + "(Nc = " + str(comp_count)) - self.OM_data_init = self.OM_data_init + (",comp = {") - comp = str(addedcomp).strip('[').strip(']') - comp = comp.replace("'", "") - self.OM_data_init = self.OM_data_init + comp + ("},") - self.OM_data_init = self.OM_data_init + 'pressDrop = ' + str(self.PressureDrop) +',' - self.OM_data_init = self.OM_data_init + 'eff = ' + str(self.eff) + ');\n' - return self.OM_data_init - - def OM_Flowsheet_Eqn(self, addedcomp): - self.OM_data_eqn = '' - self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.InputStms[0].name + '.outlet,' + self.name + '.inlet' + ');\n') - self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.name + '.outlet,' + self.OutputStms[0].name + '.inlet);\n') - self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.EngStms.name + '.outlet,' + self.name + '.energy);\n') - - if(self.mode =="enFlo"): - self.OM_data_eqn = self.OM_data_eqn + (self.EngStms.name+'.'+self.mode+'='+ self.modeVal + ';\n') - else: - self.OM_data_eqn = self.OM_data_eqn + (self.name+'.'+self.mode+'='+ self.modeVal + ';\n') - return self.OM_data_eqn -- cgit From 3cbdd4238867bc860282f7cf702d73b5be6e3f86 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Sat, 4 Mar 2023 11:32:15 +0530 Subject: Revert "Restructuring Finalized for App Bundling" This reverts commit 7af3526e105cc330422f8742ec5edec1c4a0a98f. --- src/main/python/OMChem/Heater.py | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 src/main/python/OMChem/Heater.py (limited to 'src/main/python/OMChem/Heater.py') diff --git a/src/main/python/OMChem/Heater.py b/src/main/python/OMChem/Heater.py new file mode 100644 index 0000000..a24253d --- /dev/null +++ b/src/main/python/OMChem/Heater.py @@ -0,0 +1,75 @@ +from OMChem.EngStm import EngStm +class Heater(): + counter = 1 + def __init__(self,name='Heater',PressureDrop = None, eff = None): + self.PressureDrop = PressureDrop + self.eff = eff + self.OM_data_eqn = '' + self.OM_data_init = '' + self.InputStms = None + self.OutputStms = None + self.EngStms = EngStm(name='EngStm'+name) + self.type = 'Heater' + self.mode = None + self.modeVal = None + + self.Prop = { + 'pressDrop':None, + 'eff':None, + 'outT':None, + 'tempInc':None, + 'heatAdd':None, + } + + # new + self.name = name + str(Heater.counter) + self.no_of_input = 1 + self.no_of_output = 1 + Heater.counter += 1 + + def getname(self): + return self.name + + def connect(self,InputStms = None,OutputStms = None): + self.InputStms = InputStms + self.OutputStms = OutputStms + + def modesList(self): + return ["heatAdd","outT","outVapPhasMolFrac","tempInc","enFlo"] + + def paramgetter(self,mode="heatAdd"): + self.mode = mode + dict = {"PressureDrop":None,"eff":None,self.mode:None} + return dict + + def paramsetter(self,dict): + + self.PressureDrop = dict['PressureDrop'] + self.eff = dict['eff'] + self.modeVal = dict[self.mode] + + def OM_Flowsheet_Init(self, addedcomp): + self.OM_data_init = '' + comp_count = len(addedcomp) + self.OM_data_init = self.OM_data_init + 'Simulator.Streams.Energy_Stream '+self.EngStms.name+';\n' + self.OM_data_init = self.OM_data_init + ( + "Simulator.Unit_Operations.Heater " + self.name + "(Nc = " + str(comp_count)) + self.OM_data_init = self.OM_data_init + (",comp = {") + comp = str(addedcomp).strip('[').strip(']') + comp = comp.replace("'", "") + self.OM_data_init = self.OM_data_init + comp + ("},") + self.OM_data_init = self.OM_data_init + 'pressDrop = ' + str(self.PressureDrop) +',' + self.OM_data_init = self.OM_data_init + 'eff = ' + str(self.eff) + ');\n' + return self.OM_data_init + + def OM_Flowsheet_Eqn(self, addedcomp): + self.OM_data_eqn = '' + self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.InputStms[0].name + '.outlet,' + self.name + '.inlet' + ');\n') + self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.name + '.outlet,' + self.OutputStms[0].name + '.inlet);\n') + self.OM_data_eqn = self.OM_data_eqn + ('connect(' + self.EngStms.name + '.outlet,' + self.name + '.energy);\n') + + if(self.mode =="enFlo"): + self.OM_data_eqn = self.OM_data_eqn + (self.EngStms.name+'.'+self.mode+'='+ self.modeVal + ';\n') + else: + self.OM_data_eqn = self.OM_data_eqn + (self.name+'.'+self.mode+'='+ self.modeVal + ';\n') + return self.OM_data_eqn -- cgit