KR100271596B1 - Analysis and real-time execution method of a function block type process control program - Google Patents

Analysis and real-time execution method of a function block type process control program Download PDF

Info

Publication number
KR100271596B1
KR100271596B1 KR1019970048004A KR19970048004A KR100271596B1 KR 100271596 B1 KR100271596 B1 KR 100271596B1 KR 1019970048004 A KR1019970048004 A KR 1019970048004A KR 19970048004 A KR19970048004 A KR 19970048004A KR 100271596 B1 KR100271596 B1 KR 100271596B1
Authority
KR
South Korea
Prior art keywords
function
primitive
function block
array
control program
Prior art date
Application number
KR1019970048004A
Other languages
Korean (ko)
Other versions
KR19990026052A (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 KR1019970048004A priority Critical patent/KR100271596B1/en
Publication of KR19990026052A publication Critical patent/KR19990026052A/en
Application granted granted Critical
Publication of KR100271596B1 publication Critical patent/KR100271596B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/75Structural analysis for program understanding

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE: An interpretation and real time execution method of a function block type process control program is provided to define a unit element of a control operation as a primitive function for a program formation and execution for a process control and easily use a function block formed by grouping a high frequency portion as one element like a service routine of a computer language for thereby implementing an efficient control program. CONSTITUTION: A function block is interpreted. A function block source function group arrangement which includes a unit arrangement with respect to each source function of the function block is generated. A function block source function code arrangement which includes a pointer which indicates a function block source function group arrangement with respect to a source function included in the function block is generated. A function block region variable arrangement is generated for storing variables used in the function block. Source function group arrangements which include a unit arrangement with respect to the source function are generated. A source function code arrangement which includes a pointer is generated. System region, input and output and region variable arrangements are generated for storing the variables. A function block source function code arrangement is copied to the source function code arrangement.

Description

기능블럭형 공정 제어 프로그램의 해석 및 실시간 실행 방법How to interpret functional block type process control program and execute it in real time

본 발명은 공정 제어 시스템에서 공정 제어 프로그램의 해석 및 실시간 실행 방법에 관한 것으로서, 특히 제어 동작의 단위 요소인 원시기능과, 원시기능들의 조합 중 사용 빈도가 높은 것을 하나의 개체로 묶어 정의한 기능블럭을 포함하는 공정 제어 프로그램의 해석 및 실행 방법에 관한 것이다.The present invention relates to a method of interpreting and executing a process control program in a process control system, and more particularly, to a function block in which a primitive function which is a unit element of a control operation and a combination of primitive functions having a high frequency of use are grouped and defined as a single object. It relates to a method of interpreting and executing a process control program that includes.

생산성 향상을 통한 경쟁력 강화 및 다양한 시장의 요구에 능동적으로 대처하기 위해서 공정 제어 시스템을 이용하여 단위 기계 〔각종 엑츄에이터(actuator)〕의 자동화를 포함하여 전 공정을 자동화하는데 관한 연구가 활발히 진행되고 있다. 더욱이 1970년대 초반부터 마이크로프로세서의 발달로 자동화용 제어 장치에 혁신적인 변화가 도입되었다. 이를 기반으로, 발전, 제철, 화학 공정 및 빌딩 자동화 분야에서도 디지털 컴퓨터를 이용한 자동화가 전면적으로 시도되어 왔다. 이러한 공정 제어 시스템은 공정 관리, 감시, 계획 등을 담당하는 상위 컴퓨터와 순차 및 비순차(non-sequence) 제어를 담당하는 중앙 제어기, 그리고 각종 센서 신호와 엑츄에이터 제어 신호의 입출력을 담당하는 직접 및 원격 입출력장치로 구성될 수 있다.In order to strengthen competitiveness through productivity improvement and actively respond to the demands of various markets, researches on automating all processes including the automation of unit machines (various actuators) using a process control system are being actively conducted. Moreover, from the early 1970s, the development of microprocessors introduced innovative changes in automation control devices. Based on this, automation using digital computers has been attempted in the fields of power generation, steelmaking, chemical process and building automation. This process control system is the host computer responsible for process management, monitoring, and planning, the central controller responsible for sequential and non-sequence control, and direct and remote control for input and output of various sensor signals and actuator control signals. It may be configured as an input / output device.

이와 같은 시스템에서 공정 제어를 실행하기 위해서는 그 제어 대상을 제어하기 위한 사용자 프로그램, 즉 제어 프로그램을 작성하여야 한다. 제어 프로그램의 작성은 고급 프로그램 언어인 C, C++, PASCAL 등을 사용할 수도 있으나 현장에서 사용하기에 복잡하고 제어 대상 시스템의 특성을 상세히 파악하고 있어야 하는 등의 불편함이 있어 주로 사다리 형태의 PLC (programmable logic controller) 프로그램 언어인 래더 다이아그램(ladder diagram)을 이용하고 있다. 그러나 래더 다이아그램은 시스템이 커질수록 그 복잡성이 기하급수적으로 증대하므로 문제가 발생하였을 경우 이를 해결하기가 어렵고, 프로그램을 모듈화하기가 어려워 재사용이 곤란하며, 다른 사람이 작성한 프로그램을 읽고 이해하기가 어렵다는 단점이 있다.In order to execute process control in such a system, a user program for controlling the control object, that is, a control program, must be created. The control program can be written in C, C ++, PASCAL, etc., but it is inconvenient to use in the field and needs to understand the characteristics of the control system in detail. logic controller) Ladder diagram, a programming language, is used. However, since the complexity of the ladder diagram increases exponentially as the system gets bigger, it is difficult to solve the problem when it occurs, it is difficult to reuse the program because it is difficult to modularize the program, and it is difficult to read and understand programs written by others. There are disadvantages.

따라서 본 발명에 따르면 래더 다이아그램의 단점을 보완하고 공정 제어에 적절한 형태의 프로그램 작성과 실행을 위해 제어 동작의 단위 요소를 하나의 원시기능으로 정의하고, 원시기능들의 조합으로서 사용 빈도가 높은 부분을 하나의 개체로 묶어 정의한 기능블럭을 마치 일반 컴퓨터 언어의 서비스 루틴처럼 쉽게 불러 쓸 수 있도록 함으로써 제어 프로그램을 효율적으로 구현하는 공정 제어 프로그램 해석 및 실행 방법이 제공된다. 본 발명에 따라 작성된 제어 프로그램은 상위 컴퓨터에 의해 중앙 제어기가 이해할 수 있는 문자형 언어로 변환되어서 중앙 제어기로 다운로드된다. 중앙 제어기에서는 문자형 언어로 표현된 제어 프로그램을 해석하여 실행에 필요한 데이터 구조를 만들어 저장하고 상위 컴퓨터로부터의 실행 신호에 따라 이를 실행한다.Therefore, according to the present invention, a unit element of the control operation is defined as one primitive function to compensate for the disadvantages of the ladder diagram and to create and execute a program suitable for process control. It provides a method of interpreting and executing a process control program that efficiently implements a control program by making functional blocks defined as a single object easily called and used as service routines of general computer language. The control program created in accordance with the present invention is converted into a textual language understood by the central controller by the host computer and downloaded to the central controller. The central controller interprets the control program expressed in a literal language, creates and stores a data structure for execution, and executes it according to the execution signal from the host computer.

본 발명에 따르면 다수의 기능블럭 - 상기 각각의 기능블럭은 사전 설정된 다수의 타입의 기능블럭 중 하나이고, 상기 각 타입의 기능블럭은 사전 설정된 다수의 원시기능을 포함하고, 상기 다수의 원시기능 각각은 다수의 그룹 중 하나에 속함 - 과 다수의 원시기능으로 구성된 제어 프로그램의 해석 및 실행 방법에 있어서,According to the present invention, a plurality of functional blocks-each functional block is one of a plurality of preset functional blocks, each functional block includes a plurality of preset primitive functions, and each of the plurality of primitive functions Belongs to one of a number of groups-in terms of how to interpret and execute a control program consisting of a number of primitive functions,

(1) 상기 기능블럭을 해석하는 단계로서,(1) analyzing the functional blocks,

