JPH10143495A - Method and device for operating average value - Google Patents

Method and device for operating average value

Info

Publication number
JPH10143495A
JPH10143495A JP29305696A JP29305696A JPH10143495A JP H10143495 A JPH10143495 A JP H10143495A JP 29305696 A JP29305696 A JP 29305696A JP 29305696 A JP29305696 A JP 29305696A JP H10143495 A JPH10143495 A JP H10143495A
Authority
JP
Japan
Prior art keywords
value
average value
input
summing
numerical
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP29305696A
Other languages
Japanese (ja)
Inventor
康則 ▲吉▼野
Yasunori Yoshino
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP29305696A priority Critical patent/JPH10143495A/en
Publication of JPH10143495A publication Critical patent/JPH10143495A/en
Pending legal-status Critical Current

Links

Landscapes

  • Complex Calculations (AREA)

Abstract

PROBLEM TO BE SOLVED: To shorten processing time without lowering calculation accuracy. SOLUTION: Each time a sample value is inputted (S103), a microprocessor (MPU) sums it up (S105) and when a number (i) of times reaches a number (n) (S107), the next input is waited. When the next input is performed (S109), the oldest sample value is subtracted from the summedup value (S110), the latest sample value is added in place of it (S111), the added total value is divided by (n) (S114), and an average value is outputted. Thus, it is enough only to perform addition, subtraction and division once by once for operating the average value from the (n+1)th time.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は平均値演算方法及び
その演算装置に関し、特に車両等移動体に搭載され、移
動中にも衛星通信を行うアンテナの制御に必要な、車両
の動揺角算出のための角速度センサの角速度データの平
均値演算方法及びその演算装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method for calculating an average value and an arithmetic device therefor. For calculating an average value of angular velocity data of an angular velocity sensor for calculating the average value.

【0002】[0002]

【従来の技術】順次入力される数値の最新のn(nは正
の整数)個の平均値を演算する平均値演算方法の一例が
特開昭59−221769号公報に開示されている。
2. Description of the Related Art An example of an average value calculating method for calculating the latest n (n is a positive integer) average values of sequentially input numerical values is disclosed in Japanese Patent Application Laid-Open No. 59-221969.

【0003】この公報に開示されている技術は、n個の
数値の合計値より平均値を減算した後に、新たに入力さ
れる数値を加算し、これをnで除算することで平均値を
求めるというものである。
According to the technique disclosed in this publication, an average value is obtained by subtracting an average value from a total value of n numerical values, adding a newly input numerical value, and dividing this by n. That is.

【0004】又、この公報の従来技術に、順次入力され
る最新のn個の数値の合計値を算出し、その合計値から
最古の数値を減算し、その減算後の合計値に次に入力さ
れる数値を加算し、その加算後の合計値をnで除算して
平均値を求めるという処理を数値が入力されるたびに行
う技術が開示されている。
In the prior art disclosed in this publication, a total value of the latest n numerical values sequentially inputted is calculated, the oldest numerical value is subtracted from the total value, and the total value after the subtraction is added to the total value. There is disclosed a technique of performing a process of adding an input numerical value, dividing the sum after the addition by n to obtain an average value each time a numerical value is input.

【0005】[0005]

【発明が解決しようとする課題】しかし、その公報に開
示されている技術によれば、n個の数値の合計値より最
古の数値を減算するのではなく、現時点における平均値
を減算するため、最古の数値と現平均値との差をnで除
算した値分が平均値の誤差となって生ずるという欠点が
あった。
However, according to the technique disclosed in that publication, instead of subtracting the oldest number from the sum of the n numbers, the average value at the present time is subtracted. There is a drawback that a value obtained by dividing the difference between the oldest numerical value and the current average value by n is an error in the average value.

【0006】又、その公報の従来技術に開示されている
技術によれば、新しい数値が入力されるたびにn個の数
値の合計値を算出しているため、加算に要する時間が長
くなり、演算処理能力の高い演算処理装置が必要となる
という欠点があった。
Further, according to the technique disclosed in the prior art of that publication, the total value of n numbers is calculated each time a new value is input, so that the time required for addition becomes longer. There is a drawback that an arithmetic processing unit having high arithmetic processing capability is required.

【0007】そこで本発明の目的は、計算精度を落とす
ことがなく、かつ処理時間の短縮を図ることが可能な平
均値演算方法及びその演算装置を提供することにある。
SUMMARY OF THE INVENTION An object of the present invention is to provide an average value calculation method and a calculation device capable of reducing the processing time without lowering the calculation accuracy.

【0008】[0008]

【課題を解決するための手段】前記課題を解決するため
に本発明は、順次入力される数値の最新のn(nは正の
整数)個の平均値を演算する平均値演算方法であって、
最初のn個の数値を合計する第1の過程と、この第1の
過程で得られた合計値から最古の数値を減算する第2の
過程と、この第2の過程で得られた合計値に次に入力さ
れる数値を加算する第3の過程と、この第3の過程で得
られた合計値をnで除算し平均値を演算する第4の過程
と、前記第2乃至第4の過程を繰り返して行う第5の過
程からなることを特徴とする。
According to the present invention, there is provided an average value calculating method for calculating the latest n (n is a positive integer) average value of sequentially input numerical values. ,
A first step of summing the first n numbers, a second step of subtracting the oldest number from the sum obtained in the first step, and a sum obtained in the second step A third step of adding the next input numerical value to the value, a fourth step of dividing the total value obtained in the third step by n to calculate an average value, and the second to fourth steps. And a fifth step of repeating the step.

【0009】又、他の発明は、順次入力される数値の最
新のn(nは正の整数)個の平均値を演算する平均値演
算装置であって、最初に入力されるn個の数値を格納す
る格納手段と、この格納手段に格納されるn個の数値を
合計する合計手段と、この合計手段で得られたn個の数
値の合計値より最古の数値を減算する減算手段と、次に
入力される数値を前記減算手段で減算された後の合計値
に加算する加算手段と、この加算手段で得られた合計値
をnで除算し平均値を演算する平均値演算手段と、前記
減算手段、加算手段及び平均値演算手段に前記数値が入
力されるたびに処理を行わせる制御手段とを有すること
を特徴とする。
Another aspect of the present invention is an average value calculating device for calculating the latest n (n is a positive integer) average value of sequentially input numerical values, wherein the n input numerical values are input first. And summing means for summing the n numbers stored in the storage means, and subtraction means for subtracting the oldest number from the sum of the n numbers obtained by the summing means. An adding means for adding the next input numerical value to the total value after being subtracted by the subtracting means; an average value calculating means for dividing the total value obtained by the adding means by n to calculate an average value; And control means for performing processing each time the numerical value is input to the subtraction means, the addition means, and the average value calculation means.

【0010】本発明によれば、最初のn個の数値の合計
値が算出された後は、数値が入力されるたびに合計値か
ら最古の数値の減算、最新の数値の加算、加算後の合計
値の除算が夫々行われる。
According to the present invention, after the total value of the first n numerical values is calculated, the oldest numerical value is subtracted from the total value, the latest numerical value is added, and Are divided respectively.

【0011】又、他の発明によれば、最初のn個の数値
の合計値が格納手段に格納され、その合計値が合計手段
で算出された後は、数値が入力されるたびに合計値から
最古の数値の減算が減算手段で、最新の数値の加算が加
算手段で、加算後の合計値の除算が平均値演算手段で夫
々行われる。
According to another aspect of the invention, the total value of the first n numerical values is stored in the storage means, and after the total value is calculated by the totaling means, the total value is calculated every time a numerical value is input. , The addition of the latest numerical value is performed by the adding means, and the division of the total value after the addition is performed by the average value calculating means.

【0012】[0012]

【発明の実施の形態】以下、本発明の実施の形態につい
て添付図面を参照しながら説明する。図1は本発明に係
る平均値演算装置を含む衛星追尾装置の最良の実施の形
態の構成図である。
Embodiments of the present invention will be described below with reference to the accompanying drawings. FIG. 1 is a configuration diagram of a preferred embodiment of a satellite tracking device including an average value calculation device according to the present invention.

【0013】衛星追尾装置は、車両等移動体の動揺角の
角速度を検出して角速度に比例したアナログ量を出力す
る角速度センサ1と、角速度センサ1により得られたア
ナログ量をディジタル量に変換するA/D変換器2と、
A/D変換器2より入力されたディジタル量に基づき平
均値演算を行うマイクロプロセッサ(以下、MPUとい
う。)3と、この平均値演算に使用するデータが格納さ
れるRAM(Random Access Memor
y)4と、平均値演算の処理プログラムが格納されるR
OM(Read Only Memory)5と、電源
遮断(オフ)時の各パラメータを格納するバックアップ
メモリ6と、MPU3からの指令値に基づき後述するモ
ータ8を駆動するモータ駆動回路7と、衛星通信用の追
尾型アンテナ9と、このアンテナ9の指向方向を制御す
るモータ8と、アンテナ9を介して衛星通信を行い、音
声等の情報を通信する衛星通信用送受信器10とからな
る。さらに、この衛星通信用送受信器10はMPU3に
衛星指向精度向上のため必要な衛星受信レベル、受信状
況等を通知する。
The satellite tracking device detects an angular velocity of a rocking angle of a moving body such as a vehicle and outputs an analog quantity proportional to the angular velocity, and converts the analog quantity obtained by the angular velocity sensor 1 into a digital quantity. An A / D converter 2;
A microprocessor (hereinafter, referred to as MPU) 3 for performing an average value calculation based on the digital amount input from the A / D converter 2, and a RAM (Random Access Memory) for storing data used for the average value calculation.
y) 4 and R in which the processing program for the average value calculation is stored
An OM (Read Only Memory) 5, a backup memory 6 for storing parameters when power is turned off (off), a motor drive circuit 7 for driving a motor 8 based on a command value from the MPU 3, and a satellite communication It comprises a tracking antenna 9, a motor 8 for controlling the directivity of the antenna 9, and a satellite communication transceiver 10 for performing satellite communication via the antenna 9 and communicating information such as voice. Further, the satellite communication transceiver 10 notifies the MPU 3 of the satellite reception level, reception status, and the like necessary for improving the satellite pointing accuracy.

【0014】このうち、A/D変換器2、MPU3、R
AM4、ROM5及びバックアップメモリ6により平均
値演算装置11が構成される。
Among them, A / D converter 2, MPU3, R
The AM 4, the ROM 5, and the backup memory 6 constitute an average value calculation device 11.

【0015】次に、RAM4に領域確保される平均値演
算に必要な領域について説明する。
Next, a description will be given of an area required for calculating an average value, which is secured in the RAM 4.

【0016】RAM4に確保される領域は、最新のサン
プルデータが格納される最新サンプル格納部(NEW)
21と、平均演算に用いるサンプル値が順次格納される
サンプル値格納配列部22と、サンプル値格納配列部2
2の最新の格納位置を示す格納位置指示部(i)23
と、サンプル値格納配列部22に格納されたサンプルの
全加算値が格納される合計値格納部(TOTAL)24
と、サンプルの平均値が格納される平均演算結果格納部
(AVE)25とからなる。
The area secured in the RAM 4 is a latest sample storage (NEW) in which the latest sample data is stored.
21, a sample value storage array unit 22 in which sample values used for averaging are sequentially stored, and a sample value storage array unit 2
Storage position indicating unit (i) 23 indicating the latest storage position
And a total value storage unit (TOTAL) 24 in which the total added value of the samples stored in the sample value storage array unit 22 is stored.
And an average calculation result storage (AVE) 25 for storing the average value of the samples.

