CN105278445A - Secondary development method of synchronous generator excitation regulator control program - Google Patents

Secondary development method of synchronous generator excitation regulator control program Download PDF

Info

Publication number
CN105278445A
CN105278445A CN201510749628.6A CN201510749628A CN105278445A CN 105278445 A CN105278445 A CN 105278445A CN 201510749628 A CN201510749628 A CN 201510749628A CN 105278445 A CN105278445 A CN 105278445A
Authority
CN
China
Prior art keywords
program
script
language
host
host program
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
Application number
CN201510749628.6A
Other languages
Chinese (zh)
Other versions
CN105278445B (en
Inventor
解建伟
曹成军
秦茂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Kinte Industrial Co Ltd
Original Assignee
Guangzhou Kinte Industrial Co Ltd
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 Guangzhou Kinte Industrial Co Ltd filed Critical Guangzhou Kinte Industrial Co Ltd
Priority to CN201510749628.6A priority Critical patent/CN105278445B/en
Publication of CN105278445A publication Critical patent/CN105278445A/en
Application granted granted Critical
Publication of CN105278445B publication Critical patent/CN105278445B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • G05B19/056Programming the PLC
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/10Plc systems
    • G05B2219/13Plc programming
    • G05B2219/13165Program plc by independent build in processor

Abstract

The invention discloses a secondary development method of a synchronous generator excitation regulator control program integrated embedded language, comprising the steps as follows: (1) compiling an embedded script program using lua scripting language; (2) modifying the running environment program of the script program according to an operating system and a compiler used so as to link the running environment of the script program to a host program in the form of program library, wherein the host program is an excitation regulator C language control program; (3) writing an interface function for calling the script program from the host program and an interface function for accessing the host program from the script program; and (4) initializing the running environment and the running state of the script program, and completing registration of the interface function for calling the script program from the host program in the host program so as to enable the host program to read, compile and execute the script program by calling the interface function of the script program.

Description

The Secondary of Excitation Controller for Synchronous Generator control program
Technical field
The present invention relates to a kind of implementation method of Excitation Controller for Synchronous Generator control program, specifically, relate to a kind of construction cycle short, extended capability is strong, maintenance cost is low, the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program of relatively independent operation.
Background technology
Existing field regulator control program is generally directly developed in real time operating system, or uses configuration software and use PLC to develop.Although use configuration software and PLC develop, technical difficulty is low, and the development and testing cycle is short, also clearly, shortcoming is underaction to shortcoming, and exploitation has limitation; And the control program design directly developed in real time operating system is flexible, easy to use, but shortcoming be programming difficulty comparatively configuration and PLC develop high, the change of project demands needs again to develop props up a sequence of threads.The change of application program to project demands that above-mentioned three kinds of modes develop does not have expandability, all need to remodify when a small amount of amendment of needs, increase, deletion signal condition, computing method or steering logic, test, download whole application program, if importantly the control program of mainline release has upgrading, the control program of each branch version all needs to merge one by one, test upgrading, this can make troubles to program version management, and the cost of program maintenance simultaneously can increase along with being on the increase of branch line version program.
Summary of the invention
For above deficiency, the invention provides a kind of construction cycle short, extended capability is strong, and maintenance cost is low, the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program of relatively independent operation, and it comprises:
1) embedded shell script is compiled;
2) the running environment program of shell script is revised according to the operating system used and compiler, to enter in host program by the running environment of shell script with the mode chain of routine library;
3) write the interface function from host program invoke script program, and access the interface function of host program from shell script;
4) running environment of initializtion script program and running status, the registration of the interface function from host program invoke script program is completed, so that host program realizes reading in, compiling and perform shell script by the interface function of invoke script program in host program.
In order to realize the present invention further, mutual employing between described host program and shell script selects steering logic output mode, sequential control logic output mode, Parallel Control logic output mode, or any combinational logic of at least two kinds in above-mentioned Three models.
In order to realize the present invention further, described shell script adopts lua script to carry out the exploitation of secondary embedded program, host program is the field regulator C language control program developed in vxworks real time operating system, host program is by calling lua_register function to the new C programmer of lua language program environment registration, the new C language function of registration directly can be accessed in such lua language, host program uses lua_getglobalCAPI function encapsulation C language to the interface of lua language, and C application program is by interface accessing lua language program.
In order to realize the present invention further, described selection steering logic output mode selects to run host program by selector switch, or Run Script program.
In order to realize the present invention further, whether described sequential control logic output mode selects to be connected in series in host program by shell script by selector switch.
In order to realize the present invention further, whether described Parallel Control logic output mode is selected by shell script and host program parallel running by selector switch.
In order to realize the present invention further, described host program determines whether to perform shell script by the positional information of decision logic selector switch.
In order to realize the present invention further, when script compile, the execution appearance mistake of shell script, shell script suspends execution at once, the error code of " occurring mistake " is returned to host program by shell script, control selector switch by host program and switch to OFF position, the errors present that simultaneously will obtain, error code and wrong time information output.
Beneficial effect of the present invention:
1, the source code of the shell script of secondary development of the present invention can be loaded into C language application program by host program from file system dynamically, and the code of shell script is compiled, runs, suspends or exited, these operations do not affect the correctness of other function of host program; In addition, shell script and host program amendment, upgrading is independent of each other mutually; Further, the log information of shell script (comprising the information such as file path, errors present, error code, time of origin) with text mode writing in files, and finally can be presented at terminal.
2, the construction cycle of the present invention is short, and extended capability is strong, and maintenance cost is low, when amendment appears in host program or shell script, can't affect the normal operation of the other side.
Accompanying drawing explanation
Fig. 1 is the schematic diagram of selection steering logic output mode of the present invention;
Fig. 2 is the schematic diagram of sequential control logic output mode of the present invention;
Fig. 3 is the schematic diagram of Parallel Control logic output mode of the present invention.
Embodiment
Below in conjunction with accompanying drawing, the present invention is further elaborated.
The implementation procedure of the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program of the present invention is as follows:
1) the embedded shell script of lua language compilation is adopted, and the language running environment of shell script is entered in host program with the mode chain of application library, host program is the field regulator C language control program developed in vxworks real time operating system, type according to operating system and compiler revises script environment program, and compiling is by return state pointer.
2) interface function of accessing host program from shell script is write according to function prototype, input parameter, output three parts: the interface function of accessing C programmer from lua all needs the interface shape with identical prototype typedefint (* lua_CFunction) (lua_State*L) to write; In the new function structure of writing, obtain the next parameter of shell script transmission by the lua_toXXX function in CAPI; When needing to return results, by lua_pushXXX function, result is pressed in stack, then returns results number.
3) write the interface function by host program invoke script program, write according to following steps: first, interface function by the lua_getglobal function in CAPI by script function name pop down; Then, use lua_pushXXX function that the parameter of needs is pressed into virtual stack in order, re-use lua_pcall function and perform shell script; Finally, lua_toXXX function is used to obtain the operation result of script application programe.
4) error handle function is write: when lua runs throw exception, obtain script error code by lua_tostring function from stack space, and the information such as the time obtained from operating system and position are saved in journal file, and deliver to terminal demonstration.
5) running environment of initializtion script program and running status:
51) use the luaL_newstate function creation lua running environment in CAPI, use luaL_openlibs to open all java standard libraries, initializtion script language running environment and running status.
52) use the lua_register function in CAPI that the interface function needed from shell script access host program is registered to lua running environment, call for shell script.
53) use the luaL_loadfile function in CAPI to load shell script, luaL_loadfile function, from a files loading lua application source code, compiles, then compiling result is returned with pointer form.
The access process of shell script of the present invention is as follows:
1) Run Script program, uses host program invoke script program interface functions to perform shell script in host program;
2) after shell script is finished, in host program, call lua_close function, close shell script and running environment.
As shown in Figure 1, adopt between shell script and host program and select steering logic output mode, realize mutual exclusion by selector switch 100 to switch, thus select to run host program 101 or Run Script program 102, selector switch 100 can be controlled by host program 101, also can be controlled by shell script.
As shown in Figure 2, sequential control logic output mode is adopted between shell script and host program, after the logic of host program 103 exports, increase selector switch 104, switch to by selector switch 104 the order actuating logic that ON position realizes host program 103 and shell script 105; When selector switch 104 switches to OFF position, host program 103 is Output rusults directly, and selector switch 104 is controlled by host program 103.
As shown in Figure 3, Parallel Control logic output mode is adopted between shell script and host program, when host program 107 runs, switch to ON position by selector switch 106 and realize shell script 108 and host program 107 parallel running, finally operation result is sent into simultaneously rear host program 109 (other subsequent control program), when selector switch 106 switches to OFF position, rear host program 109 receives only the operation result of host program 107.
When script compile, perform there is mistake time, the automatically out of service and throw exception code of shell script; Host program obtains shell script error code and processes mistake, arranges malfunction mark.
When shell script restarts operation, need first to stop all scripts to run, logic selector switch switches to OFF position; Then call lua_close function and close lua language running environment; Finally, re-execute initializtion script language environment and state, registration function, load source code, Run Script program.
The foregoing is only better embodiment of the present invention, the present invention is not limited to above-mentioned embodiment, the structural modification that local is small may be there is in implementation process, if do not depart from the spirit and scope of the present invention to various change of the present invention or modification, and belonging within claim of the present invention and equivalent technologies scope, then the present invention is also intended to comprise these change and modification.

