General Purpose Geodetic Library
SgParameter.h
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of Space Geodetic Library. The library is used by
4  * nuSolve, a part of CALC/SOLVE system, and designed to make analysis of
5  * geodetic VLBI observations.
6  * Copyright (C) 2010-2020 Sergei Bolotin.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef SG_EST_PARAMETER_H
24 #define SG_EST_PARAMETER_H
25 
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 
32 #include <QtCore/QString>
33 
34 #include <SgPartial.h>
35 #include <SgParameterCfg.h>
36 #include <SgVector.h>
37 #include <SgSymMatrix.h>
38 
39 
40 
41 /***===================================================================================================*/
47 class SgParameter : public SgPartial
48 {
49 public:
51  {
52  // Attr_IS_BREAK = 1<<0, //!< there is a break in the parameter's behavior
53  // Attr_IS_PROPAGATED = 1<<1, //!< the parameter's info have to be propagated in future
54  // Attr_IS_IN_RUN = 1<<2, //!<
55  // Attr_IS_PARTIAL_SET = 1<<3, //!< rise this bit on when the partial is assigned
56  // Attr_IS_SPECIAL = 1<<4, //!< for estimator use
57  Attr_IS_SOLVED = 1<<5,
58  Attr_AUX_FLAG = 1<<6,
59  };
60  //
61  // constructors/destructors:
62  //
66  inline SgParameter();
67 
72  inline SgParameter(const SgParameter& p);
73 
78  inline SgParameter(const QString& name);
79 
83  inline ~SgParameter();
84 
85 
86 
87  //
88  // Interfaces:
89  //
93 
96  inline double getValue() const;
97 
100  inline double getSolution() const;
101 
104  inline double getSigma() const;
105 
108  inline double getScale() const;
109 
112  inline SgParameterCfg::PMode getPMode() const;
113 
116  inline SgParameterCfg::SType getSType() const;
117 
120  inline double getSigmaAPriori() const;
121 
124  inline double getSigmaAPrioriAux() const;
125 
128  inline double getTau() const;
129 
132  inline double getPsd_RWN() const;
133 
136  inline double getPsd_BN() const;
137 
140  inline const QString& getPrefix() const;
141 
144  inline double getStep() const;
145 
148  inline double getTTL() const;
149 
152  inline int getNumOfPolynomials() const;
153 
156  inline SgMJD getTLeft() const;
157 
160  inline SgMJD getTRight() const;
161 
164  inline int getIdx() const;
165 
166  //
170  inline void setValue(double v);
171 
175  inline void setSolution(double v);
176 
180  inline void setSigma(double v);
181 
185  inline void setScale(double v);
186 
190  inline void setPMode(SgParameterCfg::PMode mode);
191 
195  inline void setSType(SgParameterCfg::SType type);
196 
200  inline void setSigmaAPriori(double v);
201 
205  inline void setSigmaAPrioriAux(double v);
206 
210  inline void setTau(double v);
211 
215  inline void setPsd_RWN(double v);
216 
220  inline void setPsd_BN(double v);
221 
225  inline void setPrefix(const QString& prefix);
226 
230  inline void setStep(double step);
231 
234  inline void setTTL(double ttl);
235 
238  inline void setNumOfPolynomials(int);
239 
242  inline void setTLeft(const SgMJD& t);
243 
246  inline void setTRight(const SgMJD& t);
247 
250  inline void setIdx(int idx);
251 
252  //
253  // Functions:
254  //
257  static const QString className();
258 
261  void tune(const SgParameterCfg&);
262 
266 
269  void tune(const SgParameter&);
270 
273  inline void resetStatistics();
274 
275  inline void decreaseTTL(double);
276 
277  inline void resetTTL();
278 
281  void update(SgParameter* p);
282 
283  double calcM(double);
284 
285  double calcRW(double);
286 
287  //
288  // Friends:
289  //
290 
291  //
292  // I/O:
293  //
294  // ...
295 
296 protected:
297  double value_;
298  double solution_;
299  double sigma_;
300  double scale_;
301 
304  double sigmaAPriori_;
306  double tau_;
307  double psd_RWN_;
308  double psd_BN_;
309  QString prefix_;
310  double step_;
311  double ttl_;
313  //-- experimental:
316  int idx_;
317 };
318 /*=====================================================================================================*/
319 
320 
321 
322 
323 
324 
325 
326 
327 /*=====================================================================================================*/
328 /* */
329 /* SgParamater inline members: */
330 /* */
331 /*=====================================================================================================*/
332 //
333 //
334 // CONSTRUCTORS:
335 //
336 // An empty constructor:
338  SgPartial(),
339  tLeft_(tZero),
340  tRight_(tInf)
341 {
342  value_ = 0.0;
343  solution_ = 0.0;
344  sigma_ = 1.0;
345  scale_ = 1.0;
348  sigmaAPriori_ = 1.0;
349  sigmaAPrioriAux_ = 1.0;
350  tau_ = 0.0;
351  psd_RWN_ = 1.0;
352  psd_BN_ = 1.0;
353  prefix_ = " ";
354  step_ = 1.0;
355  ttl_ = 36525.0;
356  numOfPolynomials_ = 0;
357  idx_ = -1;
358 };
359 
360 
361 
362 // An empty constructor, just set up a name:
363 inline SgParameter::SgParameter(const QString& name) :
364  SgPartial(name),
365  tLeft_(tZero),
366  tRight_(tInf)
367 {
368  value_ = 0.0;
369  solution_ = 0.0;
370  sigma_ = 1.0;
371  scale_ = 1.0;
374  sigmaAPriori_ = 1.0;
375  sigmaAPrioriAux_ = 1.0;
376  tau_ = 0.0;
377  psd_RWN_ = 1.0;
378  psd_BN_ = 1.0;
379  prefix_ = " ";
380  step_ = 1.0;
381  ttl_ = 36525.0;
382  numOfPolynomials_ = 0;
383  idx_ = -1;
384 };
385 
386 
387 
388 // A regular constructor:
390  SgPartial(p),
391  tLeft_(p.getTLeft()),
392  tRight_(p.getTRight())
393 {
394  value_ = p.getValue();
395  solution_ = p.getSolution();
396  sigma_ = p.getSigma();
397  scale_ = p.getScale();
398  pMode_ = p.getPMode();
399  sType_ = p.getSType();
402  tau_ = p.getTau();
403  psd_RWN_ = p.getPsd_RWN();
404  psd_BN_ = p.getPsd_BN();
405  prefix_ = p.getPrefix();
406  step_ = p.getStep();
407  ttl_ = p.getTTL();
409  idx_ = p.getIdx();
410 };
411 
412 
413 
414 // A destructor:
416 {
417  // nothing to do
418 };
419 
420 
421 
422 //
423 // INTERFACES:
424 //
425 //
426 //
427 inline double SgParameter::getValue() const
428 {
429  return value_;
430 };
431 
432 
433 
434 //
435 inline double SgParameter::getSolution() const
436 {
437  return solution_;
438 };
439 
440 
441 
442 //
443 inline double SgParameter::getSigma() const
444 {
445  return sigma_;
446 };
447 
448 
449 
450 //
451 inline double SgParameter::getScale() const
452 {
453  return scale_;
454 };
455 
456 
457 
458 //
460 {
461  return pMode_;
462 };
463 
464 
465 
466 //
468 {
469  return sType_;
470 };
471 
472 
473 
474 //
475 inline double SgParameter::getSigmaAPriori() const
476 {
477  return sigmaAPriori_;
478 };
479 
480 
481 
482 //
483 inline double SgParameter::getSigmaAPrioriAux() const
484 {
485  return sigmaAPrioriAux_;
486 };
487 
488 
489 
490 //
491 inline double SgParameter::getTau() const
492 {
493  return tau_;
494 };
495 
496 
497 
498 //
499 inline double SgParameter::getPsd_RWN() const
500 {
501  return psd_RWN_;
502 };
503 
504 
505 
506 //
507 inline double SgParameter::getPsd_BN() const
508 {
509  return psd_BN_;
510 };
511 
512 
513 
514 //
515 inline const QString& SgParameter::getPrefix() const
516 {
517  return prefix_;
518 };
519 
520 
521 
522 //
523 inline double SgParameter::getStep() const
524 {
525  return step_;
526 };
527 
528 
529 
530 //
531 inline double SgParameter::getTTL() const
532 {
533  return ttl_;
534 };
535 
536 
537 
538 //
540 {
541  return numOfPolynomials_;
542 };
543 
544 
545 
546 //
548 {
549  return tLeft_;
550 };
551 
552 
553 
554 //
556 {
557  return tRight_;
558 };
559 
560 
561 
562 //
563 inline int SgParameter::getIdx() const
564 {
565  return idx_;
566 };
567 
568 
569 
570 //
571 inline void SgParameter::setValue(double v)
572 {
573  value_ = v;
574 };
575 
576 
577 
578 //
579 inline void SgParameter::setSolution(double v)
580 {
581  solution_ = v;
582 };
583 
584 
585 
586 //
587 inline void SgParameter::setSigma(double v)
588 {
589  sigma_ = v;
590 };
591 
592 
593 
594 //
595 inline void SgParameter::setScale(double v)
596 {
597  scale_ = v;
598 };
599 
600 
601 
602 //
604 {
605  pMode_ = mode;
606 };
607 
608 
609 
610 //
612 {
613  sType_ = type;
614 };
615 
616 
617 
618 //
619 inline void SgParameter::setSigmaAPriori(double v)
620 {
621  sigmaAPriori_ = v;
622 };
623 
624 
625 
626 //
627 inline void SgParameter::setSigmaAPrioriAux(double v)
628 {
629  sigmaAPrioriAux_ = v;
630 };
631 
632 
633 
634 //
635 inline void SgParameter::setTau(double v)
636 {
637  tau_ = v;
638 };
639 
640 
641 
642 //
643 inline void SgParameter::setPsd_RWN(double v)
644 {
645  psd_RWN_ = v;
646 };
647 
648 
649 
650 //
651 inline void SgParameter::setPsd_BN(double v)
652 {
653  psd_BN_ = v;
654 };
655 
656 
657 
658 //
659 inline void SgParameter::setPrefix(const QString& prefix)
660 {
661  prefix_ = prefix;
662 };
663 
664 
665 
666 //
667 inline void SgParameter::setStep(double s)
668 {
669  step_ = s;
670 };
671 
672 
673 
674 //
675 inline void SgParameter::setTTL(double ttl)
676 {
677  ttl_ = ttl;
678 };
679 
680 
681 
682 //
684 {
685  numOfPolynomials_ = n;
686 };
687 
688 
689 
690 //
691 inline void SgParameter::setTLeft(const SgMJD& t)
692 {
693  tLeft_ = t;
694 };
695 
696 
697 
698 //
699 inline void SgParameter::setTRight(const SgMJD& t)
700 {
701  tRight_ = t;
702 };
703 
704 
705 
706 //
707 inline void SgParameter::setIdx(int idx)
708 {
709  idx_ = idx;
710 };
711 
712 
713 
714 //
715 // FUNCTIONS:
716 //
717 //
718 //
720 {
722  value_ = solution_ = 0.0;
723  sigma_ = 1.0;
724 };
725 
726 
727 
728 //
729 inline void SgParameter::decreaseTTL(double dt)
730 {
731  ttl_ -= dt;
732 };
733 
734 
735 
736 //
738 {
739  while (ttl_<=0.0)
740  ttl_ += step_;
741 };
742 
743 
744 
745 
746 //
747 // FRIENDS:
748 //
749 //
750 //
751 
752 
753 /*=====================================================================================================*/
754 
755 
756 
757 
758 
759 /*=====================================================================================================*/
760 //
761 // aux functions:
762 //
763 //
765 
766 //
768 
769 //
771 
772 //
774 
775 //
777 
778 //
779 void reportParameterList(const QList<SgParameter*>&, bool=false);
780 
781 //
782 //void clearStatisticsForParameters(QList<SgParameter*>&);
783 /*=====================================================================================================*/
784 #endif //SG_EST_PARAMETER_H
const SgMJD tZero(1957, 10, 4)
const SgMJD tInf(2100, 1, 1)
void reportParameterList(const QList< SgParameter * > &, bool=false)
bool lessThan4_ParameterByTTLSortingOrder(SgParameter *, SgParameter *)
bool lessThan4_ParameterByNameSortingOrder(SgParameter *, SgParameter *)
bool lessThan4_ParameterByTRightSortingOrder(SgParameter *, SgParameter *)
bool lessThan4_ParameterByTLeftSortingOrder(SgParameter *, SgParameter *)
void updateSolutionAtParameterList(QList< SgParameter * > &, SgVector *, SgSymMatrix *)
Definition: SgMJD.h:59
double getPsd_BN() const
Definition: SgParameter.h:507
void setSType(SgParameterCfg::SType type)
Definition: SgParameter.h:611
double sigma_
a sigma of the latest estimation;
Definition: SgParameter.h:299
double calcRW(double)
double getStep() const
Definition: SgParameter.h:523
double getScale() const
Definition: SgParameter.h:451
const QString & getPrefix() const
Definition: SgParameter.h:515
int idx_
an index in common list of parameters
Definition: SgParameter.h:316
double solution_
a solution from latest estimation;
Definition: SgParameter.h:298
double value_
the value of adjustment process (cumulative);
Definition: SgParameter.h:297
double getSolution() const
Definition: SgParameter.h:435
void setPsd_RWN(double v)
Definition: SgParameter.h:643
void setTLeft(const SgMJD &t)
Definition: SgParameter.h:691
SgMJD getTRight() const
Definition: SgParameter.h:555
void setSigmaAPrioriAux(double v)
Definition: SgParameter.h:627
void setNumOfPolynomials(int)
Definition: SgParameter.h:683
void resetTTL()
Definition: SgParameter.h:737
SgParameterCfg::PMode pMode_
Definition: SgParameter.h:302
void setIdx(int idx)
Definition: SgParameter.h:707
double getPsd_RWN() const
Definition: SgParameter.h:499
QString prefix_
Definition: SgParameter.h:309
double ttl_
Definition: SgParameter.h:311
SgMJD getTLeft() const
Definition: SgParameter.h:547
void setPsd_BN(double v)
Definition: SgParameter.h:651
void setTTL(double ttl)
Definition: SgParameter.h:675
SgMJD tLeft_
Definition: SgParameter.h:314
void setTRight(const SgMJD &t)
Definition: SgParameter.h:699
SgMJD tRight_
Definition: SgParameter.h:315
static const QString className()
Definition: SgParameter.cpp:37
int getNumOfPolynomials() const
Definition: SgParameter.h:539
void tune(const SgParameterCfg &)
Definition: SgParameter.cpp:72
SgParameterCfg::PMode getPMode() const
Definition: SgParameter.h:459
double psd_RWN_
PSD of Ruled White Noise.
Definition: SgParameter.h:307
void setPrefix(const QString &prefix)
Definition: SgParameter.h:659
void setSigma(double v)
Definition: SgParameter.h:587
double psd_BN_
PSD of White Noise used in break.
Definition: SgParameter.h:308
double getValue() const
Definition: SgParameter.h:427
SgParameterCfg::SType sType_
Definition: SgParameter.h:303
double getSigma() const
Definition: SgParameter.h:443
int getIdx() const
Definition: SgParameter.h:563
void update(SgParameter *p)
double getSigmaAPriori() const
Definition: SgParameter.h:475
void decreaseTTL(double)
Definition: SgParameter.h:729
void resetStatistics()
Definition: SgParameter.h:719
void setScale(double v)
Definition: SgParameter.h:595
SgParameter & operator=(const SgParameter &a)
Definition: SgParameter.cpp:45
void setStep(double step)
Definition: SgParameter.h:667
double step_
Definition: SgParameter.h:310
double sigmaAPrioriAux_
a priori std. deviation (to init the Inform. matrix)
Definition: SgParameter.h:305
double scale_
a scale factor;
Definition: SgParameter.h:300
void setSolution(double v)
Definition: SgParameter.h:579
SgParameterCfg::SType getSType() const
Definition: SgParameter.h:467
@ Attr_AUX_FLAG
for external use
Definition: SgParameter.h:58
@ Attr_IS_SOLVED
for estimator use
Definition: SgParameter.h:57
void setTau(double v)
Definition: SgParameter.h:635
void setValue(double v)
Definition: SgParameter.h:571
double calcM(double)
void setSigmaAPriori(double v)
Definition: SgParameter.h:619
int numOfPolynomials_
number of polinomials for a model
Definition: SgParameter.h:312
double getTTL() const
Definition: SgParameter.h:531
double getTau() const
Definition: SgParameter.h:491
double sigmaAPriori_
a priori std. deviation (to init the Inform. matrix)
Definition: SgParameter.h:304
double getSigmaAPrioriAux() const
Definition: SgParameter.h:483
void setPMode(SgParameterCfg::PMode mode)
Definition: SgParameter.h:603
double tau_
time of relaxation (for stochastic parameters)
Definition: SgParameter.h:306
void resetStatistics()
Definition: SgPartial.h:395