1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2024 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23 from daCore import BasicObjects, NumericObjects
24 from daAlgorithms.Atoms import ecwstdkf
26 # ==============================================================================
27 class ElementaryAlgorithm(BasicObjects.Algorithm):
29 BasicObjects.Algorithm.__init__(self, "KALMANFILTER")
30 self.defineRequiredParameter(
32 default = "KalmanFilter",
34 message = "Variant ou formulation de la méthode",
42 self.defineRequiredParameter(
43 name = "EstimationOf",
46 message = "Estimation d'état ou de paramètres",
47 listval = ["State", "Parameters"],
49 self.defineRequiredParameter(
50 name = "StoreInternalVariables",
53 message = "Stockage des variables internes ou intermédiaires du calcul",
55 self.defineRequiredParameter(
56 name = "StoreSupplementaryCalculations",
59 message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
62 "APosterioriCorrelations",
63 "APosterioriCovariance",
64 "APosterioriStandardDeviations",
65 "APosterioriVariances",
68 "CostFunctionJAtCurrentOptimum",
70 "CostFunctionJbAtCurrentOptimum",
72 "CostFunctionJoAtCurrentOptimum",
79 "InnovationAtCurrentAnalysis",
80 "InnovationAtCurrentState",
81 "SimulatedObservationAtCurrentAnalysis",
82 "SimulatedObservationAtCurrentOptimum",
83 "SimulatedObservationAtCurrentState",
86 self.requireInputArguments(
87 mandatory= ("Xb", "Y", "HO", "R", "B"),
88 optional = ("U", "EM", "CM", "Q"),
100 "ParallelDerivativesOnly",
104 def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
105 self._pre_run(Parameters, Xb, Y, U, HO, EM, CM, R, B, Q)
107 # --------------------------
108 if self._parameters["Variant"] == "KalmanFilter":
109 NumericObjects.multiXOsteps(self, Xb, Y, U, HO, EM, CM, R, B, Q, ecwstdkf.ecwstdkf, True)
111 # --------------------------
112 elif self._parameters["Variant"] == "OneCorrection":
113 ecwstdkf.ecwstdkf(self, Xb, Y, U, HO, CM, R, B)
115 # --------------------------
117 raise ValueError("Error in Variant name: %s"%self._parameters["Variant"])
119 self._post_run(HO, EM)
122 # ==============================================================================
123 if __name__ == "__main__":
124 print("\n AUTODIAGNOSTIC\n")