(11) 상기 기능블럭에 포함된 다수의 원시기능 각각에 대한 단위 배열을 포함하는 기능블럭 원시기능 그룹 배열(130a)을 생성하는 단계와,(11) generating a function block primitive function group arrangement 130a including a unit array for each of a plurality of primitive functions included in the function block;

(12) 각각의 타입의 기능블럭에 대해 상기 기능블럭에 포함된 원시기능에 대한 상기 기능블럭 원시기능 그룹 배열을 가리키는 포인터를 포함하는 기능블럭 원시기능 코드 배열(120)을 생성하는 단계와,(12) generating a function block primitive function code array 120 including a pointer to the function block primitive function group arrangement for primitive functions included in the function block for each type of function block;

(13) 상기 각각의 타입의 기능블럭에서 사용되는 변수들을 저장하기 위한 기능블럭 지역 변수 배열(95)을 생성하는 단계,(13) generating a function block local variable array 95 for storing variables used in each type of function block,

를 포함하는 기능블럭 해석 단계와,A function block analysis step comprising:

(2) 상기 제어 프로그램을 해석하는 단계로서,(2) interpreting the control program,

(21) 상기 제어 프로그램 내의 상기 원시기능들 각각에 대한 단위 배열을 포함하는 원시기능 그룹 배열(110a, 110b)을 생성하는 단계와,(21) generating a primitive function group arrangement (110a, 110b) including a unit array for each of the primitive functions in the control program;

(22) 상기 원시기능 그룹 배열을 가리키는 포인터를 포함하는 원시기능 코드 배열(100)을 생성하는 단계와,(22) generating a primitive function code array 100 including a pointer to the primitive function group arrangement;

(23) 상기 각각의 원시기능들에서 사용되는 변수들을 저장하기 위한 시스템 전역, 입출력 및 지역 변수 배열(70, 80)을 생성하는 단계와,(23) generating system global, input / output and local variable arrays 70 and 80 for storing variables used in the respective primitive functions;

(24) 각 기능블럭의 호출시에 상기 각 기능블럭에 해당하는 기능블럭 원시기능 코드 배열(120)을 원시기능 코드 배열(100)로 복사하는 단계,(24) copying the function block primitive function code array 120 corresponding to each function block to the primitive function code array 100 when each function block is called;

(25) 상기 각 기능블럭의 호출시에 상기 각 기능블럭에 해당하는 기능블럭 원시기능 그룹 배열(130a)의 내용을 원시기능 그룹 배열(110a, 110b)로 복사하는 단계,(25) copying the contents of the function block primitive function group array 130a corresponding to each function block to the primitive function group arrays 110a and 110b when each function block is called;

(26) 상기 각 기능블럭의 호출시에 상기 각 기능블럭에 해당하는 기능블럭 지역 변수 배열(95)의 내용을 복사하여 기능블럭 전역 변수 배열(90)을 생성하는 단계,(26) generating a function block global variable array 90 by copying the contents of the function block local variable array 95 corresponding to each function block when the function blocks are called;

를 포함하는 제어 프로그램 해석 단계와A control program interpreting step comprising a

(3) 상기 원시기능 코드 배열, 상기 원시기능 그룹 배열, 상기 시스템 전역, 입출력 및 지역 변수 배열 및 상기 기능블럭 전역 변수 배열을 이용하여 상기 제어 프로그램을 실행하는 단계(3) executing the control program using the primitive function code array, the primitive function group array, the system global, input / output and local variable arrays, and the function block global variable array;

를 포함하는 제어 프로그램 해석 및 실행 방법이 제공된다.Provided is a control program interpretation and execution method comprising a.

도 1은 본 발명의 전체 시스템 구성도.1 is an overall system configuration of the present invention.

도 2는 본 발명에 따라 생성되어 프로그램 실행시에 사용되는 배열들 간의 관계를 나타내는 도면.2 illustrates a relationship between arrangements created in accordance with the present invention and used when executing a program.

도 3은 기능블럭 배열들을 원시기능 배열들로 복사하는 방법을 도시하는 도면.3 illustrates a method of copying functional block arrays into primitive functional arrays.

도 4는 기능블럭 지역 변수를 기능블럭 전역 변수로 복사하는 방법을 도시하는 도면.4 illustrates a method of copying a functional block local variable into a functional block global variable.

<도면의 주요 부분에 대한 부호의 설명><Explanation of symbols for the main parts of the drawings>

5 : 공유 메모리5: shared memory

10 : 상위 컴퓨터10: parent computer

20 : 중앙 제어기20: central controller

30 : 하위 네트워크 제어기30: lower network controller

40a, 40b : 직접 입출력 장치40a, 40b: direct input / output device

50a, 50b : 원격 입출력 장치50a, 50b: remote input / output device

60a, 60b : 단말 장치60a, 60b: terminal device

100 : 원시기능 코드 배열100: primitive function code array

120 : 기능블럭 원시기능 코드 배열120: function block native function code array

이하 첨부 도면을 참조하여 본 발명의 한 실시예를 상세히 설명하기로 한다. 먼저, 본 발명의 방법이 실행될 수 있는, 공정 제어 시스템의 한 예를 도 1을 참조하여 살펴보면, 공정 제어 시스템(1)은 일반적으로 상위 컴퓨터(10), 중앙 제어기(20), 하위 네트워크 제어기(30), 직접 입출력 장치(40a. 40b), 원격 입출력 장치(50a, 50b), 단말 장치(60a, 60b) 등을 포함하고 각 장치들은 도시된 바와 같이 버스를 통해 접속되어 있다. 상위 컴퓨터(10)는 시스템 구조 정의, 시스템 변수 정의, 공정 제어 프로그램 작성, 공정 모니터링 등을 총체적으로 담당한다. 시스템 구조 정의는 전체 시스템의 구조 (예를 들어, 입출력 개수, 네트워크 노드 수 등)를 정의하는 것이고, 시스템 변수 정의는 시스템에서 사용할 시스템 전역 변수들과 시스템 입출력 변수들을 정의하는 것이다. 상위 컴퓨터(10)에서 시스템 구조와 변수가 정의된 후 본 공정 제어 시스템(1)에서 실행될 공정 제어 프로그램이 작성된다. 바람직하게는 사용자가 그래픽 형태로 표현되는 각 원시기능과 기능블럭을 편집기를 이용하여 편집함으로써 제어 프로그램을 작성할 수 있다 (이에 대해서는 본 발명의 출원인과 동일 출원인에 의해 출원된 특허출원 제97-21703호를 참조하기 바란다).Hereinafter, an embodiment of the present invention will be described in detail with reference to the accompanying drawings. First, referring to FIG. 1, an example of a process control system in which the method of the present invention may be practiced, the process control system 1 is generally characterized by an upper computer 10, a central controller 20, a lower network controller ( 30), direct input / output devices 40a and 40b, remote input / output devices 50a and 50b, terminal devices 60a and 60b, and the like, and each device is connected via a bus as shown. The host computer 10 is generally responsible for system structure definition, system variable definition, process control program creation, process monitoring, and the like. The system structure definition defines the structure of the entire system (eg, the number of input / output, the number of network nodes, etc.), and the system variable definition defines the system global variables and system input / output variables for use in the system. After the system structure and variables are defined in the host computer 10, a process control program to be executed in the process control system 1 is created. Preferably, the user can create a control program by editing each primitive function and function block expressed in a graphic form using an editor (for this, Patent Application No. 97-21703 filed by the same applicant as the applicant of the present invention). See).

상위 컴퓨터(10)에서 작성된 공정 제어 프로그램은 중앙 제어기가 이해할 수 있는 문자형 언어로 변환되어, 예를 들어 ASCII 코드 형태로, 상위 네트워크〔예를 들어 이더넷(Ethernet), 15〕를 통해 중앙 제어기(20)로 다운로드(download)된다. 다운로드된, 문자형 언어로 변환된 공정 제어 프로그램은 중앙 제어기(20)에 의해 해석된 후 실시간, 다중 처리 방식으로 실행된다.The process control program created in the host computer 10 is converted into a character language understood by the central controller, for example, in the form of ASCII code, and the central controller 20 through the host network (eg, Ethernet, 15). Will be downloaded. The downloaded process control program converted into a textual language is interpreted by the central controller 20 and then executed in a real time, multi-processing manner.

