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
24 from daAlgorithms.Atoms import cekf, ceks, exks, exkf
26 # ==============================================================================
27 class ElementaryAlgorithm(BasicObjects.Algorithm):
29 BasicObjects.Algorithm.__init__(self, "EXTENDEDKALMANFILTER")
30 self.defineRequiredParameter(
34 message = "Variant ou formulation de la méthode",
44 self.defineRequiredParameter(
45 name = "ConstrainedBy",
46 default = "EstimateProjection",
48 message = "Prise en compte des contraintes",
49 listval = ["EstimateProjection"],
51 self.defineRequiredParameter(
52 name = "EstimationOf",
55 message = "Estimation d'état ou de paramètres",
56 listval = ["State", "Parameters"],
58 self.defineRequiredParameter(
59 name = "StoreInternalVariables",
62 message = "Stockage des variables internes ou intermédiaires du calcul",
64 self.defineRequiredParameter(
65 name = "StoreSupplementaryCalculations",
68 message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
71 "APosterioriCorrelations",
72 "APosterioriCovariance",
73 "APosterioriStandardDeviations",
74 "APosterioriVariances",
77 "CostFunctionJAtCurrentOptimum",
79 "CostFunctionJbAtCurrentOptimum",
81 "CostFunctionJoAtCurrentOptimum",
82 "CurrentIterationNumber",
88 "InnovationAtCurrentAnalysis",
89 "InnovationAtCurrentState",
90 "SimulatedObservationAtCurrentAnalysis",
91 "SimulatedObservationAtCurrentOptimum",
92 "SimulatedObservationAtCurrentState",
95 self.defineRequiredParameter( # Pas de type
97 message = "Liste des valeurs de bornes",
99 self.requireInputArguments(
100 mandatory= ("Xb", "Y", "HO", "R", "B"),
101 optional = ("U", "EM", "CM", "Q"),
113 "ParallelDerivativesOnly",
117 def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
118 self._pre_run(Parameters, Xb, Y, U, HO, EM, CM, R, B, Q)
120 # --------------------------
121 if self._parameters["Variant"] == "EKF":
122 exkf.exkf(self, Xb, Y, U, HO, EM, CM, R, B, Q)
124 # --------------------------
125 elif self._parameters["Variant"] == "CEKF":
126 cekf.cekf(self, Xb, Y, U, HO, EM, CM, R, B, Q)
128 # --------------------------
129 elif self._parameters["Variant"] == "EKS":
130 exks.exks(self, Xb, Y, U, HO, EM, CM, R, B, Q)
132 # --------------------------
133 elif self._parameters["Variant"] == "CEKS":
134 ceks.ceks(self, Xb, Y, U, HO, EM, CM, R, B, Q)
136 # --------------------------
138 raise ValueError("Error in Variant name: %s"%self._parameters["Variant"])
140 self._post_run(HO, EM)
143 # ==============================================================================
144 if __name__ == "__main__":
145 print("\n AUTODIAGNOSTIC\n")