1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico
22 from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2
24 def INCLUDE(self,PSSE_path,sav_file,**args):
26 Fonction sd_prod pour la macro INCLUDE
29 if sav_file==None: return
34 if hasattr(self,'fichier_ini'):
36 if self.fichier_ini == sav_file : return
37 self.fichier_ini=sav_file
38 if hasattr(self,'old_context_fichier_init' ):
40 for concept in self.old_context_fichier_init.values():
41 #self.jdc.delete_concept(concept)
42 listeADeTruire.append(concept)
44 self.contexte_fichier_init={}
45 #self.reevalue_sd_jdc()
46 self.jdc.reset_context()
48 self.fichier_ini=sav_file
49 self.contexte_fichier_init = {}
50 self.fichier_unite = 999
51 self.fichier_err = None
58 MachineDico,LoadDico,LineDico,TransfoDico, MotorDico = ExtractGeneratorLoadLineandTransfoDico2(sav_file,PSSE_path)
61 if self.jdc.appli is not None:
62 self.jdc.appli.affiche_alerte("Error", 'An error happened in ExtractGeneratorandLoadList execution ')
66 self.fichier_err = str(exc)
67 self.contexte_fichier_init = {}
70 for nom in MachineDico.keys():
71 self.fichier_text += "%s=MONGENER(ID='%s',);\n" % (nom, 'a')
72 listeNouveau.append(nom)
74 for nom in LoadDico.keys():
75 self.fichier_text += "%s=MACHARGE(ID='%s',);\n" % (nom, 'a')
76 listeNouveau.append(nom)
78 for nom in LineDico.keys():
79 self.fichier_text += "%s=MALIGNE(ID='%s',);\n" % (nom,'a')
80 listeNouveau.append(nom)
82 for nom in TransfoDico.keys():
83 self.fichier_text += "%s=MONTRANSFO(ID='%s',);\n" % (nom,'a')
84 listeNouveau.append(nom)
86 for nom in MotorDico.keys():
87 self.fichier_text += "%s=MONMOTEUR(ID='%s',);\n" % (nom,'a')
88 listeNouveau.append(nom)
90 import Extensions.jdc_include
91 self.JdC_aux = Extensions.jdc_include.JDC_CATA_INCLUDE(code='PSEN', execmodul=None)
92 self.make_contexte_include(None, self.fichier_text)
93 self.old_context_fichier_init = self.contexte_fichier_init
94 self.parent.record_unit(unite, self)
96 self.jdc.MachineDico=MachineDico
97 self.jdc.LoadDico=LoadDico
98 self.jdc.LineDico=LineDico
99 self.jdc.TransfoDico=TransfoDico
100 self.jdc.MotorDico = MotorDico
103 for concept in listeADeTruire :
104 if concept.nom not in listeNouveau: self.jdc.delete_concept(concept)
105 self.reevalue_sd_jdc()
107 def INCLUDE_context(self,d):
109 Fonction op_init pour macro INCLUDE
111 for k,v in self.g_context.items():