"""
Définit les outils généraux élémentaires.
-
- Ce module est destiné à être appelée par AssimilationStudy.
"""
__author__ = "Jean-Philippe ARGAUD"
__all__ = []
"Permet de lancer le calcul d'assimilation"
if FileName is None or not os.path.exists(FileName):
raise ValueError("a YACS file name has to be given for YACS execution.\n")
+ else:
+ __file = os.path.abspath(FileName)
+ logging.debug("The YACS file name is \"%s\"."%__file)
if not PlatformInfo.has_salome or \
not PlatformInfo.has_yacs or \
not PlatformInfo.has_adao:
xmlLoader = loader.YACSLoader()
xmlLoader.registerProcCataLoader()
try:
- catalogAd = r.loadCatalog("proc", os.path.abspath(FileName))
+ catalogAd = r.loadCatalog("proc", __file)
r.addCatalog(catalogAd)
except:
pass
try:
- p = xmlLoader.load(os.path.abspath(FileName))
+ p = xmlLoader.load(__file)
except IOError as ex:
print("The YACS XML schema file can not be loaded: %s"%(ex,))
#
return 1
+# ==============================================================================
+class RegulationAndParameters(object):
+ """
+ Classe générale d'interface d'action pour la régulation et ses paramètres
+ """
+ def __init__(self,
+ name = "GenericRegulation",
+ asAlgorithm = None,
+ asDict = None,
+ asScript = None,
+ ):
+ """
+ """
+ self.__name = str(name)
+ self.__P = {}
+ #
+ if asAlgorithm is None and asScript is not None:
+ __Algo = ImportFromScript(asScript).getvalue( "Algorithm" )
+ else:
+ __Algo = asAlgorithm
+ #
+ if asDict is None and asScript is not None:
+ __Dict = ImportFromScript(asScript).getvalue( self.__name, "Parameters" )
+ else:
+ __Dict = asDict
+ #
+ if __Dict is not None:
+ self.__P.update( dict(__Dict) )
+ #
+ if __Algo is not None:
+ self.__P.update( {"Algorithm":self.__A} )
+
+ def get(self, key = None):
+ "Vérifie l'existence d'une clé de variable ou de paramètres"
+ if key in self.__P:
+ return self.__P[key]
+ else:
+ return self.__P
+
# ==============================================================================
class DataObserver(object):
"""
self.__logSerie = []
self.__switchoff = False
self.__viewers = {
- "TUI":Interfaces._TUIViewer,
- "DCT":Interfaces._DCTViewer,
- "SCD":Interfaces._SCDViewer,
+ "TUI" :Interfaces._TUIViewer,
+ "SCD" :Interfaces._SCDViewer,
"YACS":Interfaces._YACSViewer,
}
self.__loaders = {
- "TUI":Interfaces._TUIViewer,
- "DCT":Interfaces._DCTViewer,
- "EPD":Interfaces._EPDViewer,
- "COM":Interfaces._COMViewer,
+ "TUI" :Interfaces._TUIViewer,
+ "COM" :Interfaces._COMViewer,
}
if __addViewers is not None:
self.__viewers.update(dict(__addViewers))