MBDyn-1.7.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
id.h
Go to the documentation of this file.
1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/elec/id.h,v 1.19 2017/01/12 14:46:22 masarati Exp $ */
2 /*
3  * MBDyn (C) is a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati <masarati@aero.polimi.it>
9  * Paolo Mantegazza <mantegazza@aero.polimi.it>
10  *
11  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12  * via La Masa, 34 - 20156 Milano, Italy
13  * http://www.aero.polimi.it
14  *
15  * Changing this copyright notice is forbidden.
16  *
17  * This program is free software; you can redistribute it and/or modify
18  * it under the terms of the GNU General Public License as published by
19  * the Free Software Foundation (version 2 of the License).
20  *
21  *
22  * This program is distributed in the hope that it will be useful,
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU General Public License for more details.
26  *
27  * You should have received a copy of the GNU General Public License
28  * along with this program; if not, write to the Free Software
29  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30  */
31 
32 #ifndef ID_H
33 #define ID_H
34 
35 #include "ac/f2c.h"
36 #include "myassert.h"
37 #include "ldl.h"
38 #include "forgfact.h"
39 
40 const doublereal LDL_INIT = 1.e12;
41 
42 /* Ident - begin */
43 
44 class Ident {
45  protected:
48 
51 
54 
57 
60 
64 
68 
69  /* helper */
70  void SetForgettingFactor(const doublereal& kk);
71 
72  public:
74  const doublereal& ldl_init = LDL_INIT);
75  virtual ~Ident(void);
76  doublereal dGetForgettingFactor(void) const;
77  doublereal* pdGetTheta(void);
78  void UpdateTheta(const doublereal* pd); // non usata
79  doublereal* pdGetErr(void);
80  void Update(const doublereal* pphi, const doublereal* yy);
81 };
82 
83 /* Ident - end */
84 
85 
86 /* IdentProcess - begin */
87 
88 class IdentProcess {
89  protected:
90  unsigned int iNumOutput;
91  unsigned int iNumInput;
92  unsigned int iOrdA;
93  unsigned int iOrdB;
94 
96 
97  public:
98  IdentProcess(unsigned int iOut, unsigned int iIn,
99  unsigned int iA, unsigned int iB);
100 
101  virtual ~IdentProcess(void);
102 
103  void CreateIdent(integer size, integer nout, ForgettingFactor* pf);
104  virtual void Update(const doublereal* pdY, const doublereal* pdU) = 0;
105  virtual void GetTheta(doublereal* pdTheta) = 0;
106  virtual void GetErr(doublereal* pdE);
107 
108  virtual inline doublereal dGetForgettingFactor(void) {
109  ASSERT(pIdent != NULL);
110  return pIdent->dGetForgettingFactor();
111  };
112 
113  virtual integer iGetSize(void) const = 0;
114 
115  integer iGetNumOutput(void) const {
116  return iNumOutput;
117  };
118 };
119 
120 /* IdentProcess - end */
121 
122 
123 /* IdentARXProcess - begin */
124 
126  protected:
128 
129  // e' il puntatore allo spazio di lavoro; usato solo per gestirlo
131 
134 
135  public:
136  IdentARXProcess(unsigned int iOut, unsigned int iIn,
137  unsigned int iA, unsigned int iB,
138  ForgettingFactor* pf);
139 
140  virtual ~IdentARXProcess(void);
141  virtual void Update(const doublereal* pdYTmp, const doublereal* pdUTmp);
142  virtual void GetTheta(doublereal* pdTheta);
143 
144  virtual integer iGetSize(void) const {
145  return size;
146  };
147 };
148 
149 /* IdentARXProcess - end */
150 
151 
152 /* IdentARMAXProcess - begin */
153 
155  protected:
157 
158  // e' il puntatore allo spazio di lavoro; usato solo per gestirlo
160 
164 
165  flag fCheckMA(doublereal* pdTheta);
166 
167  public:
168  IdentARMAXProcess(unsigned int iOut, unsigned int iIn,
169  unsigned int iA, unsigned int iB,
170  ForgettingFactor* pf);
171 
172  virtual ~IdentARMAXProcess(void);
173  virtual void Update(const doublereal* pdYTmp, const doublereal* pdUTmp);
174  virtual void GetTheta(doublereal* pdTheta);
175  void GetErr(doublereal* pdE);
176 
177  virtual integer iGetSize(void) const {
178  return size;
179  };
180 };
181 
182 /* IdentARMAXProcess - end */
183 
184 #endif
doublereal * pdGetTheta(void)
Definition: id.cc:115
virtual void GetTheta(doublereal *pdTheta)
Definition: id.cc:259
doublereal * pdBase
Definition: id.h:49
IdentARXProcess(unsigned int iOut, unsigned int iIn, unsigned int iA, unsigned int iB, ForgettingFactor *pf)
Definition: id.cc:201
const doublereal LDL_INIT
Definition: id.h:40
integer iGetNumOutput(void) const
Definition: id.h:115
long int flag
Definition: mbdyn.h:43
flag fCheckMA(doublereal *pdTheta)
Definition: id.cc:370
Definition: id.h:44
doublereal ** vz
Definition: id.h:56
virtual doublereal dGetForgettingFactor(void)
Definition: id.h:108
integer size
Definition: id.h:46
void SetForgettingFactor(const doublereal &kk)
Definition: id.cc:99
integer nout
Definition: id.h:47
unsigned int iOrdA
Definition: id.h:92
void CreateIdent(integer size, integer nout, ForgettingFactor *pf)
Definition: id.cc:182
virtual ~IdentProcess(void)
Definition: id.cc:177
virtual ~IdentARXProcess(void)
Definition: id.cc:224
doublereal * pdErr
Definition: id.h:163
doublereal * z
Definition: id.h:55
doublereal * pdBase
Definition: id.h:159
doublereal * pdGetErr(void)
Definition: id.cc:133
void Update(const doublereal *pphi, const doublereal *yy)
Definition: id.cc:137
IdentProcess(unsigned int iOut, unsigned int iIn, unsigned int iA, unsigned int iB)
Definition: id.cc:167
virtual void Update(const doublereal *pdYTmp, const doublereal *pdUTmp)
Definition: id.cc:229
integer size
Definition: id.h:127
integer size
Definition: id.h:156
ForgettingFactor * pF
Definition: id.h:65
doublereal * phi
Definition: id.h:61
doublereal dGetForgettingFactor(void) const
Definition: id.cc:95
doublereal * pdPhi
Definition: id.h:161
IdentARMAXProcess(unsigned int iOut, unsigned int iIn, unsigned int iA, unsigned int iB, ForgettingFactor *pf)
Definition: id.cc:272
doublereal * pdY
Definition: id.h:162
virtual void Update(const doublereal *pdY, const doublereal *pdU)=0
doublereal * theta
Definition: id.h:58
virtual ~Ident(void)
Definition: id.cc:89
void GetErr(doublereal *pdE)
Definition: id.cc:363
doublereal w
Definition: id.h:67
#define ASSERT(expression)
Definition: colamd.c:977
unsigned int iNumOutput
Definition: id.h:90
virtual void GetTheta(doublereal *pdTheta)=0
doublereal * pdBase
Definition: id.h:130
doublereal * err
Definition: id.h:63
doublereal ** ppdBase
Definition: id.h:50
doublereal * ldl
Definition: id.h:52
virtual integer iGetSize(void) const =0
Ident * pIdent
Definition: id.h:95
doublereal ** vtheta
Definition: id.h:59
virtual integer iGetSize(void) const
Definition: id.h:144
virtual void GetErr(doublereal *pdE)
Definition: id.cc:191
void UpdateTheta(const doublereal *pd)
Definition: id.cc:126
doublereal * y
Definition: id.h:62
unsigned int iNumInput
Definition: id.h:91
doublereal ** vldl
Definition: id.h:53
virtual integer iGetSize(void) const
Definition: id.h:177
virtual void GetTheta(doublereal *pdTheta)
Definition: id.cc:346
double doublereal
Definition: colamd.c:52
virtual ~IdentARMAXProcess(void)
Definition: id.cc:298
long int integer
Definition: colamd.c:51
doublereal * pdPhi
Definition: id.h:132
Ident(integer size, integer nout, ForgettingFactor *pf, const doublereal &ldl_init=LDL_INIT)
Definition: id.cc:40
virtual void Update(const doublereal *pdYTmp, const doublereal *pdUTmp)
Definition: id.cc:304
doublereal * pdY
Definition: id.h:133
doublereal k
Definition: id.h:66
unsigned int iOrdB
Definition: id.h:93