중앙 제어기(20)는 제어 프로그램 처리부, 상위 컴퓨터(10)와의 네트워킹을 담당하는 상위 네트워킹 담당부, 직접 입출력 장치 제어부, 원격 입출력 장치와의 네트워킹를 담당하는 하위 네트워킹 담당부로 구성되어 있다. 중앙 제어기(20)에서는 상위 네트워크(15)를 통해 상위 컴퓨터(10)로부터 다운로드 받은 제어 프로그램을 해석하고 해석 결과 만들어진 데이타 구조를 공유 메모리(5)에 저장한다. 또한 직접 입출력장치(40a, 40b)를 통해 입력되어 공유 메모리(5)에 저장되어 있는 값들과 원격 입출력장치(50a, 50b)에서 입력되어 하위 네트워크(45)를 통해 전달되어 공유 메모리(5)에 저장되어 있는 값들을 이용하여 제어 프로그램을 실행하고 그 결과를 직접 입출력 장치(40a, 40b)로 출력하거나 하위 네트워크(45)를 통해 원격 입출력 장치(50a, 50b)로 전달한다. 제어 프로그램의 실행 결과는 필요에 따라 상위 컴퓨터(10)로 상위 네트워크(15)를 통해 보내져서 공정 모니터링 등에 이용된다.The central controller 20 is composed of a control program processor, an upper networking unit in charge of networking with the upper computer 10, a direct input / output unit control unit, and a lower networking unit in charge of networking with a remote input / output device. The central controller 20 analyzes the control program downloaded from the host computer 10 through the host network 15 and stores the data structure created as a result of the analysis in the shared memory 5. In addition, the values inputted through the direct input / output devices 40a and 40b and stored in the shared memory 5 and input from the remote input / output devices 50a and 50b are transmitted through the lower network 45 to the shared memory 5. The control program is executed using the stored values and the result is directly output to the input / output devices 40a and 40b or transmitted to the remote input / output devices 50a and 50b through the lower network 45. The execution result of the control program is sent to the host computer 10 through the host network 15 as needed to be used for process monitoring and the like.

직접/원격 입출력 장치(40a, 40b, 50a, 50b)는 각종 아날로그 및 디지털 신호를 입출력하기 위한 장치들로 구성되어 있다. 직접 입출력 장치들(40a, 40b)은 중앙 제어기(20)와 동일한 버스 (예를 들어 VME 버스, 25)에 연결되어 있어 중앙 제어기(20)와 비교적 가까운 곳의 단말 장치들(60a)의 입출력을 담당하게 되고, 원격 입출력 장치(50a, 50b)는 중앙 제어기와 멀리 떨어져 있는 단말 장치들(60b)의 입출력을 담당한다. 단말 장치의 예로는 제어의 대상이 되거나 제어에 사용되는 입력을 제공하는 전동기, 유압 구동기, 스위치, 램프, 릴레이 및 센서 등이 있다. 원격 입출력 장치(50a, 50b)는 필드 버스 (예를 들어 Profibus, 45)를 이용한 네트워킹을 통해 중앙 제어기(20)와 정보를 주고 받는다.The direct / remote input / output devices 40a, 40b, 50a, and 50b are composed of devices for inputting and outputting various analog and digital signals. The direct input / output devices 40a and 40b are connected to the same bus as the central controller 20 (for example, a VME bus 25), so that the input / output devices of the terminal devices 60a relatively close to the central controller 20 can be connected. The remote input / output devices 50a and 50b are responsible for the input / output of the terminal devices 60b remote from the central controller. Examples of the terminal device include an electric motor, a hydraulic driver, a switch, a lamp, a relay, a sensor, and the like which are subject to control or provide an input used for control. The remote input / output devices 50a and 50b exchange information with the central controller 20 through networking using a field bus (for example, Profibus, 45).

이제부터는 위에서 간단히 살펴본 기능블럭형 공정 제어 프로그램의 해석 및 실행 과정을 좀 더 상세하게 설명하기로 한다. 원시기능 및 기능블럭으로 구성되어 있는 본 발명의 공정 제어 프로그램에서 사용하고 있는 변수들에 대해 설명하면, 상위 컴퓨터(10)의 시스템 구성 정의에서 정의된, 입출력 장치의 각 포트 및 단말들을 나타내기 위한 시스템 입출력 변수, 제어 프로그램에서 공통적으로 사용되는 변수로서 제어 프로그램의 임의 위치에서 참조할 수 있고 수정도 가능한 시스템 전역 변수, 제어 프로그램의 일정한 영역 내에서만 사용되는 시스템 지역 변수, 미리 정의된 기능블럭을 호출하는 데에 사용되는 기능블럭 변수 등이 있다. 이러한 변수들은 그 특성에 따라 논리, 정수, 실수 중의 한 타입인데, ON/OFF 상태를 나타내는 변수의 경우는 논리 변수를, 정수 값을 가지는 것들은 정수 변수를, 실수 값이 필요한 경우는 실수 변수를 사용한다.The following describes the process of interpreting and executing the functional block type process control program briefly described above in more detail. The variables used in the process control program of the present invention, which are composed of primitive functions and functional blocks, are described in order to represent respective ports and terminals of the input / output device defined in the system configuration definition of the host computer 10. System I / O variables, variables commonly used in the control program, system global variables that can be referenced and modified from any position in the control program, system local variables used only within a certain area of the control program, and predefined function blocks are called. Function block variables used to do this. Depending on the characteristics of these variables, one of the following types is logical, integer, or real number. For variables indicating ON / OFF status, use logical variables, those with integer values use integer variables, and real values if real values are required. do.

시스템 입출력 변수와 시스템 전역 변수들은 상위 컴퓨터(10)에서 시스템 변수 정의에서 정의된 것으로서 제어 프로그램과 함께 중앙 제어기(20)로 다운로드된다. 중앙 제어기(20)에서는 이를 공유 메모리(5) 상에 시스템 전역 및 입출력 변수 배열(도 2 및 도 3의 70)로 배치하고, 제어 프로그램의 해석이나 실행 시에 그 고유한 이름을 이용하여 배열 내의 위치를 찾게 된다.The system input / output variables and system global variables are defined in the system variable definition at the host computer 10 and are downloaded to the central controller 20 together with the control program. The central controller 20 arranges this as a system-wide and I / O variable array (70 in FIGS. 2 and 3) on the shared memory 5, and uses the unique name in the array when interpreting or executing the control program. You will find a location.

시스템 지역 변수에 대해서는 공유 메모리(5) 상에 시스템 지역 변수 배열(도 2의 80)을 두고 각 변수의 종류 (논리, 정수 혹은 실수)에 따라 메모리 공간을 하나씩 할당하여, 그 이름과 배열 지수를 해당 변수의 ID(identification number)로 해서 참조하거나 수정하도록 하고 있다.For system local variables, place the system local variable array (80 in FIG. 2) on the shared memory 5 and allocate one memory space according to the type (logical, integer or real) of each variable. It is referred to or modified as the ID (identification number) of the variable.

한편, 제어 프로그램 내에서 동일한 기능블럭이 여러 번 수행될 수 있는데, 이는 미리 정의된 소정의 기능블럭에 대해 전술한 기능블럭 변수들을 다수개 선언하고 서로 다른 기능블럭 변수들을 호출함으로써 가능해진다. 따라서, 기능블럭들을 해석할 때 소정의 기능블럭 내부에서만 사용되는 지역 변수들을 위한 기능블럭 지역 변수 배열 (도 4의 95)과 이러한 기능블럭을 제어 프로그램 내에서 실행시킬 때 사용할 전역 변수들을 지정하기 위한 기능블럭 전역 변수 배열 (도 2 내지 도 4의 90) 등을 두고 있다.On the other hand, the same function block can be executed several times in the control program, which is made possible by declaring a plurality of function block variables described above for a predetermined function block and calling different function block variables. Therefore, when interpreting the function blocks, a function block local variable array (95 in FIG. 4) for local variables used only within a predetermined function block and a global variable to be used when executing such a function block in a control program are used. Function block global variable array (90 in Figs. 2 to 4).

