CN108733365A - A kind of data field multiplexing process method of power function - Google Patents
A kind of data field multiplexing process method of power function Download PDFInfo
- Publication number
- CN108733365A CN108733365A CN201810328950.5A CN201810328950A CN108733365A CN 108733365 A CN108733365 A CN 108733365A CN 201810328950 A CN201810328950 A CN 201810328950A CN 108733365 A CN108733365 A CN 108733365A
- Authority
- CN
- China
- Prior art keywords
- function
- variable
- data field
- instruction
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Devices For Executing Special Programs (AREA)
- Executing Machine-Instructions (AREA)
Abstract
The present invention discloses a kind of data field multiplexing process method of power function, includes the following steps:Step 1, morphology is carried out to source program, grammer scans, formation syntax tree;Variable, the function list of extraction procedure, according to the order-assigned data field of input variable, output variable, function variable, temporary variable, function of the same name only distributes a data field example, and function data area is according to function input variable, function return value variable order-assigned;Step 2, according to syntax tree, semantic analysis is carried out, machine-independent binary instruction is formed, the data replication instruction of function argument and parameter is inserted into before the instruction of output call function;Step 3, it explains and executes instruction file, before call function, execute data replication instruction, practical parameter value is copied into the data field that the function is distributed, when executing function call instruction later, be passed to the first address in function data area.Such method can simplify the realization of interpreter and improve reliability.
Description
Technical field
The invention belongs to Industry Control Programming field, more particularly to the data field multiplexing process method of a kind of power function.
Background technology
The structured text (ST) that IEC61131-3 standards define be one is the high-level programming language similar to Pascal,
Be particularly suitable for complexity applies algorithm design programming.The file directly run for target machine can be compiled in ST codes, but usually exists
In application process, exists with the newer demand of online unperturbed that program organization unit (POU) is unit, be not suitable at this time using volume
Type product is translated, needs to explain executing machine-independent binary system dummy order.Standard feature function, letter are often called in ST programs
Several calling realizes the method usually using storehouse, and there are the stacking of parameter and argument, Pop operations, increase setting for interpreter
Difficulty is counted, and affects operation for embedded system efficiency.
Based on this, inventor furthers investigate the solution of the data field of power function, thus this case generates.
Invention content
The purpose of the present invention is to provide a kind of data field multiplexing process method of power function, multiple by function of the same name
With the method for data field, pass through interpreter program high-efficiency operation.
In order to achieve the above objectives, solution of the invention is:
A kind of data field multiplexing process method of power function, includes the following steps:
Step 1, morphology is carried out to source program, grammer scans, formation syntax tree;Variable, the function list of extraction procedure, are pressed
According to the order-assigned data field of input variable, output variable, function variable, temporary variable, function of the same name only distributes a data
Area's example, function data area is according to function input variable, function return value variable order-assigned;
Step 2, according to syntax tree, semantic analysis is carried out, machine-independent binary instruction is formed, letter is called in output
The data replication instruction of function argument and parameter is inserted into before several instructions;
Step 3, it explains and executes instruction file, before call function, execute data replication instruction, practical parameter value is copied to
The data field that the function is distributed is passed to the first address in function data area when executing function call instruction later.
In above-mentioned steps 1, single variable is indicated in data field with 1 complex structure body, and record IEC61131-3 specifications are fixed
The attribute of justice.
In above-mentioned steps 1, the allocated size of the variable of each fundamental type in data field is identical, for compound type, according to
The sub- variable that secondary tiling expands into fundamental type is allocated.
In above-mentioned steps 2, data replication instruction be record argument variable, parameter variable data field serial number.
In above-mentioned steps 3, move instructions are data replication instruction, and call instructions execute instruction for function.
After adopting the above scheme, the present invention has the advantages that:For the application scenarios executed are explained, pass through function
The multiplexing method in function data area is inserted into data synchronization duplicate instructions before function executes, simplifies the complexity of interpreter, no
It needs to handle parameter by the way of storehouse, data field is fixed in operational process, determines whether data field surpasses convenient for off-line analysis
Limit, improves the reliability of system.
Description of the drawings
Fig. 1 is the data field multiplex process of power function in the present invention.
Specific implementation mode
Below with reference to attached drawing, technical scheme of the present invention and advantageous effect are described in detail.
As shown in Figure 1, the present invention provides a kind of data field multiplexing process method of power function, include the following steps:
Step 1, morphology is carried out to source program, grammer scans, formation syntax tree.Variable, the function list of extraction procedure, are pressed
According to the order-assigned data field of input variable, output variable, function variable, temporary variable.Function of the same name only distributes a data
Area's example, function data area is according to function input variable, function return value variable order-assigned.Wherein single variable is in data field
It is to be indicated with 1 complex structure body, whether record variable type, variate-value, variable are rising edge, failing edge, holding, constant etc.
The attribute that IEC61131-3 specifications define.Allocated size of the variable of each fundamental type in data field is identical.For knot
The compound types such as structure body, array, successively tiling expand into the sub- variable of fundamental type and are allocated.
Preferably, by taking Fig. 1 as an example, IN1 [0..100], IN2 [0..100], OUT [0..100] defined in the ST programs
Aray variable, VAR1, VAR2, VAR3 single variable, ADD functions are had invoked in Do statement.ADD functions have 2 it is defeated
Enter variable and 1 return value.Therefore data separation timing divides successively according to the input of program, output, built-in variable, function data area
Match.Each variable is indicated in data field with 1 structure, it is preferable that single structure of the variable in data field is defined as follows:
Step 2, according to syntax tree, semantic analysis is carried out, machine-independent binary instruction is formed.Letter is called in output
The data replication instruction of function argument and parameter is inserted into before several instructions.Wherein data replication instruction is record argument variable, shape
Serial number of the parameter in data field.IDX (IN1 [I]) indicates i-th input variable IN1 [I] in the serial number of data field, such as IDX
(IN1 [0])=0.
Step 3, it explains and executes instruction file, before call function, execute data replication instruction, practical parameter value is copied to
The data field that the function is distributed is passed to the first address in function data area when executing function call instruction later.Preferably,
Move instructions are data replication instruction, and call instructions execute instruction for function.By taking Fig. 1 as an example, it is equivalent to and first carries out P1=IN1
After [I], P2=IN2 [I], then execute ADD (P1, P2) function.Interpreter need not build transit shed structure, but be multiplexed letter
Several data fields, data field size is fixed in operational process, avoids frequent storehouse application destruction, the behaviour such as data stacking is popped
Make.
In summary, a kind of data field multiplexing process method of power function of the present invention, is tied for defined in IEC61131
The case where repeatedly calling same canonical function in the program organization unit (POU) of structure text (ST) language carries out data space
Optimization, homonymous standards function only distributes a public data area, which stores the input variable of the function declaration, returns
Value.When compiling forms instruction, it is inserted into data replication instruction before the instruction for calling the function, practical parameter value is copied into the letter
Several distributed data fields, when execution of function, are passed to fixed data field first address.The method achieve the multiplexing of data field,
The life cycle of function parameter need not be safeguarded by building transit shed, simplify the realization of instruction interpreter, be suitable for
Data space is limited in embedded real time system, execution efficiency requires high occasion.
Above example is merely illustrative of the invention's technical idea, and protection scope of the present invention cannot be limited with this, every
According to technological thought proposed by the present invention, any change done on the basis of technical solution each falls within the scope of the present invention
Within.
Claims (5)
1. a kind of data field multiplexing process method of power function, it is characterised in that include the following steps:
Step 1, morphology is carried out to source program, grammer scans, formation syntax tree;Variable, the function list of extraction procedure, according to defeated
Enter variable, output variable, function variable, temporary variable order-assigned data field, function of the same name only distributes a data field reality
Example, function data area is according to function input variable, function return value variable order-assigned;
Step 2, according to syntax tree, semantic analysis is carried out, machine-independent binary instruction is formed, in output call function
The data replication instruction of function argument and parameter is inserted into before instruction;
Step 3, it explains and executes instruction file, before call function, execute data replication instruction, practical parameter value is copied into the letter
Several distributed data fields are passed to the first address in function data area when executing function call instruction later.
2. a kind of data field multiplexing process method of power function as described in claim 1, it is characterised in that:The step 1
In, single variable is indicated in data field with 1 complex structure body, the attribute that record IEC61131-3 specifications define.
3. a kind of data field multiplexing process method of power function as described in claim 1, it is characterised in that:The step 1
In, the allocated size of the variable of each fundamental type in data field is identical, and for compound type, tiling successively expands into basic class
The sub- variable of type is allocated.
4. a kind of data field multiplexing process method of power function as described in claim 1, it is characterised in that:The step 2
In, data replication instruction be record argument variable, parameter variable data field serial number.
5. a kind of data field multiplexing process method of power function as described in claim 1, it is characterised in that:The step 3
In, move instructions are data replication instruction, and call instructions execute instruction for function.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810328950.5A CN108733365B (en) | 2018-04-13 | 2018-04-13 | Data area multiplexing processing method of function |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810328950.5A CN108733365B (en) | 2018-04-13 | 2018-04-13 | Data area multiplexing processing method of function |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108733365A true CN108733365A (en) | 2018-11-02 |
CN108733365B CN108733365B (en) | 2021-10-01 |
Family
ID=63940800
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810328950.5A Active CN108733365B (en) | 2018-04-13 | 2018-04-13 | Data area multiplexing processing method of function |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108733365B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002351509A (en) * | 2001-05-25 | 2002-12-06 | Mitsubishi Electric Corp | Programming tool and programming method |
CN105116800A (en) * | 2015-08-11 | 2015-12-02 | 浙江中控技术股份有限公司 | Method for compiling function type POU object |
-
2018
- 2018-04-13 CN CN201810328950.5A patent/CN108733365B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002351509A (en) * | 2001-05-25 | 2002-12-06 | Mitsubishi Electric Corp | Programming tool and programming method |
CN105116800A (en) * | 2015-08-11 | 2015-12-02 | 浙江中控技术股份有限公司 | Method for compiling function type POU object |
Non-Patent Citations (1)
Title |
---|
蓝海滨: "可编程控制器结构化文本语言编译前端的研究与设计", 《电子元器件应用》 * |
Also Published As
Publication number | Publication date |
---|---|
CN108733365B (en) | 2021-10-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Cardelli | Compiling a functional language | |
US6877155B1 (en) | System and method for generating target language code utilizing an object oriented code generator | |
US7739696B2 (en) | Message translation systems and methods | |
Visser | Stratego: A language for program transformation based on rewriting strategies system description of stratego 0.5 | |
US20100306750A1 (en) | Parallel program generation method | |
CN102096390A (en) | Programmable logic controller, program compiler, compiling system and method | |
CN103116513B (en) | A kind of heterogeneous multi-nucleus processor compiler | |
CN105373411B (en) | A kind of On-board programming system and design method for spaceborne digital signal processor | |
CN107451045A (en) | A kind of method and device of abnormal information positioning | |
Chin et al. | Parallelization via context preservation | |
WO1996007137A1 (en) | System, method, and compiler pre-processor for conditionally compiling a software compilation unit | |
CN104881396A (en) | Graphical-program compile file forming method | |
CN106339249B (en) | Dynamic configuration programmed method | |
CN108733365A (en) | A kind of data field multiplexing process method of power function | |
CN102929853A (en) | DCS (Data Communication System) project data generating system and method based on Excel sheet association | |
CN108121285B (en) | Application software collaborative compiling method and device based on continuous function diagram | |
CN101645018B (en) | Method, system and device for processing byte codes in multiple versions | |
JP6175306B2 (en) | Control program dividing apparatus, control program dividing method and recording medium therefor | |
CN111367937A (en) | Data processing method and device | |
JP3596570B2 (en) | Method of allocating classes to main storage | |
Lutovac et al. | Usage of XML and P code for robot motion control | |
WO2018122660A1 (en) | Method and system for migration of control logic in a distributed control system | |
CN108804222B (en) | Temporary variable data area allocation method | |
Hill | Lua-Language-Based Data Acquisition Processing EPICS Subscription Filters | |
CN114489683A (en) | JVM-based functional programming grammar implementation method for java-like language |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |