KR100942128B1 - Method for Calculating Revolution Per Unit time using High Speed Counter - Google Patents

Method for Calculating Revolution Per Unit time using High Speed Counter Download PDF

Info

Publication number
KR100942128B1
KR100942128B1 KR1020080011836A KR20080011836A KR100942128B1 KR 100942128 B1 KR100942128 B1 KR 100942128B1 KR 1020080011836 A KR1020080011836 A KR 1020080011836A KR 20080011836 A KR20080011836 A KR 20080011836A KR 100942128 B1 KR100942128 B1 KR 100942128B1
Authority
KR
South Korea
Prior art keywords
unit time
interrupt
per unit
revolutions per
rpu
Prior art date
Application number
KR1020080011836A
Other languages
Korean (ko)
Other versions
KR20090085909A (en
Inventor
박강희
Original Assignee
엘에스산전 주식회사
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 엘에스산전 주식회사 filed Critical 엘에스산전 주식회사
Priority to KR1020080011836A priority Critical patent/KR100942128B1/en
Publication of KR20090085909A publication Critical patent/KR20090085909A/en
Application granted granted Critical
Publication of KR100942128B1 publication Critical patent/KR100942128B1/en

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01PMEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
    • G01P3/00Measuring linear or angular speed; Measuring differences of linear or angular speeds
    • G01P3/42Devices characterised by the use of electric or magnetic means
    • G01P3/44Devices characterised by the use of electric or magnetic means for measuring angular speed
    • G01P3/48Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage
    • G01P3/481Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage of pulse signals
    • G01P3/487Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage of pulse signals delivered by rotating magnets
    • FMECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
    • F04POSITIVE - DISPLACEMENT MACHINES FOR LIQUIDS; PUMPS FOR LIQUIDS OR ELASTIC FLUIDS
    • F04DNON-POSITIVE-DISPLACEMENT PUMPS
    • F04D27/00Control, e.g. regulation, of pumps, pumping installations or pumping systems specially adapted for elastic fluids
    • F04D27/004Control, e.g. regulation, of pumps, pumping installations or pumping systems specially adapted for elastic fluids by varying driving speed
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
    • G01D18/00Testing or calibrating apparatus or arrangements provided for in groups G01D1/00 - G01D15/00
    • G01D18/001Calibrating encoders

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Mechanical Engineering (AREA)
  • General Engineering & Computer Science (AREA)
  • Measuring Frequencies, Analyzing Spectra (AREA)

Abstract

본 발명은 고속카운터를 이용하여 단위시간당 회전수(RPU: Revolution Per Unit time)를 산출하고자 할 때 입력 펄스 수의 변동 상황을 정확히 반영하여 RPU 단위시간과 표시값 갱신주기가 상이한 경우에도 단위시간당 회전수를 정확하게 계산할 수 있도록 한다. 이를 위하여 사용자가 설정하는 RPU 단위시간과 표시값 갱신주기에 따라 인터럽트 발생주기를 세분화하고, 각 인터럽트 발생주기에 입력되는 펄스 수를 보관하였다가 이후 단위시간당 회전수 계산에 이용한다. 이에 따라, 펄스 입력 속도에 차이가 발생하더라도 그 영향을 최소화함으로써 단위시간당 회전수 계산시의 오차를 개선할 수 있다.According to the present invention, when a revolution per unit time (RPU) is calculated using a high speed counter, the revolution per unit time is accurately reflected by a change in the number of input pulses, so that the rotation time per unit time is different. Make sure you can count numbers correctly. To this end, the interrupt generation cycle is subdivided according to the RPU unit time and display value update cycle set by the user, and the number of pulses inputted in each interrupt generation cycle is stored and then used for calculating the number of revolutions per unit time. Accordingly, even if a difference occurs in the pulse input speed, an error in calculating the number of revolutions per unit time can be improved by minimizing the effect.

고속카운터, 단위시간당 회전수(RPU), 인터럽트 발생주기, 갱신주기 High speed counter, revolution per unit time (RPU), interrupt generation cycle, update cycle

Description

고속카운터를 이용한 단위시간당 회전수 산출 방법{ Method for Calculating Revolution Per Unit time using High Speed Counter }Method for Calculating Revolution Per Unit time using High Speed Counter}

본 발명은 고속카운터를 이용한 단위시간당 회전수 산출 방법에 관한 것으로서, 특히 고속카운터를 이용하여 단위시간당 회전수(RPU)를 산출하고자 할 때 입력 펄스 수의 변동 상황을 정확히 반영하여 RPU 단위시간과 표시값 갱신주기가 상이한 경우에도 단위시간당 회전수를 정확하게 계산할 수 있도록 한다. The present invention relates to a method for calculating the number of revolutions per unit time using a high speed counter, in particular, when calculating the number of revolutions per unit time (RPU) using a high speed counter accurately reflects the change in the number of input pulses RPU unit time and display Even when the value update period is different, the number of revolutions per unit time can be calculated accurately.

산업 현장의 여러 분야에 걸쳐 단위시간당 회전수(RPU: Revolution Per Unit time) 정보가 사용된다. 일정 회전체의 회전에 따라 펄스가 발생하도록 구성하였을 때 1회전당 발생하는 펄스 수를 알고 있다면 고속카운터를 이용하여 펄스의 수를 계수함으로써 단위시간당 회전 수를 산출할 수 있다.Revolution Per Unit time (RPU) information is used across many sectors of the industry. If the number of pulses generated per one rotation is known when the pulses are generated according to the rotation of the predetermined rotor, the number of rotations per unit time can be calculated by counting the number of pulses using a high speed counter.

구체적인 예로서, 피엘시(PLC: Programmable Logic Controller)는 고속의 펄스 열을 계수하기 위하여 기본 유닛에 내장된 형태, 또는 증설 모듈의 형태로 고속 카운터 기능을 제공한다.As a specific example, a programmable logic controller (PLC) provides a high speed counter function in the form of a built-in base unit or an expansion module for counting a high speed pulse train.