앞서 설명된 바와 같이 시스템 전역 변수와 시스템 입출력 변수들은 상위 컴퓨터(10)에서 중앙 제어기(20)로 다운로드 될 때 중앙 제어기(20)의 공유 메모리(5) 상의 별도 영역을 할당받게 되지만, 제어 프로그램이나 기능블럭 내의 지역 변수들, 기능블럭 변수 호출에 사용되는 입출력 독립변수, 후술되는 원시기능 내부의 내부 파라미터 등은 제어 프로그램의 구성에 따라 발생되기도 하고 없어지기도 하는 것들이므로 이들에 대해 정해진 영역을 별도로 두면 메모리의 낭비가 심하므로 일정한 공통 영역에서 필요할 때마다 메모리 공간을 하나씩 할당하여 사용하는 것이 유리하다. 그러므로 제어 프로그램이나 기능블럭 내의 코드를 해석하는 중에 중앙 제어기(20)에서 관리하는 논리, 정수, 실수의 시스템 지역 변수 배열(80)이나 기능블럭 지역 변수 배열(95)에서 필요로 할 때마다, 메모리 공간을 하나씩 할당을 하게 되고 해당 배열의 지수를 자신의 주소로 관리한다.As described above, the system global variables and the system input / output variables are allocated separate areas on the shared memory 5 of the central controller 20 when they are downloaded from the upper computer 10 to the central controller 20. Local variables in the function block, I / O independent variables used to call the function block variables, and internal parameters inside the primitive function described later may occur or disappear depending on the configuration of the control program. Since memory is wasted, it is advantageous to allocate and use one memory space whenever needed in a certain common area. Therefore, whenever the logic, integer, or real system local variable array 80 or the functional block local variable array 95 managed by the central controller 20 during the interpretation of the code in the control program or the function block is required, Allocates space one by one and manages the index of the array as its own address.

제어 프로그램이 해석되면 해당 프로그램이 어떤 원시기능들로 구성되어 있는지를 표시하기 위한 원시기능 코드 배열(도 2 및 도 4의 100)과 각 원시기능들을 후술하는 바와 같이 그 특성에 따라 분류해 놓은 5개의 원시기능 그룹 배열들(110a, 110b; 5개 중 원시기능 그룹 1 배열 , 2 배열만 도시한 것임)이 만들어지게 된다. 도 2 및 도 4에 도시된 바와 같이, 원시기능 코드 배열(100)은 여러개의 단위로 이루어져 있고 한 단위는 다음과 같이 구성되어 있다.When the control program is interpreted, a primitive function code array (100 in FIGS. 2 and 4) for indicating which primitive functions are configured, and each primitive function is classified according to its characteristics as described below. Two primitive function group arrays 110a and 110b (of which only the primitive function group 1 and 2 arrays are shown) are created. As shown in Figure 2 and 4, the primitive function code array 100 is composed of a number of units, one unit is configured as follows.

〔1〕 해당 원시기능이 속한 원시기능 그룹을 나타내는 그룹 번호[1] Group number indicating the primitive function group to which the primitive function belongs

〔2〕 해당 원시기능 그룹 배열에서 해당 원시기능이 위치한 곳을 가리키는 포인터[2] Pointer to the location of the primitive function in the primitive function group array

〔3〕 원시기능 코드 배열 내에서 다음 실행할 곳을 가리키는 포인터(next)[3] Pointer to next place in the source code array (next)

〔4〕 원시기능 코드 배열 내에서 분기 조건이 거짓일 경우 실행할 곳을 가리키는 포인터(enext)[4] A pointer to where to execute if the branch condition is false in the primitive code array.

