TW201917600A - Controlling method for integrating standard programming language script structure in virtual machine and computer program product - Google Patents

Controlling method for integrating standard programming language script structure in virtual machine and computer program product Download PDF

Info

Publication number
TW201917600A
TW201917600A TW106137172A TW106137172A TW201917600A TW 201917600 A TW201917600 A TW 201917600A TW 106137172 A TW106137172 A TW 106137172A TW 106137172 A TW106137172 A TW 106137172A TW 201917600 A TW201917600 A TW 201917600A
Authority
TW
Taiwan
Prior art keywords
virtual machine
programming language
standard programming
control method
script
Prior art date
Application number
TW106137172A
Other languages
Chinese (zh)
Other versions
TWI637277B (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 TW106137172A priority Critical patent/TWI637277B/en
Application granted granted Critical
Publication of TWI637277B publication Critical patent/TWI637277B/en
Publication of TW201917600A publication Critical patent/TW201917600A/en

Links

Abstract

Embodiments disclose a controlling method for interpreting standard programming language script program in a virtual machine and a computer program product. The script program of a micro-controller is imported in the environment using the standard programming language such as the C programming language. A compiler compiles the script program. A virtual machine executes the script program to control a base-layer mechanical component. The virtual machine is constructed upon the open instructions, and the virtual machine and the base-layer mechanical component communicate with each other in accordance with the international standard IEC61800-7-201.

Description

標準程式語言腳本架構結合虛擬機的控制方法及程式產品Control method and program product of standard programming language script framework combined with virtual machine

本發明係有關於一種標準程式語言腳本架構結合虛擬機的控制方法及程式產品,特別是指將微控制器的腳本建構在一標準程式語言的環境,並由一虛擬機來執行該腳本,而該虛擬機建構在開放式指令集,且該虛擬機與底層機械元件的溝通方式係透過IEC國際標準的發明。The invention relates to a control method and a program product of a standard programming language script framework combined with a virtual machine, in particular to constructing a script of a microcontroller in an environment of a standard programming language and executing the script by a virtual machine. The virtual machine is built on an open instruction set, and the communication method between the virtual machine and the underlying mechanical components is invented through the IEC international standard.

目前,如果終端使用者希望在控制系統終端(CSE)中撰寫腳本程式,通常是以CSE製造商的客製語言編寫腳本,該語言可試圖與譬如C語言等工業標準語言類似。Currently, if an end user wishes to write a script in a control system terminal (CSE), the script is usually written in a custom language of the CSE manufacturer. This language can attempt to be similar to an industry standard language such as the C language.

執行引擎可分為:(1)直接解譯器型式,參閱第二圖,微控制器(A)通過CSE的裝置外部通訊介面(B)與CSE連線,而微控制器(A)中使用者已撰寫之程式文字將在執行時間內解譯,以控制底層機械元件(C),此方法因多餘的文字處理而具有計算效率低落的缺點。(2)另一實現係一虛擬機(VM)(D),參閱第三圖,其提供使用者一實現供應商客製指令集架構(ISA)之虛擬CPU(E),通過虛擬機資訊傳輸介面(F)來控制底層機械元件(G),使用者文字程式在上載至VM(D)執行前,將先編譯成該客製ISA之機器碼。缺點在於編譯器工具鏈係特定供應商專屬且無法用於編譯依電腦工業標準化語言格式撰寫之使用者程式。The execution engine can be divided into: (1) a direct interpreter type, see the second figure, the microcontroller (A) is connected to the CSE through the CSE device external communication interface (B), and the microcontroller (A) is used in The program text written by the author will be interpreted in the execution time to control the underlying mechanical component (C). This method has the disadvantage of low calculation efficiency due to redundant word processing. (2) Another implementation is a virtual machine (VM) (D). Refer to the third figure, which provides users with a virtual CPU (E) that implements the vendor's custom instruction set architecture (ISA) and transmits information through the virtual machine. The interface (F) controls the underlying mechanical components (G). The user's text program will be compiled into the machine code of the customized ISA before uploading it to the VM (D) for execution. The disadvantage is that the compiler tool chain is specific to a specific vendor and cannot be used to compile user programs written in a computer industry standardized language format.

另外,再參閱第二圖及第三圖所示,微控制器(A)及虛擬機(D)透過裝置應用服務介面(H)(I)與底層機械元件(C)(G)溝通的方式對不同供應商而言,裝置應用服務介面(H)(I)是採用不同標準。In addition, referring to the second and third figures, the way in which the microcontroller (A) and virtual machine (D) communicate with the underlying mechanical components (C) (G) through the device application service interface (H) (I) For different vendors, the device application service interface (H) (I) uses different standards.

總體而言,既有可編寫腳本的CSE具有以下限制:Overall, existing scriptable CSEs have the following limitations:

1.除了大多數接受現代軟體程式訓練之人力所組成的大潛力使用者群外,資訊技術及電子工業之使用者通常不熟悉程式設計環境使用之程式語言。1. Except for the large potential user group consisting of most of the manpower trained in modern software programs, users of the information technology and electronics industries are generally unfamiliar with the programming languages used in the programming environment.

2.程式設計環境不符工業自動化、資訊技術、或嵌入式電子領域中使用之『任何』標準,而需要腳本環境之新使用者學習無法轉移或重複使用之程式語言。2. The programming environment does not conform to the "any" standard used in the field of industrial automation, information technology, or embedded electronics, and new users who need a scripting environment learn programming languages that cannot be transferred or reused.

3.CSE作為執行環境之主機,而存取CSE應用服務之方法不是採用國際工業標準。3. CSE is the host of the execution environment, and the method of accessing CSE application services is not using international industry standards.

因此,本發明提出一種標準程式語言腳本架構結合虛擬機的控制方法,用以改善前述缺失,本發明包括有下列步驟:Therefore, the present invention proposes a standard programming language script architecture combined with a virtual machine control method to improve the aforementioned defects. The present invention includes the following steps:

將一微控制器的腳本建構在一標準程式語言的環境;使用一編譯器編譯該腳本;由一虛擬機來執行該腳本,用以控制一底層機械元件,其中,該虛擬機建構在開放式指令集,且該虛擬機與該底層機械元件溝通係透過IEC國際標準。Constructing a script of a microcontroller in a standard programming language environment; compiling the script using a compiler; executing the script by a virtual machine to control a low-level mechanical element, wherein the virtual machine is built in an open Instruction set, and the virtual machine communicates with the underlying mechanical components through the IEC international standard.

進一步,該標準程式語言為C語言。Further, the standard programming language is C language.

進一步,可在該開放式指令集中外加一自訂指令。Further, a custom instruction may be added to the open instruction set.

進一步,該虛擬機與該底層機械元件溝通係透過IEC61800-7-201的國際標準。Further, the communication between the virtual machine and the underlying mechanical components is through the international standard of IEC61800-7-201.

進一步,該虛擬機之主機CPU用於輔助該虛擬機的虛擬CPU進行運算。Further, the host CPU of the virtual machine is used to assist the virtual CPU of the virtual machine to perform operations.

進一步,供該虛擬機判讀的機械碼透過一電路模擬器被加載儲存於一程序記憶體。Further, the mechanical code for interpretation by the virtual machine is loaded and stored in a program memory through a circuit simulator.

進一步,該虛擬機的資料數據及程序數據來自於該虛擬機之主機的部分資料數據及部分程序數據。Further, the data data and the program data of the virtual machine are derived from part of the data data and part of the program data of the host of the virtual machine.

進一步,該虛擬機內部狀態可透過與該虛擬機之主機的通訊介面相同的通訊介面進行訪問。Further, the internal state of the virtual machine can be accessed through the same communication interface as the communication interface of the host of the virtual machine.

進一步,該虛擬機與一實體主控制器透過相同的控制方式來控制該底層機械元件。Further, the virtual machine and a physical main controller control the underlying mechanical element through the same control mode.

本發明再提出一種程式產品,係用以安裝至一電腦,並執行前述標準程式語言腳本架構結合虛擬機的控制方法。The present invention further proposes a program product, which is used to install to a computer and execute the control method of the aforementioned standard programming language script framework combined with a virtual machine.

根據上述技術特徵可達成以下功效:According to the above technical features, the following effects can be achieved:

1.使已熟悉微控制器程式設計之具備一般電子學背景的使用者,具有簡易學習曲線。1. Make users who are familiar with microcontroller programming with a general electronics background have a simple learning curve.

2.終端使用者可將先進功能建入CSE中,無需CSE提供者冒險曝露屬財產權的VM主機內部工作細節。2. End users can build advanced functions into CSE, without the need for CSE providers to risk exposing the details of the internal work of the VM host, which is a property right.

3.單純的軟體實現,可如同軟體升級一般地加入既有裝置中。3. Pure software implementation can be added to existing devices just like software upgrades.

綜合上述技術特徵,本發明標準程式語言腳本架構結合虛擬機的控制方法及程式產品的主要功效將可於下述實施例清楚呈現。In summary of the above technical features, the standard programming language script framework of the present invention combined with the control method of the virtual machine and the main functions of the program product will be clearly presented in the following embodiments.

參閱第一圖所示,使用者透過一使用者電腦(1)的一集成開發環境(IDE)(11)採用一標準程式語言編寫腳本,該標準程式語言例如使用C語言或JAVA。然而較佳的是使用C語言,因為C語言是最常被使用的程式語言,可使已熟悉微控制器程式設計之具備一般電子學背景的使用者,能夠具有簡易的學習曲線。Referring to the first figure, a user writes a script by using an integrated development environment (IDE) (11) of a user computer (1) using a standard programming language, such as C language or JAVA. However, it is better to use the C language, because the C language is the most commonly used programming language, so that users who are familiar with microcontroller programming and have a general electronics background can have a simple learning curve.

使用一編譯器(12)編譯該腳本,之後再透過一電路模擬器(13)將該腳本轉換成一機械碼而可供控制系統終端(CSE)(2)的一虛擬機(21)判讀,該機械碼透過CSE(2)之一裝置外部通訊介面(22)而被加載儲存於該虛擬機(21)之一程序記憶體(211)。A compiler (12) is used to compile the script, and then the script is converted into a mechanical code by a circuit simulator (13) for interpretation by a virtual machine (21) of the control system terminal (CSE) (2). The mechanical code is loaded into a program memory (211) of the virtual machine (21) through an external communication interface (22) of a device of the CSE (2).

由該虛擬機(21)來執行該腳本,用以控制一底層機械元件(23),其中,該虛擬機(21)建構在開放式指令集,並且可供使用者在該開放式指令集中外加一自訂指令,藉以供使用者根據不同需求而自行擴充指令,因此使用者可將先進功能建入CSE(2)中,無需CSE(2)提供者冒險曝露屬財產權的虛擬機內部工作細節。該虛擬機(21)通過一虛擬機資訊傳輸介面(212)來連接一裝置應用服務介面(24),以控制該底層機械元件(23),其中該裝置應用服務介面(24)採用IEC的國際標準,例如IEC61800-7-201的國際標準,可以省去因為採用不同標準下,使用者的學習時間。再其中,該虛擬機(21)內部狀態可透過與該虛擬機(21)之主機的通訊介面相同的通訊介面進行訪問,亦即使用者可直接透過該使用者電腦(1)連接該CSE(2)之裝置外部通訊介面(22)而直接檢視該虛擬機(21)內部狀態。而該虛擬機(21)之主機CPU(213)可用於輔助該虛擬機(21)的虛擬CPU(214)進行運算,以加速運算速度。又,該虛擬機(21)的程序數據及資料數據分別儲存在該程序記憶體(211)與一資料記憶體(215)中,且該程序數據及資料數據來自於該虛擬機(21)之主機的部分程序數據及部分資料數據,此種機制提供資源分散,避免該虛擬機(21)無權訪問該虛擬機(21)之主機的資料數據及程序數據。The script is executed by the virtual machine (21) to control an underlying mechanical element (23), wherein the virtual machine (21) is constructed in an open instruction set, and can be used by users to add to the open instruction set. A custom instruction for users to expand instructions according to different needs, so users can build advanced functions into CSE (2) without the need for the CSE (2) provider to risk exposing the details of the internal work of the virtual machine that are property rights. The virtual machine (21) is connected to a device application service interface (24) through a virtual machine information transmission interface (212) to control the underlying mechanical component (23). The device application service interface (24) adopts the international standards of IEC Standards, such as the international standard of IEC61800-7-201, can save users' learning time because of adopting different standards. Furthermore, the internal state of the virtual machine (21) can be accessed through the same communication interface as the communication interface of the host of the virtual machine (21), that is, the user can directly connect to the CSE ( 2) the external communication interface (22) of the device and directly check the internal state of the virtual machine (21). The host CPU (213) of the virtual machine (21) can be used to assist the virtual CPU (214) of the virtual machine (21) to perform calculations to accelerate the calculation speed. In addition, the program data and data data of the virtual machine (21) are stored in the program memory (211) and a data memory (215) respectively, and the program data and data data come from the virtual machine (21). This mechanism provides part of the program data and some data data of the host. This mechanism provides resource dispersion and prevents the virtual machine (21) from having access to the host data and program data of the virtual machine (21).

要特別說明的是,該CSE(2)可再連接一實體主控制器(3),而該虛擬機(21)與該實體主控制器(3)可透過相同的控制方式來控制該底層機械元件(23)。It should be particularly noted that the CSE (2) can be connected to a physical main controller (3), and the virtual machine (21) and the physical main controller (3) can control the underlying machinery through the same control method. Element (23).

在本發明的另一實施例中,再提出一種程式產品,該程式產品可用以安裝至一電腦,藉以使該電腦可執行前述標準程式語言腳本架構結合虛擬機的控制方法。因此本發明透過單純的軟體實現,可如同軟體升級一般地加入既有裝置中。In another embodiment of the present invention, a program product is further provided, and the program product can be installed on a computer, so that the computer can execute the control method of the foregoing standard programming language script framework combined with a virtual machine. Therefore, the present invention is implemented by simple software, and can be added to an existing device just like software upgrade.

綜合上述實施例之說明,當可充分瞭解本發明之操作、使用及本發明產生之功效,惟以上所述實施例僅係為本發明之較佳實施例,當不能以此限定本發明實施之範圍,即依本發明申請專利範圍及發明說明內容所作簡單的等效變化與修飾,皆屬本發明涵蓋之範圍內。Based on the description of the above embodiments, the operation, use and effects of the present invention can be fully understood, but the above-mentioned embodiments are only preferred embodiments of the present invention, and the implementation of the present invention cannot be limited in this way. The scope, that is, the simple equivalent changes and modifications made according to the scope of the patent application and the description of the invention, are all within the scope of the present invention.

(1)‧‧‧使用者電腦(1) ‧‧‧user computer

(11)‧‧‧集成開發環境(11) ‧‧‧Integrated Development Environment

(12)‧‧‧編譯器(12) ‧‧‧Compiler

(13)‧‧‧電路模擬器(ICE)(13) ‧‧‧Circuit Simulator (ICE)

(2)‧‧‧控制系統終端(CSE)(2) ‧‧‧Control System Terminal (CSE)

(21)(D)‧‧‧虛擬機(VM)(21) (D) ‧‧‧Virtual Machine (VM)

(211)‧‧‧程序記憶體(211) ‧‧‧Program memory

(212)(F)‧‧‧虛擬機資訊傳輸介面(212) (F) ‧‧‧Virtual Machine Information Transmission Interface

(213)‧‧‧主機CPU(213) ‧‧‧Host CPU

(214)(E)‧‧‧虛擬CPU(214) (E) ‧‧‧Virtual CPU

(215)‧‧‧資料記憶體(215) ‧‧‧Data Memory

(22)(B)‧‧‧裝置外部通訊介面(22) (B) ‧‧‧Device external communication interface

(23)(C)(G)‧‧‧底層機械元件(23) (C) (G) ‧‧‧bottom mechanical components

(24)(H)(I)‧‧‧裝置應用服務介面(24) (H) (I) ‧‧‧Device Application Service Interface

(3)‧‧‧實體主控制器(3) ‧‧‧Entity Master Controller

(A)‧‧‧微控制器(A) ‧‧‧Microcontroller

[第一圖]係為執行本發明方法之系統的功能方塊圖。[First Figure] is a functional block diagram of a system for performing the method of the present invention.

[第二圖]係為習知以微控制器控制CSE的功能方塊圖。[Second figure] is a functional block diagram of controlling CSE by a microcontroller.

[第三圖]係為習知以虛擬機控制CSE的功能方塊圖。[Third figure] is a functional block diagram of controlling CSE by a virtual machine.

Claims (10)

一種標準程式語言腳本架構結合虛擬機的控制方法,包括下列步驟: 將一微控制器的腳本建構在一標準程式語言的環境; 使用一編譯器編譯該腳本; 由一虛擬機來執行該腳本,用以控制一底層機械元件,其中,該虛擬機建構在開放式指令集,且該虛擬機與該底層機械元件溝通係透過IEC國際標準。A control method of a standard programming language script structure combined with a virtual machine includes the following steps: constructing a script of a microcontroller in a standard programming language environment; compiling the script using a compiler; and executing the script by a virtual machine, It is used to control a low-level mechanical element, wherein the virtual machine is constructed in an open instruction set, and the virtual machine communicates with the low-level mechanical element through the IEC international standard. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,該標準程式語言為C語言。According to the standard programming language script framework described in item 1 of the scope of the patent application combined with the control method of the virtual machine, wherein the standard programming language is C language. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,可在該開放式指令集中外加一自訂指令。For example, the standard programming language script framework described in the first patent application scope and the virtual machine control method, wherein a custom instruction may be added to the open instruction set. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,該虛擬機與該底層機械元件溝通係透過IEC61800-7-201的國際標準。For example, the standard programming language script architecture described in item 1 of the scope of patent application combines the control method of the virtual machine, wherein the communication between the virtual machine and the underlying mechanical component is through the international standard of IEC61800-7-201. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,該虛擬機之主機CPU用於輔助該虛擬機的虛擬CPU進行運算。The standard programming language script architecture described in item 1 of the scope of the patent application combines the control method of the virtual machine, wherein the host CPU of the virtual machine is used to assist the virtual CPU of the virtual machine to perform operations. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,供該虛擬機判讀的機械碼透過一電路模擬器被加載儲存於一程序記憶體。According to the standard programming language script architecture described in item 1 of the scope of patent application combined with a control method of a virtual machine, a mechanical code for the virtual machine to read is loaded into a program memory through a circuit simulator. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,該虛擬機的資料數據及程序數據來自於該虛擬機之主機的部分資料數據及部分程序數據。The standard programming language script architecture described in item 1 of the scope of patent application combined with a virtual machine control method, wherein the data data and program data of the virtual machine come from part of the data data and part of the program data of the host of the virtual machine. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,該虛擬機內部狀態可透過與該虛擬機之主機的通訊介面相同的通訊介面進行訪問。For example, the standard programming language script architecture described in the scope of application for patents combined with a virtual machine control method, wherein the internal state of the virtual machine can be accessed through the same communication interface as the communication interface of the host of the virtual machine. 如申請專利範圍第1項所述之標準程式語言腳本架構結合虛擬機的控制方法,其中,該虛擬機與一實體主控制器透過相同的控制方式來控制該底層機械元件。The standard programming language script architecture described in item 1 of the scope of the patent application combines the control method of a virtual machine, wherein the virtual machine and a physical main controller use the same control method to control the underlying mechanical element. 一種程式產品,係用以安裝至一電腦,並執行如申請專利範圍第1項至第9項任一項所述之標準程式語言腳本架構結合虛擬機的控制方法。A program product is used to install to a computer and execute a control method of a standard programming language script framework combined with a virtual machine as described in any one of claims 1 to 9 of the scope of patent application.
TW106137172A 2017-10-27 2017-10-27 Standard programming language scripting architecture combined with virtual machine control method and program product TWI637277B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW106137172A TWI637277B (en) 2017-10-27 2017-10-27 Standard programming language scripting architecture combined with virtual machine control method and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW106137172A TWI637277B (en) 2017-10-27 2017-10-27 Standard programming language scripting architecture combined with virtual machine control method and program product

Publications (2)

Publication Number Publication Date
TWI637277B TWI637277B (en) 2018-10-01
TW201917600A true TW201917600A (en) 2019-05-01

Family

ID=64802728

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106137172A TWI637277B (en) 2017-10-27 2017-10-27 Standard programming language scripting architecture combined with virtual machine control method and program product

Country Status (1)

Country Link
TW (1) TWI637277B (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8327316B2 (en) * 2008-09-30 2012-12-04 Ics Triplex Isagraf Inc. Compilation model
CN102566481B (en) * 2010-12-16 2013-07-24 无锡信捷电气有限公司 C language-based PLC (Programmable Logic Controller) control system and realization method thereof
CN106527335B (en) * 2016-12-08 2019-03-19 湖南戈人自动化科技有限公司 A kind of PLC controller for supporting association Cheng Gongneng

Also Published As

Publication number Publication date
TWI637277B (en) 2018-10-01

Similar Documents

Publication Publication Date Title
EP2368189B1 (en) Debugging pipeline
CN107526625B (en) Java intelligent contract security detection method based on bytecode inspection
WO2013114926A1 (en) Support device, recording medium having support program recorded thereon, and method for generating executable program
JPS6017539A (en) Emulation system
US7647583B2 (en) Method and apparatus for emulating a hardware/software system using a computer
US20090172710A1 (en) Method and system for enabling a mini program on a computing device to access an auxiliary system
US20080120595A1 (en) System and method for hot code replace
CN100492387C (en) Method and system for software protected development based on Keil C51
CN109670299A (en) A kind of method and electronic equipment creating Python sandbox environment
Lacamera Embedded Systems Architecture: Explore architectural concepts, pragmatic design patterns, and best practices to produce robust systems
CN110637521B (en) Data real-time storage method and system based on model simulation
US9323543B2 (en) Capability based device driver framework
WO2016206818A1 (en) Method and system for preparing code to be executed by programmable control devices
TWI637277B (en) Standard programming language scripting architecture combined with virtual machine control method and program product
US8090935B2 (en) Direct register access for host simulation
CN113177292B (en) Universal BIM secondary development implementation method and device
CN106970825B (en) ARM7 simulation target machine implementation method based on GDB configurable framework
KR101083271B1 (en) System and method for converting active x control
WO2004088508A2 (en) A method of creating software that is portable across different operating systems
US8135943B1 (en) Method, apparatus, and computer-readable medium for generating a dispatching function
Nakamoto et al. Virtual software execution environments for distributed embedded control systems
US20140195834A1 (en) High throughput low latency user mode drivers implemented in managed code
Viarheichyk Embedded Programming with Modern C++ Cookbook: Practical recipes to help you build robust and secure embedded applications on Linux
US9830174B2 (en) Dynamic host code generation from architecture description for fast simulation
Ebenhofer et al. Generic and reconfigurable IEC 61499 function blocks for advanced platform independent engineering