도 1을 참조하자면, 피엘시(PLC)의 단위시간당 회전수 측정 기능을 사용하기 위해서는 일반적으로 개인용 컴퓨터(PC: Personal Computer)나 HMI(Human Machine Interface) 기기(11) 등을 이용하여 피엘시(12)에 RPU 단위시간, 1회전당 펄스 수, 및 계산결과를 표시해주는 주기(이하, 표시값 갱신주기라 한다) 등의 기초 정보를 설정해준다.Referring to FIG. 1, in order to use the RPM measurement function per unit time of the PLC, a PC may be generally installed using a personal computer (PC) or a human machine interface (HMI) device 11. 12) Basic information such as RPU unit time, number of pulses per revolution, and period for displaying the calculation result (hereinafter referred to as display value update cycle) are set.

고속펄스 입력회로(12-1)는 엔코더(13)로부터 입력되는 고속의 펄스열을 CMOS 레벨로 변환하여 마이크로 프로세서(12-2: MPU)로 전달하고, 마이크로 프로세(12-2)는 고속펄스 입력회로(12-1)를 통해 입력된 펄스열을 계수하며, 표시값 갱신주기가 되면 그동안 입력된 펄스의 수와 1회전당 펄스 수, RPU 단위시간의 관계에 의해 단위시간당 회전수를 계산하여 출력 버퍼(12-3)에 저장한다. 그러면, 개인용 컴퓨터나 HMI 기기(11)가 출력 버퍼(12-3)에 저장된 값을 읽어가 화면에 표시함으로써 사용자에게 현재의 단위시간당 회전수를 알려준다.The high speed pulse input circuit 12-1 converts a high speed pulse string input from the encoder 13 to a CMOS level and transmits the same to the microprocessor 12-2 (MPU), and the microprocessor 12-2 receives the high speed pulse. The pulse train inputted through the input circuit 12-1 is counted, and when the display value update cycle is reached, the number of revolutions per unit time is calculated based on the relationship between the number of input pulses, the number of pulses per revolution, and the RPU unit time. It stores in the buffer 12-3. Then, the personal computer or HMI device 11 reads the value stored in the output buffer 12-3 and displays it on the screen to inform the user of the current rotation speed per unit time.

도 2를 참조하여 종래의 단위시간당 회전수 계산 방법을 살펴보기로 한다.Referring to Figure 2 will be described a conventional method for calculating the number of revolutions per unit time.

피엘시(PLC)의 고속카운터 기능을 기동시키면 마이크로 프로세서(12-2)는 내부 펌웨어에 의해 고속 펄스를 입력받기 시작하고 고속카운터 정지 지령이 있을 때까지 입력되는 펄스 수를 계수한다(S21).When the high speed counter function of the PLC is activated, the microprocessor 12-2 starts receiving the high speed pulse by the internal firmware and counts the number of pulses input until the high speed counter stop command is received (S21).

이때 개인용 컴퓨터나 HMI 기기(11)에 의해 단위시간당 회전수 측정 기능이 활성화되어 있으면, 마이크로 프로세서(12-2)는 표시값 갱신주기마다 인터럽트가 발생하도록 내부 타이머 인터럽트를 기동한다(S22).At this time, if the rotational speed measurement function per unit time is activated by the personal computer or the HMI device 11, the microprocessor 12-2 starts the internal timer interrupt so that an interrupt occurs every display value update period (S22).

한편, 마이크로 프로세서(12-2)는 고속펄스 입력회로(12-1)로부터 전달되는 펄스열을 계수하다가 표시값 갱신주기가 되어 내부 타이머 인터럽트가 발생하면 인터럽트 서비스 루틴으로 진행한다(S23).On the other hand, the microprocessor 12-2 counts the pulse string transmitted from the high speed pulse input circuit 12-1, and when the display timer update cycle occurs and the internal timer interrupt occurs, the microprocessor 12-2 proceeds to the interrupt service routine (S23).

인터럽트 서비스 루틴에서는 먼저 누적된 총 입력 펄스 수에서 RPU 구간 초기값을 빼어 이번 표시값 갱신주기에서 입력된 펄스의 수를 계산하고(S24), 다음의 수학식 1과 같이 단위시간당 회전수를 산출한다(S26).The interrupt service routine first calculates the number of pulses input in this display value update period by subtracting the initial value of the RPU interval from the accumulated total number of input pulses (S24), and calculates the revolutions per unit time as shown in Equation 1 below. (S26).

Figure 112008009557086-pat00001
Figure 112008009557086-pat00001

이제, 단계 S25에서 계산된 단위시간당 회전수는 출력 버퍼(12-3)에 저장하여 개인용 컴퓨터나 HMI 기기(11)에서 읽어가도록 한다(S26). 그리고, 마이크로 프로세서(12-2)는 다음 단위시간당 회전수를 계산하기 위하여 현재의 고속카운터 값을 RPU 구간 초기값으로 저장한 후 인터럽트 서비스 루틴을 종료한다.Now, the number of revolutions per unit time calculated in step S25 is stored in the output buffer 12-3 for reading by the personal computer or HMI device 11 (S26). The microprocessor 12-2 ends the interrupt service routine after storing the current high speed counter value as the initial value of the RPU interval in order to calculate the number of revolutions per unit time.

수학식 1에서 볼 수 있듯이 종래에는 표시값 갱신주기 동안 입력된 펄스 수를 RPU 단위시간과의 비례관계에 의해 곱하거나 나눔으로써 RPU 단위시간 동안의 전체 입력 펄스 수를 추정하는 방법을 사용하고 있었다. 즉, 도 3a에 도시한 예와 같이 표시값 갱신주기가 1초이고 RPU 단위시간이 3초라면, 현재 표시값 갱신주기 1초 동안 입력된 펄스 수를 이용하여 나머지 구간의 펄스 수를 예상한다. 이 때문에 다음과 같은 문제점이 발생한다.As can be seen from Equation 1, conventionally, a method of estimating the total number of input pulses during an RPU unit time by multiplying or dividing the number of pulses input during a display value update period by a proportional relationship with the RPU unit time is used. That is, if the display value update period is 1 second and the RPU unit time is 3 seconds as shown in the example shown in FIG. 3A, the number of pulses in the remaining sections is estimated using the number of pulses input during the current display value update period 1 second. This causes the following problems.

1) 1회의 표시값 갱신주기 동안 입력된 펄스 수만을 이용하여 RPU 단위시간 전체 구간에 대한 펄스 수를 예측하므로, 특정 표시값 갱신주기 동안의 펄스 입력 속도가 소폭으로 변동하더라도 단위시간당 회전수 계산 결과의 변동폭이 커진다. 이러한 현상은 표시값 갱신주기와 RPU 단위시간의 차이가 클수록 더 커지게 된다.1) Since the number of pulses for the entire section of the RPU unit time is predicted using only the number of pulses input during one display value update period, even if the pulse input speed during a specific display value update period changes slightly, the number of revolutions per unit time is calculated. The fluctuation range of becomes large. This phenomenon becomes larger as the difference between the display value update period and the RPU unit time increases.

예로서 1회전당 펄스 수가 2이고, RPU 단위시간이 3초이며 표시값 갱신주기가 1초인 경우를 가정하면, 도 3b에 도시한 바와 같이 N 번째 표시값 갱신주기에서 입력 펄스 수가 작은 폭 증가한 상황에서도 단위시간당 회전수의 결과값에 오차가 확대되어 나타나게 된다.As an example, assuming that the number of pulses per revolution is 2, the RPU unit time is 3 seconds, and the display value update period is 1 second, as shown in FIG. Also, the error is enlarged in the result value of the revolutions per unit time.

2) 표시값 갱신주기 동안 입력된 펄스 수를 표시값 갱신주기와 RPU 단위시간의 비율로 곱하거나 나누는 방법을 사용하므로, 만일 피엘시(PLC) 등 단위시간당 회전수를 측정하는 장치가 부동소수점 연산이 불가능한 경우에는 단위시간당 회전수의 계산결과에 오차가 발생하게 된다.2) Since the number of pulses input during the display value update cycle is multiplied or divided by the ratio of the display value update cycle and the RPU unit time, a device that measures the number of revolutions per unit time, such as PLC, calculates floating point. If this is impossible, an error occurs in the calculation result of the revolutions per unit time.

예로서 표시값 갱신주기가 1.5초, RPU 단위시간이 10초, 1 회전당 펄스 수가 2이고 1초에 1회전 한다고 가정하면, 오차를 줄이기 위해 10배로 스케일링하여 계산한다고 해도 수학식 1에 의해 단위시간당 회전수의 계산결과는 '3.333'이 되어야 한다. 그러나, 부동 소수점 처리가 불가능한 경우에는 '3'으로 되어 계산 결과의 오차발생이 불가피하게 된다. 이러한 문제점은 펄스 입력 속도가 고속일수록 더 커지게 된다. For example, suppose that the display value update cycle is 1.5 seconds, the RPU unit time is 10 seconds, the number of pulses per revolution is 2, and the number of pulses is rotated once per second. The calculation of revolutions per hour shall be '3.333'. However, when floating point processing is not possible, it becomes '3', which causes an error in the calculation result. This problem becomes larger as the pulse input speed is higher.

이에 본 발명은 상기와 같은 문제점을 해결하기 위하여 안출된 것으로서, RPU 단위시간과 표시값 갱신주기에 따라 인터럽트 발생주기를 세분화하여 각 구간에 입력된 입력 펄스 수를 보관하도록 함으로써, 단위시간당 회전수 계산의 오차를 줄일 수 있는 고속카운터를 이용한 단위시간당 회전수 산출 방법을 제공하는데 그 목적이 있다.Accordingly, the present invention has been made to solve the above problems, by subdividing the interrupt generation cycle according to the RPU unit time and the display value update period to store the number of input pulses input to each section, the number of rotations per unit time calculation It is an object of the present invention to provide a method for calculating the number of revolutions per unit time using a high speed counter that can reduce the error.

상기와 같은 목적을 달성하기 위하여, 본 발명에 따른 고속카운터를 이용한 단위시간당 회전수 산출 방법은, 고속카운터를 이용한 입력 펄스의 계수가 시작되고, 사용자가 RPU 단위시간, 표시값 갱신주기, 1회전당 펄스 수를 설정하는 단계; 상기 RPU 단위시간과 표시값 갱신주기 모두에 대하여 정수 배의 관계를 갖는 값 중 가장 큰 값으로 인터럽트 발생주기를 설정하고, 상기 RPU 단위시간을 상기 인터럽트 발생주기로 나눈 개수(n)만큼의 증분변수를 설정하는 단계; 타이머 인터럽트를 기동하여 상기 인터럽트 발생주기가 되면 인터럽트를 발생시켜 이하의 a) 내지 d) 단계로 이루어지는 인터럽트 서비스 루틴이 수행되도록 하는 인터럽트 발생단계를 포함하여 이루어진다.In order to achieve the above object, the method for calculating the number of revolutions per unit time using the high speed counter according to the present invention, the count of the input pulse using the high speed counter is started, the user the RPU unit time, display value update cycle, once Setting the number of pulses per turn; The interrupt generation period is set to the largest value among the values having an integer multiple of both the RPU unit time and the display value update period, and an incremental variable equal to the number n divided by the RPU unit time by the interrupt generation period is set. Setting up; And an interrupt generating step of generating an interrupt when the timer interrupt is activated to generate the interrupt, thereby performing an interrupt service routine consisting of steps a) to d) below.

상기 인터럽트 서비스 루틴은, a) 이번 인터럽트 발생주기 동안 입력된 펄스 수를 계산하여 상기 설정된 각 증분변수에 순차 저장하되, 'n+1'번째 발생한 인터 럽트부터는 상기 각 증분변수에 저장된 값을 순환시켜 저장 순서가 가장 빠른 값을 대체하여 저장하는 단계; b) 인터럽트 발생횟수를 감시하여, '표시값 갱신주기/인터럽트 발생주기'만큼 상기 인터럽트가 발생하였을 때마다 이번 표시값 갱신주기가 완료된 것으로 판단하는 단계; c) 상기 판단 결과 이번 표시값 갱신주기가 완료된 경우에는 상기 각 증분변수에 저장되어 있는 값을 이용하여 단위시간당 회전수를 산출하는 단계; 및 d) 인터럽트 서비스 루틴을 종료하고 상기 인터럽트 발생단계로 되돌아 가는 단계를 포함하여 이루어질 수 있다.The interrupt service routine, a) calculates the number of pulses input during this interrupt generation cycle and stores them sequentially in each of the set incremental variables, starting from the interrupt occurrence of the 'n + 1' th time, and circulating the values stored in each incremental variable. Storing the value in which the storage order is the fastest; b) monitoring the number of interrupt occurrences and determining that the display value update cycle is completed each time the interrupt occurs by the display value update cycle / interrupt generation cycle; c) calculating the number of revolutions per unit time using the values stored in each incremental variable when the display value update period is completed as a result of the determination; And d) terminating the interrupt service routine and returning to the interrupt generation step.

상기 인터럽트 발생단계는 먼저 상기 고속카운터 값을 변수 'count_ini'에 저장해 놓는 과정을 포함하고, 상기 이번 인터럽트 발생주기 동안 입력된 펄스 수는 상기 인터럽트가 발생한 시점의 상기 고속카운터 값에서 상기 변수 'count_ini' 값을 차감하여 계산하도록 구성될 수 있다.The interrupt generating step includes storing the high speed counter value in a variable 'count_ini' first, and the number of pulses input during the current interrupt generation period is the variable 'count_ini' at the high speed counter value at the time of the interrupt occurrence. And calculate by subtracting the value.

상기 단위시간당 회전수는 상기 인터럽트 발생횟수가 상기 n개 미만일 때는 수학식The number of revolutions per unit time is expressed by the equation when the number of interrupt occurrences is less than n

Figure 112008009557086-pat00002
Figure 112008009557086-pat00002

에 따라 산출하도록 구성될 수 있다.It can be configured to calculate according to.

여기서, RPU는 단위시간당 회전수, T1은 인터럽트 발생주기, N1은 인터럽트 발생횟수이다.Here, RPU is the number of revolutions per unit time, T1 is the interrupt generation cycle, and N1 is the number of interrupt occurrences.

상기 단위시간당 회전수는 상기 인터럽트 발생횟수가 상기 n개 이상일 때는 수학식The number of revolutions per unit time is expressed as the interrupt occurrence frequency when n or more

Figure 112008009557086-pat00003
Figure 112008009557086-pat00003

에 따라 산출하도록 구성될 수 있다.It can be configured to calculate according to.

본 발명에 따르면, 표시값 갱신주기와 RPU 단위시간이 서로 상이하고, 각 표시값 갱신주기에서 입력되는 펄스의 수에 차이가 발생하더라도 그러한 차이가 단위시간당 회전수 계산에 미치는 영향을 최소화시킬 수 있다. 이에 따라, 단위시간당 회전수 계산시 발생할 수 있는 오차를 줄일 수 있다.According to the present invention, even if the display value update period and the RPU unit time are different from each other, and there is a difference in the number of pulses input in each display value update period, it is possible to minimize the effect of such a difference on the calculation of revolutions per unit time. . Accordingly, it is possible to reduce the error that may occur when calculating the number of revolutions per unit time.

이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 실시예를 상세히 설명하기로 한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

도 4를 참조하자면, 먼저 고속카운터를 이용한 입력 펄스의 계수가 시작되고, 단위시간당 회전수 측정 기능을 이용하고자 하는 사용자는 RPU 단위시간, 표시값 갱신주기, 1회전당 펄스 수 등 단위시간당 회전수를 산출하기 위하여 필요한 기초 정보를 설정한다(S41). 도 1에 도시한 피엘시의 예에서는 개인용 컴퓨터나 HMI 기기 등을 통해 피엘시로 입력시켜 놓게 된다.Referring to FIG. 4, first, an input pulse count is started using a high speed counter, and a user who wants to use the rotational speed measurement function per unit time includes an RPU unit time, a display value update cycle, and a rotational speed per unit time, such as a pulse number per revolution. The basic information necessary to calculate is set (S41). In the example of PELC shown in FIG. 1, PSI is inputted through a personal computer or an HMI device.

이제 단계 S41을 통해 설정된 정보를 이용하여 인터럽트 발생주기와, 각 인터럽트 발생주기 동안 입력된 펄스 수를 보관해 놓기 위한 변수(이하, 증분변수라 하고 'delta'로 표시하기로 한다)를 설정한다(S42).Now, using the information set in step S41, an interrupt generation cycle and a variable for storing the number of pulses input during each interrupt generation cycle (hereinafter, referred to as "incremental variables") will be set. S42).

인터럽트 발생주기는 RPU 단위시간과 표시값 갱신주기 모두에 대하여 정수 배의 관계를 갖는 값 중 가장 큰 값으로 설정한다.The interrupt generation period is set to the largest value among the integer multiples of both the RPU unit time and the display value update period.

즉, RPU 단위시간과 표시값 갱신주기가 서로 정수 배의 관계에 있으면 인터럽트 발생주기는 갱신주기가 된다. 예를 들어 RPU 단위시간이 3초이고 갱신주기가 1초인 경우는 1초마다 인터럽트가 발생하도록 설정한다. 만일 RPU 단위시간과 갱신주기가 정수 배의 관계에 있지 않으면, 두 값 모두에 대해 동시에 정수 배의 관계를 가지는 값 중 가장 큰 값이 인터럽트 발생주기가 된다. 예로서 RPU 단위시간이 4초이고 갱신주기가 1.5초인 경우에는 두 값 모두에 대해 정수 배의 관계에 있는 값 중 가장 큰 값인 0.5초가 인터럽트가 발생주기가 된다.In other words, if the RPU unit time and the display value update cycle are integer multiples of each other, the interrupt generation cycle becomes the update cycle. For example, if the RPU unit time is 3 seconds and the update cycle is 1 second, an interrupt is generated every 1 second. If the RPU unit time and the update period are not in integer multiples, the interrupt generation cycle is the largest value that has an integer multiple of both values at the same time. For example, if the RPU unit time is 4 seconds and the update period is 1.5 seconds, the interrupt generation cycle is 0.5 seconds, which is the largest value among the integer multiples of both values.

또한, 증분변수의 개수는 RPU 단위시간을 인터럽트 발생주기로 나눈 수(n) 이며, 각 증분변수는 초기화된다.In addition, the number of incremental variables is the number n divided by the interrupt generation period of the RPU unit time, and each incremental variable is initialized.

도 5에 인터럽트 발생주기, 증분변수, RPU 단위시간, 표시값 갱신주기 상호간의 관계를 나타내었다. 상기의 예와 같이 RPU 단위시간이 4초이고 갱신주기가 1.5초인 경우에는 0.5초가 인터럽트가 발생주기가 되고, 총 8개의 증분변수( delta[0] 내지 delta[7])가 설정된다.5 shows the relationship between the interrupt generation cycle, the incremental variable, the RPU unit time, and the display value update cycle. If the RPU unit time is 4 seconds and the update period is 1.5 seconds as described above, 0.5 seconds is the interrupt generation period, and a total of eight incremental variables (delta [0] to delta [7]) are set.

그리고, 임시변수 i와 u를 설정한다(S43). 변수 i는 인터럽트가 발생한 총 횟수를 나타내기 위한 것이고, 변수 u는 각 표시값 갱신주기가 완료되었음을 나타내기 위한 것으로서, 모두 초기값은 0으로 설정하기로 한다.Then, temporary variables i and u are set (S43). The variable i is for indicating the total number of times the interrupt has occurred, the variable u is for indicating that each display value update cycle is completed, and all initial values are set to zero.

이제 타이머 인터럽트를 기동하여 인터럽트 발생주기를 측정하는 과정이 이루어지는데(S44), 단계 S44에서는 먼저 고속카운터의 현재 값을 변수 'count_ini'에 저장시켜 놓도록 한다. 이값은 나중에 각 인터럽트 발생주기에서 입력된 펄스의 수를 확인하는데 사용된다.Now, the process of measuring the interrupt occurrence period by starting the timer interrupt is performed (S44). In step S44, the current value of the high speed counter is first stored in the variable 'count_ini'. This value is later used to check the number of pulses entered in each interrupt generation cycle.

그리고, 타이머의 측정값이 인터럽트 발생주기가 되면 인터럽트를 발생시켜 인터럽트 서비스 루틴으로 분기한다(S45). 단계 S46 이하의 과정은 인터럽트 서비스 루틴에서 이루어지는 과정이며, 인터럽트 서비스 루틴이 종료하면 다시 단계 S44로 되돌아 와서 타이머 인터럽트를 기동하여 인터럽트 발생주기를 측정하는 과정을 반복하게 된다.When the measured value of the timer reaches the interrupt generation cycle, an interrupt is generated and branches to the interrupt service routine (S45). The process below step S46 is a process performed in the interrupt service routine. When the interrupt service routine ends, the process returns to step S44 again to start a timer interrupt to repeat the process of measuring the interrupt occurrence cycle.

이제 인터럽트 서비스 루틴에 대하여 설명하기로 한다.The interrupt service routine will now be described.

먼저, 변수 i를 n 값과 비교한다(S46). 즉, n은 증분변수의 개수이고 변수 i는 인터럽트가 발생한 횟수를 나타내므로, 증분변수의 개수만큼 인터럽트가 발생하였는지의 여부를 판단하는 과정이다.First, the variable i is compared with the value n (S46). That is, since n is the number of incremental variables and variable i represents the number of interrupts generated, it is a process of determining whether interrupts are generated by the number of incremental variables.

단계 S46에서의 판단 결과, 변수 i의 값이 n 값 미만이라면 현재 차수의 증분변수 delta[i]에 이번 인터럽트 발생주기 동안 입력된 펄스 수를 저장한다(S47-1). 즉, 총 인터럽트 발생횟수가 n 값과 같아지기 전까지는 이번 인터럽트 발생주기 동안 입력된 펄스 수가 각 증분변수에 순차적으로 저장된다.As a result of the determination in step S46, if the value of the variable i is less than the value of n, the number of pulses input during this interrupt generation period is stored in the incremental variable delta [i] of the current order (S47-1). That is, until the total interrupt occurrence number is equal to n value, the number of pulses input during this interrupt generation cycle is stored in each incremental variable sequentially.

이때 이번 인터럽트 발생주기 동안 입력된 펄스 수는 단계 S45에서 인터럽트가 발생하였을 때의 고속카운터의 값에서 단계 S44에서 저장해 놓은 변수 count_ini 값을 차감함으로써 확인할 수 있다.At this time, the number of pulses input during this interrupt generation cycle can be confirmed by subtracting the variable count_ini value stored in step S44 from the value of the high speed counter when the interrupt occurred in step S45.