【0017】尚、サンプル値格納配列部22の配列をD
T[n]で表す。又、nは正の整数で平均処理の要素数
を表す。
The array of the sample value storage array section 22 is D
It is represented by T [n]. N is a positive integer and represents the number of elements of the averaging process.

【0018】次に、この平均値演算装置11の動作につ
いてフローチャートを参照しながら説明する。図2は本
発明の第1の動作を示すフローチャートである。
Next, the operation of the average value calculating device 11 will be described with reference to a flowchart. FIG. 2 is a flowchart showing the first operation of the present invention.

【0019】尚、以下説明する第1乃至第4の動作全て
に共通することであるが、平均値演算はMPU3がRO
M5に格納された処理プログラムに基づき行い、処理途
中及び処理結果のデータはRAM4内の所定領域に格納
される。
Note that, although common to all of the first to fourth operations described below, the average value calculation is performed by the MPU 3 using the RO.
The processing is performed based on the processing program stored in M5, and data during the processing and the processing result are stored in a predetermined area in the RAM 4.

【0020】同図を参照して、第1の動作は、まず、電
源投入(オン)により(S101)平均値演算が開始さ
れると、RAM4の各値が初期化される(S102)。
即ち、格納位置指示部(i)23、合計値格納部(TO
TAL)24及びサンプル値格納配列部(DT[n])
22の内容がリセットされる。
Referring to FIG. 1, in a first operation, first, when the average value calculation is started by turning on the power (ON) (S101), each value of the RAM 4 is initialized (S102).
That is, the storage position indicating unit (i) 23 and the total value storage unit (TO)
TAL) 24 and sample value storage array section (DT [n])
22 is reset.

【0021】次に、最新のサンプル値が角速度センサ1
よりA/D変換器2及びMPU3を介して入力され、最
新サンプル格納部(NEW)21に格納され(S10
3)、さらにサンプル値格納配列部(DT[n])22
に格納される(S104)。
Next, the latest sample value is stored in the angular velocity sensor 1
Is input through the A / D converter 2 and the MPU 3 and stored in the latest sample storage (NEW) 21 (S10).
3), and a sample value storage array section (DT [n]) 22
(S104).

【0022】次に、サンプル値格納配列部(DT
[n])22に格納されているサンプル値の合計が算出
される(S105)。いま、サンプルは1つしかないの
で合計値はサンプル値に等しい。その合計値は合計値格
納部(TOTAL)24に格納される。
Next, the sample value storage array section (DT
[N]) The sum of the sample values stored in 22 is calculated (S105). Now, since there is only one sample, the total value is equal to the sample value. The total value is stored in a total value storage (TOTAL) 24.

【0023】次に、格納位置指示部(i)23の指示値
iが0から1に更新される(S106)。そして、指示
値iがサンプル値格納配列部(DT[n])22の要素
数nと一致するか否かが調べられ(S107)、一致し
ない場合はS103に戻り、サンプル値の入力を継続す
る。
Next, the indicated value i of the storage position indicating unit (i) 23 is updated from 0 to 1 (S106). Then, it is checked whether or not the indicated value i matches the number n of elements of the sample value storage array section (DT [n]) 22 (S107). If not, the process returns to S103 and input of the sample value is continued. .

【0024】一方、S107にて指示値iが要素数nと
一致する場合は、本発明の平均演算に必要な要素が揃っ
たことになり、まず、格納位置指示部(i)23がリセ
ットされ(S108)、最新のサンプル値が最新サンプ
ル格納部(NEW)21に格納される(S109)。
On the other hand, if the indicated value i matches the number n of elements in S107, it means that the elements necessary for the averaging operation of the present invention have been completed, and the storage position indicating unit (i) 23 is first reset. (S108), the latest sample value is stored in the latest sample storage (NEW) 21 (S109).

【0025】そして、合計値格納部(TOTAL)24
内の合計値より最古のサンプル値が減算され、合計値格
納部(TOTAL)24には減算後の合計値が格納され
る(S110)。最古のサンプル値とは、サンプル値格
納配列部(DT[n])22に格納されている最古のサ
ンプル値であり、これは格納位置指示部(i)23の指
示値iが示す位置におけるサンプル値である。
The total value storage (TOTAL) 24
The oldest sample value is subtracted from the total value in the above, and the total value after subtraction is stored in the total value storage (TOTAL) 24 (S110). The oldest sample value is the oldest sample value stored in the sample value storage array unit (DT [n]) 22, and is the position indicated by the indicated value i of the storage position indicating unit (i) 23. Is the sample value at.

【0026】次に、最新のサンプル値が合計値格納部
(TOTAL)24内の合計値に加算され、合計値格納
部(TOTAL)24には加算後の合計値が格納される
(S111)。そして、その最新サンプル値はサンプル
値格納配列部(DT[n])22の最古のサンプル値が
格納されていた位置に上書き保存され(S112)、そ
の後、格納位置指示部(i)23の指示値iが0から1
に更新される(S113)。
Next, the latest sample value is added to the total value in the total value storage unit (TOTAL) 24, and the total value after the addition is stored in the total value storage unit (TOTAL) 24 (S111). Then, the latest sample value is overwritten and saved at the position where the oldest sample value was stored in the sample value storage array unit (DT [n]) 22 (S112). Indicated value i is 0 to 1
Is updated to (S113).

【0027】次に、合計値格納部(TOTAL)24に
格納された合計値が要素数nで除算され、平均値が演算
される(S114)。そして、その平均値はMPU3等
必要な処理系に引き渡される(S115)。
Next, the total value stored in the total value storage (TOTAL) 24 is divided by the number n of elements to calculate an average value (S114). Then, the average value is transferred to a necessary processing system such as the MPU 3 (S115).

【0028】次に、指示値iがサンプル値格納配列部
(DT[n])22の要素数nと一致するか否かが調べ
られ(S116)、一致しない場合はS109に戻り、
順次指示値iを更新しつつ平均値が算出される。
Next, it is checked whether or not the indicated value i matches the number n of elements of the sample value storage array section (DT [n]) 22 (S116). If not, the flow returns to S109.
The average value is calculated while sequentially updating the designated value i.

【0029】一方、S116にて指示値iが要素数nと
一致する場合は、S108に戻り指示値iをリセットし
た後、S109以下の平均値演算処理を継続する。これ
で、第1の動作は終了する。
On the other hand, if the indicated value i matches the number n of elements in S116, the process returns to S108, resets the indicated value i, and then continues the average value calculation processing in S109 and subsequent steps. Thus, the first operation ends.

【0030】いま、第1の動作のサンプル値格納配列部
(DT[n])22の要素数nが16の場合について検
討する。
Now, consider the case where the number n of elements of the sample value storage array section (DT [n]) 22 in the first operation is 16.

【0031】n=16なので、サンプル値格納配列部
(DT[n])22の配列DTは、DT[0]からDT
[15]までの16要素となり、従来例の単純に毎回全
ての要素を加算する方式においては、16個の配列デー
タを加算し、それを割り算するので加算数15回、除算
数1回の演算が必要であるのに対し、本発明では、合計
値を求めるために、毎回必要とされる演算は、最古のデ
ータの減算1回、最新データの加算1回及び平均値算出
のための除算1回だけとなり、加減算時間でいえば、従
来例に比べ2/15の処理時間で結果が得られる。
Since n = 16, the array DT of the sample value storage array unit (DT [n]) 22 is DT [0] to DT [0].
In the conventional method in which all elements are simply added each time, there are 16 elements up to [15], and 16 pieces of array data are added and divided, so that the calculation is performed with 15 additions and 1 division. In the present invention, however, in the present invention, the operations required each time to obtain the total value include one subtraction of the oldest data, one addition of the latest data, and division for calculating the average value. Only once, the result is obtained in a processing time of 2/15 of the conventional example in terms of the addition and subtraction time.

【0032】次に、初期値100から1サンプルあたり
10ずつ連続増加していく場合につき、従来例の全加算
格納値から現平均値を減算した後に新たなデータを加算
する場合と比較する。
Next, in the case where the initial value is continuously increased by 10 per sample from the initial value 100, a comparison is made with the conventional case where the current average value is subtracted from the total addition stored value and new data is added.

【0033】n=1の場合に100が、n=2の場合に
110が、…、n=16の場合に250が夫々サンプル
値格納配列部(DT[n])22に格納されたとする
と、その平均値は、100+110+120+…+25
0=2800 であり、2800/16=175 だか
ら、平均値は175となる。
Assuming that 100 when n = 1, 110 when n = 2,..., And 250 when n = 16, are stored in the sample value storage array section (DT [n]) 22, respectively. The average value is 100 + 110 + 120 + ... + 25
Since 0 = 2800 and 2800/16 = 175, the average value is 175.

【0034】いま、次のサンプル値260が入力された
とすると、本発明の場合は、2800−100+260
=2960 であり、2960/16=185 とな
る。
Assuming that the next sample value 260 is input, in the case of the present invention, 2800-100 + 260
= 2960, and 2960/16 = 185.

【0035】一方、従来例の場合は、2800−175
+260=2885 であり、2885/16=18
0.3 となる。
On the other hand, in the case of the conventional example, 2800-175
+ 260 = 2885, and 2885/16 = 18
0.3.

【0036】即ち、本発明の場合は、平均値データも1
85−175=10 であり、確実に10だけ増加する
が、従来例の場合は、180.3−175=5.3しか
増加せず、誤差が大きいことが分かる。
That is, in the case of the present invention, the average value data is also 1
85-175 = 10, which is surely increased by 10, but in the case of the conventional example, it increases only by 180.3-175 = 5.3, which indicates that the error is large.

【0037】次に、第2の動作について説明する。図3
は本発明の第2の動作を示すフローチャートである。
Next, the second operation will be described. FIG.
Is a flowchart showing a second operation of the present invention.

【0038】この第2の動作が第1の動作と異なる点
は、第1の動作(図2参照)のS106とS107の間
にS201及びS202を追加した点であり、その他は
第1の動作と同じである。従って、動作説明はS201
及びS202について行い、その他は図示するに止め説
明を省略する。
The second operation differs from the first operation in that S201 and S202 are added between S106 and S107 of the first operation (see FIG. 2), and the other operations are the first operation. Is the same as Therefore, the operation is described in S201.
Steps S202 and S202 are performed, and the other steps are not shown in the drawings and the description is omitted.

【0039】第2の動作は、サンプル値が1つ入力され
るたびにS201にてその平均値(AVE)を取り、S
202にてその平均値をMPU3等必要な処理系に引き
渡すものである。
In the second operation, every time one sample value is input, the average value (AVE) is obtained in S201, and
At 202, the average value is transferred to a necessary processing system such as the MPU3.

【0040】即ち、第1の動作では、図2において、S
101からS107まで終了するまでは平均値が出力さ
れないため、電源投入から平均値が出力されるまで所定
時間を要したが、第2の動作ではS101からS107
までの期間内においてもS202にて平均値が出力され
るため、このような不都合は解消される。
That is, in the first operation, in FIG.
Since the average value is not output until the process from 101 to S107 is completed, a predetermined time is required from the power-on to the output of the average value. However, in the second operation, the process from S101 to S107 is performed.
Since the average value is output in S202 even in the period up to this point, such a disadvantage is solved.

【0041】より具体的には、第1の動作では、平均演
算に必要な要素数nが蓄積されるまで平均値を出力する
ことはできないが、第2の動作では、合計値(TOTA
L)と指示値iを使用して暫定の平均値を(合計値/
i)で算出することにより、平均値を最初のサンプル値
が入力された時点から毎回出力することができる。
More specifically, in the first operation, the average value cannot be output until the number of elements n required for the averaging operation is accumulated, but in the second operation, the total value (TOTA
L) and the indicated value i, the provisional average value is calculated as (total value /
By calculating in i), the average value can be output each time the first sample value is input.

【0042】次に、第3の動作について説明する。図4
は本発明の第3の動作を示すフローチャートである。
Next, the third operation will be described. FIG.
Is a flowchart showing a third operation of the present invention.

【0043】この第3の動作が第1の動作と異なる点
は、第1の動作(図2参照)のS102乃至S107を
S301及びS302で置き換えた点にある。その他は
第1の動作と同じである。従って、動作説明はS301
及びS302について行い、その他は図示するに止め説
明を省略する。
The third operation differs from the first operation in that S102 to S107 of the first operation (see FIG. 2) are replaced with S301 and S302. Others are the same as the first operation. Therefore, the operation is described in S301.
And S302, and the other steps are not shown in the figure and the description is omitted.

【0044】第3の動作は、電源投入後(S101)、
最初のサンプル値が入力されると(S301)、そのサ
ンプル値がn倍されて合計値格納部24にそのn倍した
サンプル値が格納されるとともに、サンプル値格納配列
部22のn個の格納部に最初のサンプル値が格納される
(S302)。即ち、サンプル値格納配列部22のn個
の格納部には同一の値のサンプル値が格納される。
The third operation is as follows: after the power is turned on (S101),
When the first sample value is input (S301), the sample value is multiplied by n, the sample value multiplied by n is stored in the total value storage unit 24, and the n number of samples stored in the sample value storage array unit 22 are stored. The first sample value is stored in the section (S302). That is, the same sample values are stored in the n storage units of the sample value storage array unit 22.

【0045】そして、この合計値格納部24に格納され
た合計値及びサンプル値格納配列部22のn個の格納部
に格納されたサンプル値に基づき、前述したS108乃
至S116の処理が行われる。
Then, based on the total value stored in the total value storage section 24 and the sample values stored in the n storage sections of the sample value storage array section 22, the above-described processing of S108 to S116 is performed.

【0046】即ち、第3の動作では、最初のサンプル値
が入力された時点でS108乃至S116の処理に移行
することが可能となるため、電源投入から平均値が出力
されるまでの所要時間を短縮することが可能となる。
That is, in the third operation, it is possible to shift to the processing from S108 to S116 when the first sample value is input, so that the time required from power-on to output of the average value is reduced. It can be shortened.

【0047】この場合、装置立ち上げ後、nサンプル得
られた時点で正規のサンプル数による平均演算結果が得
られることになる。
In this case, the average calculation result based on the normal number of samples is obtained when n samples are obtained after the apparatus is started.

【0048】最後に、第4の動作について説明する。図
1を参照して、第4の動作はバックアップメモリ6にR
AM4内の平均値演算結果格納部25に格納された平均
値の最終結果を格納するようMPU3が制御するもので
ある。このようにすることにより、装置の電源を遮断し
ても平均値の最終結果はバックアップメモリ6に記憶さ
れているため、次回の電源投入の際、このバックアップ
メモリ6より前回の平均値の最終結果を読出し利用する
ことができる。
Finally, the fourth operation will be described. Referring to FIG. 1, the fourth operation is to store R in backup memory 6.
The MPU 3 controls so that the final result of the average value stored in the average value calculation result storage unit 25 in the AM 4 is stored. In this way, the final result of the average value is stored in the backup memory 6 even if the power of the apparatus is cut off. Can be read and used.

【0049】従って、第3の動作(図4参照)の最初の
サンプル値(S301)としてこのバックアップメモリ
6より読出したサンプル値を用いることにより、最初の
サンプル値の入力を待つことなく、図4のS108以下
の処理の待機に入ることが可能となる。即ち、最初のサ
ンプル値が入力されるとS109より処理が開始される
ことになるため、最初のサンプル値が入力されてから最
初の平均値が出力されるまでに要する時間を第1の動作
に比べ短縮することができる。
Therefore, by using the sample value read from the backup memory 6 as the first sample value (S301) of the third operation (see FIG. 4), the input of the first sample value can be performed without waiting for the input of the first sample value. It is possible to enter the standby for the processing of S108 and thereafter. That is, when the first sample value is input, the process is started from S109, so that the time required from the input of the first sample value to the output of the first average value is set as the first operation. It can be shortened.

【0050】ここで、バックアップメモリ6は、EEP
ROM(ElectricallyErasable
Programmable ROM)、電池バックアッ
プによるRAM等の読書き可能な、電源遮断時に記憶デ
ータが保存されるものであれば任意のものを使用するこ
とが可能である。
Here, the backup memory 6 stores the EEP
ROM (Electrically Erasable)
Any type of readable and writable memory such as a programmable ROM (RAM) or a battery-backed-up RAM that can store stored data when the power is turned off can be used.

【0051】又、平均値演算装置11(図1参照)内の
MPU3,RAM4,ROM5を説明の便宜から区別し
て記載しているが、1チップIC(Integrate
dCircuit)CPU(Central Proc
essing Unit)のように、1つのIC内にこ
れらMPU3,RAM4,ROM5の機能を有するもの
を使用してもよい。
Although the MPU 3, RAM 4, and ROM 5 in the average value calculation device 11 (see FIG. 1) are described separately for convenience of explanation, a one-chip IC (Integrate) is used.
dCircuit) CPU (Central Proc)
An IC having the functions of the MPU 3, the RAM 4, and the ROM 5 may be used in one IC as in the case of an Essing Unit.

【0052】又、角速度センサ1がアナログ出力で構成
されているため、A/D変換器2でディジタル変換して
いるが、角速度センサ1としてディジタル出力のものを
用い、例えば、シリアル通信等によりその出力をMPU
3に入力するようにしてもよい。
Further, since the angular velocity sensor 1 has an analog output, the digital conversion is performed by the A / D converter 2. However, a digital output sensor is used as the angular velocity sensor 1, and the angular velocity sensor 1 is connected by, for example, serial communication. MPU output
3 may be input.

【0053】更に、平均値は平均演算結果格納部25に
格納するよう構成しているが、平均値を平均演算結果格
納部25に格納せず直接必要とされる処理系(MPU3
等)に引き渡すようにしてもよい。このようにすること
により平均演算結果格納部25を省略することができ
る。
Further, the average value is stored in the average calculation result storage unit 25. However, the average value is not stored in the average calculation result storage unit 25, and the processing system (MPU 3
Etc.). By doing so, the average calculation result storage unit 25 can be omitted.

【0054】一方、合計値は合計値格納部24に格納す
るよう構成しているが、計算精度がそれほど要求され
ず、整数演算のみで出力結果を求めればよい場合は、合
計値ではなく平均値のみを領域確保し、合計値は平均値
をn倍することにより求めるよう構成すれば、合計値格
納部24を省略することができる。又、平均値は合計値
の1/nの値なので使用するメモリの領域も少なくする
ことができる。又、nを2のべき乗に選べば乗算の代わ
りに該当データのシフト動作により合計値を求めること
ができるので、処理時間に関しても大きな負担とはなら
ない。
On the other hand, although the total value is configured to be stored in the total value storage unit 24, if the calculation accuracy is not so required and the output result can be obtained only by the integer operation, the average value is used instead of the total value. If only the area is secured and the total value is obtained by multiplying the average value by n, the total value storage unit 24 can be omitted. Further, since the average value is 1 / n of the total value, the memory area to be used can be reduced. Further, if n is a power of 2, the total value can be obtained by shifting the corresponding data instead of multiplication, so that the processing time does not become a large burden.

【0055】[0055]

【発明の効果】本発明によれば、順次入力される数値の
最新のn(nは正の整数)個の平均値を演算する平均値
演算方法であって、最初のn個の数値を合計する第1の
過程と、この第1の過程で得られた合計値から最古の数
値を減算する第2の過程と、この第2の過程で得られた
合計値に次に入力される数値を加算する第3の過程と、
この第3の過程で得られた合計値をnで除算し平均値を
演算する第4の過程と、前記第2乃至第4の過程を繰り
返して行う第5の過程から平均値演算方法を構成したた
め、計算精度を落とすことがなく、かつ処理時間の短縮
を図ることが可能となる。
According to the present invention, there is provided an average value calculating method for calculating the latest n (n is a positive integer) average value of sequentially input numerical values, wherein the first n numerical values are summed. A first step of subtracting the oldest numerical value from the total value obtained in the first step, and a numerical value input next to the total value obtained in the second step. A third step of adding
An average value calculation method is composed of a fourth step of dividing the total value obtained in the third step by n to calculate an average value and a fifth step of repeating the second to fourth steps. Therefore, it is possible to reduce the processing time without lowering the calculation accuracy.

【0056】又、他の発明によれば、順次入力される数
値の最新のn(nは正の整数)個の平均値を演算する平
均値演算装置であって、最初に入力されるn個の数値を
格納する格納手段と、この格納手段に格納されるn個の
数値を合計する合計手段と、この合計手段で得られたn
個の数値の合計値より最古の数値を減算する減算手段
と、次に入力される数値を前記減算手段で減算された後
の合計値に加算する加算手段と、この加算手段で得られ
た合計値をnで除算し平均値を演算する平均値演算手段
と、前記減算手段、加算手段及び平均値演算手段に前記
数値が入力されるたびに処理を行わせる制御手段とによ
り平均値演算装置を構成したため、計算精度を落とすこ
とがなく、かつ処理時間の短縮を図ることが可能とな
る。
According to another aspect of the present invention, there is provided an average value calculating device for calculating the latest n (n is a positive integer) average value of sequentially inputted numerical values, wherein , A summing means for summing n numbers stored in the storage means, and n obtained by the summing means.
Subtracting means for subtracting the oldest number from the sum of the numbers, adding means for adding the next input value to the sum after the subtraction by the subtracting means, and adding means obtained by the adding means. An average value calculating device including an average value calculating unit that divides a total value by n to calculate an average value, and a control unit that performs processing each time the numerical value is input to the subtracting unit, the adding unit, and the average value calculating unit. With this configuration, it is possible to reduce the processing time without lowering the calculation accuracy.

【図面の簡単な説明】[Brief description of the drawings]