본 발명에서 사용하는 원시기능들로는 산술 연산 기능, 삼각함수 기능, 비트 단위의 논리 연산 기능, 비교 기능, 비트 쉬프트(bit shift) 기능, 선택(selection) 기능, 변수형 변환(type conversion) 기능, 마스크(mask) 기능, 쌍안정(bistable) 기능, 에지 탐지(edge detection) 기능, 시계(timer) 기능 등이 있다. 하나의 원시기능이 해석되면 앞에서 설명한 원시기능 코드 배열(100)의 한 단위와 5가지의 원시기능 그룹 배열 중에 해당 원시기능이 속한 배열에서 한 단위를 할당받게 된다.Primitive functions used in the present invention include arithmetic operation function, trigonometric function, bitwise logical operation function, comparison function, bit shift function, selection function, type conversion function, mask ( mask functions, bistable functions, edge detection functions, and timer functions. When one primitive function is interpreted, one unit of the primitive function code array 100 and five primitive function group arrays described above are allocated one unit from the array to which the primitive function belongs.

본 발명에서 사용하고 있는 모든 원시기능들은 그의 입출력 독립변수의 개수와 내부 파라미터의 개수에 따라 다음과 같은 5가지 원시기능 그룹으로 나뉘어져 있다.All primitive functions used in the present invention are divided into the following primitive function groups according to the number of independent input / output variables and the number of internal parameters.

〔1〕 원시기능 그룹 1 : 입력 독립변수 1, 출력 독립변수 1인 원시기능들[1] Primitive Function Group 1: Primitive Functions with Input Independent Variable 1 and Output Independent Variable 1

〔2〕 원시기능 그룹 2 : 입력 독립변수 2, 출력 독립변수 1인 원시기능들[2] Primitive Function Group 2: Primitive Functions with Input Independent Variable 2 and Output Independent Variable 1

〔3〕 원시기능 그룹 3 : 입력 독립변수 3, 출력 독립변수 1인 원시기능들[3] Primitive Function Group 3: Primitive Functions with Input Independent Variable 3 and Output Independent Variable 1

〔4〕 원시기능 그룹 4 : 입력 독립변수 1, 출력 독립변수 1, 내부 파라미터 1인 원시기능들[4] Primitive Function Group 4: Primitive Functions with Input Independent Variable 1, Output Independent Variable 1, and Internal Parameter 1.

〔5〕 원시기능 그룹 5 : 입력 독립변수 2, 출력 독립변수 1, 내부 파라미터 2인 원시기능들[5] Primitive Function Group 5: Primitive Functions with Input Independent Variable 2, Output Independent Variable 1, and Internal Parameter 2.

이런 원시기능 그룹 배열들(110a, 110b)은 각각 기능 코드와 입출력 독립변수, 내부 파라미터 등에 대한 포인터로 이루어져 있고, 이들 포인터는 그 실제 변수 등의 값이 저장되는 메모리 장소를 가리킨다. 입출력 독립변수 및 내부 파라미터들은 그 원시기능의 종류에 따라 논리, 정수 또는 실수 값을 가리키고 이들이 어떤 종류의 값이어야 하는지가 미리 정해져 있으므로 해당 원시기능을 실행할 때 그에 맞는 종류의 변수를 사용하게 된다. 이와 같이 원시기능들을 5가지의 그룹으로 분리하고 있는 이유는, 각 원시기능마다 입출력 독립변수 및 내부 파라미터의 개수가 다르므로 모든 원시기능들에 대해 동일한 배열 구조를 사용하는 것은 메모리의 낭비를 초래하기 때문이다.These primitive function group arrays 110a and 110b are composed of pointers to function codes, input / output independent variables, internal parameters, and the like, respectively, and these pointers point to memory locations in which values of the actual variables and the like are stored. I / O independent variables and internal parameters point to logic, integer or real number values according to the type of primitive function, and what kind of value they should be. Therefore, the appropriate type of variable is used when executing the primitive function. The reason for dividing primitive functions into five groups is that using the same array structure for all primitive functions wastes memory because the number of input / output independent variables and internal parameters are different for each primitive function. Because.

도 2에는 원시기능 코드 배열(100), 원시기능 그룹 배열(110a, 110b)과 몇 가지 변수 배열들의 관계가 도시되어 있는데, 도 2에 도시된 바와 같이 최종적으로 실제 값이 존재하는 곳은 변수 배열들이고 나머지 중간 단계의 배열들은 단지 이들을 참조하기 위한 정보 (포인터)를 가지고 있는 것들이다.FIG. 2 illustrates the relationship between the primitive function code array 100 and the primitive function group arrays 110a and 110b and several variable arrays. As shown in FIG. The rest of the intermediate arrays just contain information (pointers) to refer to them.

다음에는 복수 개의 원시기능들을 묶어 하나의 새로운 기능을 할 수 있는 도구인 기능블럭에 대해 설명하기로 한다. 상위 컴퓨터(10)로부터 중앙 제어기(20)로 제어 프로그램을 다운로드하기 전에, 시스템에서 정의되어 있거나 사용자가 몇 개의 원시기능을 묶어 별도로 정의한 기능블럭들에 대한 기능블럭 프로그램이 다운로드된다. 첨부 1에 이러한 기능블럭 프로그램의 한 예를 보이고 있는데, 그 내부가 여러 개의 원시기능들의 조합으로 되어 있는 것을 알 수 있다. 전체 제어 프로그램의 한 부분이라 할 수 있는 첨부 2의 서브 프로그램의 예에서 보면 첨부 1에서 "SAMPLE"이라는 이름으로 정의된 기능블럭 타입에 대해 "FBvar1", "FBvar2"라는 복수 개의 기능블럭 변수를 선언하고 있음을 알 수 있다. 이 각각은 호출함으로서 동일한 기능블럭이 두번 실행된다.Next, a function block, which is a tool that combines a plurality of primitive functions and performs a new function, will be described. Before downloading the control program from the host computer 10 to the central controller 20, the function block program for the function blocks defined in the system or separately defined by the user by binding several primitive functions are downloaded. An example of such a function block program is shown in Appendix 1, which shows that it is a combination of several primitive functions. In the example of subprogram of Attachment 2, which is a part of the whole control program, declares multiple function block variables "FBvar1" and "FBvar2" for the function block type defined as "SAMPLE" in Attachment 1. It can be seen that. By calling each of these, the same function block is executed twice.

기능블럭을 해석하는 과정을 살펴보면 먼저 각각의 기능 블럭의 내용을 기술하는 기능블럭 프로그램을 중앙 제어기(20)에서 해석하고, 그 기능과 사용 변수들에 대한 정보를 만들고 그에 필요한 메모리를 할당한다. 그 후 제어 프로그램 해석시에는 등록된 타입의 기능블럭 변수에, 미리 만들어진 해당 기능블럭 타입의 정보들을 복사하여 사용하게 된다. 이러한 복사 과정은 도 3과 도 4에 나타나 있다. 기능블럭의 해석에 의해 만들어지는 기능블럭 원시기능 코드 배열 역시 앞서 설명된 원시기능의 경우와 거의 비슷한 데이터 구조를 가지게 된다. 즉, 기능블럭 프로그램 내부가 어떤 원시기능들로 구성되어 있는지를 표시하기 위한 기능블럭 원시기능 코드 배열(120)은 원시기능 코드 배열(100)과 동일한 구조를 가지고 있어서 소정의 기능블럭 프로그램 내에 포함된 각 원시기능들에 해당하는 배열 단위들을 포함한다. 각 원시기능 그룹에 대해서도 앞서의 원시기능 그룹 배열(110a, 110b)과 동일한 구조의 5개의 기능블럭 원시기능 그룹 배열들(130a)을 가지게 되는데 이들의 역할은 앞서 원시기능의 경우와 동일하다. 그리고 기능블럭 프로그램 내에서 사용하고 있는 입출력 독립변수, 지역 변수 등을 위해 기능블럭 지역 변수 배열(95)을 두어 기능블럭 프로그램 해석시 필요로 하는 변수의 종류에 따라 논리, 정수 또는 실수 변수 중에 하나씩 메모리 공간을 할당받게 된다.Referring to the process of interpreting the functional block, the functional block program describing the contents of each functional block is first interpreted by the central controller 20, and the information about the function and the use variables is made and the memory required for the allocation is allocated. Subsequently, when the control program is interpreted, the information of the corresponding function block type prepared in advance is copied to the function block variable of the registered type. This copying process is shown in FIGS. 3 and 4. The function block primitive code arrays produced by the interpretation of the function blocks also have a data structure that is almost similar to that of the primitive functions described above. That is, the function block primitive function code array 120 for indicating which primitive functions are configured inside the function block program has the same structure as the primitive function code array 100 and is included in a predetermined function block program. Contains array units corresponding to each primitive. Each primitive function group has five functional block primitive function group arrays 130a having the same structure as the primitive function group arrangements 110a and 110b described above, and their roles are the same as in the primitive function. In addition, the function block local variable array 95 is set up for I / O independent variables and local variables used in the function block program, and memory is stored in one of logical, integer, or real number variables according to the type of variable needed for the function block program analysis. Space is allocated.

기능블럭 프로그램의 해석이 끝나고 난 후 제어 프로그램이 해석된다. 제어 프로그램에서 하나의 기능블럭 변수가 호출되면 앞서 기능블럭 프로그램 해석시에 만들어 놓은 배열들을 복사하여 제어 프로그램의 실행에 사용한다. 즉, 도 4에 도시된 바와 같이 기능블럭 원시기능 코드 배열(120)은 원시기능 코드 배열(100)로, 5개의 기능블럭 원시기능 그룹 배열들(130a)은 각각 해당하는 원시기능 그룹 배열들(110a, 110b)로, 기능블럭 지역 변수 배열(95)은 기능블럭 전역 변수 배열(90)로 복사되고 제어 프로그램의 실행시에는 각각 후자의 것이 사용된다. 이와 같이 하는 이유는 앞서 설명한 대로 동일한 기능블럭 타입에 대해 여러 개의 서로 다른 기능블럭 변수들이 하나의 서브 프로그램 내에 존재할 수 있기 때문에 (즉, 동일한 기능블럭이 여러번 호출될 수 있으므로) 각 기능블럭 변수별로 별도의 영역을 할당해 주어야 하기 때문이다.After the analysis of the function block program is completed, the control program is interpreted. When one function block variable is called in the control program, the arrays created when the function block program is interpreted are copied and used to execute the control program. That is, as shown in FIG. 4, the functional block primitive function code array 120 is a primitive function code array 100, and the five functional block primitive function group arrays 130a correspond to corresponding primitive function group arrangements ( 110a and 110b, the functional block local variable array 95 is copied to the functional block global variable array 90 and the latter are used at the time of execution of the control program, respectively. The reason for this is that, as described above, several different function block variables for the same function block type can exist in one subprogram (that is, the same function block can be called multiple times), so that each function block variable is separate. This is because we need to allocate the area of.

또, 기능블럭 전역 변수 배열(90)을 시스템 전역 및 입출력 변수 배열(70)과 별도로 구성한 이유는, 이 기능블럭 전역 변수 배열(90)의 내용은 사용자가 상위 컴퓨터(10)에서 지정한 시스템 입출력 변수나 시스템 전역 변수와는 달리 중앙 제어기(20) 내부에서 지정, 관리되기 때문이다. 한편, 기능블럭 변수의 입출력 독립변수로서 시스템 입출력 변수나 시스템 전역 변수들을 직접 사용할 수 있는데 이런 경우에는 그 포인터가 그대로 복사되어 결국 동일한 변수를 지정하게 된다 (도 3 참조). 이와 같은 절차를 통해 해석된 기능블럭들을 관리하기 위해 기능블럭 레지스터 배열을 두는데 그 내부는 다음과 같이 구성된다.The reason why the functional block global variable array 90 is configured separately from the system global and I / O variable array 70 is that the contents of the functional block global variable array 90 are defined by the user. Unlike the system global variable, because it is assigned and managed within the central controller 20. On the other hand, system input / output variables or system-wide variables can be used directly as input / output independent variables of function block variables. In this case, the pointers are copied as they are and eventually designate the same variables (see FIG. 3). In order to manage the function blocks interpreted through the above procedure, the function block register array is provided, and the inside thereof is configured as follows.

〔1〕 기능블럭의 종류에 해당하는 이름[1] Name corresponding to type of function block

〔2〕 입출력 독립변수의 개수와 그들에 대한 포인터들[2] Number of input / output independent variables and pointers to them

〔3〕 기능블럭 원시기능 코드 배열에서 해당 기능블럭의 내용이 담겨 있는 시작과 끝 포인터들[3] Function block Start and end pointers containing the contents of the function block in the source code array.

〔4〕 5개의 기능블럭 원시기능 그룹 배열들에서 해당 기능블럭의 내용이 담겨 있는 시작과 끝 포인터들[4] Start and end pointers containing the contents of the functional block in the five functional block primitive group arrays.

〔5〕 기능블럭 지역 변수 배열에서 해당 기능블럭이 사용하고 있는 모든 종류 변수 배열들의 시작과 끝 포인터들[5] Function block Local variable array start and end pointers of all kinds of variable arrays used by the function block.

제어 프로그램 해석시에는 제어 프로그램 내에서 선언한 기능블럭 변수의 종류가 이 기능블럭 레지스터 배열에 있는 것인지를 그 이름을 이용하여 찾게 되고, 이름이 있다면 이 레지스터 배열의 정보를 이용하여 기능블럭 관련 배열들의 어느 부분을 복사할 것인지를 결정하게 되는 것이다.When interpreting the control program, the name of the function block variable declared in the control program is found in the function block register array, and if there is a name, the information in the function block array is used to determine the type of function block variables. You will decide which part to copy.

제어 프로그램은 여러 개의 독립된 또는 연결된 서브 프로그램들의 조합이라고 볼 수 있고 첨부 2가 이러한 서브 프로그램의 한 예라고 할 수 있는데, 이 서브 프로그램은 다음과 같은 구성 요소들을 가지게 된다.The control program can be regarded as a combination of several independent or linked subprograms, and Attachment 2 is an example of such a subprogram. The subprogram has the following components.

〔1〕 서브 프로그램의 이름[1] Sub program name

〔2〕 서브 프로그램 내의 지역 변수의 선언부[2] Declaration section of local variables in subprograms

〔3〕 서브 프로그램 내의 기능블럭 변수의 선언부[3] Declaration unit of function block variable in subprogram

〔4〕 서브 프로그램의 프로그램부[4] subprogram

각 서브 프로그램은 그 이름에 따라 구분되고, 지역 변수들은 시스템 지역 변수 배열에서 논리, 정수, 실수 변수 중에 해당하는 종류의 메모리 공간을 하나씩 할당받고 그 위치를 가리키는 포인터를 가지게 된다. 기능블럭 변수의 경우는 일단 그 변수의 종류가 미리 정의된 기능블럭 중의 하나인지를 기능블럭 레지스터 배열을 검색하여 찾고, 그 종류의 기능블럭이 존재한다면 앞서 기능블럭의 설명에서 언급된 바와 같이, 미리 만들어진 기능블럭 관련 배열 중에 필요한 만큼을 복사하여 사용하게 된다. 서브 프로그램의 프로그램부를 해석하면서 앞서 원시기능, 기능블럭 등의 설명에서 언급된 바와 같은 배열들을 만들고 서브 프로그램의 실행시에 이들 배열들을 이용하게 된다. 이외에 전체 제어 프로그램에 있어 각 서브 프로그램들 각각이 차지하는 영역에 대한 정보를 관리하는 부분이 필요한데 이는 다음과 같은 구성 요소들을 가지는 서브 프로그램 배열로 만들어진다.Each subprogram is classified according to its name, and local variables are allocated one of the corresponding types of memory space among logical, integer, and real variables in the system local variable array and have a pointer to the location. In the case of a function block variable, the function block register array is searched to find out whether the type of the variable is one of the predefined function blocks, and if the function block exists, as mentioned in the description of the function block. Copy and use as many of the function block arrays as needed. By interpreting the program part of the subprogram, arrays are created as mentioned in the description of primitive functions, function blocks, etc., and these arrays are used when the subprogram is executed. In addition, it is necessary to manage the information on the area occupied by each subprogram in the entire control program, which is made of a subprogram array having the following components.

〔1〕 각 서브 프로그램이 차지하는 원시기능 코드 배열 내의 시작과 끝 포인터들[1] Start and end pointers in the source function code array occupied by each subprogram

〔2〕 각 서브 프로그램이 차지하는 5개의 원시기능 그룹 배열들의 시작과 끝 포인터들[2] Start and end pointers of the five primitive function group arrays occupied by each subprogram

〔3〕 각 서브 프로그램이 사용하는 시스템 지역 변수 배열 내의 3종류의 변수들의 시작과 끝 포인터들[3] Start and end pointers of three variables in the system local variable array used by each subprogram

기능블럭은 결국 그를 구성하는 원시기능들의 조합으로 만들어지게 되므로 하나의 서브 프로그램은 그를 구성하는 원시기능들의 조합이라 볼 수 있다. 그러므로 서브 프로그램의 시작과 끝을 표시하는 것은 서브 프로그램 배열 내에 지정되어 있는 원시기능 코드 배열의 시작과 끝 포인터라고 할 수 있다. 그 외에 각 서브 프로그램 내에서 사용하고 있는 변수들에 대한 시작과 끝 포인터를 별도로 관리하는 이유는 자원 관리를 위해 전체 또는 각 서브 프로그램이 차지하는 메모리의 양이 얼마나 되는가를 알기 위함이다.A function block is eventually made up of a combination of primitive functions that constitute it, so a subprogram can be regarded as a combination of primitive functions that constitute it. Therefore, marking the start and end of a subprogram can be said to be the start and end pointers of the source code array specified in the subprogram array. In addition, the reason for separately managing start and end pointers for variables used in each subprogram is to know how much memory the entire or each subprogram occupies for resource management.

이런 과정을 거쳐 제어 프로그램이 전부 해석되어 필요한 데이터 구조가 모두 만들어지면 우선 서브 프로그램 배열을 이용하여 실행할 서브 프로그램의 시작과 끝 포인터를 가지고 실행을 시작하게 된다. 시작 포인터의 위치로부터 하나씩 원시기능을 수행해 가되, 원시기능 그룹 배열에서 원시기능의 기능 코드, 입출력 변수에 대한 포인터, 내부 파라미터들의 포인터를 읽고 이를 이용하여 기능블럭 전역 변수 배열에 필요한 변수값을 쓰거나 배열로부터 변수값을 읽음으로써 프로그램을 실행한다. 이러한 실행 과정을 다시 도 2를 참조하여 상술하면, 우선 해당 서브 프로그램을 시작할 원시기능 코드 배열의 포인터로부터 해당 원시기능이 속한 원시기능 그룹 번호를 읽는다. 다음에 해당 원시기능 그룹 배열에서 본 원시기능 코드가 있는 위치를 나타내는 포인터 값을 이용하여 해당 원시기능 그룹 배열 내의 위치를 찾는다. 그 위치에서 본 원시기능의 역할을 나타내는 기능 코드를 찾고, 입력 독립변수들 및 내부 파라미터들에 해당하는 포인터들이 가리키는 변수 배열들에서 실제 값들을 읽어, 기능 코드에 따라 필요한 작업을 수행하고 나서, 출력 독립변수와 내부 파라미터들에 해당하는 포인터들이 가리키는 해당 변수 배열에 그 값들을 저장하게 된다. 이렇게 해서 하나의 원시기능에 대한 실행이 완료되게 되고, 다시 원시기능 코드 배열로 돌아와서 다음 실행할 포인터 값과 서브 프로그램 배열에서 읽은 서브 프로그램 끝 포인터 값을 비교하여 아직 끝이 아닌 경우에는 본 과정을 계속 반복함으로써 서브 프로그램이 실행되게 된다. 서브 프로그램으로 구성된 제어 프로그램은 상기와 같이 서브 프로그램을 실행함으로써 실행된다.Through this process, when all the control programs are interpreted and all necessary data structures are made, the execution starts with the start and end pointers of the subprogram to be executed using the subprogram array. It executes primitive functions one by one from the starting pointer position, and reads the function codes of primitive functions, pointers to I / O variables, and pointers to internal parameters from primitive function group arrays, and uses them to write or array the variable values required for the function block global variable array. Run the program by reading the variable value from the. This execution process will be described with reference to FIG. 2 again. First, a primitive function group number to which a corresponding primitive function belongs is read from a pointer of a primitive function code array to start a corresponding subprogram. Next, the pointer in the primitive function group array is used to find the position in the primitive function group array. Find the function code that represents the role of the primitive function as seen from that location, read the actual values from the array of variables pointed to by the pointers corresponding to the input arguments and internal parameters, perform the necessary operations according to the function code, and then print The values are stored in the variable array pointed to by the pointers to the independent and internal parameters. This completes the execution of one primitive function, returns to the primitive function code array, compares the next execution pointer value with the subprogram end pointer value read from the subprogram array, and repeats this process if it is not the end. As a result, the subprogram is executed. The control program composed of the subprogram is executed by executing the subprogram as described above.

상기와 같은 방법으로 상위 컴퓨터에서 편집기를 이용하여 제어 프로그램을 작성하면 프로그램 작성이나 수정이 용이하고 전체의 흐름 파악이나 문제 해결이 손쉽게 되며, 한번 사용된 프로그램의 재사용이 용이한 등의 장점이 있게 된다.Creating a control program by using an editor in the upper computer in the above way, it is easy to create or modify the program, easy to grasp the overall flow or solve the problem, it is easy to reuse the program once used. .

본 발명에 따르면, 상위 컴퓨터에 의해 문자형 언어로 변환되어 전송된 제어 프로그램을 실행에 필요한 데이터 구조로 미리 해석하므로, 해석시는 시간이 소요되지만, 실행시에는 프로그램의 해석에 전혀 시간이 소요되지 않고 이미 만들어진 데이터 구조를 참조하여 동작이 일어나게 되므로 제어 프로그램 실행상의 가장 큰 문제 중의 하나인 실시간 수행(real-time execution)이 보장된다.According to the present invention, since the control program, which is converted into a character language by the host computer and transmitted, is interpreted in advance into a data structure required for execution, the analysis takes time, but the execution does not take any time to interpret the program. The operation occurs by referring to the data structure that has already been created, so real-time execution, which is one of the biggest problems in the control program execution, is guaranteed.

또한 서로 다른 제어 프로그램에 대해 별도의 데이터 구조를 만들고 실제 이를 실행할 때는 해당 데이터 구조의 포인터만을 기억하고 추적하게 됨으로써 동일한 실행 코드 (프로그램)로부터 복수 개의 실행기를 만들 수 있어 병렬 처리에 적합하고 확장성이 좋으며, 각 제어 프로그램이 해석되어 있는 공유 메모리 장소가 별도로 관리되고 있으므로 디버깅이 간단하다.In addition, by creating separate data structures for different control programs and actually executing them, only pointers to those data structures are remembered and tracked so that multiple executors can be created from the same executable code (program). Good and easy to debug because the shared memory where each control program is interpreted is managed separately.

또한 범용의 UNIX tool (예를 들어 lex & yacc)을 이용하여 개발함으로써 중앙 제어기가 바뀌게 되더라고 이식성이 좋다.It is also highly portable even if the central controller is changed by developing with a general-purpose UNIX tool (eg lex & yacc).

부가적으로, 제어 프로그램의 양과 이에 필요한 중앙 제어기의 공유 메모리의 양이 거의 비례하므로 제어 대상에 따라 시스템 규모를 설정하기도 쉽다.In addition, since the amount of the control program and the amount of shared memory of the central controller required are almost proportional, it is easy to set the system scale according to the control object.

첨부 1 : 기능블럭 프로그램의 한 예Appendix 1: Example of Function Block Program

FUNCTION_BLOCK SAMPLEFUNCTION_BLOCK SAMPLE

VAR_INVAR_IN

IN1 : BOOL; IN2 : INT; IN3 : REAL;IN1: BOOL; IN2: INT; IN3: REAL;

END_VAREND_VAR

VAR_OUTVAR_OUT

OUT1 : INT; OUT2 : INT;OUT1: INT; OUT2: INT;

END_VAREND_VAR

VARVAR

tmp : INT;tmp: INT;

END_VAREND_VAR

IF IN1 = TRUEIF IN1 = TRUE

THEN tmp := 23;THEN tmp: = 23;

ELSE tmp := 77;ELSE tmp: = 77;

END_IFEND_IF

OUT1 := tmp * 13;OUT1: = tmp * 13;

OUT2 := INT(IN3) * 3;OUT2: = INT (IN3) * 3;

END_FUNCTION_BLOCKEND_FUNCTION_BLOCK

첨부 2 : 서브 프로그램의 한 예Attachment 2: An example of a subprogram

SUB_PROGRAM EXAMPLESUB_PROGRAM EXAMPLE

VARVAR

지역INT : INT;Local INT: INT;

지역BOOL : BOOL;Local BOOL: BOOL;

지역REAL : REAL;Local REAL: REAL;

END_VAREND_VAR

FUNCTION_BLOCK_VARFUNCTION_BLOCK_VAR

FBvar1 : SAMPLE;FBvar1: SAMPLE;

FBvar2 : SAMPLE;FBvar2: SAMPLE;

END_FUNCTION_BLOCK_VAREND_FUNCTION_BLOCK_VAR

IF GBreturn = TRUEIF GBreturn = TRUE

THEN 지역INT := 10;THEN local INT: = 10;

ELSE 지역INT := 20;ELSE local INT: = 20;

END_IFEND_IF

GItarget := GIrefer + 지역INT;GItarget: = GIrefer + local INT;

Grsval := SIN(GItarget);Grsval: = SIN (GItarget);

FBvar1(IN1:=TRUE, IN2:=10, IN3:=Grsval);FBvar1 (IN1: = TRUE, IN2: = 10, IN3: = Grsval);

Gireturn1 := FBvar1.OUT1;Gireturn1: = FBvar1.OUT1;

Gireturn2 := FBvar1.OUT2;Gireturn2: = FBvar1.OUT2;

FBvar2(IN1:=TRUE, IN2:=20, IN3:=Grsval);FBvar2 (IN1: = TRUE, IN2: = 20, IN3: = Grsval);

Gireturn3 := FBvar2.OUT1;Gireturn3: = FBvar2.OUT1;

Gireturn4 := FBvar2.OUT2;Gireturn4: = FBvar2.OUT2;

END_SUB_PROGRAMEND_SUB_PROGRAM

Claims (4)

다수의 기능블럭 - 상기 각각의 기능블럭은 사전 설정된 다수의 타입의 기능블럭 중 하나이고, 상기 각 타입의 기능블럭은 사전 설정된 다수의 원시기능을 포함하고, 상기 다수의 원시기능 각각은 다수의 그룹 중 하나에 속함 - 과 다수의 원시기능으로 구성된 제어 프로그램의 해석 및 실행 방법에 있어서,A plurality of functional blocks, each functional block being one of a plurality of preset functional blocks, each functional block comprising a plurality of preset primitive functions, each of the plurality of primitive functions being a plurality of groups In the method of interpreting and executing a control program consisting of and a number of primitive functions, (1) 상기 기능블럭을 해석하는 단계로서,(1) analyzing the functional blocks, (11) 상기 기능블럭에 포함된 다수의 원시기능 각각에 대한 단위 배열을 포함하는 기능블럭 원시기능 그룹 배열(130a)을 생성하는 단계와,(11) generating a function block primitive function group arrangement 130a including a unit array for each of a plurality of primitive functions included in the function block; (12) 각각의 타입의 기능블럭에 대해 상기 기능블럭에 포함된 원시기능에 대한 상기 기능블럭 원시기능 그룹 배열을 가리키는 포인터를 포함하는 기능블럭 원시기능 코드 배열(120)을 생성하는 단계와,(12) generating a function block primitive function code array 120 including a pointer to the function block primitive function group arrangement for primitive functions included in the function block for each type of function block; (13) 상기 각각의 타입의 기능블럭에서 사용되는 변수들을 저장하기 위한 기능블럭 지역 변수 배열(95)을 생성하는 단계,(13) generating a function block local variable array 95 for storing variables used in each type of function block, 를 포함하는 기능블럭 해석 단계와,A function block analysis step comprising: (2) 상기 제어 프로그램을 해석하는 단계로서,(2) interpreting the control program, (21) 상기 제어 프로그램 내의 상기 원시기능들 각각에 대한 단위 배열을 포함하는 원시기능 그룹 배열(110a, 110b)을 생성하는 단계와,(21) generating a primitive function group arrangement (110a, 110b) including a unit array for each of the primitive functions in the control program; (22) 상기 원시기능 그룹 배열을 가리키는 포인터를 포함하는 원시기능 코드 배열(100)을 생성하는 단계와,(22) generating a primitive function code array 100 including a pointer to the primitive function group arrangement; (23) 상기 각각의 원시기능들에서 사용되는 변수들을 저장하기 위한 시스템 전역, 입출력 및 지역 변수 배열(70, 80)을 생성하는 단계와,(23) generating system global, input / output and local variable arrays 70 and 80 for storing variables used in the respective primitive functions; (24) 각 기능블럭의 호출시에 상기 각 기능블럭에 해당하는 기능블럭 원시기능 코드 배열(120)을 원시기능 코드 배열(100)로 복사하는 단계,(24) copying the function block primitive function code array 120 corresponding to each function block to the primitive function code array 100 when each function block is called; (25) 상기 각 기능블럭의 호출시에 상기 각 기능블럭에 해당하는 기능블럭 원시기능 그룹 배열(130a)의 내용을 원시기능 그룹 배열(110a, 110b)로 복사하는 단계,(25) copying the contents of the function block primitive function group array 130a corresponding to each function block to the primitive function group arrays 110a and 110b when each function block is called; (26) 상기 각 기능블럭의 호출시에 상기 각 기능블럭에 해당하는 기능블럭 지역 변수 배열(95)의 내용을 복사하여 기능블럭 전역 변수 배열(90)을 생성하는 단계,(26) generating a function block global variable array 90 by copying the contents of the function block local variable array 95 corresponding to each function block when the function blocks are called; 를 포함하는 제어 프로그램 해석 단계와A control program interpreting step comprising a (3) 상기 원시기능 코드 배열, 상기 원시기능 그룹 배열, 상기 시스템 전역, 입출력 및 지역 변수 배열 및 상기 기능블럭 전역 변수 배열을 이용하여 상기 제어 프로그램을 실행하는 단계(3) executing the control program using the primitive function code array, the primitive function group array, the system global, input / output and local variable arrays, and the function block global variable array; 를 포함하는 제어 프로그램 해석 및 실행 방법.Control program interpretation and execution method comprising a. 제1항에 있어서, 상기 각각의 원시기능은 사전 설정된 입출력 변수와 내부 파라미터를 갖고, 상기 사전 설정된 입출력 변수와 내부 파라미터에 따라 상기 다수의 그룹으로 구분되고, 상기 단위 배열은 기능 코드 및 입출력 변수에 대한 포인터, 내부 파라미터에 대한 포인터를 포함하는 제어 프로그램 해석 및 실행 방법.The apparatus of claim 1, wherein each primitive function has a predetermined input / output variable and an internal parameter, and is divided into a plurality of groups according to the preset input / output variable and an internal parameter, and the unit array is assigned to a function code and an input / output variable. A control program interpretation and execution method that includes a pointer to a pointer to a pointer to an internal parameter. 제1항에 있어서, 상기 원시기능 코드 배열은,The method of claim 1, wherein the primitive function code array, 원시기능이 속하는 그룹을 나타내는 그룹 번호,A group number indicating which group the primitive belongs to, 원시기능 그룹 배열에서 상기 원시기능에 해당하는 부분을 가리키는 포인터Pointer to the portion of the primitive group that corresponds to the primitive. 상기 원시기능 코드 배열 내에서 다음에 실행될 곳을 가리키는 포인터,A pointer to where to execute next in the primitive code array, 상기 원시기능 코드 배열 내에서 분기 조건이 거짓인 경우 실행할 곳을 가리키는 포인터Pointer to the place to execute when branch condition is false in the primitive code array 를 포함하는 제어 프로그램 해석 및 실행 방법.Control program interpretation and execution method comprising a. 제3항에 있어서,The method of claim 3, 상기 제어 프로그램은 다수의 서브 프로그램을 포함하고,The control program includes a plurality of subprograms, 상기 서브 프로그램 각각은 각 서브 프로그램에 대한 원시기능 코드 배열의 시작과 끝을 가리키는 포인터를 이용하여 시작으로부터 하나씩 원시기능을 수행해 감으로써 실행되고,Each of the subprograms is executed by executing primitive functions one by one using a pointer to the beginning and end of the primitive function code array for each subprogram, 상기 각각의 원시기능은 상기 원시기능 그룹 배열에서 원시기능의 기능 코드, 입출력 변수에 대한 포인터, 내부 파라미터들의 포인터를 읽고, 시스템 전역, 입출력 및 지역 변수 배열에서 입력 변수들 및 내부 파라미터들의 포인터들이 가리키는 실제 값들을 읽어, 기능 코드에 따라 필요한 작업을 수행하고 나서, 상기 시스템 전역, 입출력 및 지역 변수 배열에서 출력 변수와 내부 파라미터들에 해당하는 포인터들이 가리키는 곳에 그 값들을 저장함으로서 수행되는 제어 프로그램 해석 및 실행 방법.Each primitive function reads a function code of a primitive function, a pointer to an input / output variable, a pointer of internal parameters in the primitive function group array, and indicates the pointers of input variables and internal parameters in a system global, input / output and local variable array. Interpret the control program by reading the actual values, performing the necessary operations according to the function codes, and then storing them in the system global, I / O and local variable arrays where the pointers to the output and internal parameters point. How to run.
KR1019970048004A 1997-09-22 1997-09-22 Analysis and real-time execution method of a function block type process control program KR100271596B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019970048004A KR100271596B1 (en) 1997-09-22 1997-09-22 Analysis and real-time execution method of a function block type process control program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019970048004A KR100271596B1 (en) 1997-09-22 1997-09-22 Analysis and real-time execution method of a function block type process control program

Publications (2)

Publication Number Publication Date
KR19990026052A KR19990026052A (en) 1999-04-15
KR100271596B1 true KR100271596B1 (en) 2000-11-15

Family

ID=19521477

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019970048004A KR100271596B1 (en) 1997-09-22 1997-09-22 Analysis and real-time execution method of a function block type process control program

Country Status (1)

Country Link
KR (1) KR100271596B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005310056A (en) * 2004-04-26 2005-11-04 Mitsubishi Electric Corp Program execution control system

Also Published As

Publication number Publication date
KR19990026052A (en) 1999-04-15

Similar Documents

Publication Publication Date Title
US7331037B2 (en) Static memory allocation in a graphical programming system
CN103814333A (en) Method and device for the programming and configuration of programmable logic controller
JP3819639B2 (en) Programming device
EP0231594A2 (en) Interactive multilevel hierarchical data flow programming system
Chiron et al. Design of IEC 61131-3 function blocks using SysML
KR100271596B1 (en) Analysis and real-time execution method of a function block type process control program
Barbacci et al. Developing applications for heterogeneous machine networks: The Durra environment
EP4343468A1 (en) Development assistance device, control method for development assistance device, information processing program, and recording medium
Engels et al. Graph grammar engineering: A method used for the development of an integrated programming support environment
CN115248570A (en) Development environment and management development operation method of compiling programmable logic controller
CN115470012A (en) Runtime environment and method for creating event-driven execution model of industrial application
Halang Languages and tools for the graphical and textual system independent programming of programmable logic controllers
Wiberg Graphical programming of time-deterministic real-time systems
Fischer et al. Conceptual design of an engineering model for product and plant automation
Karjoth XFSM: A formal model of communicating state machines for implementation specifications
Friedrich et al. Efficient object-oriented software with design patterns
Tapken Implementing hierarchical graph-structures
KR100282094B1 (en) How to Manage Control Logic in Control Logic Builder
KR980009091A (en) Crane control system and communication method with integrated network
KR19990058389A (en) How to manage memory by loop unit of function block
KR100423742B1 (en) Exclusive control system by sequential function chart
Kaplan et al. An architecture for tool integration
Chalabine Invasive interactive parallelization
Ferrarini Hierarchical multi-layer CAD system for systematic design of complex logic controllers
Rzonca et al. IEC structured text programming of a small Distributed Control System

Legal Events

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

Payment date: 20060731

Year of fee payment: 7

LAPS Lapse due to unpaid annual fee