Claims (8)

1. a Secondary for the integrated embedded language of Excitation Controller for Synchronous Generator control program, it is characterized in that, it comprises:
1) embedded shell script is compiled;
2) the running environment program of shell script is revised according to the operating system used and compiler, to enter in host program by the running environment of shell script with the mode chain of routine library;
3) write the interface function from host program invoke script program, and access the interface function of host program from shell script;
4) running environment of initializtion script program and running status, the registration of the interface function from host program invoke script program is completed, so that host program realizes reading in, compiling and perform shell script by the interface function of invoke script program in host program.
2. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 1, it is characterized in that, mutual employing between described host program and shell script selects steering logic output mode, sequential control logic output mode, Parallel Control logic output mode, or any combinational logic of at least two kinds in above-mentioned Three models.
3. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 1, it is characterized in that, described shell script adopts lua script to carry out the exploitation of secondary embedded program, host program is the field regulator C language control program developed in vxworks real time operating system, host program is by calling lua_register function to the new C programmer of lua language program environment registration, the new C language function of registration directly can be accessed in such lua language, host program uses lua_getglobalCAPI function encapsulation C language to the interface of lua language, C application program is by interface accessing lua language program.
4. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 2, it is characterized in that, described selection steering logic output mode selects to run host program by selector switch, or Run Script program.
5. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 2, it is characterized in that, whether described sequential control logic output mode selects to be connected in series in host program by shell script by selector switch.
6. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 2, it is characterized in that, whether described Parallel Control logic output mode is selected by shell script and host program parallel running by selector switch.
7. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 1, is characterized in that, described host program determines whether to perform shell script by the positional information of decision logic selector switch.
8. the Secondary of the integrated embedded language of Excitation Controller for Synchronous Generator control program according to claim 7, it is characterized in that, when script compile, the execution appearance mistake of shell script, shell script suspends execution at once, the error code of " occurring mistake " is returned to host program by shell script, control selector switch by host program and switch to OFF position, the errors present that simultaneously will obtain, error code and wrong time information output.
CN201510749628.6A 2015-11-05 2015-11-05 Excitation Controller for Synchronous Generator controls the Secondary of program Active CN105278445B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510749628.6A CN105278445B (en) 2015-11-05 2015-11-05 Excitation Controller for Synchronous Generator controls the Secondary of program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510749628.6A CN105278445B (en) 2015-11-05 2015-11-05 Excitation Controller for Synchronous Generator controls the Secondary of program