그러나, 단계 S46에서의 판단 결과, 변수 i의 값이 n 값 이상이라면, 각 증분변수에 저장된 값을 순환시킴으로써, 이번 인터럽트 발생주기 동안 입력된 펄스 수가 저장 순서가 가장 빠른 값을 대체하여 저장되도록 한다(S47-2). 즉, 각 증분변수 delta[0] 내지 delta[n-2]는 각각 delta[1] 내지 delta[n-1] 값으로 순환적으로 대체되고, 증분변수 delta[n-1]에 이번 인터럽트 발생주기 동안 입력된 펄스 수가 저장된다. 이것은 인터럽트 발생횟수가 n을 넘으면 가장 최근의 n개 인터럽트 발생주기에서 각각 입력된 펄스 수가 증분변수에 저장된다는 것을 의미한다.However, as a result of the determination in step S46, if the value of the variable i is equal to or greater than n, the value stored in each incremental variable is circulated so that the number of pulses input during this interrupt generation cycle is replaced by the value having the fastest storage order. (S47-2). That is, each incremental variable delta [0] to delta [n-2] is cyclically replaced with a value of delta [1] to delta [n-1], respectively, and the interrupt occurrence period is incremented to the incremental variable delta [n-1]. The number of pulses entered during is stored. This means that if the number of interrupt occurrences exceeds n, the number of pulses entered in each of the most recent n interrupt cycles is stored in the increment variable.

이제 이번 갱신주기가 완료되었는지의 여부를 조사한다(S48)Now check whether the update cycle is completed (S48).

단계 S48은 변수 u 값을 통해 확인할 수 있는데, 단계 S42에서 설정된 내용에 따라 변수 u 값이 "표시값 갱신주기/인터럽트 발생주기"일 때 이번 표시값 갱신주기가 완료된 것으로 판단할 수 있다.Step S48 can be confirmed through the variable u value. When the variable u value is "display value update cycle / interrupt generation cycle", the display value update cycle can be determined to be completed according to the contents set in step S42.

단계 S48에서의 판단 결과 이번 표시값 갱신주기가 완료되지 않은 경우에는 변수 u 값을 1 증가시킨다(S49-1).As a result of the determination in step S48, when the display value update period is not completed, the variable u value is increased by one (S49-1).

그러나, 단계 S48에서의 판단 결과 이번 표시값 갱신주기가 완료된 경우에는 각 증분변수를 이용하여 단위시간당 회전수를 산출하고(S49-2), 다시 표시값 갱신주기를 판단할 수 있도록 변수 u값을 초기화시킨다(S49-3).However, when the display value update cycle is completed as a result of the determination in step S48, the number of revolutions per unit time is calculated using each incremental variable (S49-2), and the variable u value is determined to determine the display value update cycle again. Initialize (S49-3).

그리고, 한 번의 인터럽트 처리가 끝났으므로 변수 i 값을 1 증가시킨 후 인터럽트 서비스 루틴을 모두 종료하고 다시 단계 S44로 되돌아간다(S49-4).After the interrupt processing is completed, the value of the variable i is increased by one, and then all interrupt service routines are terminated, and the process returns to step S44 again (S49-4).

한편, 단계 S49-2에서 단위시간당 회전수를 산출하는 방법은 인터럽트가 발생한 총 횟수에 따라 다음과 같이 구성할 수 있다.On the other hand, the method for calculating the number of revolutions per unit time in step S49-2 can be configured as follows according to the total number of interrupts generated.

1) 총 인터럽트 발생횟수가 n개 미만인 경우에는 다음의 수학식 2에 따라 단위시간당 회전수를 산출하도록 한다.1) If the total number of interrupts is less than n, calculate the number of revolutions per unit time according to Equation 2 below.

Figure 112008009557086-pat00004
Figure 112008009557086-pat00004

여기서, RPU는 단위시간당 회전수, T1은 인터럽트 발생주기, N1은 인터럽트 발생횟수이다.Here, RPU is the number of revolutions per unit time, T1 is the interrupt generation cycle, and N1 is the number of interrupt occurrences.

2) 총 인터럽트 발생횟수가 n개 이상인 경우에는 다음의 수학식 3에 따라 단위시간당 회전수를 산출하도록 한다.2) If the total number of interrupts is n or more, calculate the number of revolutions per unit time according to Equation 3 below.

Figure 112008009557086-pat00005
Figure 112008009557086-pat00005

도 6에 표시값 갱신주기가 1초이고 RPU 단위시간이 3초인 경우의 예를 도식적으로 나타내었다.6 shows an example in which the display value update period is 1 second and the RPU unit time is 3 seconds.

이 경우 종래에는 매 1초마다 입력된 펄스 수를 이용하여 3초 동안 입력될 펄스수를 추정한 후 이를 통해 단위시간당 회전수(RPU)를 계산하였지만, 본 발명에 따르면 1초 시점에서는 1초 동안 입력된 펄스 수, 2초 시점에서는 2초 동안 누적된 입력 펄스 수, 3초 이후의 시점에서는 3초 동안 누적된 입력 펄스 수를 이용하여 단위시간당 회전수(RPU)를 계산한다.In this case, conventionally, the number of pulses to be input for 3 seconds was estimated using the number of pulses input every 1 second, and then the number of revolutions per unit time (RPU) was calculated through this. The number of revolutions per unit time (RPU) is calculated using the number of input pulses, the number of input pulses accumulated for two seconds at a second time point, and the number of input pulses accumulated for three seconds after a third time.

이 때문에 해당 RPU 단위시간 동안 입력된 실제 펄스 수를 통한 단위시간당 회전수 계산이 가능해지므로, 종래 방식을 사용할 때 나타나던 입력 펄스 수의 변동에 따른 단위시간당 회전수 결과값의 과도한 변동이나 곱셈/나눗셈에 따른 계산오류를 개선 수 있게 된다.This makes it possible to calculate the revolutions per unit time using the actual number of pulses input during the corresponding unit time of the RPU. It is possible to improve the calculation error.