【図1】本発明に係る平均値演算装置を含む衛星追尾装
置の最良の実施の形態の構成図である。
FIG. 1 is a configuration diagram of a best mode of a satellite tracking device including an average value calculation device according to the present invention.

【図2】本発明に係る平均値演算装置の第1の動作を示
すフローチャートである。
FIG. 2 is a flowchart showing a first operation of the average value calculation device according to the present invention.

【図3】本発明に係る平均値演算装置の第2の動作を示
すフローチャートである。
FIG. 3 is a flowchart showing a second operation of the average value calculation device according to the present invention.

【図4】本発明に係る平均値演算装置の第3の動作を示
すフローチャートである。
FIG. 4 is a flowchart showing a third operation of the average value calculating device according to the present invention.

【符号の説明】[Explanation of symbols]

3 マイクロプロセッサ 4 RAM 6 バックアップメモリ 21 最新サンプル格納部(NEW) 22 サンプル値格納配列部 23 格納位置指示部 24 合計値格納部 25 平均演算結果格納部 Reference Signs List 3 microprocessor 4 RAM 6 backup memory 21 latest sample storage unit (NEW) 22 sample value storage array unit 23 storage position indicating unit 24 total value storage unit 25 average calculation result storage unit

Claims (9)

【特許請求の範囲】[Claims] 【請求項1】 順次入力される数値の最新のn(nは正
の整数)個の平均値を演算する平均値演算方法であっ
て、 最初のn個の数値を合計する第1の過程と、この第1の
過程で得られた合計値から最古の数値を減算する第2の
過程と、この第2の過程で得られた合計値に次に入力さ
れる数値を加算する第3の過程と、この第3の過程で得
られた合計値をnで除算し平均値を演算する第4の過程
と、前記第2乃至第4の過程を繰り返して行う第5の過
程からなることを特徴とする平均値演算方法。
1. An average value calculation method for calculating the latest n (n is a positive integer) average value of sequentially input numerical values, comprising: a first step of summing the first n numerical values; A second step of subtracting the oldest value from the total value obtained in the first step, and a third step of adding the next input value to the total value obtained in the second step. And a fourth step of dividing the sum obtained in the third step by n to calculate an average value, and a fifth step of repeating the second to fourth steps. Average value calculation method.
【請求項2】 前記第1の過程は、数値が入力されるた
びに数値を合計する第6の過程と、入力された数値の数
がn個に達するとその合計値を前記第2の過程に引き渡
す第7の過程とからなることを特徴とする請求項1記載
の平均値演算方法。
2. The method according to claim 1, wherein the first step is a step of summing numerical values each time a numerical value is input, and the step of summing the total value when the number of input numerical values reaches n. 7. A method according to claim 1, further comprising the step of:
【請求項3】 前記第1の過程は、数値が入力されるた
びに数値を合計する第6の過程と、この第6の過程で得
られた合計値を入力された回数i(iは正の整数。ただ
し、i≦n)で除算し平均値を演算する第8の過程と、
iがnと等しくなるまで前記第6及び第7の過程を繰り
返して行う第9の過程と、n個の数値の合計値を前記第
2の過程に引き渡す第10の過程とからなることを特徴
とする請求項1記載の平均値演算方法。
3. The first step includes a sixth step of summing numerical values each time a numerical value is input, and a number i (i is a positive number) of inputting the total value obtained in the sixth step. An eighth step of dividing by i ≦ n) and calculating an average value;
a ninth step in which the sixth and seventh steps are repeated until i becomes equal to n; and a tenth step in which the sum of the n numbers is passed to the second step. The method for calculating an average value according to claim 1, wherein
【請求項4】 前記第1の過程は、最初に入力された数
値をn倍する第11の過程と、そのn倍された数値を最
初に入力されたn個の数値の合計値とみなして前記第2
の過程に引き渡す第12の過程とからなることを特徴と
する請求項1記載の平均値演算方法。
4. The first step comprises: an eleventh step of multiplying a first input numerical value by n; and considering the n-multiplied numerical value as a total value of n first input numerical values. The second
2. A method according to claim 1, further comprising a twelfth step of passing the step to the step.
【請求項5】 順次入力される数値の最新のn(nは正
の整数)個の平均値を演算する平均値演算装置であっ
て、 最初に入力されるn個の数値を格納する格納手段と、こ
の格納手段に格納されるn個の数値を合計する合計手段
と、この合計手段で得られたn個の数値の合計値より最
古の数値を減算する減算手段と、次に入力される数値を
前記減算手段で減算された後の合計値に加算する加算手
段と、この加算手段で得られた合計値をnで除算し平均
値を演算する平均値演算手段と、前記減算手段、加算手
段及び平均値演算手段に前記数値が入力されるたびに処
理を行わせる制御手段とを有することを特徴とする平均
値演算装置。
5. An average value calculating device for calculating the latest n (n is a positive integer) average value of sequentially input numerical values, wherein the storing means stores the first input n numerical values. Summing means for summing the n numbers stored in the storage means; subtraction means for subtracting the oldest number from the sum of the n numbers obtained by the summing means; Adding means for adding a numerical value to the total value after being subtracted by the subtracting means, average value calculating means for dividing the total value obtained by the adding means by n and calculating an average value; Control means for performing processing each time the numerical value is input to the addition means and the average value calculation means.
【請求項6】 前記合計手段は、数値が入力されるたび
に数値を合計する第2の合計手段と、入力された数値の
数がn個に達するとその合計値を前記減算手段へ出力す
る出力手段とを有することを特徴とする請求項5記載の
平均値演算装置。
6. The second summing means for summing numerical values each time a numerical value is input, and outputting the total value to the subtracting means when the number of input numerical values reaches n. The average value calculation device according to claim 5, further comprising an output unit.
【請求項7】 前記合計手段は、数値が入力されるたび
に数値を合計する第2の合計手段と、この第2の合計手
段で得られた合計値を入力された回数i(iは正の整
数。ただし、i≦n)で除算し平均値を演算する第2の
平均値演算手段と、iがnと等しくなるまで前記合計手
段及び第2の平均値演算手段に処理を行わせ、iがnと
等しくなるとそのときの合計値を前記減算手段へ出力す
る出力手段とを有することを特徴とする請求項5記載の
平均値演算装置。
7. The summing means includes: a second summing means for summing a numerical value each time a numerical value is input; and a number i (i is a positive number) of inputting the total value obtained by the second summing means. Where i ≦ n), the second average value calculating means for calculating the average value, and the summing means and the second average value calculating means perform processing until i becomes equal to n. 6. The average value calculation device according to claim 5, further comprising: output means for outputting the total value at that time when i becomes equal to n to said subtraction means.
【請求項8】 前記合計手段は、最初に入力された数値
をn倍する積算手段と、この積算手段で積算された数値
を最初に入力されたn個の数値の合計値とみなして前記
前記減算手段へ出力する出力手段とを有することを特徴
とする請求項5記載の平均値演算装置。
8. The multiplying means for multiplying a numerical value inputted first by n, and a numerical value integrated by the multiplying means as the total value of the n numerical values input first. 6. The average value calculation device according to claim 5, further comprising an output unit that outputs the average value to the subtraction unit.
【請求項9】 前記平均値演算手段により演算された平
均値の最終結果を格納するバックアップメモリをさらに
有し、前記合計手段はこのバックアップメモリに格納さ
れた平均値の最終結果を次回平均値演算処理する際の最
初に入力される数値として用いることを特徴とする請求
項8記載の平均値演算装置。
9. A backup memory for storing a final result of the average value calculated by the average value calculating means, wherein the totaling means calculates a final result of the average value stored in the backup memory for a next average value calculation. 9. The average value calculation device according to claim 8, wherein the average value calculation device is used as a numerical value input first when processing.
JP29305696A 1996-11-06 1996-11-06 Method and device for operating average value Pending JPH10143495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP29305696A JPH10143495A (en) 1996-11-06 1996-11-06 Method and device for operating average value

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP29305696A JPH10143495A (en) 1996-11-06 1996-11-06 Method and device for operating average value