Publications (2)

Publication Number Publication Date
CN105278445A true CN105278445A (en) 2016-01-27
CN105278445B CN105278445B (en) 2018-09-11

Family

ID=55147642

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510749628.6A Active CN105278445B (en) 2015-11-05 2015-11-05 Excitation Controller for Synchronous Generator controls the Secondary of program

Country Status (1)

Country Link
CN (1) CN105278445B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106647642A (en) * 2016-12-08 2017-05-10 上海维宏电子科技股份有限公司 Method for calling user-defined subprograms by extended M subprograms in numerical control system
CN107172013A (en) * 2017-04-18 2017-09-15 北京思特奇信息技术股份有限公司 A kind of data transmission method and system
CN108920379A (en) * 2018-07-18 2018-11-30 苏州思必驰信息科技有限公司 The method and apparatus for capturing lua code exception
CN116541301A (en) * 2023-06-05 2023-08-04 宁夏隆基宁光仪表股份有限公司 Design method of intelligent instrument function automatic test program

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2569445Y (en) * 2002-08-23 2003-08-27 西安理工大学 Field regulator of synchronous generator
CN1763717A (en) * 2005-11-24 2006-04-26 北京中星微电子有限公司 System and method for calling host software functions by using script and its compiler
CN2805217Y (en) * 2005-06-20 2006-08-09 西安理工大学 Synchronous motor microprocessor field regulator based-on CPLD and 80 C196 monolithic processor
CN101458633A (en) * 2007-12-13 2009-06-17 华为软件技术有限公司 Method for accessing host program by script program, and system and apparatus thereof
KR101350798B1 (en) * 2012-11-19 2014-01-16 (주)이산솔루션 Robot system controlled on the basis of opros platform and control method thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2569445Y (en) * 2002-08-23 2003-08-27 西安理工大学 Field regulator of synchronous generator
CN2805217Y (en) * 2005-06-20 2006-08-09 西安理工大学 Synchronous motor microprocessor field regulator based-on CPLD and 80 C196 monolithic processor
CN1763717A (en) * 2005-11-24 2006-04-26 北京中星微电子有限公司 System and method for calling host software functions by using script and its compiler
CN101458633A (en) * 2007-12-13 2009-06-17 华为软件技术有限公司 Method for accessing host program by script program, and system and apparatus thereof
KR101350798B1 (en) * 2012-11-19 2014-01-16 (주)이산솔루션 Robot system controlled on the basis of opros platform and control method thereof

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106647642A (en) * 2016-12-08 2017-05-10 上海维宏电子科技股份有限公司 Method for calling user-defined subprograms by extended M subprograms in numerical control system
CN107172013A (en) * 2017-04-18 2017-09-15 北京思特奇信息技术股份有限公司 A kind of data transmission method and system
CN107172013B (en) * 2017-04-18 2020-08-04 北京思特奇信息技术股份有限公司 Data transmission method and system
CN108920379A (en) * 2018-07-18 2018-11-30 苏州思必驰信息科技有限公司 The method and apparatus for capturing lua code exception
CN108920379B (en) * 2018-07-18 2022-01-11 思必驰科技股份有限公司 Method and device for capturing lua code exception
CN116541301A (en) * 2023-06-05 2023-08-04 宁夏隆基宁光仪表股份有限公司 Design method of intelligent instrument function automatic test program