도 6a의 예에서는 인터럽트 발생주기와 표시값 갱신주기가 1초로 동일하므로 이해를 돕기 위하여 수식에 '갱신주기'로 표시하였다.In the example of FIG. 6A, since the interrupt generation period and the display value update period are the same as 1 second, the expression is indicated as an 'update period' for the sake of understanding.

또한, 도 6b에는 표시값 갱신주기가 증가함에 따른 각 증분변수의 상태를 나타내었으며, 4번째 표시값 갱신주기 이후로부터는 각 증분변수 값이 순환하는 모습이 나타나 있다.In addition, FIG. 6B shows the state of each incremental variable as the display value update period is increased, and each incremental variable value is circulated after the fourth display value update period.

도 7은 도 3b의 예와 동일한 조건일 때의 단위시간당 회전수 계산 결과를 나타낸 것이다.FIG. 7 illustrates a result of calculating rotation speed per unit time under the same conditions as the example of FIG. 3B.

N초 구간에서 도시된 바와 같은 입력 펄스 수의 변동에 발생하였을 때, 종래의 방식을 사용할 때는 '158'의 단위시간당 회전수 값이 산출되지만, 본 발명에 따라 개선된 방법을 사용할 때는 같은 조건에서 '154'로 산출된다.When a change in the number of input pulses as shown in the N second interval occurs, the rotation value per unit time of '158' is calculated when using the conventional method, but under the same conditions when using the improved method according to the present invention. It is calculated as '154'.

즉, 본 발명에 따른 방법을 사용하면 종래 방식에 비하여 정확한 단위시간당 회전수 값이 산출됨을 알 수 있다.That is, using the method according to the present invention it can be seen that the number of revolutions per unit time than the conventional method is calculated.

상술한 각 실시예는 본 발명의 이해를 돕기 위한 것이며, 본 발명은 상술한 실시예에 한정되지 않고 본 발명의 기술적 사상을 벗어나지 않는 범위 내에서 당업자에 의해 다양하게 변형하여 실시할 수 있는 것임은 물론이다.Each embodiment described above is intended to help the understanding of the present invention, the present invention is not limited to the above embodiments and can be variously modified and implemented by those skilled in the art without departing from the technical spirit of the present invention. Of course.

도 1은 고속타이머 기능을 갖는 피엘시(PLC) 시스템의 예,1 is an example of a PLC system having a high-speed timer function,

도 2는 종래 단위시간당 회전수를 산출하는 과정의 예,2 is an example of a process of calculating the number of revolutions per unit time in the related art;

도 3은 종래 방식으로 단위시간당 회전수가 산출되는 과정의 도식적인 예,3 is a schematic example of a process of calculating the number of revolutions per unit time in a conventional manner;

도 4는 본 발명에 따른 고속카운터를 이용한 단위시간당 회전수 산출 방법의 일 실시예,Figure 4 is an embodiment of a method for calculating the number of revolutions per unit time using a high speed counter according to the present invention,

도 5는 인터럽트 발생주기와 증분변수의 설명을 위한 개요,5 is an overview for explaining an interrupt generation period and an incremental variable;

도 6과 도 7은 본 발명에 따른 방식으로 단위시간당 회전수가 산출되는 과정의 도식적인 예이다.6 and 7 are schematic examples of the process of calculating the revolutions per unit time in the manner according to the invention.

Claims (4)

