]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Mimic writing between KF and EKF
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 14 Feb 2013 21:36:05 +0000 (22:36 +0100)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 14 Feb 2013 21:36:05 +0000 (22:36 +0100)
src/daComposant/daAlgorithms/KalmanFilter.py
src/daComposant/daCore/AssimilationStudy.py

index 88fdb7b420f4cc9a894dbb1d223cba6788312a29..9d6a0fdd2f3994d8ff7843b83afe74c8cb10d1f5 100644 (file)
@@ -128,23 +128,22 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             else:
                 Un = None
             #
-            if self._parameters["EstimationType"] == "State" and Cm is not None and Un is not None:
-                Xn_predicted = Mt * Xn + Cm * Un
-                Pn_predicted = Mt * Pn * Ma + Q
-            elif self._parameters["EstimationType"] == "State" and (Cm is None or Un is None):
+            if self._parameters["EstimationType"] == "State":
                 Xn_predicted = Mt * Xn
+                if Cm is not None and Un is not None: # Attention : si Cm est aussi dans M, doublon !
+                    Xn_predicted = Xn_predicted + Cm * Un
                 Pn_predicted = Mt * Pn * Ma + Q
             elif self._parameters["EstimationType"] == "Parameters":
-                # Xn_predicted = Mt * Xn
-                # Pn_predicted = Mt * Pn * Ma + Q
                 # --- > Par principe, M = Id, Q = 0
                 Xn_predicted = Xn
                 Pn_predicted = Pn
             #
-            if self._parameters["EstimationType"] == "Parameters" and Cm is not None and Un is not None:
-                d  = Ynpu - Ht * Xn_predicted - Cm * Un
-            else:
+            if self._parameters["EstimationType"] == "State":
+                d  = Ynpu - Ht * Xn_predicted
+            elif self._parameters["EstimationType"] == "Parameters":
                 d  = Ynpu - Ht * Xn_predicted
+                if Cm is not None and Un is not None: # Attention : si Cm est aussi dans H, doublon !
+                    d = d - Cm * Un
             #
             K  = Pn_predicted * Ha * (Ht * Pn_predicted * Ha + R).I
             Xn = Xn_predicted + K * d
index 190baf09521884855172e1b7ac371863ba534e98..98f3f98db354f7171f4c32aab191b5972fad773f 100644 (file)
@@ -32,6 +32,7 @@ __author__ = "Jean-Philippe ARGAUD"
 import os, sys
 import numpy
 import Logging ; Logging.Logging() # A importer en premier
+import scipy.optimize # Import preventif car son abscence a de l'effet
 import Persistence
 from BasicObjects import Operator
 from PlatformInfo import uniq