1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2023 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 ecwlls
26 # ==============================================================================
27 class ElementaryAlgorithm(BasicObjects.Algorithm):
29 BasicObjects.Algorithm.__init__(self, "LINEARLEASTSQUARES")
30 self.defineRequiredParameter(
32 default = "LinearLeastSquares",
34 message = "Variant ou formulation de la méthode",
42 self.defineRequiredParameter(
43 name = "EstimationOf",
44 default = "Parameters",
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",
63 "CostFunctionJAtCurrentOptimum",
65 "CostFunctionJbAtCurrentOptimum",
67 "CostFunctionJoAtCurrentOptimum",
72 "InnovationAtCurrentAnalysis",
74 "SimulatedObservationAtCurrentOptimum",
75 "SimulatedObservationAtCurrentState",
76 "SimulatedObservationAtOptimum",
79 self.requireInputArguments(
80 mandatory= ("Y", "HO"),
83 self.setAttributes(tags=(
89 def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
90 self._pre_run(Parameters, Xb, Y, U, HO, EM, CM, R, B, Q)
92 #--------------------------
93 if self._parameters["Variant"] == "LinearLeastSquares":
94 NumericObjects.multiXOsteps(self, Xb, Y, U, HO, EM, CM, R, B, Q, ecwlls.ecwlls)
96 #--------------------------
97 elif self._parameters["Variant"] == "OneCorrection":
98 ecwlls.ecwlls(self, Xb, Y, U, HO, CM, R, B)
100 #--------------------------
102 raise ValueError("Error in Variant name: %s"%self._parameters["Variant"])
107 # ==============================================================================
108 if __name__ == "__main__":
109 print('\n AUTODIAGNOSTIC\n')