고속카운터를 이용한 입력 펄스의 계수가 시작되고, 사용자가 RPU 단위시간, 표시값 갱신주기, 1회전당 펄스 수를 설정하는 단계;Counting the input pulses using the high speed counter, and the user setting the RPU unit time, display value update period, and number of pulses per revolution; 상기 RPU 단위시간과 표시값 갱신주기 모두에 대하여 정수 배의 관계를 갖는 값 중 가장 큰 값으로 인터럽트 발생주기를 설정하고, 상기 RPU 단위시간을 상기 인터럽트 발생주기로 나눈 개수(n)만큼의 증분변수를 설정하는 단계;The interrupt generation period is set to the largest value among the values having an integer multiple of both the RPU unit time and the display value update period, and an incremental variable equal to the number n divided by the RPU unit time by the interrupt generation period is set. Setting up; 타이머 인터럽트를 기동하여 상기 인터럽트 발생주기가 되면 인터럽트를 발생시켜 이하의 a) 내지 d) 단계로 이루어지는 인터럽트 서비스 루틴이 수행되도록 하는 인터럽트 발생단계;An interrupt generation step of activating a timer interrupt to generate an interrupt when the interrupt generation cycle is reached so that an interrupt service routine consisting of steps a) to d) is performed; a) 이번 인터럽트 발생주기 동안 입력된 펄스 수를 계산하여 상기 설정된 각 증분변수에 순차 저장하되, 'n+1'번째 발생한 인터럽트부터는 상기 각 증분변수에 저장된 값을 순환시켜 저장 순서가 가장 빠른 값을 대체하여 저장하는 단계;a) Calculate the number of pulses input during this interrupt generation cycle and store them sequentially in each set increment variable, but from the 'n + 1' interrupt, the value stored in each increment variable is circulated to obtain the fastest value. Alternatively storing; b) 인터럽트 발생횟수를 감시하여, '표시값 갱신주기/인터럽트 발생주기'만큼 상기 인터럽트가 발생하였을 때마다 이번 표시값 갱신주기가 완료된 것으로 판단하는 단계;b) monitoring the number of interrupt occurrences and determining that the display value update cycle is completed each time the interrupt occurs by the display value update cycle / interrupt generation cycle; c) 상기 판단 결과 이번 표시값 갱신주기가 완료된 경우에는 상기 각 증분변수에 저장되어 있는 값을 이용하여 단위시간당 회전수를 산출하는 단계; 및c) calculating the number of revolutions per unit time using the values stored in each incremental variable when the display value update period is completed as a result of the determination; And d) 인터럽트 서비스 루틴을 종료하고 상기 인터럽트 발생단계로 되돌아 가는 단계를 포함하여 이루어지는 고속카운터를 이용한 단위시간당 회전수 산출 방법.d) A method for calculating the number of revolutions per unit time using a high speed counter comprising the step of ending an interrupt service routine and returning to the interrupt generation step. 제 1 항에 있어서,The method of claim 1, 상기 인터럽트 발생단계는 먼저 상기 고속카운터 값을 변수 'count_ini'에 저장해 놓는 과정을 포함하고,The interrupt generation step includes first storing the fast counter value in a variable 'count_ini', 상기 이번 인터럽트 발생주기 동안 입력된 펄스 수는 상기 인터럽트가 발생한 시점의 상기 고속카운터 값에서 상기 변수 'count_ini' 값을 차감하여 계산하도록 구성되는 것을 특징으로 하는 고속카운터를 이용한 단위시간당 회전수 산출 방법.The number of pulses input during the interrupt generation period is calculated by subtracting the variable 'count_ini' value from the high speed counter value at the time when the interrupt occurs. 제 1 항에 있어서,The method of claim 1, 상기 인터럽트 발생횟수가 상기 n개 미만일 때는 상기 단위시간당 회전수를 수학식When the frequency of occurrence of the interruption is less than n, the number of revolutions per unit time is calculated.
Figure 112008009557086-pat00006
Figure 112008009557086-pat00006
(RPU: 단위시간당 회전수, T1: 인터럽트 발생주기, N1: 인터럽트 발생횟수)(RPU: revolutions per unit time, T1: interrupt occurrence cycle, N1: interrupt occurrence count) 에 따라 산출하도록 구성되는 것을 특징으로 하는 고속카운터를 이용한 단위시간당 회전수 산출 방법.Method for calculating the number of revolutions per unit time using a high speed counter, characterized in that configured to calculate according to.
제 1 항에 있어서,The method of claim 1, 상기 인터럽트 발생횟수가 상기 n개 이상일 때는 상기 단위시간당 회전수를 수학식When the number of interrupt occurrences is more than n, the number of revolutions per unit time
Figure 112008009557086-pat00007
Figure 112008009557086-pat00007
( RPU: 단위시간당 회전수 )(RPU: revolutions per unit time) 에 따라 산출하도록 구성되는 것을 특징으로 하는 고속카운터를 이용한 단위시간당 회전수 산출 방법.Method for calculating the number of revolutions per unit time using a high speed counter, characterized in that configured to calculate according to.
KR1020080011836A 2008-02-05 2008-02-05 Method for Calculating Revolution Per Unit time using High Speed Counter KR100942128B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020080011836A KR100942128B1 (en) 2008-02-05 2008-02-05 Method for Calculating Revolution Per Unit time using High Speed Counter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020080011836A KR100942128B1 (en) 2008-02-05 2008-02-05 Method for Calculating Revolution Per Unit time using High Speed Counter

Publications (2)

Publication Number Publication Date
KR20090085909A KR20090085909A (en) 2009-08-10
KR100942128B1 true KR100942128B1 (en) 2010-02-16

Family

ID=41205722

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020080011836A KR100942128B1 (en) 2008-02-05 2008-02-05 Method for Calculating Revolution Per Unit time using High Speed Counter

Country Status (1)

Country Link
KR (1) KR100942128B1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101273750B1 (en) * 2010-12-21 2013-06-12 삼성전기주식회사 Measuring rotation speed of fan usinging counter
KR101363457B1 (en) * 2012-03-14 2014-02-17 주식회사 에스 피 지 Apparutus and method for Signal Conversion

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100719110B1 (en) * 2005-11-11 2007-05-17 삼성전자주식회사 Controller apparatus to acquire the encoder speed information and method thereof

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100719110B1 (en) * 2005-11-11 2007-05-17 삼성전자주식회사 Controller apparatus to acquire the encoder speed information and method thereof

Also Published As

Publication number Publication date
KR20090085909A (en) 2009-08-10

Similar Documents

Publication Publication Date Title
WO2018168101A1 (en) Seismic sensor and earthquake determination method
CN104914741A (en) Methods and apparatus for calibrating controllers for use with wells
JP5576551B2 (en) Systematic error handling method
KR100942128B1 (en) Method for Calculating Revolution Per Unit time using High Speed Counter
US20170343575A1 (en) Method for assessing a rotational speed of an engine
US10234262B2 (en) Sensor for measuring angular position, and measurement compensation method
US9071176B2 (en) Apparatus and method for controlling motor
RU2008149062A (en) METHOD FOR MEASURING FREQUENCY AND DEVICE FOR ITS IMPLEMENTATION
US8253456B2 (en) Time correction circuit and electronic apparatus
CN102163038A (en) Electronic watch, method of processing the same, and program therefor
JP5575458B2 (en) Electrical characteristic measuring apparatus and electrical characteristic measuring method
US20150015172A1 (en) Motor controller
JP3676350B2 (en) Motor speed control apparatus and method
JP6500550B2 (en) Timer correction device, timer correction method and timer correction program
JP5678868B2 (en) Signal processing device
US20210199684A1 (en) Low latency variable rotational frequency measurements
JP5578158B2 (en) Signal processing device
KR19990043005A (en) Motor speed detection device using incremental encoder
JP2006329815A (en) Tachometer
SU1104512A1 (en) Random number generator
KR100286043B1 (en) speed detecting system and method thereof
KR19980033797A (en) Speed detection device using encoder in motor and its method
JPH0839298A (en) Slide stop time measuring instrument of press machine
WO2021028981A1 (en) Device for measuring state of equipment
JP4048470B2 (en) Physical quantity measurement display method and measurement display apparatus

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20121221

Year of fee payment: 4

FPAY Annual fee payment

Payment date: 20131218

Year of fee payment: 5

FPAY Annual fee payment

Payment date: 20150106

Year of fee payment: 6