Publications (1)

Publication Number Publication Date
JPH10143495A true JPH10143495A (en) 1998-05-29

Family

ID=17789906

Family Applications (1)

Application Number Title Priority Date Filing Date
JP29305696A Pending JPH10143495A (en) 1996-11-06 1996-11-06 Method and device for operating average value

Country Status (1)

Country Link
JP (1) JPH10143495A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006065497A (en) * 2004-08-25 2006-03-09 Sanyo Electric Co Ltd Data processor, and method and program for processing data
KR101061000B1 (en) 2009-04-29 2011-08-31 주식회사엘디티 Frame data average value calculation device and method
JP2014229133A (en) * 2013-05-23 2014-12-08 富士通株式会社 Moving average processing program and processor
JP2015208682A (en) * 2014-04-24 2015-11-24 富士通株式会社 Streaming updates of central moments for heart rate variability quantification

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006065497A (en) * 2004-08-25 2006-03-09 Sanyo Electric Co Ltd Data processor, and method and program for processing data
KR101061000B1 (en) 2009-04-29 2011-08-31 주식회사엘디티 Frame data average value calculation device and method
JP2014229133A (en) * 2013-05-23 2014-12-08 富士通株式会社 Moving average processing program and processor
US9436465B2 (en) 2013-05-23 2016-09-06 Fujitsu Limited Moving average processing in processor and processor
JP2015208682A (en) * 2014-04-24 2015-11-24 富士通株式会社 Streaming updates of central moments for heart rate variability quantification

Similar Documents

Publication Publication Date Title
US7250741B2 (en) Method and system for calculating available power of a battery
JP3487903B2 (en) Arithmetic device and arithmetic method
EP2112591B1 (en) Embedded control system
JPH10143495A (en) Method and device for operating average value
CN115932631A (en) Method and device for predicting battery life, electronic equipment and readable storage medium
EP0650115B1 (en) Multiplier capable of calculating double precision, single precision, inner product and multiplying complex numbers
CN114919642A (en) Electric power steering compensation method and device and vehicle
JPS62191926A (en) Arithmetic unit
CN111383157A (en) Image processing method and device, vehicle-mounted operation platform, electronic equipment and system
EP1143264B1 (en) GPS receiver having DR sensor signal sampling function
CN112838865A (en) DC offset calibration method, device and storage medium
US6332136B1 (en) Fuzzy filtering method and associated fuzzy filter
CN116311660A (en) Information pushing method and device, electronic equipment and computer storage medium
CN114722343A (en) Clutch position signal filtering method and device, storage medium and terminal
EP1355230A2 (en) Arithmetic processing unit and semiconductor device
JP3613314B2 (en) Information processing system
KR20010023229A (en) System for division using small-capacity memory
CN117991307B (en) Method and device for solving displacement of navigation receiver
CA1173164A (en) Fraction calculator
CN118114498A (en) Data filtering method, device, computer equipment, storage medium and program product
JP3499674B2 (en) Method for measuring characteristics of D / A converter and unit for measuring characteristics of D / A converter
CN114116748A (en) Information processing method, information processing device, electronic equipment and storage medium
CN116062028A (en) Method and device for calculating vehicle corner signal, vehicle and storage medium
JP3358112B2 (en) Programmable controller
CN114811032A (en) Gear self-learning method, device, equipment and storage medium