ARCS6 AR6-REV.24062600
読み取り中…
検索中…
一致する文字列を見つけられません
TwoInertiaStateFeedback.hh
[詳解]
1
9//
10// Copyright (C) 2011-2020 Yokokura, Yuki
11// This program is free software;
12// you can redistribute it and/or modify it under the terms of the FreeBSD License.
13// For details, see the License.txt file.
14
15#ifndef TWOINERTIASTATEFEEDBACK
16#define TWOINERTIASTATEFEEDBACK
17
18#include <cassert>
19#include <complex>
20#include "Matrix.hh"
21#include "TwoInertiaParamDef.hh"
23
24// ARCS組込み用マクロ
25#ifdef ARCS_IN
26 // ARCSに組み込まれる場合
27 #include "ARCSassert.hh"
28 #include "ARCSeventlog.hh"
29#else
30 // ARCSに組み込まれない場合
31 #define arcs_assert(a) (assert(a))
32 #define PassedLog()
33 #define EventLog(a)
34 #define EventLogVar(a)
35#endif
36
37namespace ARCS { // ARCS名前空間
40//template <>
42 public:
49 const struct TwoInertiaParamDef& Params,
50 const double Pole1, const double Pole2, const double Pole3,
51 const double Bandwidth, const double SmplTime
52 )
53 : Kt(Params.Kt),
54 Jm(Params.Jm),
55 Dm(Params.Dm),
56 Jl(Params.Jl),
57 Dl(Params.Dl),
58 Ks(Params.Ks),
59 Rg(Params.Rg),
60 gsob(Bandwidth),
61 Ts(SmplTime),
62 f(),
63 SOB(Params, Bandwidth, SmplTime)
64 {
65 CalcStateFeedbackGain(Pole1, Pole2, Pole3);
66 PassedLog();
67 }
68
77 const struct TwoInertiaParamDef& Params,
78 const double Pole1, const std::complex<double>& Pole2, const std::complex<double>& Pole3,
79 const double Bandwidth, const double SmplTime
80 )
81 : Kt(Params.Kt),
82 Jm(Params.Jm),
83 Dm(Params.Dm),
84 Jl(Params.Jl),
85 Dl(Params.Dl),
86 Ks(Params.Ks),
87 Rg(Params.Rg),
88 gsob(Bandwidth),
89 Ts(SmplTime),
90 f(),
91 SOB(Params, Bandwidth, SmplTime)
92 {
93 CalcStateFeedbackGain(Pole1, Pole2, Pole3);
94 PassedLog();
95 }
96
100 : Kt(r.Kt),
101 Jm(r.Jm),
102 Dm(r.Dm),
103 Jl(r.Jl),
104 Dl(r.Dl),
105 Ks(r.Ks),
106 Rg(r.Rg),
107 gsob(r.gsob),
108 Ts(r.Ts),
109 f(r.f),
110 SOB(std::move(r.SOB))
111 {
112
113 }
114
119
123 double GetFeedbackCurrent(const double Current, const double Velocity){
124 const Matrix<1,1> ireg = f*SOB.GetEstimatedVect(Current, Velocity);
125 return ireg[1];
126 }
127
128 private:
130 const TwoInertiaStateFeedback& operator=(const TwoInertiaStateFeedback&) = delete;
131 double Kt;
132 double Jm;
133 double Dm;
134 double Jl;
135 double Dl;
136 double Ks;
137 double Rg;
138 double gsob;
139 double Ts;
140 Matrix<3,1> f;
142
147 void CalcStateFeedbackGain(double p1, double p2, double p3){
148 const double fl = -(Jm*Rg*(Dl*Dl*Dl - 2.0*Dl*Jl*Ks + Dl*Dl*Jl*p1 + Dl*Dl*Jl*p2 + Dl*Dl*Jl*p3 - Jl*Jl*Ks*p1 - Jl*Jl*Ks*p2 - Jl*Jl*Ks*p3 + Dl*Jl*Jl*p1*p2 + Dl*Jl*Jl*p1*p3 + Dl*Jl*Jl*p2*p3 + Jl*Jl*Jl*p1*p2*p3))/(Jl*Jl*Ks*Kt);
149 const double fs = (Jm*Rg*(p1*p2 + p1*p3 + p2*p3 - Ks/Jl + Dl*Dl/(Jl*Jl) - Ks/(Jm*Rg*Rg) + (Dl*p1)/Jl + (Dl*p2)/Jl + (Dl*p3)/Jl))/Kt;
150 const double fm = -(Dl*Jm + Dm*Jl + Jl*Jm*p1 + Jl*Jm*p2 + Jl*Jm*p3)/(Jl*Kt);
151 f.Set(fl, fs, fm);
152 }
153
158 void CalcStateFeedbackGain(double p1, const std::complex<double>& p2, const std::complex<double>& p3){
159 arcs_assert(p2 == conj(p3)); // 極がペアになってるかチェック
160 const std::complex<double> fl = -(Jm*Rg*(Dl*Dl*Dl - 2.0*Dl*Jl*Ks + Dl*Dl*Jl*p1 + Dl*Dl*Jl*p2 + Dl*Dl*Jl*p3 - Jl*Jl*Ks*p1 - Jl*Jl*Ks*p2 - Jl*Jl*Ks*p3 + Dl*Jl*Jl*p1*p2 + Dl*Jl*Jl*p1*p3 + Dl*Jl*Jl*p2*p3 + Jl*Jl*Jl*p1*p2*p3))/(Jl*Jl*Ks*Kt);
161 const std::complex<double> fs = (Jm*Rg*(p1*p2 + p1*p3 + p2*p3 - Ks/Jl + Dl*Dl/(Jl*Jl) - Ks/(Jm*Rg*Rg) + (Dl*p1)/Jl + (Dl*p2)/Jl + (Dl*p3)/Jl))/Kt;
162 const std::complex<double> fm = -(Dl*Jm + Dm*Jl + Jl*Jm*p1 + Jl*Jm*p2 + Jl*Jm*p3)/(Jl*Kt);
163 f.Set(fl.real(), fs.real(), fm.real());
164 }
165
166};
167}
168
169#endif
170
ARCS イベントログクラス
#define PassedLog()
イベントログ用マクロ(ファイルと行番号のみ記録版)
Definition ARCSeventlog.hh:26
ARCS用ASSERTクラス
#define arcs_assert(a)
ARCS用assertマクロ a : assert条件
Definition ARCSassert.hh:17
2慣性共振系のパラメータ定義ファイル
行列/ベクトル計算クラス(テンプレート版)
2慣性系状態オブザーバクラス
行列/ベクトル計算クラス(テンプレート版)
Definition Matrix.hh:44
constexpr void Set(const T1 &u1, const T2 &... u2)
行列要素に値を設定する関数
Definition Matrix.hh:385
2慣性共振系のパラメータ構造体(Ds無し版)
Definition TwoInertiaParamDef.hh:18
2慣性共振系の状態フィードバックレギュレータ
Definition TwoInertiaStateFeedback.hh:41
TwoInertiaStateFeedback(const struct TwoInertiaParamDef &Params, const double Pole1, const std::complex< double > &Pole2, const std::complex< double > &Pole3, const double Bandwidth, const double SmplTime)
コンストラクタ(実数極版)
Definition TwoInertiaStateFeedback.hh:76
double GetFeedbackCurrent(const double Current, const double Velocity)
状態フィードバックレギュレータの補償電流を取得する関数
Definition TwoInertiaStateFeedback.hh:123
TwoInertiaStateFeedback(TwoInertiaStateFeedback &&r)
ムーブコンストラクタ
Definition TwoInertiaStateFeedback.hh:99
~TwoInertiaStateFeedback()
デストラクタ
Definition TwoInertiaStateFeedback.hh:116
TwoInertiaStateFeedback(const struct TwoInertiaParamDef &Params, const double Pole1, const double Pole2, const double Pole3, const double Bandwidth, const double SmplTime)
コンストラクタ(実数極版)
Definition TwoInertiaStateFeedback.hh:48
2慣性系状態オブザーバクラス
Definition TwoInertiaStateObsrv.hh:40
void GetEstimatedVect(const double Current, const double Velocity, Matrix< 1, 3 > &xhat)
推定状態ベクトルを取得する関数(普通版)
Definition TwoInertiaStateObsrv.hh:98