Also Published As

Publication number Publication date
CN105278445B (en) 2018-09-11

Similar Documents

Publication Publication Date Title
CA2292123C (en) Method and system for modifying executable code to add additional functionality
CN102053836B (en) Implementation method of version management tool for Android application development
CN110865971B (en) System and method for verifying SOC chip
CN105278445A (en) Secondary development method of synchronous generator excitation regulator control program
CN100492387C (en) Method and system for software protected development based on Keil C51
CN104699478A (en) Method for changing the software in the memory of an electronic control unit
CN112882718B (en) Compiling processing method, device, equipment and storage medium
CN115629971A (en) Application development system and method
CN104536870A (en) Process monitoring method and device
EP3380899B1 (en) Program randomization for cyber-attack resilient control in programmable logic controllers
US6643800B1 (en) Method and apparatus for testing microarchitectural features by using tests written in microcode
CN102331961A (en) Method, system and dispatcher for simulating multiple processors in parallel
CN111597115A (en) Automatic closed-loop test system and test method for embedded operating system
CN111984263A (en) Method, device, equipment and medium for running second system application on first system
CN100359485C (en) Testing device and method for flush-bonding system
CN109144849A (en) A kind of embedded software adjusting, measuring method
CN113805848B (en) Target machine control software integration method and system
CN114924737A (en) Battery management system source code integration test method and device and electronic equipment
Coleman et al. Visual-trace simulation of concurrent finite-state machines for validation and model-checking of complex behaviour
US11630757B1 (en) System and method for developing, testing and debugging software for microcontrollers
Guo et al. BOOTLOADER Analysis Construction and U-BOOT Porting Based on S3C2440
CN114035920A (en) Method and device for symmetric loading and running of DSP (digital Signal processor) program
KR101548960B1 (en) Method for making and debuging program using virtual platform and appparatus therof
Baráth et al. Detecting binary incompatible software components using dynamic loader
deBruyn A Flight Software Framework and State Machine DSL for Advanced Collegiate Rockets

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant